Skip to content

Commit 5b1f9a9

Browse files
committed
sim: swap-move: Allow firmware data in the first trailer sector
When using the swap-move strategy, the simulator now doesn't compute anymore the maximum image size so the area allocated to the trailer has a size that is a multiple of the sector size. Indeed, the swap-move strategy now supports having part of the firmware in the first sector holding trailer data, allowing larger images. Signed-off-by: Thomas Altenbach <thomas.altenbach@legrand.com>
1 parent 7309c0f commit 5b1f9a9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sim/src/image.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1807,9 +1807,11 @@ fn image_largest_trailer(dev: &dyn Flash, areadesc: &AreaDesc, slot: &SlotInfo)
18071807
let trailer = if Caps::OverwriteUpgrade.present() {
18081808
// magic + image-ok + copy-done + swap-info
18091809
c::boot_magic_sz() + 3 * c::boot_max_align()
1810-
} else if Caps::SwapUsingOffset.present() || Caps::SwapUsingMove.present() {
1810+
} else if Caps::SwapUsingOffset.present() {
18111811
let sector_size = dev.sector_iter().next().unwrap().size as u32;
18121812
align_up(c::boot_trailer_sz(dev.align() as u32), sector_size) as usize
1813+
} else if Caps::SwapUsingMove.present() {
1814+
c::boot_trailer_sz(dev.align() as u32) as usize
18131815
} else if Caps::SwapUsingScratch.present() {
18141816
estimate_swap_scratch_trailer_size(dev, areadesc, slot)
18151817
} else {

0 commit comments

Comments
 (0)