renanbirck 0 Posted October 28, 2014 Share Posted October 28, 2014 I have a program of about 40 KB (I use FAT32 through FatFs, that takes a lot of memory) that I developed using msp430-gcc 4.6.3 for a MSP430F5529 (that has 128 KB Flash). I am trying to move it to msp430-gcc 4.9.1 (downloaded from TI) but am getting the following errors upon linking: /opt/ti/gcc/bin/msp430-elf-gcc -I /opt/ti/gcc/include -mmcu=msp430f5529 -Os -g -c -o main.o main.c /opt/ti/gcc/bin/msp430-elf-gcc -I /opt/ti/gcc/include -mmcu=msp430f5529 -Os -g -c -o ccsbcs.o ccsbcs.c /opt/ti/gcc/bin/msp430-elf-gcc -I /opt/ti/gcc/include -mmcu=msp430f5529 -Os -g -c -o delay.o delay.c /opt/ti/gcc/bin/msp430-elf-gcc -I /opt/ti/gcc/include -mmcu=msp430f5529 -Os -g -c -o fat32.o fat32.c /opt/ti/gcc/bin/msp430-elf-gcc -I /opt/ti/gcc/include -mmcu=msp430f5529 -Os -g -c -o lis3dh.o lis3dh.c /opt/ti/gcc/bin/msp430-elf-gcc -I /opt/ti/gcc/include -mmcu=msp430f5529 -Os -g -c -o mmc.o mmc.c /opt/ti/gcc/bin/msp430-elf-gcc -I /opt/ti/gcc/include -mmcu=msp430f5529 -Os -g -c -o nrf24l01p.o nrf24l01p.c /opt/ti/gcc/bin/msp430-elf-gcc -I /opt/ti/gcc/include -mmcu=msp430f5529 -Os -g -c -o pcf2123.o pcf2123.c /opt/ti/gcc/bin/msp430-elf-gcc -I /opt/ti/gcc/include -mmcu=msp430f5529 -Os -g -c -o port_int.o port_int.c /opt/ti/gcc/bin/msp430-elf-gcc -I /opt/ti/gcc/include -mmcu=msp430f5529 -Os -g -c -o spi.o spi.c /opt/ti/gcc/bin/msp430-elf-gcc -I /opt/ti/gcc/include -mmcu=msp430f5529 -Os -g -c -o spi2_small.o spi2_small.c /opt/ti/gcc/bin/msp430-elf-gcc -I /opt/ti/gcc/include -mmcu=msp430f5529 -Os -g -c -o tools.o tools.c /opt/ti/gcc/bin/msp430-elf-gcc -I /opt/ti/gcc/include -mmcu=msp430f5529 -Os -g -c -o uart.o uart.c /opt/ti/gcc/bin/msp430-elf-gcc -I /opt/ti/gcc/include -mmcu=msp430f5529 -Os -g -c -o ucs.o ucs.c /opt/ti/gcc/bin/msp430-elf-gcc -I /opt/ti/gcc/include -mmcu=msp430f5529 -Os -g -L /opt/ti/gcc/include -T/usr/msp430/lib/ldscripts/msp430.x main.o ccsbcs.o delay.o fat32.o lis3dh.o mmc.o nrf24l01p.o pcf2123.o port_int.o spi.o spi2_small.o tools.o uart.o ucs.o -o main.elf /opt/ti/gcc/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/bin/ld: main.elf section `.text' will not fit in region `rom' /opt/ti/gcc/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/bin/ld: region `rom' overflowed by 25014 bytes /opt/ti/gcc/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/lib/crt0.o: In function `.Loc.113.1': /opt/redhat/msp430-14r1-10/sources/tools/libgloss/msp430/crt0.S:36: undefined reference to `__init_array_start' /opt/ti/gcc/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/lib/crt0.o: In function `.Loc.114.1': /opt/redhat/msp430-14r1-10/sources/tools/libgloss/msp430/crt0.S:36: undefined reference to `__init_array_end' /opt/ti/gcc/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/lib/crt0.o: In function `.Loc.121.1': /opt/redhat/msp430-14r1-10/sources/tools/libgloss/msp430/crt0.S:36: undefined reference to `__preinit_array_start' /opt/ti/gcc/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/lib/crt0.o: In function `.Loc.122.1': /opt/redhat/msp430-14r1-10/sources/tools/libgloss/msp430/crt0.S:36: undefined reference to `__preinit_array_end' /opt/ti/gcc/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/lib/crt0.o: In function `.Loc.129.1': /opt/redhat/msp430-14r1-10/sources/tools/libgloss/msp430/crt0.S:36: undefined reference to `__fini_array_start' /opt/ti/gcc/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/lib/crt0.o: In function `.Loc.130.1': /opt/redhat/msp430-14r1-10/sources/tools/libgloss/msp430/crt0.S:36: undefined reference to `__fini_array_end' /opt/ti/gcc/bin/../lib/gcc/msp430-elf/4.9.1/crtend.o:(.init+0x2): relocation truncated to fit: R_MSP430X_ABS16 against `__do_global_ctors_aux' main.o: In function `sd_card_handler': /mnt/dados/Pegaso/src_5529_newgcc/main.c:36:(.text+0xc): relocation truncated to fit: R_MSP430X_ABS16 against `.rodata' /mnt/dados/Pegaso/src_5529_newgcc/main.c:36:(.text+0x16): relocation truncated to fit: R_MSP430X_ABS16 against `.rodata' /mnt/dados/Pegaso/src_5529_newgcc/main.c:36:(.text+0x3a): relocation truncated to fit: R_MSP430X_ABS16 against `.rodata' /mnt/dados/Pegaso/src_5529_newgcc/main.c:36:(.text+0x4c): relocation truncated to fit: R_MSP430X_ABS16 against `.rodata' /mnt/dados/Pegaso/src_5529_newgcc/main.c:36:(.text+0x64): relocation truncated to fit: R_MSP430X_ABS16 against `.rodata' /mnt/dados/Pegaso/src_5529_newgcc/main.c:36:(.text+0x72): relocation truncated to fit: R_MSP430X_ABS16 against `.rodata' /mnt/dados/Pegaso/src_5529_newgcc/main.c:36:(.text+0x94): relocation truncated to fit: R_MSP430X_ABS16 against `.rodata' /mnt/dados/Pegaso/src_5529_newgcc/main.c:36:(.text+0xa0): relocation truncated to fit: R_MSP430X_ABS16 against `.rodata' /mnt/dados/Pegaso/src_5529_newgcc/main.c:36:(.text+0xa6): relocation truncated to fit: R_MSP430X_ABS16 against `.rodata' /mnt/dados/Pegaso/src_5529_newgcc/main.c:36:(.text+0xb6): additional relocation overflows omitted from the output /opt/ti/gcc/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/lib/libcrt.a(crt_bss.o): In function `.Loc.50.1': /opt/redhat/msp430-14r1-10/sources/tools/libgloss/msp430/crt0.S:50: undefined reference to `__bssstart' /opt/ti/gcc/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/lib/libcrt.a(crt_bss.o): In function `.Loc.52.1': /opt/redhat/msp430-14r1-10/sources/tools/libgloss/msp430/crt0.S:50: undefined reference to `__bsssize' /opt/ti/gcc/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/lib/libcrt.a(crt_movedata.o): In function `.Loc.65.1': /opt/redhat/msp430-14r1-10/sources/tools/libgloss/msp430/crt0.S:65: undefined reference to `__datastart' /opt/ti/gcc/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/lib/libcrt.a(crt_movedata.o): In function `.Loc.66.1': /opt/redhat/msp430-14r1-10/sources/tools/libgloss/msp430/crt0.S:65: undefined reference to `__romdatastart' /opt/ti/gcc/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/lib/libcrt.a(crt_movedata.o): In function `.Loc.72.1': /opt/redhat/msp430-14r1-10/sources/tools/libgloss/msp430/crt0.S:65: undefined reference to `__romdatacopysize' /opt/ti/gcc/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/lib/libnosys.a(sbrk.o).data+0x0): undefined reference to `end' collect2: error: ld returned 1 exit status makefile.new:17: recipe for target 'all' failed What's wrong here? Quote Link to post Share on other sites
pabigot 355 Posted October 28, 2014 Share Posted October 28, 2014 Some of it is that msp430-elf doesn't generate quite as compact code as mspgcc did. There should be a flag you can set to enable large memory model, which will make the code and data larger but also use the high memory. Use msp430-elf-gcc --target-help to see what your options are. Quote Link to post Share on other sites
renanbirck 0 Posted November 7, 2014 Author Share Posted November 7, 2014 I try enabling the large memory model but didn't work: /opt/ti/gcc/bin/msp430-elf-gcc -I /opt/ti/gcc/include -mmcu=msp430f5529 -Os -g -mlarge -L /opt/ti/gcc/include -Wl,-Map=output.map main.o ccsbcs.o delay.o fat32.o lis3dh.o mmc.o nrf24l01p.o pcf2123.o port_int.o spi.o spi2_small.o tools.o uart.o ucs.o -o main.elf /opt/ti/gcc/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/bin/ld: main.elf section `.text' will not fit in region `ROM' /opt/ti/gcc/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/bin/ld: section __interrupt_vector_48 loaded at [0000ffde,0000ffdf] overlaps section .text loaded at [00004f6c,0001886f] /opt/ti/gcc/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/bin/ld: region `ROM' overflowed by 35522 bytes In the help I saw the option -mcode-region and -mdata-region then I tried -mcode-region=upper -mdata-region=lower that doesn't work either, I get the error /opt/ti/gcc/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/bin/ld: error: no memory region specified for loadable section `.upper.text' Quote Link to post Share on other sites
maximedg 0 Posted May 29, 2015 Share Posted May 29, 2015 any luck renanbirck? I'm just going to share my experience. I've tried many combinations of gcc flags, including the vendor specific memory flags you mention, but no luck ... msp430-gcc blows the roof compared to the legacy mspgcc. Here is are some numbers (bin.legacy is mspgcc, bin is TI msp430-gcc 3_03_04_00) for a given application: $ msp430-elf-size bin/wizzimote/gateway.elf bin.legacy/wizzimote/gateway.elf text data bss dec hex filename 29532 1564 1054 32150 7d96 bin/wizzimote/gateway.elf 10120 12 1846 11978 2eca bin.legacy/wizzimote/gateway.elf bam, and somewhat telling: $ wc -l bin/wizzimote/gateway.map bin.legacy/wizzimote/gateway.map 4020 bin/wizzimote/gateway.map 1678 bin.legacy/wizzimote/gateway.map and this is the only one of my projects that sill produces a binary without running into the same overflow error as you. Most of the code bloat seems to come from libc. Maybe libc in mspgcc was built without debugging symbols? Or built with size optimization flags that I could try on msp430-gcc? I'm going to check once I get mspgcc back up. I'm starting to wonder if I should go back to mspgcc ... though I'm having trouble building it again on osx yosemite. I fear TI may not have a great incentive to tackle this while they are selling a commercial compiler priced on code size. Oh and while I'm at it, huge thanks @@pabigot for your support of mspgcc, you're the man Quote Link to post Share on other sites
rockets4kids 204 Posted May 29, 2015 Share Posted May 29, 2015 Have you gotten "hello world" to compile under the new toolchain? If not, that is where you want to start. Most of your size issues are likely coming from newlib, not the compiler directly. That said, I still have reservations about the new compiler so unless you need support for large memory or C++11 I suggest you stick with 4.6.3. maximedg 1 Quote Link to post Share on other sites
maximedg 0 Posted May 29, 2015 Share Posted May 29, 2015 Thanks rockets, I wrote a more detailed explanation this morning in the TI forums here before seeing you response. Most of your size issues are likely coming from newlib, not the compiler directly. My feeling is newlib is the culprit. I'm going to keep investigating but I feel like I'll have to go back to mspgcc. I'll post some results here if I try a bare hello world example. Quote Link to post Share on other sites
pabigot 355 Posted June 5, 2015 Share Posted June 5, 2015 Oh and while I'm at it, huge thanks @@pabigot for your support of mspgcc, you're the man You're welcome. I don't check in here regularly anymore as I'm not doing anything with TI hardware now, but yes the bulk of the bloat is probably due to newlib. If you use newlib nano things get a lot better. I don't use mspgcc anymore (won't build on Ubuntu 14.04 without more effort than I care to make), and made the switch to upstream msp430-elf-gcc late last year, in part because newlib nano was finally usable. Check out BSP430 for some suggestions. You'd have to clone the repo and look at what's in the makefile to get the necessary flags for nano access. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.