Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] msp430-gcc: "Only cross-compile builds are support"
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
tomtom69
n00b
n00b


Joined: 09 Nov 2010
Posts: 70

PostPosted: Tue Apr 10, 2012 5:52 pm    Post subject: [SOLVED] msp430-gcc: "Only cross-compile builds are sup Reply with quote

Hi,

I would like to develop programs (embedded, no linux on target) using a MSP430 launchpad board. To do this I need a cross compiler. Gentoo portage delivers the msp430-gcc package, which seems to be the right choice for this.
But when I try to emerge dev-embedded/msp430-gcc I get the following error message:

>>> Running pre-merge checks for dev-embedded/msp430-gcc-4.6.2_p20120330
* ERROR: dev-embedded/msp430-gcc-4.6.2_p20120330 failed (pretend phase):
* Only cross-compile builds are supported

This looks strange, because cross-compiling looks to me like what I need.
Host is amd64 stable (I needed to add "=dev-embedded/msp430-gcc-4.6.2_p20120330 ~amd64" to /etc/portage/package.keywords to be able to emerge msp430-gcc).

I did not find any howto about cross-compiling for embedded targets. Does anyone know what to do to get msp430-gcc installed on my machine?


tom


Last edited by tomtom69 on Sun Apr 15, 2012 2:35 pm; edited 1 time in total
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 8864
Location: beyond the rim

PostPosted: Wed Apr 11, 2012 9:35 am    Post subject: Reply with quote

http://www.gentoo.org/proj/en/base/embedded/cross-development.xml
Back to top
View user's profile Send private message
tomtom69
n00b
n00b


Joined: 09 Nov 2010
Posts: 70

PostPosted: Wed Apr 11, 2012 6:42 pm    Post subject: Reply with quote

Thank you for your answer, Genone.

I tried to follow this guide, however I do not know which target (-t) to specify:
"Target (-t) takes a tuple ARCH-VENDOR-OS-LIBC; see 'crossdev -t help'"
OK, so I looked at the help page for crossdev.
"Architectures" does not contain MSP430. MSP430 is mentioned in "Special Targets".
But what to do with the other things like OS and VENDOR in the tuple?
I tried "-t mps430" and "-t msp430-newlib", because I do not use any OS (which would be ridiculous on a MCU with 8kB flash and 1kB RAM), but both do not work.
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 8864
Location: beyond the rim

PostPosted: Thu Apr 12, 2012 8:26 am    Post subject: Reply with quote

tomtom69 wrote:
I tried "-t mps430" and "-t msp430-newlib",

Was that a typo in your post?
Anyway, I've no experience with microcontroller targets, so pointing you to crossdev was about as much help as I can provide on this matter.
Back to top
View user's profile Send private message
tomtom69
n00b
n00b


Joined: 09 Nov 2010
Posts: 70

PostPosted: Thu Apr 12, 2012 7:24 pm    Post subject: Reply with quote

Yes, it was only a typo...

Anyone here with uC experience?
Back to top
View user's profile Send private message
radhermit
Developer
Developer


Joined: 15 Apr 2010
Posts: 7

PostPosted: Sat Apr 14, 2012 7:44 pm    Post subject: Reply with quote

tomtom69 wrote:
I tried "-t mps430" and "-t msp430-newlib", because I do not use any OS (which would be ridiculous on a MCU with 8kB flash and 1kB RAM), but both do not work.


Always use "msp430" as the target for crossdev, everything else won't work. Note that you must use >=crossdev-20111221 since older versions don't include proper msp430 support.
Back to top
View user's profile Send private message
tomtom69
n00b
n00b


Joined: 09 Nov 2010
Posts: 70

PostPosted: Sun Apr 15, 2012 11:44 am    Post subject: Reply with quote

-t msp430 works now:
It was necessary to add "--ov-output /usr/portage/". I first tried "--ov-output msptest" which did not work.
I built the toolchain now, but it does not work as expected:

$ msp430-gcc -Os -Wall -g -mmcu=msp430x2012 -o main.elf main.o
/usr/libexec/gcc/msp430/ld: cannot open linker script file memory.x: No such file or directory
collect2: ld gab 1 als Ende-Status zurück

Looks like it is related this bug:
https://bugs.gentoo.org/show_bug.cgi?id=147155

I tried to re-emerge msp430mcu and set the symlinks according to the bug report, but the problem remains.
The package msp430mcu contains the *.x files in /usr/msp430/lib/ldscripts/$MCUTYPE/

Where does msp430-ld look for the linker script files?
Back to top
View user's profile Send private message
tomtom69
n00b
n00b


Joined: 09 Nov 2010
Posts: 70

PostPosted: Sun Apr 15, 2012 12:54 pm    Post subject: Reply with quote

ld works now.
I took the demo file for the launchpad which specifies -mmcu=msp430x2012, but the cross compiler does not have this mcu type.
Changed this to -mmcu=msp430g2553 and now gcc runs without error messages. :-)

The demo code does not run yet because it uses a different gcc version or header files, but this should not be a problem.
Back to top
View user's profile Send private message
radhermit
Developer
Developer


Joined: 15 Apr 2010
Posts: 7

PostPosted: Sun Apr 15, 2012 8:19 pm    Post subject: Reply with quote

tomtom69 wrote:
-t msp430 works now:
It was necessary to add "--ov-output /usr/portage/". I first tried "--ov-output msptest" which did not work.
I built the toolchain now, but it does not work as expected:


Using crossdev to build the toolchain without specifying that should work fine too. It just uses the last overlay specified in PORTDIR_OVERLAY by default.

tomtom69 wrote:
$ msp430-gcc -Os -Wall -g -mmcu=msp430x2012 -o main.elf main.o
/usr/libexec/gcc/msp430/ld: cannot open linker script file memory.x: No such file or directory
collect2: ld gab 1 als Ende-Status zurück

Looks like it is related this bug:
https://bugs.gentoo.org/show_bug.cgi?id=147155

I tried to re-emerge msp430mcu and set the symlinks according to the bug report, but the problem remains.
The package msp430mcu contains the *.x files in /usr/msp430/lib/ldscripts/$MCUTYPE/

Where does msp430-ld look for the linker script files?


No, it's not related to that bug. It's because you're specifying a legacy mcu tag that isn't used anymore probably because you're following instructions that were written almost 2 years ago.

Generally with the current msp430 toolchain, you should use mcu tags of type "msp430f" instead of "msp430x" so in this case use "-mmcu=msp430f2012". You can find all the specific mappings from legacy mcu tags to specific devices in the legacy.map file distributed in the msp430mcu tarball.
Back to top
View user's profile Send private message
tomtom69
n00b
n00b


Joined: 09 Nov 2010
Posts: 70

PostPosted: Mon Apr 16, 2012 5:47 pm    Post subject: Reply with quote

I do not have any overlays installed, so PORTDIR_OVERLAY does not exist - this is why crossdev insists on the --ov-output parameter
(as far as I understood the crossdev guide there is no need for overlays any more to get a working cross compiler).

The legacy.map file is really a great help when converting makefiles or projects.

Thanks for your help! :-)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum