Convert BOOT_MAGIC_SZ to #define
Convert this `extern const uint32_t` to a simple define. Provide an
accessor function so that the simulator is able to access the value as
well. This has a minor improvement on the generated code within MCUboot
itself.
Signed-off-by: David Brown <david.brown@linaro.org>
diff --git a/sim/mcuboot-sys/csupport/run.c b/sim/mcuboot-sys/csupport/run.c
index dd63d55..5697948 100644
--- a/sim/mcuboot-sys/csupport/run.c
+++ b/sim/mcuboot-sys/csupport/run.c
@@ -454,3 +454,8 @@
{
return BOOT_MAX_ALIGN;
}
+
+uint32_t boot_magic_sz(void)
+{
+ return BOOT_MAGIC_SZ;
+}
diff --git a/sim/mcuboot-sys/src/c.rs b/sim/mcuboot-sys/src/c.rs
index 3d2f3ea..f3de302 100644
--- a/sim/mcuboot-sys/src/c.rs
+++ b/sim/mcuboot-sys/src/c.rs
@@ -41,7 +41,7 @@
}
pub fn boot_magic_sz() -> usize {
- unsafe { raw::BOOT_MAGIC_SZ as usize }
+ unsafe { raw::boot_magic_sz() as usize }
}
pub fn boot_max_align() -> usize {
@@ -83,7 +83,7 @@
pub fn boot_trailer_sz(min_write_sz: u8) -> u32;
- pub static BOOT_MAGIC_SZ: u32;
+ pub fn boot_magic_sz() -> u32;
pub fn boot_max_align() -> u32;
pub fn rsa_oaep_encrypt_(pubkey: *const u8, pubkey_len: libc::c_uint,