AnsweredAssumed Answered

how to declare non-initialized variables (MPC5567)

Question asked by Olivier Pasutto on Jul 27, 2011
Latest reply on Jul 29, 2011 by Olivier Pasutto



In my current project, I'm using a non-volatile battery backed SRAM, and now, I would like to declare variables that will be placed in that memory but that will not be initialized to zero at init.

In my lcf I added a memory section like that:


MEMORY{...    saved_ram:          org = 0x20000000,   len = 0x00020000...}SECTIONS{GROUP : {       .dataSavedRam  : {}    } >}

 and in my code:


#pragma push#pragma section data_type ".dataSavedRam" ".dataSavedRam"#pragma pop__declspec(section ".dataSavedRam") int savedVarExample;

But during startup my variable is initialized to 0 in the function __init_data (in __start.c).


So, what is the best solution to avoid that?


thank you.