Skip to main content
russdx
Associate III
January 26, 2013
Question

pre set values in sram

  • January 26, 2013
  • 1 reply
  • 682 views
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 :)
    This topic has been closed for replies.

    1 reply

    Tesla DeLorean
    Guru
    January 26, 2013
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..