2015-12-06 02:57 AM
Hello
using MDK-ARM , I want from startup code change the initialization of global variable after warm reset (Pressing reset button) ... But I dont know where to look ?The idea is I want the variable keep its value after warm reset, not re-initialized by zero.Any Idea ? #startup-code2015-12-06 09:34 AM
Well it does cause a lot of complications. May be you need to think carefully about what you're doing, and how to do it? Doing it for everything has a lot of ramifications.
You could presumably make a ''noinit'' section within the scatter file, and place specific variables into that? You could perhaps have that area be the NVRAM memory? Or a separate area of SRAM. You could also group all of the state you want to hold across reset into a singular structure, and place that structure, or a pointer for it, in the NVRAM/NOINIT, and tag it in a way you can tell if it is valid or not. The code in __main, which is called before your main() function deals with the initialization of statics, either by copying or zeroing.2015-12-07 01:28 AM
[Solved]
Thanks clivenoninit section worked, thanks a lot, it was just a school exercise ,,, :)