Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 542380 - sys-devel/crossdev: msp430 target needs more work: extra headers and linker scripts
Summary: sys-devel/crossdev: msp430 target needs more work: extra headers and linker s...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Crossdev team
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: crossdev-bugs
  Show dependency tree
 
Reported: 2015-03-06 21:00 UTC by Ladislav Laska
Modified: 2022-04-29 09:01 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
msptest.c (msptest.c,433 bytes, text/plain)
2015-03-06 21:01 UTC, Ladislav Laska
Details
support files ebuild (msp430-gcc-support-files-20151218.ebuild,635 bytes, text/plain)
2015-12-18 14:39 UTC, Petre Rodan
Details
updated msp430 GCC support files (msp430-gcc-support-files-1.212.ebuild,652 bytes, text/plain)
2022-02-17 20:28 UTC, cJ
Details
crossdev patch for adding an ebuild of system headers not provided by a libc (crossdev-msp430.patch,1.89 KB, patch)
2022-02-17 20:30 UTC, cJ
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ladislav Laska 2015-03-06 21:00:24 UTC
The crossdev fails to install msp430 target properly: all the mcu specific headers, previously provided by cross-msp430/msp430mcu are missing, and thus no code can be compile for this architecture. See the attached msptest.c, that should be compiled by command 'msp430-gcc msptest.c -mmcu=msp430g2553'.

Reproducible: Always

Steps to Reproduce:
crossdev -t msp430
msp430-gcc msptest.c -mmcu=msp430g2553
Actual Results:  
krakonos@ibex ~ $ msp430-elf-gcc -mmcu=msp430g2553 msptest.c 
msptest.c:10:20: fatal error: msp430.h: No such file or directory
 #include <msp430.h>
                    ^
compilation terminated.


Expected Results:  
Working binary created.

ibex krakonos # emerge --info
Portage 2.2.14 (python 2.7.9-final-0, default/linux/amd64/13.0, gcc-4.8.3, glibc-2.19-r1, 3.10.25-gentoo x86_64)
=================================================================
System uname: Linux-3.10.25-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_L5639_@_2.13GHz-with-gentoo-2.2
KiB Mem:     2050916 total,    187380 free
KiB Swap:    2097148 total,   1621428 free
Timestamp of tree: Fri, 06 Mar 2015 03:30:02 +0000
ld GNU ld (Gentoo 2.24 p1.4) 2.24
distcc 3.1 x86_64-pc-linux-gnu [disabled]
app-shells/bash:          4.2_p53
dev-lang/perl:            5.20.2
dev-lang/python:          2.7.9-r1, 3.3.5-r1, 3.4.1
dev-util/cmake:           2.8.12.2-r1
dev-util/pkgconfig:       0.28-r1
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.13.11
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.69
sys-devel/automake:       1.11.6-r1, 1.13.4
sys-devel/binutils:       2.24-r3
sys-devel/gcc:            4.8.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.4
sys-devel/make:           4.1-r1
sys-kernel/linux-headers: 3.16 (virtual/os-headers)
sys-libs/glibc:           2.19-r1
Repositories: gentoo perl-experimental Krakonos-s-overlay crossdev
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA dlj-1.1"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.5/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=native -pipe"
DISTDIR="/tmp/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news nodoc noinfo parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/data/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/perl-experimental /home/krakonos/gentoo-overlay /var/crossdev-overlay"
USE="acl amd64 berkdb bzip2 cli cracklib crypt cxx dri fortran gdbm iconv iproute2 ipv6 libav mbox mmx modules multilib mysql ncurses nls nptl openmp pam pcre readline session sse sse2 ssl tcpd unicode vhosts zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="cpu apache disk mysql network openvpn processes users df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, SYNC, USE_PYTHON
Comment 1 Ladislav Laska 2015-03-06 21:01:35 UTC
Created attachment 398262 [details]
msptest.c
Comment 2 Ladislav Laska 2015-03-06 21:02:21 UTC
Comment on attachment 398262 [details]
msptest.c

>/******************************************************************************
> * Filename: msptest.c
> *
> * Created: 2015/03/06 21:07
> * Author: Ladislav Láska
> * e-mail: laska@kam.mff.cuni.cz
> *
> ******************************************************************************/
>
>#include <msp430.h>
>
>int main() {
>	WDTCTL = WDTPW + WDTHOLD;
>	P1DIR |= 0xff;
>	P1OUT |= 0xff;
>	for (;;) {
>		__delay_cycles(100000);
>		P1OUT ^= 0xff;
>	}
>}
Comment 3 SpanKY gentoo-dev 2015-03-09 01:06:19 UTC
Tim should let me know what i need to fix ;)

