sim: Don't mark permanent in overwrite mode

Overwrite mode is always a permanent upgrade, so skip trying to mark
this in the images.  This marking is problematic with larger write
alignments.

Signed-off-by: David Brown <david.brown@linaro.org>
This commit is contained in:
David Brown 2019-11-15 12:00:20 -07:00 committed by David Brown
parent 347dc5726d
commit eecae52af8
1 changed files with 7 additions and 0 deletions

View File

@ -1490,6 +1490,13 @@ pub fn mark_upgrade(flash: &mut SimMultiFlash, slot: &SlotInfo) {
/// Writes the image_ok flag which, guess what, tells the bootloader
/// the this image is ok (not a test, and no revert is to be performed).
fn mark_permanent_upgrade(flash: &mut SimMultiFlash, slot: &SlotInfo) {
// Overwrite mode always is permanent, and only the magic is used in
// the trailer. To avoid problems with large write sizes, don't try to
// set anything in this case.
if Caps::OverwriteUpgrade.present() {
return;
}
let dev = flash.get_mut(&slot.dev_id).unwrap();
let mut ok = [dev.erased_val(); 8];
ok[0] = 1u8;