cancel
Showing results for 
Search instead for 
Did you mean: 

static memory zeroed at system reset

Dan Mackie
Senior

At system reset, static memory is zeroed.  I want static memory to be entirely left alone by the system.  I want the memory to have what I put in it, not clobbered.  Granted, I have to retain power to the device, but static memory should be able to retain data across any number of system resets.  This reset happens in an assembler module supplied by ST in the Raisonance development kit I am using for F4 and L4 devices.  I tried changing the source module, and deleting the old object file, but the Raisonance kit does not reassemble that module.  When I try to look at that module in the debugger, it seems the linker omitted the object code, but the resets to zero are still happening.  The module is startup_stm32f429xx.s

3 REPLIES 3
Pavel A.
Evangelist III

Set a breakpoint in the startup before it touches any RAM (or clear the checkbox Resume in debugger settings). Then the debugger will stop early and you can see whether the SRAM is preserved or already erased. In the latter case this is a power issue, not solvable in software.

The MCU doesn't do this. Code in startup.s is entirely responsible for clearing and copying data sections, as usually expected by C runtime code.

Can also have sections set as NOLOAD or NOINIT depending on the tools chain.

You can carve out sections of memory so they are not used by the Linker, see .LD file.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Dan Mackie
Senior

The problem is certainly caused by software.  Changed the initialization software to skip zeroing my memory block,  problem goes away.  Now my static memory values are preserved across system resets for that particular memory block.