stm32/boardctrl: Skip running main.py if boot.py had an error.

Previous behaviour was: if boot.py had an exception then main.py would
still run, which is arguably unexpected behaviour.

This commit changes the behaviour so main.py is not run if boot.py has an
error.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2021-06-11 10:47:51 +10:00
parent 4ada56d4cb
commit 87985fc7e9
1 changed files with 2 additions and 0 deletions

View File

@ -155,6 +155,8 @@ int boardctrl_run_boot_py(boardctrl_state_t *state) {
return BOARDCTRL_GOTO_SOFT_RESET_EXIT; return BOARDCTRL_GOTO_SOFT_RESET_EXIT;
} }
if (!ret) { if (!ret) {
// There was an error, prevent main.py from running and flash LEDs.
state->reset_mode = BOARDCTRL_RESET_MODE_SAFE_MODE;
flash_error(4); flash_error(4);
} }
} }