This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiling with msp430-elf-gcc won't fit into RAM



I'm able to compile with IAR, but while trying to get code compiling with the Red Hat msp430GCC (and the old MSPGCC) I get an error like:

/home/nak/Msp430GCCopensource/bin/../lib/gcc/msp430-elf/4.8.0/../../../../msp430-elf/bin/ld: out.o section `.noinit' will not fit in region `RAM'
/home/nak/Msp430GCCopensource/bin/../lib/gcc/msp430-elf/4.8.0/../../../../msp430-elf/bin/ld: region `RAM' overflowed by 152 bytes

For reference here's the ugly source code: https://bitbucket.org/naked/msp-datalogger/src

I would like to use open source tools as I refine the code for this project.

So, I figure I'm ignorant to some command line switches that I need to use, or the IAR compiler does some magic to fit more variables into RAM than GCC.

Any thoughts would be appreciated.

  • It’s possible that the elf-gcc runtime library uses more global/static vars than the IAR one. It is also possible that elf-gcc reserves more space for stack/heap by default.

    Try to reduce the default stack size/heap size and/or remove some global vars in your code, so it finally links. Then tell the linker to generate a map file and check what’s using up your ram.

  • Hi,

    The attached makefile runs one of the MSP430 USB Red Hat GCC examples using command line.  Instructions on how to setup the folders and run the makefile can be found in the Examples_Guide_MSP430_USb.pdf options of the MSP430USBDevelopersPackage_4_10_02.   The makefile also has the options and files required to run the Red Hat GCC examples.

    Regards,

    Arthi Bhathttp://e2e.ti.com/cfs-file.ashx/__key/communityserver-discussions-components-files/166/1425.Makefile

  • It would be beneficial to generate the detailed link map file from the IAR tool and the gcc tool and compare. This will tell you exactly where the extra RAM is being used.

    You can look in the .xcl file and see how much RAM is being allocated for stack in IAR.

  • Hello again,

    I finally got the project to compile and link (and generate a map file):

    msp430-elf-gcc main.c MMC_lib/mmc.c MMC_lib/hal_SPI.c -I /home/nak/Msp430GCCopensource/include -I MMC_lib -D__msp430g2744__ -mmcu=msp430G2744 -O3 -g -ffunction-sections -fdata-sections -w -T /home/nak/Msp430GCCopensource/include/msp430g2744/memory.ld -T /home/nak/Msp430GCCopensource/include/msp430g2744/peripherals.ld -Wl,--gc-sections -Wl,-Map=datalogger.map -o datalogger.out

    It was really just looking at make files and doing a bunch of trial and error.

    So, I did something (I have no idea what honestly, which is slightly disturbing) and now there's no problems with over using RAM and the code seems to load and run fine so far!

    Here are the map files generated for the curious:

    I'll post back here if I have any more revelations, and I will read any further responses, thanks everyone.

**Attention** This is a public forum