device-os
device-os copied to clipboard
[bootloader] Implement bootloader reset reasons
Problem
The RTL bootloader has not been updated to use the backup register HAL to communicate reset reason to the system part application. This leads to undefined reset reasons in the following scenarios
- When completing OTA bootloader update
- When completing DFU update via button reset/hold
Solution
The backup register HAL is implemented on RTL platform via retained SRAM, the bootloader just needs to write the "registers"
Steps to Test
Checkout branch, compile bootloader, flash
Flash app via reset button hold and DFU
Log reset reason ie (Log.info("Last Reset Reason %d", System.resetReason());
)
Verify that it is correct (70
= firmware update, 40
= pin/power reset):
0000008051 [app] INFO: Last Reset Reason 70
Without bootloader update, the values are undefined:
0000058978 [app] INFO: Last Reset Reason -49520187
Example App
References
See comment here
Completeness
- [x] User is totes amazing for contributing!
- [ ] Contributor has signed CLA (Info here)
- [ ] Problem and Solution clearly stated
- [ ] Run unit/integration/application tests on device
- [ ] Added documentation
- [ ] Added to CHANGELOG.md after merging (add links to docs and issues)