6 years, 8 months ago.

64KB or 32KB SRAM?


Note: while there are IMHO still unclear things, the issue here are not showstoppers anymore.

(Edited) Issues that we have:

  • Switching from C027 to mbed-LPC1768 in the online compiler changes the RAM usage (under Build) from to 129%, even the same MCU is used (is it really the same?). Can someone clarify if this is expected behaviour?
  • BTW: Even if the RAM usage is 129%, the online compiler does not report an error.
  • Is it correct that the file GCC ARM exported file LPC1768.ld is the same for mbed-LPC1768 and C027, even so the online compiler shows different RAM usage?

Some details:

the C027 page https://mbed.org/platforms/u-blox-C027/ says:

  • NXP LPC1768 is used
  • 64 kB available

this pages https://mbed.org/platforms/mbed-LPC1768/ says:

  • NXP LPC1768
  • 32KB RAM

The NXP data sheet says: 32kB + 2x 16kb AHB SRAM0/1 RAM (in different address range). http://www.nxp.com/documents/data_sheet/LPC1769_68_67_66_65_64_63.pdf

The online compiler says:

  • LPC1768 board: 32kb
  • C027: 64kb

The offline ARM GCC compiler export says: https://mbed.org/users/mbed_official/code/mbed/file/824293ae5e43/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/LPC1768.ld

  • 32kb
  • 16KB used for USB
  • 16KB used for Ethernet

Our program uses 44KB :-)

Not being an expert, my initial guess from this is:

The online compiler for C027 is wrong for C027 BTW: Where is the LPC1768.ld file used by the online compiler if it is not the one linked above?


Question relating to:

The u-blox-C027 is a complete starter kit that allows quick prototyping of a variety of applications for the Internet of Things. The application board has a MAX-M8Q GPS/GNSS receiver and …

4 Answers

6 years, 7 months ago.

Some clarification about RAM usage. The LPC1768 MCU has 64k of RAM split into multiple regions. The memory map file passed to the linker determines what code gets placed in a particular section.


These code snippets are from the latest as of 4th March 2014 and are subject to change

Why the platforms and compiler says 32k RAM. The scatter load file only places RW and ZI code in one section that is 32k-0xc8 bytes in size. Your application without any special attributes only has 32k of RAM available. Beyond that the linker will complain that there isn't enough room to place xx bytes. As before mentioned, the LPC1768 has 64k. The additional 32k comes in two 16k chunks and is allocated for the EthernetInterface and USBHost libraries.

Repository: mbed

6 years, 8 months ago.

44kb includes driver buffers for usb/ethernet ?

44kb is shown in the online compiler under "Program Details" -> "Build". Personally I assume that is the usage of

posted by Stefan Vaillant 03 Feb 2014
6 years, 8 months ago.

Additional note: When using the off-line compiler for our program, we get:

/usr/local/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/bin/ld: MbedSmartRestMain.elf section `.AHBSRAM1' will not fit in region `ETH_RAM'
/usr/local/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/bin/ld: region `ETH_RAM' overflowed by 256 bytes
collect2: error: ld returned 1 exit status

So in contrast to my assumptions above: the offline compiler complaints about the ETH_RAM memory region, not the RAM region.

nobody know how online compiler work, thats why offline preffered

posted by Boris Fedoseew 03 Feb 2014

The online compiler uses the same build system as can be found here.

posted by Stephen Paulger 05 Mar 2014
6 years, 5 months ago.

I think my solution should help:


Happy offline debugging!