lpcware

Static const in RAM in debug mode

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by PoolCop on Wed Jun 01 04:05:16 MST 2016
Hello all,

I'm currently developing a project with a lot of constant strings (for a multi languages user interface) on NXP1768 , LPCXpresso V8.1.4

example of string definition:
//   Define language id.
static const char * lang_text[10]= {"EN","FR","NL","IT","TK","DE","SP","PT","??","??"};


When the project is  compiled in Release mode, strings declared as static const, are store in flash memory.
When I try to compile in debug mode, looks like a copy of these "static const" is made in RAM and therefore RAM usage goes from 15% (Release) to close 98%(Debug).
I guess this is for the debug probe to access these data...

Memory region         Used Size  Region Size  %age Used
       MFlash512:      223092 B       512 KB     42.55%
        RamLoc32:       32132 B        32 KB     98.06%
        RamAHB32:          0 GB        32 KB      0.00%


I still need to complete the project and will soon face a RAM issue in Debug.

Is there a way (compiler option...) to tweak the Debug version so that these data are not copied into RAM ?

Thanks
René

Outcomes