diff options
author | Damien George <damien.p.george@gmail.com> | 2018-03-29 16:16:58 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-03-29 16:16:58 +1100 |
commit | b833f170c324bd7b9f0c1623d539fb301e7f09a6 (patch) | |
tree | f4f7ec76997c6ef71b9dea607d512015201455c2 | |
parent | 7856a416bd4718dd2f63e3adcd8a595fb4fbb9e9 (diff) |
stm32/main: Only update reset_mode if board doesn't use a bootloader.
If the board is configured to use a bootloader then that bootloader will
pass through the reset_mode.
-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) |