Linker script for new gcc?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Linker script for new gcc?

Lorenzo Marcantonio
I'm trying to build the 'new' toolchain, following the instruction here:

http://sourceforge.net/apps/mediawiki/mspgcc/index.php?title=Install:redhat

I'll need to use one of the big MSP (the 20 bit parts), so AFAIK that's
the road to follow. I think is called the uniarch compiler, am I right?

Done the binutils (got the 2.24.51.20131021 version from the repo), gcc
(4.9.0 experimental) and newlib. mspdebug is working too (getting the
FET working was another epic story, anyway). No gdb for the moment, I'm
not yet there. Also picked the latest msp430mcu package (20130321),
seems to be aligned with GIT.

Now for testing the thing: newlib built so the compiler is working (it
made a large version, too). Tried to make the MSP-EXP430G2-LaunchPad
firmware which is a) small and b) theorically already ported to mspgcc.

Issues found:
- The 'autoinclude' needed an #include <msp430.h> to work, actually. In
  fact to make #include<> work I had to rebuild everything with the
  sysroot feature enable (pointing to /usr/local/msp430-elf)o
- The interrupt macros had to be replaced with the
  __attribute__((interrupt()))_ equivalent stuff

Now the compiler works and I got the launchpad.o file (which is already
a good result). However the link pass bomb out saying:

cannot open linker script file msp430g2553/memory.ld: No such file or
directory

AFAIK that's requested (as documented in
http://gcc.gnu.org/onlinedocs/gcc/MSP430-Options.html) by a spec entry
in msp430.h (in the gcc sources); I think the relevant fragment is this:

%{!T*:%{!msim:%{mmcu=*:--script=%*/memory.ld %--script=%*/peripherals.ld}}}

I think the idea is 'when not targeting the simulator add these two
linker scripts to the link stage'. Fine for me HOWEVER msp430mcu doesn't
provide memory.ld and peripherals.ld ... it gives memory.x and periph.h!
Are these the same thing? is msp430mcu in need of an update for this new
gcc feature?

I tried giving it the obviously renamed files but it obviously don't
work... I feel the x files are only fragments of the needed stuff (for
comparison I looked into the msp430.ld from binutils), like section
declaration and architecture and other things I have no idea of:P

In short it says:
- launchpad.elf section `.text' will not fit in region `ram'
- crt0.S:23: undefined reference to `__stack (and other vital stuff)
- undefined reference to `__bis_status_register' (isn't that a builtin?
  or must it be replaced with BIS_SR?)

The link command is

msp430-elf-gcc -mmcu=msp430g2553 -o launchpad.elf launchpad.o

stracing shows that ld is called in this way (resolved the pathnames
and indented the thing )

/usr/local/libexec/gcc/msp430-elf/4.9.0/ld
    --sysroot=/usr/local/msp430-elf
    -o launchpad.elf
    /usr/local/msp430-elf/lib/crt0.o
    /usr/local/lib/gcc/msp430-elf/4.9.0/crtbegin.o
    -L/usr/local/lib/gcc/msp430-elf/4.9.0
    -L/usr/local/lib/gcc
    -L/usr/local/msp430-elf/lib
    -L/usr/local/msp430-elf/lib
    launchpad.o
    -lgcc
    --start-group
    -lc
    -lgcc
    -lnosys
    --end-group
    --script=msp430g2553/memory.ld
    --script=msp430g2553/peripherals.ld
    -lgcc
    /usr/local/lib/gcc/msp430-elf/4.9.0/crtend.o
    /usr/local/msp430-elf/lib/crtn.o
    -lgcc

No idea about the group thing, but it really wants to be sure to include
libgcc, it seems:P

Any suggestion on how to make it work? Hopefully an updated msp430mcu?
The alternative would be a manual merge (msp430 seems to provide the
missing vital declarations) which would be a) painful and b) really unelegant.
Or manual link (maybe even worse)

Thanks in advance

--
Lorenzo Marcantonio
Logos Srl

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Mspgcc-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: Linker script for new gcc?

Peter Bigot-4
msp430mcu only works with mspgcc, not with RH gcc (msp430-elf).  File
names, installation path, and other characteristics are not compatible with
the new toolchain.

You need the GCC_RH_20131206.zip from the "Get Software" link at:
http://www.ti.com/tool/msp430-gcc-opensource

Peter



On Thu, Dec 26, 2013 at 6:35 AM, Lorenzo Marcantonio <
[hidden email]> wrote:

