2018-06-14 07:39 AM
My program executes a software reset under certain conditions using 'NVIC_SystemReset();'
Before executing the reset I need to set a variable that will still be accessible after the reset so the program can understand the cause and take appropriate action. On a PIC I do this by using a special variable '_excep_code'.
How can I do the same thing on the STM32.
Developing on Nucleo-H743, Software Workbench for STM32
2018-06-14 08:41 AM
In linker script, set up a section in RAM, which is not going to be cleared by the startup code.
This has been discussed here several times, try to search.
JW
2018-06-14 11:15 AM
An alternative to linker sections is to use the backup registers in the RTC. As long as you have backup domain power it's preserved, plus there's some parasitic write protection during the reset cycle.
Jack Peacock
2018-06-14 04:32 PM
And an alternative to backup registers in RTC there's the backup RAM, if implemented in given model of STM32... ;)
JW