stm32/main: Move update_reset_mode to outside the soft-reset loop.
Running the update inside the soft-reset loop will mean that (on boards like PYBD that use a bootloader) the same reset mode is used each reset loop, eg factory reset occurs each time. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
b7883ce74c
commit
1e297c8898
@ -552,6 +552,11 @@ void stm32_main(uint32_t reset_mode) {
|
|||||||
MP_STATE_PORT(pyb_uart_obj_all)[MICROPY_HW_UART_REPL - 1] = &pyb_uart_repl_obj;
|
MP_STATE_PORT(pyb_uart_obj_all)[MICROPY_HW_UART_REPL - 1] = &pyb_uart_repl_obj;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !MICROPY_HW_USES_BOOTLOADER
|
||||||
|
// check if user switch held to select the reset mode
|
||||||
|
reset_mode = update_reset_mode(1);
|
||||||
|
#endif
|
||||||
|
|
||||||
soft_reset:
|
soft_reset:
|
||||||
|
|
||||||
#if defined(MICROPY_HW_LED2)
|
#if defined(MICROPY_HW_LED2)
|
||||||
@ -564,11 +569,6 @@ soft_reset:
|
|||||||
led_state(3, 0);
|
led_state(3, 0);
|
||||||
led_state(4, 0);
|
led_state(4, 0);
|
||||||
|
|
||||||
#if !MICROPY_HW_USES_BOOTLOADER
|
|
||||||
// check if user switch held to select the reset mode
|
|
||||||
reset_mode = update_reset_mode(1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Python threading init
|
// Python threading init
|
||||||
#if MICROPY_PY_THREAD
|
#if MICROPY_PY_THREAD
|
||||||
mp_thread_init();
|
mp_thread_init();
|
||||||
@ -776,5 +776,8 @@ soft_reset_exit:
|
|||||||
|
|
||||||
gc_sweep_all();
|
gc_sweep_all();
|
||||||
|
|
||||||
|
// Set reset_mode to normal boot.
|
||||||
|
reset_mode = 1;
|
||||||
|
|
||||||
goto soft_reset;
|
goto soft_reset;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user