sim: Add OldCorrect and NoUpgrade dependency types
Add two additional dependency types. The NoUpgrade type indicates that
this slot should not contain an upgrade at all. The OldCorrect
indicates a dependency on the old version of the other slot.
Signed-off-by: David Brown <david.brown@linaro.org>
Signed-off-by: Fabio Utzig <utzig@apache.org>
diff --git a/sim/src/image.rs b/sim/src/image.rs
index 82cd729..88a85be 100644
--- a/sim/src/image.rs
+++ b/sim/src/image.rs
@@ -38,6 +38,7 @@
BoringDep,
Depender,
DepTest,
+ DepType,
PairDep,
UpgradeInfo,
};
@@ -167,7 +168,10 @@
Box::new(BoringDep(image_num))
};
let primaries = install_image(&mut flash, &slots[0], 42784, &*dep, false);
- let upgrades = install_image(&mut flash, &slots[1], 46928, &*dep, false);
+ let upgrades = match deps.depends[image_num] {
+ DepType::NoUpgrade => install_no_image(),
+ _ => install_image(&mut flash, &slots[1], 46928, &*dep, false)
+ };
OneImage {
slots: slots,
primaries: primaries,
@@ -1228,6 +1232,14 @@
}
}
+/// Install no image. This is used when no upgrade happens.
+fn install_no_image() -> ImageData {
+ ImageData {
+ plain: vec![],
+ cipher: None,
+ }
+}
+
fn make_tlv() -> TlvGen {
if Caps::EcdsaP224.present() {
panic!("Ecdsa P224 not supported in Simulator");