however, you should post the crossdev summary when filing related bugs.  what does this show:
$ qlist -Iv msp430
Comment 4 Ladislav Laska 2015-03-09 01:12:59 UTC
krakonos@ibex ~ $ qlist -Iv msp430 
cross-msp430-elf/binutils-2.25
cross-msp430-elf/gcc-4.9.2

I'm not sure how to get more info from crossdev, the options don't say much. Maybe this could help?:

ibex krakonos # crossdev -t msp430 -p
 * crossdev version:      20141030
 * Host Portage ARCH:     amd64
 * Target Portage ARCH:   *
 * Target System:         msp430-elf
 * Stage:                 3 (C compiler & libc)
 * ABIs:                  default

 * binutils:              >=binutils-2.24.90
 * gcc:                   >=gcc-4.9.1
 * libc:                  >=newlib-2.1.0

 * CROSSDEV_OVERLAY:      /var/crossdev-overlay
 * PORT_LOGDIR:           /var/log/portage
 * PORTAGE_CONFIGROOT:
Comment 5 SpanKY gentoo-dev 2015-03-09 03:32:25 UTC
(In reply to Ladislav Laska from comment #4)

why don't you have cross-msp430-elf/newlib installed ?  if you don't have a C library, then trying to use headers from it isn't going to work.

did you unmerge it ?  how exactly did you run crossdev the first time ?
Comment 6 Tim Harder gentoo-dev 2015-03-09 05:08:24 UTC
(In reply to SpanKY from comment #3)
> Tim should let me know what i need to fix ;)

Ah yes, I should probably revive msp430mcu and toss TI's generic tarball dump into some sort of snapshot format and fix up crossdev a bit. URLs for reference:

TI's msp430 gcc homepage: http://www.ti.com/tool/msp430-gcc-opensource

Linker scripts are under support files (or at this url):
http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/latest/exports/msp430-gcc-support-files.zip
Comment 7 Ladislav Laska 2015-03-09 10:39:15 UTC
Well, I just installed it and nothing changed. I originally found this out on a friend's laptop, and then installed it on my server to test, with a -s1 switch. I want to keep my old toolchain on desktop, for work.

Now I have:
krakonos@ibex ~ $ qlist -Iv msp430
cross-msp430-elf/binutils-2.25
cross-msp430-elf/gcc-4.9.2
cross-msp430-elf/newlib-2.2.0.20150225


(In reply to SpanKY from comment #5)
> (In reply to Ladislav Laska from comment #4)
> 
> why don't you have cross-msp430-elf/newlib installed ?  if you don't have a
> C library, then trying to use headers from it isn't going to work.
> 
> did you unmerge it ?  how exactly did you run crossdev the first time ?
Comment 8 Tim Harder gentoo-dev 2015-03-09 14:04:55 UTC
(In reply to Ladislav Laska from comment #7)
> Well, I just installed it and nothing changed.

I thought my reply was clear. If not, currently you'll need to take the linker scripts from the tarball in comment #6, and drop them somewhere like /usr/msp430-elf/lib. I'll toss them in an ebuild soon to fix things.
Comment 9 Ladislav Laska 2015-03-09 14:13:09 UTC
It was not. This fixes it, but I'll be looking forward for an ebuild. 

Thanks!
Comment 10 SpanKY gentoo-dev 2015-03-09 17:43:48 UTC
(In reply to Ladislav Laska from comment #7)

well, if you used the -s1 flag, you shouldn't be surprised when you don't have any C library headers.  crossdev gave you what you asked for.

i'll leave it to Tim whether he wants to punt this as INVALID or relabel it as generic msp430mcu support.
Comment 11 Petre Rodan 2015-12-18 14:39:43 UTC
Created attachment 419598 [details]
support files ebuild


indeed, I tried using crossdev to compile a msp430 target only to find that most of the header and ld files were missing. 
I installed the latest support files from the TI site (see ebuild) - the compiler worked but the linker borks up.

>> Building proj.elf as target RELEASE
qa.o: In function `.L23':
qa.c:(.text.parse_user_input+0x246): warning: _stat is not implemented and will always fail
/usr/libexec/gcc/msp430-elf/ld: proj.elf section `.text' will not fit in region `ROM'
/usr/libexec/gcc/msp430-elf/ld: section __interrupt_vector_42 loaded at [000000000000ffd2,000000000000ffd3] overlaps section .text loaded at [00000000000087f0,000000000001299d]
/usr/libexec/gcc/msp430-elf/ld: region `ROM' overflowed by 10984 bytes
proj.o: In function `main':
proj.c:(.text.startup.main+0x3a): relocation truncated to fit: R_MSP430X_ABS16 against symbol `stat' defined in .text section in /usr/lib/gcc/msp430-elf/4.9.3/../../../../msp430-elf/lib/libnosys.a(stat.o)
proj.c:(.text.startup.main+0x3e): relocation truncated to fit: R_MSP430X_ABS16 against symbol `stat' defined in .text section in /usr/lib/gcc/msp430-elf/4.9.3/../../../../msp430-elf/lib/libnosys.a(stat.o)
proj.o: In function `adc_read':
proj.c:(.text.adc_read+0x6a): relocation truncated to fit: R_MSP430X_ABS16 against symbol `stat' defined in .text section in /usr/lib/gcc/msp430-elf/4.9.3/../../../../msp430-elf/lib/libnosys.a(stat.o)
proj.o: In function `.L41':
proj.c:(.text.store_pkt+0x80): relocation truncated to fit: R_MSP430X_ABS16 against symbol `stat' defined in .text section in /usr/lib/gcc/msp430-elf/4.9.3/../../../../msp430-elf/lib/libnosys.a(stat.o)
proj.c:(.text.store_pkt+0xc4): relocation truncated to fit: R_MSP430X_ABS16 against symbol `stat' defined in .text section in /usr/lib/gcc/msp430-elf/4.9.3/../../../../msp430-elf/lib/libnosys.a(stat.o)
proj.c:(.text.store_pkt+0xda): relocation truncated to fit: R_MSP430X_ABS16 against symbol `stat' defined in .text section in /usr/lib/gcc/msp430-elf/4.9.3/../../../../msp430-elf/lib/libnosys.a(stat.o)
proj.c:(.text.store_pkt+0x106): relocation truncated to fit: R_MSP430X_ABS16 against symbol `stat' defined in .text section in /usr/lib/gcc/msp430-elf/4.9.3/../../../../msp430-elf/lib/libnosys.a(stat.o)
proj.o: In function `.L49':
proj.c:(.text.store_pkt+0x340): relocation truncated to fit: R_MSP430X_ABS16 against symbol `stat' defined in .text section in /usr/lib/gcc/msp430-elf/4.9.3/../../../../msp430-elf/lib/libnosys.a(stat.o)
proj.o: In function `.L78':
proj.c:(.text.schedule+0x3c): relocation truncated to fit: R_MSP430X_ABS16 against symbol `stat' defined in .text section in /usr/lib/gcc/msp430-elf/4.9.3/../../../../msp430-elf/lib/libnosys.a(stat.o)
proj.c:(.text.schedule+0x52): relocation truncated to fit: R_MSP430X_ABS16 against symbol `stat' defined in .text section in /usr/lib/gcc/msp430-elf/4.9.3/../../../../msp430-elf/lib/libnosys.a(stat.o)
proj.c:(.text.schedule+0x5c): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Makefile:89: recipe for target 'proj.elf' failed
make: *** [proj.elf] Error 1
Comment 12 Petre Rodan 2015-12-19 12:10:57 UTC
OK, I soon found out that default newlib generates code that is too big for most msp430 mcus out there. I will try to generate packages based on a tweaked 'nano' spec that resemble the mspgcc behaviour.

http://pabigot.github.io/bsp430/msp430elf.html
https://github.com/pabigot/bsp430/blob/next/maintainer/msp430-elf-build
Comment 13 Tim Harder gentoo-dev 2019-11-18 22:05:27 UTC
Re-assigning since I don't have any msp430 hardware on hand anymore.
Comment 14 cJ 2022-02-17 15:56:33 UTC
As of today, `crossdev -t msp430` doesn't finish successfully.

I have a background task of taking a look at what crosstool-ng is doing (it works) to see what needs to be done for the toolchain to be viable.

I saw that the FreeBSD port for the MSP430 toolchain:
 https://cgit.freebsd.org/ports/tree/devel/gcc-msp430-ti-toolchain/Makefile?id=1bf865fed5a69877b34d01b873ccac59a8ab9476
includes bits of newlib inside GCC's source tree when building GCC, but doing so doesn't seem mandatory.


Of course, adding an msp430-gcc-support-files ebuild is part of the equation.
Comment 15 cJ 2022-02-17 20:06:45 UTC
(In reply to myself from comment #14)
> As of today, `crossdev -t msp430` doesn't finish successfully.

My bad, I hadn't noticed that newlib's ebuild is using the environment's CFLAGS for the cross-compiler, and it was quite populated due to my using distcc. Sorry for the noise.

Will submit an updated ebuild for the TI support files.
Comment 16 cJ 2022-02-17 20:28:35 UTC
Created attachment 765321 [details]
updated msp430 GCC support files
Comment 17 cJ 2022-02-17 20:30:33 UTC
Created attachment 765322 [details, diff]
crossdev patch for adding an ebuild of system headers not provided by a libc

Adding a patch for crossdev that installs the support files.