From 3294a49cec25901f57d825ef0a7ba02bd7c3169e Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Wed, 10 Mar 2021 18:31:51 +0100 Subject: [PATCH] fix(core): don't assert reset flags to allow "reboot to bootloader" --- core/embed/boardloader/main.c | 4 +--- core/embed/trezorhal/lowlevel.c | 7 ++++--- core/embed/trezorhal/lowlevel.h | 1 + 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/embed/boardloader/main.c b/core/embed/boardloader/main.c index 850d2fca34..ab19163349 100644 --- a/core/embed/boardloader/main.c +++ b/core/embed/boardloader/main.c @@ -166,9 +166,7 @@ static secbool copy_sdcard(void) { } int main(void) { - if (sectrue != reset_flags_check()) { - return 1; - } + reset_flags_reset(); // need the systick timer running before many HAL operations. // want the PVD enabled before flash operations too. diff --git a/core/embed/trezorhal/lowlevel.c b/core/embed/trezorhal/lowlevel.c index 9129aa8e12..3cda602169 100644 --- a/core/embed/trezorhal/lowlevel.c +++ b/core/embed/trezorhal/lowlevel.c @@ -176,8 +176,9 @@ secbool reset_flags_check(void) { return secfalse; } #endif - - RCC->CSR |= RCC_CSR_RMVF; // clear the reset flags - return sectrue; } + +void reset_flags_reset(void) { + RCC->CSR |= RCC_CSR_RMVF; // clear the reset flags +} diff --git a/core/embed/trezorhal/lowlevel.h b/core/embed/trezorhal/lowlevel.h index efadaf0d5e..df154dba65 100644 --- a/core/embed/trezorhal/lowlevel.h +++ b/core/embed/trezorhal/lowlevel.h @@ -30,5 +30,6 @@ uint32_t flash_set_option_bytes(void); secbool flash_configure_option_bytes(void); void periph_init(void); secbool reset_flags_check(void); +void reset_flags_reset(void); #endif // __TREZORHAL_LOWLEVEL_H__