mcuboot icon indicating copy to clipboard operation
mcuboot copied to clipboard

Add BOOT_SERIAL_WAIT_FOR_DFU_ALWAYS Zephyr Kconfig option.

Open mondalaci opened this issue 1 year ago • 3 comments

This PR adds the BOOT_SERIAL_WAIT_FOR_DFU_ALWAYS Kconfig option. When set to n, under normal circumstances, the bootloader doesn't enter serial recovery mode, allowing the firmware to start up as quickly as possible. However, when physically resetting the device, the bootloader enters serial recovery mode, which comes in very handy when the firmware is broken.

This patch was actually created by Vidar Berg at https://devzone.nordicsemi.com/f/nordic-q-a/108213/mcuboot-should-only-timeout-after-hardware-reset/469112 who allowed me to submit it here as a PR.

mondalaci avatar Feb 22 '24 21:02 mondalaci

Sorry, the Kconfig description is inaccurate. The following description is accurate:

If y, MCUboot enters serial recovery for the duration of BOOT_SERIAL_WAIT_FOR_DFU_TIMEOUT upon physically resetting the board. Otherwise, MCUboot immediately executes the application.

The use case is that I want the board to boot up as quickly as possible under normal circumstances, but I also want to be able to manually trigger the bootloader even if the application firmware is broken.

It's also worth mentioning that my device is battery-powered without a dedicated on/off switch, but it has a RESET button, so the timeout allows restarting the application firmware in case of a dead loop without getting stuck in the bootloader.

CONFIG_BOOT_SERIAL_PIN_RESET doesn't fulfill the above use case because:

  • It doesn't time out when hardware reset is used but gets stuck in serial recovery mode.
  • It delays the execution of the application firmware when the board is powered under normal circumstances. (My device has an optional battery, and it can be powered via USB, too.)

mondalaci avatar Mar 09 '24 18:03 mondalaci