cancel
Showing results for 
Search instead for 
Did you mean: 

pre set values in sram

russdx
Associate II
Posted on January 26, 2013 at 14:13

I want to add some features to my program where it remembers some settings, i want to do this by storing the values in the sram.

But when i upload the firmware to the stm32 i need these values to be preset to a certain value. is this possible? (upload is done by dfu on my project)

When you upload the firmware to a fresh stm32 micro-controller is all the sram already set to 0x0 by default?(from the factory). If i do a simple check to see if its 0x0 and if it is just set my default value. but if not 0x0 leave it alone (already been set by previous init). would this work?

Any advice would be appreciated.

Thanks :)
1 REPLY 1
Posted on January 26, 2013 at 14:22

Well the zeroing is more likely a function of the compiler's run time library start up code, the initial state at processor start is not guaranteed.

It you have critical data you need some way to confirm it's integrity (ie structure with checksum), and a way to reset it to default values if it's uninitialized or corrupted.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..