Repository navigation
bootutil: add hooks reporting swap and serial upload progress - #2996
Draft
JayToltTech wants to merge 1 commit into
Draft
JayToltTech wants to merge 1 commit into
JayToltTech wants to merge 1 commit into
Conversation
A swap or a serial recovery upload of a large image can run for minutes. MCUBOOT_ACTION_HOOKS tells a board when an upgrade or serial recovery starts, but nothing reports how far it has got, so a device with only an LED for feedback can't tell a running swap from a hung one. Add MCUBOOT_PROGRESS_HOOKS, set on Zephyr by CONFIG_MCUBOOT_PROGRESS_HOOKS, alongside the action hooks. When set, MCUboot calls mcuboot_progress(type, done, total): - swap using scratch, move and offset after each sector step, counting sectors. Swap using move counts both its move and its swap pass, so done reaches total once, at the end of the swap. - serial recovery after each uploaded chunk, counting bytes. A swap resumed after a reset reports the steps it skips as well, so done still starts from the beginning. Without the option the call compiles to nothing. Signed-off-by: Jay Beavers <jay@tolttechnologies.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A swap or a serial recovery upload of a large image can take minutes.
MCUBOOT_ACTION_HOOKStells the board an upgrade or serial recovery has started, but nothing after that, so a device with only an LED can't tell a running swap from a hung one.This adds
MCUBOOT_PROGRESS_HOOKS(CONFIG_MCUBOOT_PROGRESS_HOOKSon Zephyr) next to the action hooks. When set, MCUboot callsmcuboot_progress(type, done, total):donereachestotalonce, at the end.A swap resumed after a reset still reports the steps it skips, so
donecounts from the start rather than jumping. Without the option the call compiles to nothing.I made this a separate hook rather than extending
mcuboot_status_change(), since that one takes a single enum and changing its signature breaks every existing implementation. Overwrite-only doesn't report. It copies the image in oneboot_copy_region()call, so there's nowhere to hook it without restructuring the copy.Builds on nrf52840dk with the option off. With it on, swap offset, swap move and CDC upload compile clean and the link stops only on the missing
mcuboot_progress(), which is the board's to supply. Sim passes for scratch, swap-move and swap-offset, but the sim doesn't define the hook so the calls compile out there.Thoughts on whether you'd rather this be a separate hook or folded into the action hooks?