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.

CCS/gcc - How to increase heap size in msp430-elf-gcc

Hello,

I am trying to run this machine learning example on my MSP430 - https://github.com/phdschooltpc/msp430-xor

I want to compile this example using msp430-elf-gcc instead of CCS.One of the compiler options in this example is :

--heap_size=1500 # for dynamic memory allocation

How do I set the same using Makefile in msp430-elf-gcc? When I compile without the increased heap size using gcc, I get a stack and heap collision error.

Thanks, 
Archie S

  • I avoid dynamic memory allocation because it is usually just a source for trouble in embedded applications. In gcc the heap usually starts at the end of the bss and has no end, hence no size. In practice it will run out of space once it reaches the stack. Or before since the stack size can vary after the memory is allocated from the heap.

    So you have to look at how much heap space you have (almost always in SRAM but on some parts could be in FRAM), how much is consumed by variables (.data and .bss), and much is need for the stack.

  • David, Thank you. A related question about ccs and gcc.

    I have an example that compiles correctly without errors in CCS, whereas when I try to compile the same using gcc I get an error saying the .text section will not fit in ROM. The linked description file seems to have similar setting. Have you encountered/solved this issue?

    Regards,
    Archie S

  • If you are using a part with memory above 0x10000 then try compiling with the option -mlarge. (20 bit addresses) Be sure to read slau646.

  • Thanks, just -mlarge model was not sufficient. I had to select code-regions to be either to compile correctly. During execution, the code does not execute correctly using -mlarge - mcode-region=either option.

  • I had to change a few application specific parameters to get it to execute correctly.

**Attention** This is a public forum