Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BOOT_SERIAL_WAIT_FOR_DFU_ALWAYS Zephyr Kconfig option. #1903

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mondalaci
Copy link

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.

Comment on lines +164 to +166
If y, MCUboot always enters serial recovery mode upon startup for the
duration of BOOT_SERIAL_WAIT_FOR_DFU_TIMEOUT. Otherwise, MCUboot only
enters serial recovery mode if the board was physically reset.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment doesn't really make sense, what does resetting have to do with staying in serial recovery mode?

Copy link
Collaborator

@nordicjm nordicjm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment does not really make sense, and there already is a mode of entering serial recovery when physical reset button is used CONFIG_BOOT_SERIAL_PIN_RESET

@mondalaci
Copy link
Author

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants