Skip to content

Commit 27fac38

Browse files
committed
stm32/mboot: Default to direct jump when DFU timeout enabled.
When MBOOT_ENABLE_DFU_TIMEOUT is enabled, default MBOOT_LEAVE_BOOTLOADER_VIA_RESET to 0 (direct jump) instead of 1 (reset). Without this, timeout expiration causes NVIC_SystemReset() which re-enters the bootloader, creating a reset loop instead of booting the application. Signed-off-by: Andrew Leech <[email protected]>
1 parent 9b21391 commit 27fac38

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ports/stm32/mboot/main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,14 @@
4444
#include "xspi.h"
4545

4646
// Whether the bootloader will leave via reset, or direct jump to the application.
47+
// When DFU timeout is enabled, default to direct jump to avoid reset loops.
4748
#ifndef MBOOT_LEAVE_BOOTLOADER_VIA_RESET
49+
#if MBOOT_ENABLE_DFU_TIMEOUT
50+
#define MBOOT_LEAVE_BOOTLOADER_VIA_RESET (0)
51+
#else
4852
#define MBOOT_LEAVE_BOOTLOADER_VIA_RESET (1)
4953
#endif
54+
#endif
5055

5156
// This option selects whether to use explicit polling or IRQs for USB events.
5257
// In some test cases polling mode can run slightly faster, but it uses more power.

0 commit comments

Comments
 (0)