Skip to content

Commit 88294be

Browse files
taltenbachnordicjm
authored andcommitted
sim: Fix incorrect trailer size computation for overwrite-only
For the overwrite-only upgrade strategy, the trailer size computed by the simulator and used to determine the maximum image size was not correct. This commit fixes the issue. Having an underestimated trailer size was causing the 'oversized_secondary_slot' to fail since the previous commit, because the oversized images are now generated to have the smallest possible size. Signed-off-by: Thomas Altenbach <[email protected]>
1 parent 66c21af commit 88294be

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

sim/src/image.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1805,9 +1805,8 @@ fn image_largest_trailer(dev: &dyn Flash, areadesc: &AreaDesc, slot: &SlotInfo)
18051805
// Using the header size we know, the trailer size, and the slot size, we can compute
18061806
// the largest image possible.
18071807
let trailer = if Caps::OverwriteUpgrade.present() {
1808-
// This computation is incorrect, and we need to figure out the correct size.
1809-
// c::boot_status_sz(dev.align() as u32) as usize
1810-
16 + 4 * dev.align()
1808+
// magic + image-ok + copy-done + swap-info
1809+
c::boot_magic_sz() + 3 * c::boot_max_align()
18111810
} else if Caps::SwapUsingOffset.present() || Caps::SwapUsingMove.present() {
18121811
let sector_size = dev.sector_iter().next().unwrap().size as u32;
18131812
align_up(c::boot_trailer_sz(dev.align() as u32), sector_size) as usize

0 commit comments

Comments
 (0)