← index #5693PR #7283
Likely Duplicate · medium · value 6.516
QUERY · ISSUE

[mboot] It will stay in the dfu mode forever and not reset

openby rolandvsopened 2020-02-24updated 2025-11-09
port-stm32needs-info

When using mboot to replace the code with dfu commands all works fine. However, mboot stays in dfu mode and not resetting the device. This is tested using mboot with the H743.

CANDIDATE · PULL REQUEST

stm32/mboot: Leave bootloader from thread mode, not from IRQ.

mergedby dpgeorgeopened 2021-05-19updated 2021-05-20
port-stm32

Leaving the bootloader from an IRQ (eg USB or I2C IRQ) will not work if MBOOT_LEAVE_BOOTLOADER_VIA_RESET is disabled, ie if mboot jumps directly to the application. This is because the CPU will still be in IRQ state when the application starts and IRQs of lower priority will be blocked.

Fix this by setting a flag when the bootloader should finish, and exit the bootloader always from the main (top level) thread.

This also improves the USB behaviour of mboot: it no longer abruptly disconnects when the manifest command is sent.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied