sim: eliminate (some) overwrite cfg
Remove some compile-time configuration of the overwrite-only flag.
These will be decided by doing a dynamic query of how the mcuboot code
has been compiled.
Signed-off-by: David Brown <david.brown@linaro.org>
diff --git a/sim/src/image.rs b/sim/src/image.rs
index 0419cbe..a25e738 100644
--- a/sim/src/image.rs
+++ b/sim/src/image.rs
@@ -38,13 +38,11 @@
}
}
- #[cfg(feature = "overwrite-only")]
pub fn run_basic_revert(&self) -> bool {
- false
- }
+ if Caps::OverwriteUpgrade.present() {
+ return false;
+ }
- #[cfg(not(feature = "overwrite-only"))]
- pub fn run_basic_revert(&self) -> bool {
let mut fails = 0;
// FIXME: this test would also pass if no swap is ever performed???
@@ -145,13 +143,11 @@
fails > 0
}
- #[cfg(feature = "overwrite-only")]
pub fn run_revert_with_fails(&self) -> bool {
- false
- }
+ if Caps::OverwriteUpgrade.present() {
+ return false;
+ }
- #[cfg(not(feature = "overwrite-only"))]
- pub fn run_revert_with_fails(&self) -> bool {
let mut fails = 0;
if Caps::SwapUpgrade.present() {
@@ -167,13 +163,11 @@
fails > 0
}
- #[cfg(feature = "overwrite-only")]
pub fn run_norevert(&self) -> bool {
- false
- }
+ if Caps::OverwriteUpgrade.present() {
+ return false;
+ }
- #[cfg(not(feature = "overwrite-only"))]
- pub fn run_norevert(&self) -> bool {
let mut flashmap = self.flashmap.clone();
let mut fails = 0;
@@ -532,7 +526,6 @@
(flashmap, count - counter)
}
-#[cfg(not(feature = "overwrite-only"))]
fn try_revert(flashmap: &SimFlashMap, areadesc: &AreaDesc, count: usize) -> SimFlashMap {
let mut flashmap = flashmap.clone();
@@ -544,7 +537,6 @@
flashmap
}
-#[cfg(not(feature = "overwrite-only"))]
fn try_revert_with_fail_at(flashmap: &SimFlashMap, images: &Images,
stop: i32) -> bool {
let mut flashmap = flashmap.clone();