Changing gcc between ARM9 and ARM-cortex automatically.

classic Classic list List threaded Threaded
7 messages Options
Marcelo Politzer Marcelo Politzer
Reply | Threaded
Open this post in threaded view
|

Changing gcc between ARM9 and ARM-cortex automatically.


Hello eLuers,

I've been getting a hard time while doing eLua development with diferent CPUs using GCC.
As the gcc to arm9 and the gcc to arm-cortex have the same name I have to manualy change the
PATH environment variable to switch between the two gcc versions. ( Learned the method from Dado ).
After getting a lot of frustration caused by forgetting to change, happened a it a few times already and I've come to a solution.
 
Why don't create symbolic links with different names to each of them like arm-elf-gcc-79 and arm-elf-gcc-cortex to avoid this conflict.
( also did the symlinks with the other binutils )

So I gave it a shot, and after creating the links at /usr/local/cross-arm/bin and at /usr/local/cross-cortex/bin ( the originals stayed intact ).

I've realized that the SConstruct needed some modifications as well ( changes documented at the bottom of the email ).
After all this change it worked like a charm and automatically choosing the toolchain.
As I think it is a good solution I came to share it with the list and check if it worth the change in the SConstruct and make people change their SO.
But would be a Great new feature to eLua and help make it more frendly. Some more thoughts about it.

Pros:
- Part of the building complexity gets transparent to user as SConstruct automatically choses the toolchain to use.
- There is no more need to prepend path to change the toolchain.
- the systems without the symbolic links still works perfectly ( need to add toolchain=arm-gcc, peaple don't need to create symlinks if they don't want to )

Cons:
- People used to: "$scons board=elua-puc" prog will have to add toolchain=arm-gcc
- can't think any more else...


And here is the documentation of how I did it and some comments as it goes:
  • The symbolinc links wore done in the following way for arm7 and arm9:

$ cd /usr/local/cross-arm
$ for file in *; do ln -s "$f" "$f"-79; done

and for arm cortex:

$ cd /usr/local/cross-cortex
$ for file in *; do ln -s "$f" "$f"-cortex-m3; done

  • Here are the changes at SConstruct: added two more toolchains, the symbolic linked ones.

