Stan,
Variable initialization process is tool chain dependent and usually is divided in 2 sections:
- BSS: variables not initialized or zero initialized. In this case, the memory is set to zeros
- Data: initialized variables.
On your toolchain startup code, you should find functions that makes the memory zero fill for BSS and the copy from Flash to RAM for Data. In the case of CW with GCC compiler, these can be found on "__arm_start.c" file.
Now, the code there will only apply to memory sections specified to store bss and data on the linker file, here an example from LCF of CW 10.4 with GCC compiler:
/* Initialized data sections goes into RAM, load LMA copy after code */
.data : AT(___ROM_AT)
{
. = ALIGN(4);
_sdata = .; /* create a global symbol at data start */
*(.data) /* .data sections */
*(.data*) /* .data* sections */
. = ALIGN(4);
_edata = .; /* define a global symbol at data end */
} > m_data
___data_size = _edata - _sdata;
/* Uninitialized data section */
. = ALIGN(4);
.bss :
{
/* This is used by the startup in order to initialize the .bss section */
__START_BSS = .;
PROVIDE ( __bss_start__ = __START_BSS );
*(.bss)
*(.bss*)
*(COMMON)
. = ALIGN(4);
__END_BSS = .;
PROVIDE ( __bss_end__ = __END_BSS );
} > m_data
As you can see, there are two sections, .data and .bss using linker such as *(.bss) and *(.data) will make the linker to place all bss on .bss memory section and all .data on .data section. ONLY what is placed here will be take by the startup functions for zero fill and copy from flash to RAM.
If your linker file define the MRAM section to be filled by .bss or .data then you would need to manually discard those by tweaking the start up code. If your MRAM section does not request to be filled with .bss or .data then the startup code is not touching this section, which means there is no variable initialization.
Hope this helps.
Regards,
Carlos Neri