> I'm trying to build the 'new' toolchain, following the instruction here:
>
> http://sourceforge.net/apps/mediawiki/mspgcc/index.php?title=Install:redhat
>
> I'll need to use one of the big MSP (the 20 bit parts), so AFAIK that's
> the road to follow. I think is called the uniarch compiler, am I right?
>
> Done the binutils (got the 2.24.51.20131021 version from the repo), gcc
> (4.9.0 experimental) and newlib. mspdebug is working too (getting the
> FET working was another epic story, anyway). No gdb for the moment, I'm
> not yet there. Also picked the latest msp430mcu package (20130321),
> seems to be aligned with GIT.
>
> Now for testing the thing: newlib built so the compiler is working (it
> made a large version, too). Tried to make the MSP-EXP430G2-LaunchPad
> firmware which is a) small and b) theorically already ported to mspgcc.
>
> Issues found:
> - The 'autoinclude' needed an #include <msp430.h> to work, actually. In
>   fact to make #include<> work I had to rebuild everything with the
>   sysroot feature enable (pointing to /usr/local/msp430-elf)o
> - The interrupt macros had to be replaced with the
>   __attribute__((interrupt()))_ equivalent stuff
>
> Now the compiler works and I got the launchpad.o file (which is already
> a good result). However the link pass bomb out saying:
>
> cannot open linker script file msp430g2553/memory.ld: No such file or
> directory
>
> AFAIK that's requested (as documented in
> http://gcc.gnu.org/onlinedocs/gcc/MSP430-Options.html) by a spec entry
> in msp430.h (in the gcc sources); I think the relevant fragment is this:
>
> %{!T*:%{!msim:%{mmcu=*:--script=%*/memory.ld %--script=%*/peripherals.ld}}}
>
> I think the idea is 'when not targeting the simulator add these two
> linker scripts to the link stage'. Fine for me HOWEVER msp430mcu doesn't
> provide memory.ld and peripherals.ld ... it gives memory.x and periph.h!
> Are these the same thing? is msp430mcu in need of an update for this new
> gcc feature?
>
> I tried giving it the obviously renamed files but it obviously don't
> work... I feel the x files are only fragments of the needed stuff (for
> comparison I looked into the msp430.ld from binutils), like section
> declaration and architecture and other things I have no idea of:P
>
> In short it says:
> - launchpad.elf section `.text' will not fit in region `ram'
> - crt0.S:23: undefined reference to `__stack (and other vital stuff)
> - undefined reference to `__bis_status_register' (isn't that a builtin?
>   or must it be replaced with BIS_SR?)
>
> The link command is
>
> msp430-elf-gcc -mmcu=msp430g2553 -o launchpad.elf launchpad.o
>
> stracing shows that ld is called in this way (resolved the pathnames
> and indented the thing )
>
> /usr/local/libexec/gcc/msp430-elf/4.9.0/ld
>     --sysroot=/usr/local/msp430-elf
>     -o launchpad.elf
>     /usr/local/msp430-elf/lib/crt0.o
>     /usr/local/lib/gcc/msp430-elf/4.9.0/crtbegin.o
>     -L/usr/local/lib/gcc/msp430-elf/4.9.0
>     -L/usr/local/lib/gcc
>     -L/usr/local/msp430-elf/lib
>     -L/usr/local/msp430-elf/lib
>     launchpad.o
>     -lgcc
>     --start-group
>     -lc
>     -lgcc
>     -lnosys
>     --end-group
>     --script=msp430g2553/memory.ld
>     --script=msp430g2553/peripherals.ld
>     -lgcc
>     /usr/local/lib/gcc/msp430-elf/4.9.0/crtend.o
>     /usr/local/msp430-elf/lib/crtn.o
>     -lgcc
>
> No idea about the group thing, but it really wants to be sure to include
> libgcc, it seems:P
>
> Any suggestion on how to make it work? Hopefully an updated msp430mcu?
> The alternative would be a manual merge (msp430 seems to provide the
> missing vital declarations) which would be a) painful and b) really
> unelegant.
> Or manual link (maybe even worse)
>
> Thanks in advance
>
> --
> Lorenzo Marcantonio
> Logos Srl
>
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics
> Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
> _______________________________________________
> Mspgcc-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Mspgcc-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: Linker script for new gcc?

Lorenzo Marcantonio
On Thu, Dec 26, 2013 at 07:05:00AM -0600, Peter Bigot wrote:
> msp430mcu only works with mspgcc, not with RH gcc (msp430-elf).  File
> names, installation path, and other characteristics are not compatible with
> the new toolchain.
>
> You need the GCC_RH_20131206.zip from the "Get Software" link at:
> http://www.ti.com/tool/msp430-gcc-opensource

Thanks! Ultra fast answer, exactly what I needed!

I imagined correctly the content of the linker script (and with some
times I *could* have done that), but the inline assembly for the missing
intrinsics is a little above my capacity:P:P

Now, lets make the 5529 work (the cute dev board with the graphic lcd..)

All in all it was a very instructive troubleshooting.

--
Lorenzo Marcantonio
Logos Srl

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Mspgcc-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users