toolchain_list = {

  'arm-gcc-79' : {
    'compile' : 'arm-elf-gcc-79',
    'link' : 'arm-elf-ld-79',
    'asm' : 'arm-elf-as-79',
    'bin' : 'arm-elf-objcopy-79',
    'size' : 'arm-elf-size-79',
    'cross_cpumode' : 'little',
    'cross_lua' : 'float_arm 64',
    'cross_lualong' : 'int 32'
  }, 
  'arm-gcc-cortex-m3' : {
    'compile' : 'arm-elf-gcc-cortex-m3',
    'link' : 'arm-elf-ld-cortex-m3',
    'asm' : 'arm-elf-as-cortex-m3',
    'bin' : 'arm-elf-objcopy-cortex-m3',
    'size' : 'arm-elf-size-cortex-m3',
    'cross_cpumode' : 'little',
    'cross_lua' : 'float_arm 64',
    'cross_lualong' : 'int 32'
  },

...

}

  • Also at SConstruct but a little further: the toolchain used by each platform. ( after some tests, I've noticed that the first acts as default, so no toolchain= is the "auto" one. )
  • As arm-gcc is not the first anymore, it needs to be explicitly called when used. so if the user calls "$scons board=elua-puc" on a system without the symbolic links it will issue an error like: "arm-gcc-79 not found" as mentioned earlier.

platform_list = {
  'at91sam7x' : { 'cpus' : [ 'AT91SAM7X256', 'AT91SAM7X512' ], 'toolchains' : [ 'arm-gcc-79', 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
  'lm3s' : { 'cpus' : [ 'LM3S8962', 'LM3S6965', 'LM3S6918', 'LM3S9B92' ], 'toolchains' : [ 'arm-gcc-cortex-m3', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
  'str9' : { 'cpus' : [ 'STR912FAW44' ], 'toolchains' : [ 'arm-gcc-79', 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
  'i386' : { 'cpus' : [ 'I386' ], 'toolchains' : [ 'i686-gcc' ] },
  'sim' : { 'cpus' : [ 'LINUX' ], 'toolchains' : [ 'i686-gcc' ] },
  'lpc288x' : { 'cpus' : [ 'LPC2888' ], 'toolchains' : [ 'arm-gcc-79', 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
  'str7' : { 'cpus' : [ 'STR711FR2' ], 'toolchains' : [ 'arm-gcc-79', 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
  'stm32' : { 'cpus' : [ 'STM32F103ZE', 'STM32F103RE' ], 'toolchains' : [ 'arm-gcc-79', 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
  'avr32' : { 'cpus' : [ 'AT32UC3A0512' ], 'toolchains' : [ 'avr32-gcc' ] },
  'lpc24xx' : { 'cpus' : [ 'LPC2468' ], 'toolchains' : [ 'arm-gcc-79', 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
  'lpc17xx' : { 'cpus' : [ 'LPC1768' ], 'toolchains' : [ 'arm-gcc-cortex-m3', 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] }
}

Thank you for the attention.
Best Regards,

Marcelo Politzer Couto.

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
jbsnyder jbsnyder
Reply | Threaded
Open this post in threaded view
|

Re: Changing gcc between ARM9 and ARM-cortex automatically.

Interesting approach.  I haven't checked, but the build scripts you've
also posted perhaps could do all of this automatically as well?

Another approach, although a bit more complicated to build is to use a
multilib version of GCC to build for both.  This can be a bit tricky,
but I do actually have an example Makefile that will download, build,
and install such a toolchain at least on OS X.  I believe it should
also work on Linux without too much modification (just install latex,
mpfr, etc.. before trying to build the toolchain):

I'd love to hear how well it works for people on Linux targets, since
perhaps there are just some small changes needed.

http://github.com/jsnyder/arm-eabi-toolchain

-jsnyder

On Thu, Apr 29, 2010 at 1:16 AM, Marcelo Politzer <[hidden email]> wrote:

>
> Hello eLuers,
>
> I've been getting a hard time while doing eLua development with diferent
> CPUs using GCC.
> As the gcc to arm9 and the gcc to arm-cortex have the same name I have to
> manualy change the
> PATH environment variable to switch between the two gcc versions. ( Learned
> the method from Dado ).
> After getting a lot of frustration caused by forgetting to change, happened
> a it a few times already and I've come to a solution.
>
> Why don't create symbolic links with different names to each of them like
> arm-elf-gcc-79 and arm-elf-gcc-cortex to avoid this conflict.
> ( also did the symlinks with the other binutils )
>
> So I gave it a shot, and after creating the links at
> /usr/local/cross-arm/bin and at /usr/local/cross-cortex/bin ( the originals
> stayed intact ).
>
> I've realized that the SConstruct needed some modifications as well (
> changes documented at the bottom of the email ).
> After all this change it worked like a charm and automatically choosing the
> toolchain.
> As I think it is a good solution I came to share it with the list and check
> if it worth the change in the SConstruct and make people change their SO.
> But would be a Great new feature to eLua and help make it more frendly. Some
> more thoughts about it.
>
> Pros:
> - Part of the building complexity gets transparent to user as SConstruct
> automatically choses the toolchain to use.
> - There is no more need to prepend path to change the toolchain.
> - the systems without the symbolic links still works perfectly ( need to add
> toolchain=arm-gcc, peaple don't need to create symlinks if they don't want
> to )
>
> Cons:
> - People used to: "$scons board=elua-puc" prog will have to add
> toolchain=arm-gcc
> - can't think any more else...
>
>
> And here is the documentation of how I did it and some comments as it goes:
>
> The symbolinc links wore done in the following way for arm7 and arm9:
>
> $ cd /usr/local/cross-arm
> $ for file in *; do ln -s "$f" "$f"-79; done
>
> and for arm cortex:
>
> $ cd /usr/local/cross-cortex
> $ for file in *; do ln -s "$f" "$f"-cortex-m3; done
>
> Here are the changes at SConstruct: added two more toolchains, the symbolic
> linked ones.
>
> toolchain_list = {
>
>   'arm-gcc-79' : {
>     'compile' : 'arm-elf-gcc-79',
>     'link' : 'arm-elf-ld-79',
>     'asm' : 'arm-elf-as-79',
>     'bin' : 'arm-elf-objcopy-79',
>     'size' : 'arm-elf-size-79',
>     'cross_cpumode' : 'little',
>     'cross_lua' : 'float_arm 64',
>     'cross_lualong' : 'int 32'
>   },
>   'arm-gcc-cortex-m3' : {
>     'compile' : 'arm-elf-gcc-cortex-m3',
>     'link' : 'arm-elf-ld-cortex-m3',
>     'asm' : 'arm-elf-as-cortex-m3',
>     'bin' : 'arm-elf-objcopy-cortex-m3',
>     'size' : 'arm-elf-size-cortex-m3',
>     'cross_cpumode' : 'little',
>     'cross_lua' : 'float_arm 64',
>     'cross_lualong' : 'int 32'
>   },
>
> ...
>
> }
>
> Also at SConstruct but a little further: the toolchain used by each
> platform. ( after some tests, I've noticed that the first acts as default,
> so no toolchain= is the "auto" one. )
> As arm-gcc is not the first anymore, it needs to be explicitly called when
> used. so if the user calls "$scons board=elua-puc" on a system without the
> symbolic links it will issue an error like: "arm-gcc-79 not found" as
> mentioned earlier.
>
> platform_list = {
>   'at91sam7x' : { 'cpus' : [ 'AT91SAM7X256', 'AT91SAM7X512' ], 'toolchains'
> : [ 'arm-gcc-79', 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ]
> },
>   'lm3s' : { 'cpus' : [ 'LM3S8962', 'LM3S6965', 'LM3S6918', 'LM3S9B92' ],
> 'toolchains' : [ 'arm-gcc-cortex-m3', 'codesourcery', 'devkitarm',
> 'arm-eabi-gcc' ] },
>   'str9' : { 'cpus' : [ 'STR912FAW44' ], 'toolchains' : [ 'arm-gcc-79',
> 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>   'i386' : { 'cpus' : [ 'I386' ], 'toolchains' : [ 'i686-gcc' ] },
>   'sim' : { 'cpus' : [ 'LINUX' ], 'toolchains' : [ 'i686-gcc' ] },
>   'lpc288x' : { 'cpus' : [ 'LPC2888' ], 'toolchains' : [ 'arm-gcc-79',
> 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>   'str7' : { 'cpus' : [ 'STR711FR2' ], 'toolchains' : [ 'arm-gcc-79',
> 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>   'stm32' : { 'cpus' : [ 'STM32F103ZE', 'STM32F103RE' ], 'toolchains' : [
> 'arm-gcc-79', 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>   'avr32' : { 'cpus' : [ 'AT32UC3A0512' ], 'toolchains' : [ 'avr32-gcc' ] },
>   'lpc24xx' : { 'cpus' : [ 'LPC2468' ], 'toolchains' : [ 'arm-gcc-79',
> 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>   'lpc17xx' : { 'cpus' : [ 'LPC1768' ], 'toolchains' : [
> 'arm-gcc-cortex-m3', 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc'
> ] }
> }
>
> Thank you for the attention.
> Best Regards,
>
> Marcelo Politzer Couto.
>
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>



--
James Snyder
Biomedical Engineering
Northwestern University
[hidden email]
PGP: http://fanplastic.org/key.txt
Phone: (847) 448-0386
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Marcelo Politzer Marcelo Politzer
Reply | Threaded
Open this post in threaded view
|

Re: Changing gcc between ARM9 and ARM-cortex automatically.

The script does create the symbolic links.
but the changes on SConstruct need to be done manualy.

I've downloaded your script, and I'm going to try it out on Linux ( Ubuntu 32 ) and
report if it works.


Regards,

Marcelo Politzer Couto.


2010/4/29 James Snyder <[hidden email]>
Interesting approach.  I haven't checked, but the build scripts you've
also posted perhaps could do all of this automatically as well?

Another approach, although a bit more complicated to build is to use a
multilib version of GCC to build for both.  This can be a bit tricky,
but I do actually have an example Makefile that will download, build,
and install such a toolchain at least on OS X.  I believe it should
also work on Linux without too much modification (just install latex,
mpfr, etc.. before trying to build the toolchain):

I'd love to hear how well it works for people on Linux targets, since
perhaps there are just some small changes needed.

http://github.com/jsnyder/arm-eabi-toolchain

-jsnyder

On Thu, Apr 29, 2010 at 1:16 AM, Marcelo Politzer <[hidden email]> wrote:
>
> Hello eLuers,
>
> I've been getting a hard time while doing eLua development with diferent
> CPUs using GCC.
> As the gcc to arm9 and the gcc to arm-cortex have the same name I have to
> manualy change the
> PATH environment variable to switch between the two gcc versions. ( Learned
> the method from Dado ).
> After getting a lot of frustration caused by forgetting to change, happened
> a it a few times already and I've come to a solution.
>
> Why don't create symbolic links with different names to each of them like
> arm-elf-gcc-79 and arm-elf-gcc-cortex to avoid this conflict.
> ( also did the symlinks with the other binutils )
>
> So I gave it a shot, and after creating the links at
> /usr/local/cross-arm/bin and at /usr/local/cross-cortex/bin ( the originals
> stayed intact ).
>
> I've realized that the SConstruct needed some modifications as well (
> changes documented at the bottom of the email ).
> After all this change it worked like a charm and automatically choosing the
> toolchain.
> As I think it is a good solution I came to share it with the list and check
> if it worth the change in the SConstruct and make people change their SO.
> But would be a Great new feature to eLua and help make it more frendly. Some
> more thoughts about it.
>
> Pros:
> - Part of the building complexity gets transparent to user as SConstruct
> automatically choses the toolchain to use.
> - There is no more need to prepend path to change the toolchain.
> - the systems without the symbolic links still works perfectly ( need to add
> toolchain=arm-gcc, peaple don't need to create symlinks if they don't want
> to )
>
> Cons:
> - People used to: "$scons board=elua-puc" prog will have to add
> toolchain=arm-gcc
> - can't think any more else...
>
>
> And here is the documentation of how I did it and some comments as it goes:
>
> The symbolinc links wore done in the following way for arm7 and arm9:
>
> $ cd /usr/local/cross-arm
> $ for file in *; do ln -s "$f" "$f"-79; done
>
> and for arm cortex:
>
> $ cd /usr/local/cross-cortex
> $ for file in *; do ln -s "$f" "$f"-cortex-m3; done
>
> Here are the changes at SConstruct: added two more toolchains, the symbolic
> linked ones.
>
> toolchain_list = {
>
>   'arm-gcc-79' : {
>     'compile' : 'arm-elf-gcc-79',
>     'link' : 'arm-elf-ld-79',
>     'asm' : 'arm-elf-as-79',
>     'bin' : 'arm-elf-objcopy-79',
>     'size' : 'arm-elf-size-79',
>     'cross_cpumode' : 'little',
>     'cross_lua' : 'float_arm 64',
>     'cross_lualong' : 'int 32'
>   },
>   'arm-gcc-cortex-m3' : {
>     'compile' : 'arm-elf-gcc-cortex-m3',
>     'link' : 'arm-elf-ld-cortex-m3',
>     'asm' : 'arm-elf-as-cortex-m3',
>     'bin' : 'arm-elf-objcopy-cortex-m3',
>     'size' : 'arm-elf-size-cortex-m3',
>     'cross_cpumode' : 'little',
>     'cross_lua' : 'float_arm 64',
>     'cross_lualong' : 'int 32'
>   },
>
> ...
>
> }
>
> Also at SConstruct but a little further: the toolchain used by each
> platform. ( after some tests, I've noticed that the first acts as default,
> so no toolchain= is the "auto" one. )
> As arm-gcc is not the first anymore, it needs to be explicitly called when
> used. so if the user calls "$scons board=elua-puc" on a system without the
> symbolic links it will issue an error like: "arm-gcc-79 not found" as
> mentioned earlier.
>
> platform_list = {
>   'at91sam7x' : { 'cpus' : [ 'AT91SAM7X256', 'AT91SAM7X512' ], 'toolchains'
> : [ 'arm-gcc-79', 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ]
> },
>   'lm3s' : { 'cpus' : [ 'LM3S8962', 'LM3S6965', 'LM3S6918', 'LM3S9B92' ],
> 'toolchains' : [ 'arm-gcc-cortex-m3', 'codesourcery', 'devkitarm',
> 'arm-eabi-gcc' ] },
>   'str9' : { 'cpus' : [ 'STR912FAW44' ], 'toolchains' : [ 'arm-gcc-79',
> 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>   'i386' : { 'cpus' : [ 'I386' ], 'toolchains' : [ 'i686-gcc' ] },
>   'sim' : { 'cpus' : [ 'LINUX' ], 'toolchains' : [ 'i686-gcc' ] },
>   'lpc288x' : { 'cpus' : [ 'LPC2888' ], 'toolchains' : [ 'arm-gcc-79',
> 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>   'str7' : { 'cpus' : [ 'STR711FR2' ], 'toolchains' : [ 'arm-gcc-79',
> 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>   'stm32' : { 'cpus' : [ 'STM32F103ZE', 'STM32F103RE' ], 'toolchains' : [
> 'arm-gcc-79', 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>   'avr32' : { 'cpus' : [ 'AT32UC3A0512' ], 'toolchains' : [ 'avr32-gcc' ] },
>   'lpc24xx' : { 'cpus' : [ 'LPC2468' ], 'toolchains' : [ 'arm-gcc-79',
> 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>   'lpc17xx' : { 'cpus' : [ 'LPC1768' ], 'toolchains' : [
> 'arm-gcc-cortex-m3', 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc'
> ] }
> }
>
> Thank you for the attention.
> Best Regards,
>
> Marcelo Politzer Couto.
>
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>



--
James Snyder
Biomedical Engineering
Northwestern University
[hidden email]
PGP: http://fanplastic.org/key.txt
Phone: (847) 448-0386
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
jbsnyder jbsnyder
Reply | Threaded
Open this post in threaded view
|

Re: Changing gcc between ARM9 and ARM-cortex automatically.

On Fri, Apr 30, 2010 at 12:35 AM, Marcelo Politzer
<[hidden email]> wrote:
> The script does create the symbolic links.
> but the changes on SConstruct need to be done manualy.

Cool.  I may give that a try on my Mac to see if I can still build the
elf toolchains (it's been a bit).

Actually, this also brings to mind something that I've run into
frequently with configuring different builds which is that I'm lazy
and usually don't want to retype a long scons invokation each time
it's run.  Might it make sense to designate some separate override or
configuration file where users could modify defaults without changing
the SConstruct?  It certainly wouldn't be difficult to  do, and
perhaps SCons might provide some convenient way to do this?

Anyone else have their root of the elua tree filled with one-liner
scripts for building different targets? :-)

> I've downloaded your script, and I'm going to try it out on Linux ( Ubuntu
> 32 ) and
> report if it works.

Thanks!  FYI, please test the binaries that it generates if it does
build.  I tried it a few months ago on Ubuntu and found that the
horrible mess that is genmultilib (shell & sed) gave me correct
results on an OS X machine, and different results on a Linux machine.
The latter was correctable by copying the specs file from the Mac,
forcing it to use proper configurations when building for Cortex-M3.
I'm hoping that has been fixed in one of these more recent releases.
I'll see if I can get a build done on a 32-bit Linux box soon and I'd
be happy to compare results.


> Regards,
>
> Marcelo Politzer Couto.
>
> 2010/4/29 James Snyder <[hidden email]>
>>
>> Interesting approach.  I haven't checked, but the build scripts you've
>> also posted perhaps could do all of this automatically as well?
>>
>> Another approach, although a bit more complicated to build is to use a
>> multilib version of GCC to build for both.  This can be a bit tricky,
>> but I do actually have an example Makefile that will download, build,
>> and install such a toolchain at least on OS X.  I believe it should
>> also work on Linux without too much modification (just install latex,
>> mpfr, etc.. before trying to build the toolchain):
>>
>> I'd love to hear how well it works for people on Linux targets, since
>> perhaps there are just some small changes needed.
>>
>> http://github.com/jsnyder/arm-eabi-toolchain
>>
>> -jsnyder
>>
>> On Thu, Apr 29, 2010 at 1:16 AM, Marcelo Politzer <[hidden email]>
>> wrote:
>> >
>> > Hello eLuers,
>> >
>> > I've been getting a hard time while doing eLua development with diferent
>> > CPUs using GCC.
>> > As the gcc to arm9 and the gcc to arm-cortex have the same name I have
>> > to
>> > manualy change the
>> > PATH environment variable to switch between the two gcc versions. (
>> > Learned
>> > the method from Dado ).
>> > After getting a lot of frustration caused by forgetting to change,
>> > happened
>> > a it a few times already and I've come to a solution.
>> >
>> > Why don't create symbolic links with different names to each of them
>> > like
>> > arm-elf-gcc-79 and arm-elf-gcc-cortex to avoid this conflict.
>> > ( also did the symlinks with the other binutils )
>> >
>> > So I gave it a shot, and after creating the links at
>> > /usr/local/cross-arm/bin and at /usr/local/cross-cortex/bin ( the
>> > originals
>> > stayed intact ).
>> >
>> > I've realized that the SConstruct needed some modifications as well (
>> > changes documented at the bottom of the email ).
>> > After all this change it worked like a charm and automatically choosing
>> > the
>> > toolchain.
>> > As I think it is a good solution I came to share it with the list and
>> > check
>> > if it worth the change in the SConstruct and make people change their
>> > SO.
>> > But would be a Great new feature to eLua and help make it more frendly.
>> > Some
>> > more thoughts about it.
>> >
>> > Pros:
>> > - Part of the building complexity gets transparent to user as SConstruct
>> > automatically choses the toolchain to use.
>> > - There is no more need to prepend path to change the toolchain.
>> > - the systems without the symbolic links still works perfectly ( need to
>> > add
>> > toolchain=arm-gcc, peaple don't need to create symlinks if they don't
>> > want
>> > to )
>> >
>> > Cons:
>> > - People used to: "$scons board=elua-puc" prog will have to add
>> > toolchain=arm-gcc
>> > - can't think any more else...
>> >
>> >
>> > And here is the documentation of how I did it and some comments as it
>> > goes:
>> >
>> > The symbolinc links wore done in the following way for arm7 and arm9:
>> >
>> > $ cd /usr/local/cross-arm
>> > $ for file in *; do ln -s "$f" "$f"-79; done
>> >
>> > and for arm cortex:
>> >
>> > $ cd /usr/local/cross-cortex
>> > $ for file in *; do ln -s "$f" "$f"-cortex-m3; done
>> >
>> > Here are the changes at SConstruct: added two more toolchains, the
>> > symbolic
>> > linked ones.
>> >
>> > toolchain_list = {
>> >
>> >   'arm-gcc-79' : {
>> >     'compile' : 'arm-elf-gcc-79',
>> >     'link' : 'arm-elf-ld-79',
>> >     'asm' : 'arm-elf-as-79',
>> >     'bin' : 'arm-elf-objcopy-79',
>> >     'size' : 'arm-elf-size-79',
>> >     'cross_cpumode' : 'little',
>> >     'cross_lua' : 'float_arm 64',
>> >     'cross_lualong' : 'int 32'
>> >   },
>> >   'arm-gcc-cortex-m3' : {
>> >     'compile' : 'arm-elf-gcc-cortex-m3',
>> >     'link' : 'arm-elf-ld-cortex-m3',
>> >     'asm' : 'arm-elf-as-cortex-m3',
>> >     'bin' : 'arm-elf-objcopy-cortex-m3',
>> >     'size' : 'arm-elf-size-cortex-m3',
>> >     'cross_cpumode' : 'little',
>> >     'cross_lua' : 'float_arm 64',
>> >     'cross_lualong' : 'int 32'
>> >   },
>> >
>> > ...
>> >
>> > }
>> >
>> > Also at SConstruct but a little further: the toolchain used by each
>> > platform. ( after some tests, I've noticed that the first acts as
>> > default,
>> > so no toolchain= is the "auto" one. )
>> > As arm-gcc is not the first anymore, it needs to be explicitly called
>> > when
>> > used. so if the user calls "$scons board=elua-puc" on a system without
>> > the
>> > symbolic links it will issue an error like: "arm-gcc-79 not found" as
>> > mentioned earlier.
>> >
>> > platform_list = {
>> >   'at91sam7x' : { 'cpus' : [ 'AT91SAM7X256', 'AT91SAM7X512' ],
>> > 'toolchains'
>> > : [ 'arm-gcc-79', 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc'
>> > ]
>> > },
>> >   'lm3s' : { 'cpus' : [ 'LM3S8962', 'LM3S6965', 'LM3S6918', 'LM3S9B92'
>> > ],
>> > 'toolchains' : [ 'arm-gcc-cortex-m3', 'codesourcery', 'devkitarm',
>> > 'arm-eabi-gcc' ] },
>> >   'str9' : { 'cpus' : [ 'STR912FAW44' ], 'toolchains' : [ 'arm-gcc-79',
>> > 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>> >   'i386' : { 'cpus' : [ 'I386' ], 'toolchains' : [ 'i686-gcc' ] },
>> >   'sim' : { 'cpus' : [ 'LINUX' ], 'toolchains' : [ 'i686-gcc' ] },
>> >   'lpc288x' : { 'cpus' : [ 'LPC2888' ], 'toolchains' : [ 'arm-gcc-79',
>> > 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>> >   'str7' : { 'cpus' : [ 'STR711FR2' ], 'toolchains' : [ 'arm-gcc-79',
>> > 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>> >   'stm32' : { 'cpus' : [ 'STM32F103ZE', 'STM32F103RE' ], 'toolchains' :
>> > [
>> > 'arm-gcc-79', 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ]
>> > },
>> >   'avr32' : { 'cpus' : [ 'AT32UC3A0512' ], 'toolchains' : [ 'avr32-gcc'
>> > ] },
>> >   'lpc24xx' : { 'cpus' : [ 'LPC2468' ], 'toolchains' : [ 'arm-gcc-79',
>> > 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>> >   'lpc17xx' : { 'cpus' : [ 'LPC1768' ], 'toolchains' : [
>> > 'arm-gcc-cortex-m3', 'arm-gcc', 'codesourcery', 'devkitarm',
>> > 'arm-eabi-gcc'
>> > ] }
>> > }
>> >
>> > Thank you for the attention.
>> > Best Regards,
>> >
>> > Marcelo Politzer Couto.
>> >
>> > _______________________________________________
>> > eLua-dev mailing list
>> > [hidden email]
>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>> >
>> >
>>
>>
>>
>> --
>> James Snyder
>> Biomedical Engineering
>> Northwestern University
>> [hidden email]
>> PGP: http://fanplastic.org/key.txt
>> Phone: (847) 448-0386
>> _______________________________________________
>> eLua-dev mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>



--
James Snyder
Biomedical Engineering
Northwestern University
[hidden email]
PGP: http://fanplastic.org/key.txt
Phone: (847) 448-0386
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
jbsnyder jbsnyder
Reply | Threaded
Open this post in threaded view
|

Re: Changing gcc between ARM9 and ARM-cortex automatically.

Also, FYI, I just realized that I only pushed my latest changes up to
that repository right before I sent this email, so if you want to try
it with the latest version, grabbing it at this point or later would
be best.

On Fri, Apr 30, 2010 at 11:53 AM, James Snyder <[hidden email]> wrote:

> On Fri, Apr 30, 2010 at 12:35 AM, Marcelo Politzer
> <[hidden email]> wrote:
>> The script does create the symbolic links.
>> but the changes on SConstruct need to be done manualy.
>
> Cool.  I may give that a try on my Mac to see if I can still build the
> elf toolchains (it's been a bit).
>
> Actually, this also brings to mind something that I've run into
> frequently with configuring different builds which is that I'm lazy
> and usually don't want to retype a long scons invokation each time
> it's run.  Might it make sense to designate some separate override or
> configuration file where users could modify defaults without changing
> the SConstruct?  It certainly wouldn't be difficult to  do, and
> perhaps SCons might provide some convenient way to do this?
>
> Anyone else have their root of the elua tree filled with one-liner
> scripts for building different targets? :-)
>
>> I've downloaded your script, and I'm going to try it out on Linux ( Ubuntu
>> 32 ) and
>> report if it works.
>
> Thanks!  FYI, please test the binaries that it generates if it does
> build.  I tried it a few months ago on Ubuntu and found that the
> horrible mess that is genmultilib (shell & sed) gave me correct
> results on an OS X machine, and different results on a Linux machine.
> The latter was correctable by copying the specs file from the Mac,
> forcing it to use proper configurations when building for Cortex-M3.
> I'm hoping that has been fixed in one of these more recent releases.
> I'll see if I can get a build done on a 32-bit Linux box soon and I'd
> be happy to compare results.
>
>
>> Regards,
>>
>> Marcelo Politzer Couto.
>>
>> 2010/4/29 James Snyder <[hidden email]>
>>>
>>> Interesting approach.  I haven't checked, but the build scripts you've
>>> also posted perhaps could do all of this automatically as well?
>>>
>>> Another approach, although a bit more complicated to build is to use a
>>> multilib version of GCC to build for both.  This can be a bit tricky,
>>> but I do actually have an example Makefile that will download, build,
>>> and install such a toolchain at least on OS X.  I believe it should
>>> also work on Linux without too much modification (just install latex,
>>> mpfr, etc.. before trying to build the toolchain):
>>>
>>> I'd love to hear how well it works for people on Linux targets, since
>>> perhaps there are just some small changes needed.
>>>
>>> http://github.com/jsnyder/arm-eabi-toolchain
>>>
>>> -jsnyder
>>>
>>> On Thu, Apr 29, 2010 at 1:16 AM, Marcelo Politzer <[hidden email]>
>>> wrote:
>>> >
>>> > Hello eLuers,
>>> >
>>> > I've been getting a hard time while doing eLua development with diferent
>>> > CPUs using GCC.
>>> > As the gcc to arm9 and the gcc to arm-cortex have the same name I have
>>> > to
>>> > manualy change the
>>> > PATH environment variable to switch between the two gcc versions. (
>>> > Learned
>>> > the method from Dado ).
>>> > After getting a lot of frustration caused by forgetting to change,
>>> > happened
>>> > a it a few times already and I've come to a solution.
>>> >
>>> > Why don't create symbolic links with different names to each of them
>>> > like
>>> > arm-elf-gcc-79 and arm-elf-gcc-cortex to avoid this conflict.
>>> > ( also did the symlinks with the other binutils )
>>> >
>>> > So I gave it a shot, and after creating the links at
>>> > /usr/local/cross-arm/bin and at /usr/local/cross-cortex/bin ( the
>>> > originals
>>> > stayed intact ).
>>> >
>>> > I've realized that the SConstruct needed some modifications as well (
>>> > changes documented at the bottom of the email ).
>>> > After all this change it worked like a charm and automatically choosing
>>> > the
>>> > toolchain.
>>> > As I think it is a good solution I came to share it with the list and
>>> > check
>>> > if it worth the change in the SConstruct and make people change their
>>> > SO.
>>> > But would be a Great new feature to eLua and help make it more frendly.
>>> > Some
>>> > more thoughts about it.
>>> >
>>> > Pros:
>>> > - Part of the building complexity gets transparent to user as SConstruct
>>> > automatically choses the toolchain to use.
>>> > - There is no more need to prepend path to change the toolchain.
>>> > - the systems without the symbolic links still works perfectly ( need to
>>> > add
>>> > toolchain=arm-gcc, peaple don't need to create symlinks if they don't
>>> > want
>>> > to )
>>> >
>>> > Cons:
>>> > - People used to: "$scons board=elua-puc" prog will have to add
>>> > toolchain=arm-gcc
>>> > - can't think any more else...
>>> >
>>> >
>>> > And here is the documentation of how I did it and some comments as it
>>> > goes:
>>> >
>>> > The symbolinc links wore done in the following way for arm7 and arm9:
>>> >
>>> > $ cd /usr/local/cross-arm
>>> > $ for file in *; do ln -s "$f" "$f"-79; done
>>> >
>>> > and for arm cortex:
>>> >
>>> > $ cd /usr/local/cross-cortex
>>> > $ for file in *; do ln -s "$f" "$f"-cortex-m3; done
>>> >
>>> > Here are the changes at SConstruct: added two more toolchains, the
>>> > symbolic
>>> > linked ones.
>>> >
>>> > toolchain_list = {
>>> >
>>> >   'arm-gcc-79' : {
>>> >     'compile' : 'arm-elf-gcc-79',
>>> >     'link' : 'arm-elf-ld-79',
>>> >     'asm' : 'arm-elf-as-79',
>>> >     'bin' : 'arm-elf-objcopy-79',
>>> >     'size' : 'arm-elf-size-79',
>>> >     'cross_cpumode' : 'little',
>>> >     'cross_lua' : 'float_arm 64',
>>> >     'cross_lualong' : 'int 32'
>>> >   },
>>> >   'arm-gcc-cortex-m3' : {
>>> >     'compile' : 'arm-elf-gcc-cortex-m3',
>>> >     'link' : 'arm-elf-ld-cortex-m3',
>>> >     'asm' : 'arm-elf-as-cortex-m3',
>>> >     'bin' : 'arm-elf-objcopy-cortex-m3',
>>> >     'size' : 'arm-elf-size-cortex-m3',
>>> >     'cross_cpumode' : 'little',
>>> >     'cross_lua' : 'float_arm 64',
>>> >     'cross_lualong' : 'int 32'
>>> >   },
>>> >
>>> > ...
>>> >
>>> > }
>>> >
>>> > Also at SConstruct but a little further: the toolchain used by each
>>> > platform. ( after some tests, I've noticed that the first acts as
>>> > default,
>>> > so no toolchain= is the "auto" one. )
>>> > As arm-gcc is not the first anymore, it needs to be explicitly called
>>> > when
>>> > used. so if the user calls "$scons board=elua-puc" on a system without
>>> > the
>>> > symbolic links it will issue an error like: "arm-gcc-79 not found" as
>>> > mentioned earlier.
>>> >
>>> > platform_list = {
>>> >   'at91sam7x' : { 'cpus' : [ 'AT91SAM7X256', 'AT91SAM7X512' ],
>>> > 'toolchains'
>>> > : [ 'arm-gcc-79', 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc'
>>> > ]
>>> > },
>>> >   'lm3s' : { 'cpus' : [ 'LM3S8962', 'LM3S6965', 'LM3S6918', 'LM3S9B92'
>>> > ],
>>> > 'toolchains' : [ 'arm-gcc-cortex-m3', 'codesourcery', 'devkitarm',
>>> > 'arm-eabi-gcc' ] },
>>> >   'str9' : { 'cpus' : [ 'STR912FAW44' ], 'toolchains' : [ 'arm-gcc-79',
>>> > 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>>> >   'i386' : { 'cpus' : [ 'I386' ], 'toolchains' : [ 'i686-gcc' ] },
>>> >   'sim' : { 'cpus' : [ 'LINUX' ], 'toolchains' : [ 'i686-gcc' ] },
>>> >   'lpc288x' : { 'cpus' : [ 'LPC2888' ], 'toolchains' : [ 'arm-gcc-79',
>>> > 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>>> >   'str7' : { 'cpus' : [ 'STR711FR2' ], 'toolchains' : [ 'arm-gcc-79',
>>> > 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>>> >   'stm32' : { 'cpus' : [ 'STM32F103ZE', 'STM32F103RE' ], 'toolchains' :
>>> > [
>>> > 'arm-gcc-79', 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ]
>>> > },
>>> >   'avr32' : { 'cpus' : [ 'AT32UC3A0512' ], 'toolchains' : [ 'avr32-gcc'
>>> > ] },
>>> >   'lpc24xx' : { 'cpus' : [ 'LPC2468' ], 'toolchains' : [ 'arm-gcc-79',
>>> > 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>>> >   'lpc17xx' : { 'cpus' : [ 'LPC1768' ], 'toolchains' : [
>>> > 'arm-gcc-cortex-m3', 'arm-gcc', 'codesourcery', 'devkitarm',
>>> > 'arm-eabi-gcc'
>>> > ] }
>>> > }
>>> >
>>> > Thank you for the attention.
>>> > Best Regards,
>>> >
>>> > Marcelo Politzer Couto.
>>> >
>>> > _______________________________________________
>>> > eLua-dev mailing list
>>> > [hidden email]
>>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>>> >
>>> >
>>>
>>>
>>>
>>> --
>>> James Snyder
>>> Biomedical Engineering
>>> Northwestern University
>>> [hidden email]
>>> PGP: http://fanplastic.org/key.txt
>>> Phone: (847) 448-0386
>>> _______________________________________________
>>> eLua-dev mailing list
>>> [hidden email]
>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>
>>
>> _______________________________________________
>> eLua-dev mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>
>>
>
>
>
> --
> James Snyder
> Biomedical Engineering
> Northwestern University
> [hidden email]
> PGP: http://fanplastic.org/key.txt
> Phone: (847) 448-0386
>



--
James Snyder
Biomedical Engineering
Northwestern University
[hidden email]
PGP: http://fanplastic.org/key.txt
Phone: (847) 448-0386
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
jbsnyder jbsnyder
Reply | Threaded
Open this post in threaded view
|

Re: Changing gcc between ARM9 and ARM-cortex automatically.

I've made a few other fixes that I believe now should allow building a
functional multilib toolchain on Ubuntu.  It turns out that Ubuntu
uses dash as the shell linked to /bin/sh and something in genmultilib
blows up with that shell.  I've added a patch to force it to use bash
instead of dash, which seems to have fixed the problem.

If anyone would like to try things on on Ubuntu or OS X, I'd be happy
to hear if it works:
http://github.com/jsnyder/arm-eabi-toolchain

On Fri, Apr 30, 2010 at 12:19 PM, James Snyder <[hidden email]> wrote:

> Also, FYI, I just realized that I only pushed my latest changes up to
> that repository right before I sent this email, so if you want to try
> it with the latest version, grabbing it at this point or later would
> be best.
>
> On Fri, Apr 30, 2010 at 11:53 AM, James Snyder <[hidden email]> wrote:
>> On Fri, Apr 30, 2010 at 12:35 AM, Marcelo Politzer
>> <[hidden email]> wrote:
>>> The script does create the symbolic links.
>>> but the changes on SConstruct need to be done manualy.
>>
>> Cool.  I may give that a try on my Mac to see if I can still build the
>> elf toolchains (it's been a bit).
>>
>> Actually, this also brings to mind something that I've run into
>> frequently with configuring different builds which is that I'm lazy
>> and usually don't want to retype a long scons invokation each time
>> it's run.  Might it make sense to designate some separate override or
>> configuration file where users could modify defaults without changing
>> the SConstruct?  It certainly wouldn't be difficult to  do, and
>> perhaps SCons might provide some convenient way to do this?
>>
>> Anyone else have their root of the elua tree filled with one-liner
>> scripts for building different targets? :-)
>>
>>> I've downloaded your script, and I'm going to try it out on Linux ( Ubuntu
>>> 32 ) and
>>> report if it works.
>>
>> Thanks!  FYI, please test the binaries that it generates if it does
>> build.  I tried it a few months ago on Ubuntu and found that the
>> horrible mess that is genmultilib (shell & sed) gave me correct
>> results on an OS X machine, and different results on a Linux machine.
>> The latter was correctable by copying the specs file from the Mac,
>> forcing it to use proper configurations when building for Cortex-M3.
>> I'm hoping that has been fixed in one of these more recent releases.
>> I'll see if I can get a build done on a 32-bit Linux box soon and I'd
>> be happy to compare results.
>>
>>
>>> Regards,
>>>
>>> Marcelo Politzer Couto.
>>>
>>> 2010/4/29 James Snyder <[hidden email]>
>>>>
>>>> Interesting approach.  I haven't checked, but the build scripts you've
>>>> also posted perhaps could do all of this automatically as well?
>>>>
>>>> Another approach, although a bit more complicated to build is to use a
>>>> multilib version of GCC to build for both.  This can be a bit tricky,
>>>> but I do actually have an example Makefile that will download, build,
>>>> and install such a toolchain at least on OS X.  I believe it should
>>>> also work on Linux without too much modification (just install latex,
>>>> mpfr, etc.. before trying to build the toolchain):
>>>>
>>>> I'd love to hear how well it works for people on Linux targets, since
>>>> perhaps there are just some small changes needed.
>>>>
>>>> http://github.com/jsnyder/arm-eabi-toolchain
>>>>
>>>> -jsnyder
>>>>
>>>> On Thu, Apr 29, 2010 at 1:16 AM, Marcelo Politzer <[hidden email]>
>>>> wrote:
>>>> >
>>>> > Hello eLuers,
>>>> >
>>>> > I've been getting a hard time while doing eLua development with diferent
>>>> > CPUs using GCC.
>>>> > As the gcc to arm9 and the gcc to arm-cortex have the same name I have
>>>> > to
>>>> > manualy change the
>>>> > PATH environment variable to switch between the two gcc versions. (
>>>> > Learned
>>>> > the method from Dado ).
>>>> > After getting a lot of frustration caused by forgetting to change,
>>>> > happened
>>>> > a it a few times already and I've come to a solution.
>>>> >
>>>> > Why don't create symbolic links with different names to each of them
>>>> > like
>>>> > arm-elf-gcc-79 and arm-elf-gcc-cortex to avoid this conflict.
>>>> > ( also did the symlinks with the other binutils )
>>>> >
>>>> > So I gave it a shot, and after creating the links at
>>>> > /usr/local/cross-arm/bin and at /usr/local/cross-cortex/bin ( the
>>>> > originals
>>>> > stayed intact ).
>>>> >
>>>> > I've realized that the SConstruct needed some modifications as well (
>>>> > changes documented at the bottom of the email ).
>>>> > After all this change it worked like a charm and automatically choosing
>>>> > the
>>>> > toolchain.
>>>> > As I think it is a good solution I came to share it with the list and
>>>> > check
>>>> > if it worth the change in the SConstruct and make people change their
>>>> > SO.
>>>> > But would be a Great new feature to eLua and help make it more frendly.
>>>> > Some
>>>> > more thoughts about it.
>>>> >
>>>> > Pros:
>>>> > - Part of the building complexity gets transparent to user as SConstruct
>>>> > automatically choses the toolchain to use.
>>>> > - There is no more need to prepend path to change the toolchain.
>>>> > - the systems without the symbolic links still works perfectly ( need to
>>>> > add
>>>> > toolchain=arm-gcc, peaple don't need to create symlinks if they don't
>>>> > want
>>>> > to )
>>>> >
>>>> > Cons:
>>>> > - People used to: "$scons board=elua-puc" prog will have to add
>>>> > toolchain=arm-gcc
>>>> > - can't think any more else...
>>>> >
>>>> >
>>>> > And here is the documentation of how I did it and some comments as it
>>>> > goes:
>>>> >
>>>> > The symbolinc links wore done in the following way for arm7 and arm9:
>>>> >
>>>> > $ cd /usr/local/cross-arm
>>>> > $ for file in *; do ln -s "$f" "$f"-79; done
>>>> >
>>>> > and for arm cortex:
>>>> >
>>>> > $ cd /usr/local/cross-cortex
>>>> > $ for file in *; do ln -s "$f" "$f"-cortex-m3; done
>>>> >
>>>> > Here are the changes at SConstruct: added two more toolchains, the
>>>> > symbolic
>>>> > linked ones.
>>>> >
>>>> > toolchain_list = {
>>>> >
>>>> >   'arm-gcc-79' : {
>>>> >     'compile' : 'arm-elf-gcc-79',
>>>> >     'link' : 'arm-elf-ld-79',
>>>> >     'asm' : 'arm-elf-as-79',
>>>> >     'bin' : 'arm-elf-objcopy-79',
>>>> >     'size' : 'arm-elf-size-79',
>>>> >     'cross_cpumode' : 'little',
>>>> >     'cross_lua' : 'float_arm 64',
>>>> >     'cross_lualong' : 'int 32'
>>>> >   },
>>>> >   'arm-gcc-cortex-m3' : {
>>>> >     'compile' : 'arm-elf-gcc-cortex-m3',
>>>> >     'link' : 'arm-elf-ld-cortex-m3',
>>>> >     'asm' : 'arm-elf-as-cortex-m3',
>>>> >     'bin' : 'arm-elf-objcopy-cortex-m3',
>>>> >     'size' : 'arm-elf-size-cortex-m3',
>>>> >     'cross_cpumode' : 'little',
>>>> >     'cross_lua' : 'float_arm 64',
>>>> >     'cross_lualong' : 'int 32'
>>>> >   },
>>>> >
>>>> > ...
>>>> >
>>>> > }
>>>> >
>>>> > Also at SConstruct but a little further: the toolchain used by each
>>>> > platform. ( after some tests, I've noticed that the first acts as
>>>> > default,
>>>> > so no toolchain= is the "auto" one. )
>>>> > As arm-gcc is not the first anymore, it needs to be explicitly called
>>>> > when
>>>> > used. so if the user calls "$scons board=elua-puc" on a system without
>>>> > the
>>>> > symbolic links it will issue an error like: "arm-gcc-79 not found" as
>>>> > mentioned earlier.
>>>> >
>>>> > platform_list = {
>>>> >   'at91sam7x' : { 'cpus' : [ 'AT91SAM7X256', 'AT91SAM7X512' ],
>>>> > 'toolchains'
>>>> > : [ 'arm-gcc-79', 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc'
>>>> > ]
>>>> > },
>>>> >   'lm3s' : { 'cpus' : [ 'LM3S8962', 'LM3S6965', 'LM3S6918', 'LM3S9B92'
>>>> > ],
>>>> > 'toolchains' : [ 'arm-gcc-cortex-m3', 'codesourcery', 'devkitarm',
>>>> > 'arm-eabi-gcc' ] },
>>>> >   'str9' : { 'cpus' : [ 'STR912FAW44' ], 'toolchains' : [ 'arm-gcc-79',
>>>> > 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>>>> >   'i386' : { 'cpus' : [ 'I386' ], 'toolchains' : [ 'i686-gcc' ] },
>>>> >   'sim' : { 'cpus' : [ 'LINUX' ], 'toolchains' : [ 'i686-gcc' ] },
>>>> >   'lpc288x' : { 'cpus' : [ 'LPC2888' ], 'toolchains' : [ 'arm-gcc-79',
>>>> > 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>>>> >   'str7' : { 'cpus' : [ 'STR711FR2' ], 'toolchains' : [ 'arm-gcc-79',
>>>> > 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>>>> >   'stm32' : { 'cpus' : [ 'STM32F103ZE', 'STM32F103RE' ], 'toolchains' :
>>>> > [
>>>> > 'arm-gcc-79', 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ]
>>>> > },
>>>> >   'avr32' : { 'cpus' : [ 'AT32UC3A0512' ], 'toolchains' : [ 'avr32-gcc'
>>>> > ] },
>>>> >   'lpc24xx' : { 'cpus' : [ 'LPC2468' ], 'toolchains' : [ 'arm-gcc-79',
>>>> > 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>>>> >   'lpc17xx' : { 'cpus' : [ 'LPC1768' ], 'toolchains' : [
>>>> > 'arm-gcc-cortex-m3', 'arm-gcc', 'codesourcery', 'devkitarm',
>>>> > 'arm-eabi-gcc'
>>>> > ] }
>>>> > }
>>>> >
>>>> > Thank you for the attention.
>>>> > Best Regards,
>>>> >
>>>> > Marcelo Politzer Couto.
>>>> >
>>>> > _______________________________________________
>>>> > eLua-dev mailing list
>>>> > [hidden email]
>>>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>>>> >
>>>> >
>>>>
>>>>
>>>>
>>>> --
>>>> James Snyder
>>>> Biomedical Engineering
>>>> Northwestern University
>>>> [hidden email]
>>>> PGP: http://fanplastic.org/key.txt
>>>> Phone: (847) 448-0386
>>>> _______________________________________________
>>>> eLua-dev mailing list
>>>> [hidden email]
>>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>>
>>>
>>> _______________________________________________
>>> eLua-dev mailing list
>>> [hidden email]
>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>>
>>>
>>
>>
>>
>> --
>> James Snyder
>> Biomedical Engineering
>> Northwestern University
>> [hidden email]
>> PGP: http://fanplastic.org/key.txt
>> Phone: (847) 448-0386
>>
>
>
>
> --
> James Snyder
> Biomedical Engineering
> Northwestern University
> [hidden email]
> PGP: http://fanplastic.org/key.txt
> Phone: (847) 448-0386
>



--
James Snyder
Biomedical Engineering
Northwestern University
[hidden email]
PGP: http://fanplastic.org/key.txt
Phone: (847) 448-0386
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Thiago Naves Thiago Naves
Reply | Threaded
Open this post in threaded view
|

Re: Changing gcc between ARM9 and ARM-cortex automatically.

In reply to this post by jbsnyder


On Fri, Apr 30, 2010 at 1:53 PM, James Snyder <[hidden email]> wrote:
On Fri, Apr 30, 2010 at 12:35 AM, Marcelo Politzer

 
> The script does create the symbolic links.
> but the changes on SConstruct need to be done manualy.

Cool.  I may give that a try on my Mac to see if I can still build the
elf toolchains (it's been a bit).

I've tryed building on OS X using a earlier version of those scripts with no success.
But I'm not a shell expert so, maybe with some modifications it would work ( I did try
to modify the script, but got nothing ).
Not sure about that new version, I might give it a try.

 
Actually, this also brings to mind something that I've run into
frequently with configuring different builds which is that I'm lazy
and usually don't want to retype a long scons invokation each time
it's run.  Might it make sense to designate some separate override or
configuration file where users could modify defaults without changing
the SConstruct?  It certainly wouldn't be difficult to  do, and
perhaps SCons might provide some convenient way to do this?

I think Marcelo was working on something like that too...
 
Anyone else have their root of the elua tree filled with one-liner
scripts for building different targets? :-)

Yeah =)
 

> I've downloaded your script, and I'm going to try it out on Linux ( Ubuntu
> 32 ) and
> report if it works.

Thanks!  FYI, please test the binaries that it generates if it does
build.  I tried it a few months ago on Ubuntu and found that the
horrible mess that is genmultilib (shell & sed) gave me correct
results on an OS X machine, and different results on a Linux machine.
The latter was correctable by copying the specs file from the Mac,
forcing it to use proper configurations when building for Cortex-M3.
I'm hoping that has been fixed in one of these more recent releases.
I'll see if I can get a build done on a 32-bit Linux box soon and I'd
be happy to compare results.

I'll try your script too..


Best,

Thiago


 
> Regards,
>
> Marcelo Politzer Couto.
>
> 2010/4/29 James Snyder <[hidden email]>
>>
>> Interesting approach.  I haven't checked, but the build scripts you've
>> also posted perhaps could do all of this automatically as well?
>>
>> Another approach, although a bit more complicated to build is to use a
>> multilib version of GCC to build for both.  This can be a bit tricky,
>> but I do actually have an example Makefile that will download, build,
>> and install such a toolchain at least on OS X.  I believe it should
>> also work on Linux without too much modification (just install latex,
>> mpfr, etc.. before trying to build the toolchain):
>>
>> I'd love to hear how well it works for people on Linux targets, since
>> perhaps there are just some small changes needed.
>>
>> http://github.com/jsnyder/arm-eabi-toolchain
>>
>> -jsnyder
>>
>> On Thu, Apr 29, 2010 at 1:16 AM, Marcelo Politzer <[hidden email]>
>> wrote:
>> >
>> > Hello eLuers,
>> >
>> > I've been getting a hard time while doing eLua development with diferent
>> > CPUs using GCC.
>> > As the gcc to arm9 and the gcc to arm-cortex have the same name I have
>> > to
>> > manualy change the
>> > PATH environment variable to switch between the two gcc versions. (
>> > Learned
>> > the method from Dado ).
>> > After getting a lot of frustration caused by forgetting to change,
>> > happened
>> > a it a few times already and I've come to a solution.
>> >
>> > Why don't create symbolic links with different names to each of them
>> > like
>> > arm-elf-gcc-79 and arm-elf-gcc-cortex to avoid this conflict.
>> > ( also did the symlinks with the other binutils )
>> >
>> > So I gave it a shot, and after creating the links at
>> > /usr/local/cross-arm/bin and at /usr/local/cross-cortex/bin ( the
>> > originals
>> > stayed intact ).
>> >
>> > I've realized that the SConstruct needed some modifications as well (
>> > changes documented at the bottom of the email ).
>> > After all this change it worked like a charm and automatically choosing
>> > the
>> > toolchain.
>> > As I think it is a good solution I came to share it with the list and
>> > check
>> > if it worth the change in the SConstruct and make people change their
>> > SO.
>> > But would be a Great new feature to eLua and help make it more frendly.
>> > Some
>> > more thoughts about it.
>> >
>> > Pros:
>> > - Part of the building complexity gets transparent to user as SConstruct
>> > automatically choses the toolchain to use.
>> > - There is no more need to prepend path to change the toolchain.
>> > - the systems without the symbolic links still works perfectly ( need to
>> > add
>> > toolchain=arm-gcc, peaple don't need to create symlinks if they don't
>> > want
>> > to )
>> >
>> > Cons:
>> > - People used to: "$scons board=elua-puc" prog will have to add
>> > toolchain=arm-gcc
>> > - can't think any more else...
>> >
>> >
>> > And here is the documentation of how I did it and some comments as it
>> > goes:
>> >
>> > The symbolinc links wore done in the following way for arm7 and arm9:
>> >
>> > $ cd /usr/local/cross-arm
>> > $ for file in *; do ln -s "$f" "$f"-79; done
>> >
>> > and for arm cortex:
>> >
>> > $ cd /usr/local/cross-cortex
>> > $ for file in *; do ln -s "$f" "$f"-cortex-m3; done
>> >
>> > Here are the changes at SConstruct: added two more toolchains, the
>> > symbolic
>> > linked ones.
>> >
>> > toolchain_list = {
>> >
>> >   'arm-gcc-79' : {
>> >     'compile' : 'arm-elf-gcc-79',
>> >     'link' : 'arm-elf-ld-79',
>> >     'asm' : 'arm-elf-as-79',
>> >     'bin' : 'arm-elf-objcopy-79',
>> >     'size' : 'arm-elf-size-79',
>> >     'cross_cpumode' : 'little',
>> >     'cross_lua' : 'float_arm 64',
>> >     'cross_lualong' : 'int 32'
>> >   },
>> >   'arm-gcc-cortex-m3' : {
>> >     'compile' : 'arm-elf-gcc-cortex-m3',
>> >     'link' : 'arm-elf-ld-cortex-m3',
>> >     'asm' : 'arm-elf-as-cortex-m3',
>> >     'bin' : 'arm-elf-objcopy-cortex-m3',
>> >     'size' : 'arm-elf-size-cortex-m3',
>> >     'cross_cpumode' : 'little',
>> >     'cross_lua' : 'float_arm 64',
>> >     'cross_lualong' : 'int 32'
>> >   },
>> >
>> > ...
>> >
>> > }
>> >
>> > Also at SConstruct but a little further: the toolchain used by each
>> > platform. ( after some tests, I've noticed that the first acts as
>> > default,
>> > so no toolchain= is the "auto" one. )
>> > As arm-gcc is not the first anymore, it needs to be explicitly called
>> > when
>> > used. so if the user calls "$scons board=elua-puc" on a system without
>> > the
>> > symbolic links it will issue an error like: "arm-gcc-79 not found" as
>> > mentioned earlier.
>> >
>> > platform_list = {
>> >   'at91sam7x' : { 'cpus' : [ 'AT91SAM7X256', 'AT91SAM7X512' ],
>> > 'toolchains'
>> > : [ 'arm-gcc-79', 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc'
>> > ]
>> > },
>> >   'lm3s' : { 'cpus' : [ 'LM3S8962', 'LM3S6965', 'LM3S6918', 'LM3S9B92'
>> > ],
>> > 'toolchains' : [ 'arm-gcc-cortex-m3', 'codesourcery', 'devkitarm',
>> > 'arm-eabi-gcc' ] },
>> >   'str9' : { 'cpus' : [ 'STR912FAW44' ], 'toolchains' : [ 'arm-gcc-79',
>> > 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>> >   'i386' : { 'cpus' : [ 'I386' ], 'toolchains' : [ 'i686-gcc' ] },
>> >   'sim' : { 'cpus' : [ 'LINUX' ], 'toolchains' : [ 'i686-gcc' ] },
>> >   'lpc288x' : { 'cpus' : [ 'LPC2888' ], 'toolchains' : [ 'arm-gcc-79',
>> > 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>> >   'str7' : { 'cpus' : [ 'STR711FR2' ], 'toolchains' : [ 'arm-gcc-79',
>> > 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>> >   'stm32' : { 'cpus' : [ 'STM32F103ZE', 'STM32F103RE' ], 'toolchains' :
>> > [
>> > 'arm-gcc-79', 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ]
>> > },
>> >   'avr32' : { 'cpus' : [ 'AT32UC3A0512' ], 'toolchains' : [ 'avr32-gcc'
>> > ] },
>> >   'lpc24xx' : { 'cpus' : [ 'LPC2468' ], 'toolchains' : [ 'arm-gcc-79',
>> > 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
>> >   'lpc17xx' : { 'cpus' : [ 'LPC1768' ], 'toolchains' : [
>> > 'arm-gcc-cortex-m3', 'arm-gcc', 'codesourcery', 'devkitarm',
>> > 'arm-eabi-gcc'
>> > ] }
>> > }
>> >
>> > Thank you for the attention.
>> > Best Regards,
>> >
>> > Marcelo Politzer Couto.
>> >
>> > _______________________________________________
>> > eLua-dev mailing list
>> > [hidden email]
>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>> >
>> >
>>
>>
>>
>> --
>> James Snyder
>> Biomedical Engineering
>> Northwestern University
>> [hidden email]
>> PGP: http://fanplastic.org/key.txt
>> Phone: (847) 448-0386
>> _______________________________________________
>> eLua-dev mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>



--
James Snyder
Biomedical Engineering
Northwestern University
[hidden email]
PGP: http://fanplastic.org/key.txt
Phone: (847) 448-0386
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev