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 swap using offset mode #2162

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Conversation

nordicjm
Copy link
Collaborator

@nordicjm nordicjm commented Jan 2, 2025

Fixes #2134

165KiB update using swap using move on nrf5340dk: 18 seconds
182KiB update using swap using offset on nrf5340dk: 13 seconds

@nordicjm nordicjm requested a review from de-nordic January 2, 2025 12:29
@nordicjm nordicjm force-pushed the swaplesserase branch 5 times, most recently from 1f86386 to 484d0f5 Compare January 3, 2025 12:53
@Laczen
Copy link

Laczen commented Jan 4, 2025

@nordicjm this is a very nice improvement. There are some minor documentation nits.

A further possible improvement could be to place the swap state (image trailer) in the update image slot (this will not be erased during the swap, and thus the image could go up to the slot size - trailer size).

@nordicjm
Copy link
Collaborator Author

nordicjm commented Jan 6, 2025

@nordicjm this is a very nice improvement. There are some minor documentation nits.

A further possible improvement could be to place the swap state (image trailer) in the update image slot (this will not be erased during the swap, and thus the image could go up to the slot size - trailer size).

I left it in the first as with the "move" slot being moved to the second image, the overhead in both slots is now about equal (swap status in primary, move slot in secondary). However I'm not sure if this mode will actually be finished, the simulator is a giant fight and lots of edge cases need handling in application code to account for the secondary slot image being at either offset, and as of right now the simulator failures make no sense to me

Adds a new variation of the swap using move mode, named swap using
offset, whereby instead of moving all the sectors in the primary
image, the sectors in the secondary image are offset instead. This
fastens image swapping time both for updates and reverts as each
sector in both slots is erased only once, which also reduces flash
wear, and uses less swap status bits to represent

Signed-off-by: Jamie McCrae <[email protected]>
Adds support for using this mode to zephyr

Signed-off-by: Jamie McCrae <[email protected]>
Adds support for getting the sector size of less sectors than are
in an image, which mirrors support in zephyr and allows getting
just the size of the first sector in an image

Signed-off-by: Jamie McCrae <[email protected]>
Enables testing this new mode

Signed-off-by: Jamie McCrae <[email protected]>
Adds details on how this new mode works

Signed-off-by: Jamie McCrae <[email protected]>
Adds a note about this new algorithm being added

Signed-off-by: Jamie McCrae <[email protected]>
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.

RFC: Swap using move but using extra sector in slot 1
2 participants