diff options
-rw-r--r-- | ports/stm32/main.c | 7 | ||||
-rw-r--r-- | ports/stm32/mpconfigboard_common.h | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/ports/stm32/main.c b/ports/stm32/main.c index 4b5997227..fb3e843bb 100644 --- a/ports/stm32/main.c +++ b/ports/stm32/main.c @@ -338,6 +338,7 @@ STATIC bool init_sdcard_fs(void) { } #endif +#if !MICROPY_HW_USES_BOOTLOADER STATIC uint update_reset_mode(uint reset_mode) { #if MICROPY_HW_HAS_SWITCH if (switch_get()) { @@ -412,6 +413,7 @@ STATIC uint update_reset_mode(uint reset_mode) { #endif return reset_mode; } +#endif void stm32_main(uint32_t reset_mode) { // TODO disable JTAG @@ -478,7 +480,6 @@ void stm32_main(uint32_t reset_mode) { soft_reset: - // check if user switch held to select the reset mode #if defined(MICROPY_HW_LED2) led_state(1, 0); led_state(2, 1); @@ -488,7 +489,11 @@ soft_reset: #endif led_state(3, 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 #if MICROPY_PY_THREAD diff --git a/ports/stm32/mpconfigboard_common.h b/ports/stm32/mpconfigboard_common.h index b876d5884..d4b812331 100644 --- a/ports/stm32/mpconfigboard_common.h +++ b/ports/stm32/mpconfigboard_common.h @@ -171,3 +171,5 @@ #define MP_HAL_CLEANINVALIDATE_DCACHE(addr, size) #define MP_HAL_CLEAN_DCACHE(addr, size) #endif + +#define MICROPY_HW_USES_BOOTLOADER (MICROPY_HW_VTOR != 0x08000000) |