Compiler compiles successfully although RAM usage exceeds the limit?

19 May 2014

How can the compiler compile successfully although the RAM usage exceeds the limit?

Please try to compile http://mbed.org/users/xively/code/xively-jumpstart-demo/ on the 'Application board for mbed NXP LPC1768'.

The program runs fine. However, when the project is exported to LPCXpresso, it will not link because RAM limit is exceeded.

Thanks

19 May 2014

The LPC1768 has three memory banks, one main 32kB bank, and two additional 16kB banks for USB/ethernet. The number the online compiler shows is the total RAM usage while assuming a total of 32kB, despite some of it being in different memory banks. Which is why it works fine and you don't have to worry about that.

No idea why LPCXpresso doesn't do it correct.

19 May 2014

Thank you Erik for the insight.

I managed to solve the problem by adding the following to the linker script of the project (D:\Embedded\NXP\_Apps\LPCXpresso\xively-jumpstart-demo\mbed\TARGET_LPC1768\TOOLCHAIN_GCC_CR\LPC1768.ld), towards the end:

    AHBSRAM0 (NOLOAD):
    {
          *(AHBSRAM0)
    } > RamAHB32
    
    AHBSRAM1 (NOLOAD):
    {
          *(AHBSRAM1)
    } > RamAHB32

    PROVIDE(_pvHeapStart = .);
    PROVIDE(_vStackTop = __top_RamLoc32 - 0);

I'm still convinced that the online compiler 'build details' is showing inaccurate info.

Cheers!

19 May 2014

Hi Sam,

The online compiler's available memory total for the LPC1768 based platforms is 32kb, however the usage includes data that will go into other memory areas. There is some discussion of this topic on this question.

Steve