Commit 66c21afc authored by Thomas Altenbach's avatar Thomas Altenbach Committed by Jamie
Browse files

sim: Generate smallest possible oversized image



To generate oversized, the simulator needs to know the maximum image
size. To obtain such size, the size of the TLV area is estimated and
when using ECDSA, the actual size of the TLV area in the generated image
was not always equal to the estimated size. This required to add a bit
more data than what should be necessary when creating oversized images,
to ensure the generated images will actually be oversized in most cases.

Thanks to the previous commit, this is no more necessary and it is now
possible to reliably generate oversized images with the smallest size.

Signed-off-by: default avatarThomas Altenbach <thomas.altenbach@legrand.com>
parent 639a1ec4
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -1884,9 +1884,8 @@ fn install_image(flash: &mut SimMultiFlash, areadesc: &AreaDesc, slot: &SlotInfo

            info!("slot: 0x{:x}, HDR: 0x{:x}, trailer: 0x{:x}",
                slot_len, HDR_SIZE, trailer);
            // the overflow size is rougly estimated to work for all
            // configurations. It might be precise if tlv_len will be maked precise.
            slot_len - HDR_SIZE - trailer - tlv_len - sector_offset + dev.align()*4

            slot_len - HDR_SIZE - trailer - tlv_len - sector_offset + dev.align()
        }

    };