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.

Expected RAM usage in CCS console vs RAM usage in *.map file?

Other Parts Discussed in Thread: MSP430G2553

I am currently using the MSP430G2553. As you guys know, it has 16kB flash and 0.5kB SRAM.


When I debug, I receive the following message on the console:

MSP430: Loading complete. There were 992 (code) and 26 (data) bytes written to FLASH. The expected RAM usage is 574 (uninitialized data + stack) bytes.

I was then worried that I've exceeded my RAM usage... I was shocked then because I only put the driver to run the Nokia 5110 LCD.


Now, I checked the *.map file and saw that the ram usage was only 80 bytes! (0x50)

So... what's the difference? Should I pay attention to the expected RAM usage?


Thanks!

  • Alister Pineda said:
    The expected RAM usage is 574 (uninitialized data + stack) bytes.

    This is just expected by the ELF compiler. If it would be the real usage you would get an error.

    The .map file or “View->Memory Allocation” gives you precise info.

  • Neither compiler nor linker can know how much ram your program really needs. The compiler can say how many global variables (initialized or not) it has compiled. Not all of them will necessarily end up in the final binary. The compiler also might detect possible runtime ram requirements by malloc (if it is called with a static value) or due to large amounts of local variables (e.g. a local array, which will blow up the stack usage).
    The linker knows which variables have been linked. It also knows, how much you defined to be reserved for the stack and also for the heap (if the code uses malloc), but doesn’t know how large your stack will really grow or how much you might allocate with malloc.

    If your code really needs 574 bytes of ram, then you’re in trouble, the G2553 only has 512. If the display library code reserves a storage array for the display memory, then 574 bytes doesn’t sound much - yet too much for this MSP.

**Attention** This is a public forum