sim: fix flash padding to use erased val
Signed-off-by: Fabio Utzig <utzig@apache.org>
diff --git a/sim/src/image.rs b/sim/src/image.rs
index 88a85be..aa4b070 100644
--- a/sim/src/image.rs
+++ b/sim/src/image.rs
@@ -1153,10 +1153,11 @@
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 @@
// 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>>;