RAM usage when transposing code from LP1768 to LPC1837

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RAM usage when transposing code from LP1768 to LPC1837

735 Views
rnb
Contributor II

Hi All,

Because of RAM limitation, I'm transposing my code from a LPC1768 to a LPC1837.

On LPC1768, I was using CMSISv2p00_LPC17xx and RDB1768cmsis2_usbstack libraries.

Code size=321kb, ram 31kb very close to the max 32k available (upper bank, aka RAM2, is already used for Heap and Stack).

Here after extract from map file:

objects size

pastedImage_1.png

RAM usage

pastedImage_4.png

My initial plan was to increase ram availability by using a LPC1837. So I bought an evaluation board and start source code migration, using LPC_Open library.

Code size is now 405kb and ram usage is 53k ! In order to be able to load the code in the evaluation board, I did revisit the RAM mapping and allocate the RamLoc32 at location 0x20000000 so that I can get a contiguous RAM block of  64k (not sure it is a good idea by the way ??). And therefore, I locate Heap and Stack at location 0x10080000.

Here after extract from map file:

objects size (slight increase in size even for the same source code)

pastedImage_3.png

RAM usage (high increase in needs):

pastedImage_5.png

Global RAM usage for application code is very similar (0x6d24 instead of 0x6c84), but why is .bss section starting at ....006180 instead of ....000de8. This difference (21k) can almost explains why there is so much RAM required.

I there something I'm missing ?

What is this "reserved"  area for ?

How can I decrease this request ?

Thank's for the support

Rene

Labels (3)
0 Kudos
3 Replies

603 Views
rnb
Contributor II

I think I figured out part of the problem.

Because the app code is intended to be used in different countries, there is a *.h file containinp all the used strings in differents languages.

Strings are declared as:  static const char[] arrays.

Previously, these strings were stored in the .rodata section (so in flash), and for some reason they are non in .data (so in RAM).

I use LPCXpresso V8.1.4 in both case.  Is there some setting in the project properties I need to look at ?

0 Kudos

603 Views
jeremyzhou
NXP Employee
NXP Employee

Hi René Brunier,
I'd recommend you to check Project Properties -> C/C++ Build -> MCU settings and linker file.
Hope it helps.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

603 Views
rnb
Contributor II

Hi Jeremyzhou,

I went into the settings and it appears that static const data placement is not the same depending on optimization level...

With optimization set to none (debug mode), static const data are located in .data region (so in RAM), when optimization is -Og (Optimize debug),  they are located in .rodata (flash).

Thanks, for the guidance.

0 Kudos