diff options
Diffstat (limited to 'chip/stm32/system.c')
-rw-r--r-- | chip/stm32/system.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/chip/stm32/system.c b/chip/stm32/system.c index bba2f72fcc..0304c7b3be 100644 --- a/chip/stm32/system.c +++ b/chip/stm32/system.c @@ -249,7 +249,7 @@ void system_pre_init(void) { #ifdef CONFIG_SOFTWARE_PANIC uint16_t reason, info; - uint8_t exception; + uint8_t exception, panic_flags; #endif /* enable clock on Power module */ @@ -316,11 +316,14 @@ void system_pre_init(void) reason = bkpdata_read(BKPDATA_INDEX_SAVED_PANIC_REASON); info = bkpdata_read(BKPDATA_INDEX_SAVED_PANIC_INFO); exception = bkpdata_read(BKPDATA_INDEX_SAVED_PANIC_EXCEPTION); - if (reason || info || exception) { + panic_flags = bkpdata_read(BKPDATA_INDEX_SAVED_PANIC_FLAGS); + if (reason || info || exception || panic_flags) { panic_set_reason(reason, info, exception); + panic_get_data()->flags = panic_flags; bkpdata_write(BKPDATA_INDEX_SAVED_PANIC_REASON, 0); bkpdata_write(BKPDATA_INDEX_SAVED_PANIC_INFO, 0); bkpdata_write(BKPDATA_INDEX_SAVED_PANIC_EXCEPTION, 0); + bkpdata_write(BKPDATA_INDEX_SAVED_PANIC_FLAGS, 0); } #endif @@ -367,6 +370,7 @@ void system_reset(int flags) #ifdef CONFIG_SOFTWARE_PANIC uint32_t reason, info; uint8_t exception; + uint8_t panic_flags = panic_get_data()->flags; /* Panic data will be wiped by hard reset, so save it */ panic_get_reason(&reason, &info, &exception); @@ -374,6 +378,7 @@ void system_reset(int flags) bkpdata_write(BKPDATA_INDEX_SAVED_PANIC_REASON, reason); bkpdata_write(BKPDATA_INDEX_SAVED_PANIC_INFO, info); bkpdata_write(BKPDATA_INDEX_SAVED_PANIC_EXCEPTION, exception); + bkpdata_write(BKPDATA_INDEX_SAVED_PANIC_FLAGS, panic_flags); #endif #ifdef CHIP_FAMILY_STM32L |