Hi,
I've developped a few msp430 projects recently using the legacy mspgcc toolchain. Recently, I ran into a compiler error that I thought would be hard to debug, so I took the opportunity to upgrade and try the newer msp430-gcc.
My target memory space is limited (cc430f5137 32KB ROM)
My problem is my builds have ballooned in size. Most don't build at all anymore and error out at "ROM overflowed". I only have one project that still builds, here are some numbers from the project that still builds:
(bin is msp430-gcc, bin.legacy is the legacy mspgcc)
$ 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
that's more than twice the size. Also, somewhat telling:
$ wc -l bin/wizzimote/gateway.map bin.legacy/wizzimote/gateway.map
4020 bin/wizzimote/gateway.map
1678 bin.legacy/wizzimote/gateway.map
running msp430-elf-size bin.legacy/wizzimote/*.a (sums to 16,517) and msp430-elf-size bin/wizzimote/*.a (sums to 15,897). This tells me my code is not the culprit.
Casually browsing the generated map files, I get the feeling the culprit is libc? It's hard for me to calculate a sum of the size of all libc elements in the map files, but it looks like there are more functions and more voluminous ones in the msp430-gcc build.
$ grep libc bin/wizzimote/gateway.map | wc -l
954
$ grep libc bin.legacy/wizzimote/gateway.map | wc -l
127
You can find a diff of the two map files here, though it's hard to read. At the bottom of the page there are two full map files.
Question: Do you have any ideas or advice to give me to bring these build sizes down, way down?
My msp430-gcc was built as described here
My significant build options are: -g (i need debug builds) -Os
I added the following build options to the msp430-gcc to try to bring down the size, to no avail: -fdata-sections -ffunction-sections -Wl,--gc-sections
I tried -mlarge and -mcode-region=upper -mdata-region=lower (those two down't work with my mcu)
The topic has been discussed before, but I have not found anything useful.
If you can help, Thanks! I'm fairly new to embedded development, so some obvious things my not come to me quickly.
Maybe I should have run these numbers using a simple "hello world" program.