From 61a540dd4ef10f0e111a98f13ee9a0e9473374dd Mon Sep 17 00:00:00 2001 From: David Brown Date: Fri, 11 Jan 2019 14:29:14 -0700 Subject: [PATCH] sim: Remove cfg on `verify_image` Remove the final conditional compilation in the simulator. The simulator is now always built the same way, and bases the tests it runs on the capability queries made to the MCUboot code. This simplifies the simulator code a bit, and, importantly, removes the ability to have mismatches between the configuration as compiled into the MCUboot code and how the simulator is compiled. Signed-off-by: David Brown --- sim/src/image.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/sim/src/image.rs b/sim/src/image.rs index 3fa45530..b940b6e2 100644 --- a/sim/src/image.rs +++ b/sim/src/image.rs @@ -850,19 +850,13 @@ fn verify_image(flashmap: &SimFlashMap, slots: &[SlotInfo], slot: usize, } } -#[cfg(feature = "overwrite-only")] -#[allow(unused_variables)] -// overwrite-only doesn't employ trailer management fn verify_trailer(flashmap: &SimFlashMap, slots: &[SlotInfo], slot: usize, magic: Option, image_ok: Option, copy_done: Option) -> bool { - true -} + if Caps::OverwriteUpgrade.present() { + return true; + } -#[cfg(not(feature = "overwrite-only"))] -fn verify_trailer(flashmap: &SimFlashMap, slots: &[SlotInfo], slot: usize, - magic: Option, image_ok: Option, - copy_done: Option) -> bool { let offset = slots[slot].trailer_off; let dev_id = slots[slot].dev_id; let mut copy = vec![0u8; c::boot_magic_sz() + c::boot_max_align() * 2];