Commit 2f6c164f authored by Fabio Utzig's avatar Fabio Utzig Committed by Fabio Utzig
Browse files

sim: fix flash padding to use erased val

Signed-off-by: default avatarFabio Utzig <utzig@apache.org>
parent ea3d3abe
Loading
Loading
Loading
Loading
+3 −4
Changes for sim/src/image.rs: 3 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -1153,10 +1153,11 @@ fn install_image(flash: &mut SimMultiFlash, slot: &SlotInfo, len: usize,
        tlv.make_tlv()
    };

    let dev = flash.get_mut(&dev_id).unwrap();

    // Pad the block to a flash alignment (8 bytes).
    while b_tlv.len() % 8 != 0 {
        //FIXME: should be erase_val?
        b_tlv.push(0xFF);
        b_tlv.push(dev.erased_val());
    }

    let mut buf = vec![];
@@ -1176,8 +1177,6 @@ fn install_image(flash: &mut SimMultiFlash, slot: &SlotInfo, len: usize,
    // un-encrypted. In the secondary slot the image is written un-encrypted,
    // and if encryption is requested, it follows an erase + flash encrypted.

    let dev = flash.get_mut(&dev_id).unwrap();

    if slot.index == 0 {
        let enc_copy: Option<Vec<u8>>;