Skip to content

Commit b833f17

Browse files
committed
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.
1 parent 7856a41 commit b833f17

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

ports/stm32/main.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ STATIC bool init_sdcard_fs(void) {
338338
}
339339
#endif
340340

341+
#if !MICROPY_HW_USES_BOOTLOADER
341342
STATIC uint update_reset_mode(uint reset_mode) {
342343
#if MICROPY_HW_HAS_SWITCH
343344
if (switch_get()) {
@@ -412,6 +413,7 @@ STATIC uint update_reset_mode(uint reset_mode) {
412413
#endif
413414
return reset_mode;
414415
}
416+
#endif
415417

416418
void stm32_main(uint32_t reset_mode) {
417419
// TODO disable JTAG
@@ -478,7 +480,6 @@ void stm32_main(uint32_t reset_mode) {
478480

479481
soft_reset:
480482

481-
// check if user switch held to select the reset mode
482483
#if defined(MICROPY_HW_LED2)
483484
led_state(1, 0);
484485
led_state(2, 1);
@@ -488,7 +489,11 @@ void stm32_main(uint32_t reset_mode) {
488489
#endif
489490
led_state(3, 0);
490491
led_state(4, 0);
492+
493+
#if !MICROPY_HW_USES_BOOTLOADER
494+
// check if user switch held to select the reset mode
491495
reset_mode = update_reset_mode(1);
496+
#endif
492497

493498
// Python threading init
494499
#if MICROPY_PY_THREAD

ports/stm32/mpconfigboard_common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,5 @@
171171
#define MP_HAL_CLEANINVALIDATE_DCACHE(addr, size)
172172
#define MP_HAL_CLEAN_DCACHE(addr, size)
173173
#endif
174+
175+
#define MICROPY_HW_USES_BOOTLOADER (MICROPY_HW_VTOR != 0x08000000)

0 commit comments

Comments
 (0)