arduino / mcuboot-arduino-stm32h7

27 stars 5 forks source link

Don't clear Reset Source Register on boot #14

Open mkj opened 2 years ago

mkj commented 2 years ago

This bootloader (and the standard Portenta H7 one) clears the RSR so it isn't possible for subsequent programs to check the reset reason. Could it be changed to keep the reset source register intact? Thanks.

https://github.com/arduino/mcuboot-arduino-stm32h7/blob/a828baf73f93b6aa855a5d185f0ca4fed5755e2f/app/main.cpp#L229

pennam commented 2 years ago

Hi @mkj, thanks for the report. I've just had a quick look and i think that it can be done calling directly the mbed-os hal function from the bootloader. I will give it a try and let you know.

pennam commented 2 years ago

@mkj storing the reset reason somewhere else, like in an RTC register, would be an acceptable solution?

wero1414 commented 4 months ago

@pennam any news on this issue? i have a board getting rebooted, and i would like to address the reset cause

pennam commented 4 months ago

It is stored in RTC backup register 8

https://github.com/arduino/mcuboot-arduino-stm32h7/commit/fc726574650a348bf2248d1938dfcaefe38b5fe0

you should be able to read it like in this example:

https://github.com/arduino/ArduinoCore-mbed/blob/main/libraries/STM32H747_System/examples/STM32H747_getResetReason/STM32H747_getResetReason.ino