2016-05-12 08:20 PM
i want to use watchdog to reset system when mcu loop, but after using NVIC_SystemReset(), all ram values are init again, i want to keep ram values same before SystemReset,
how do that????2016-05-13 05:31 AM
I think the SRAM content should be preserved by a watchdog reset, though I did not find the precise spot in the docs that state this explicitly.
But your startup code probably clears and re-initialises your ram just after reset, unless you specifically rewrote it not to. You need to modify the startup code to check if the reset cause is watchdog, and in this case skip memory clear/initialisation and instead take the actions appropriate for your application.2016-05-13 05:52 AM
>>I think the SRAM content should be preserved by a watchdog reset, though I did not find the precise spot in the docs that state this explicitly.
It is preserved, but at startup all variable are initialized. This is C standard. Put variables that you wonna preserved in separated section. How to do this depends on compiler that you use.2016-05-13 06:50 AM
At ResetHandler all your data will be there, put structures into a NOINIT section/segment. The C runtime initializes the statics ie __main or _cstartup, or assembler loops in startup.s
2016-05-15 06:30 PM
thanks for all; I done that;
I use __no_init __root before variables ( ex: __no_init __root uint8_t tx[10]; )variables will not init again if I reset system. they keep values before reset.