Add a capability query for image number
In addition to the binary capability flags, add a query function that
returns the number of images MCUboot has been configured to support.
Signed-off-by: David Brown <david.brown@linaro.org>
diff --git a/sim/src/caps.rs b/sim/src/caps.rs
index 09f6dee..2751618 100644
--- a/sim/src/caps.rs
+++ b/sim/src/caps.rs
@@ -19,8 +19,15 @@
let caps = unsafe { bootutil_get_caps() };
(caps as u32) & (self as u32) != 0
}
+
+ /// Query for the number of images that have been configured into this
+ /// MCUboot build.
+ pub fn get_num_images() -> usize {
+ (unsafe { bootutil_get_num_images() }) as usize
+ }
}
extern "C" {
fn bootutil_get_caps() -> Caps;
+ fn bootutil_get_num_images() -> u32;
}