Commit 2b8a695b authored by David Brown's avatar David Brown Committed by David Brown
Browse files

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: default avatarDavid Brown <david.brown@linaro.org>
parent e0bb1f95
Loading
Loading
Loading
Loading
+0 −2
Changes for boot/bootutil/src/bootutil_misc.c: 0 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -52,8 +52,6 @@ const uint32_t boot_img_magic[] = {
#define BOOT_MAGIC_ARR_SZ \
    (sizeof boot_img_magic / sizeof boot_img_magic[0])

const uint32_t BOOT_MAGIC_SZ = sizeof boot_img_magic;

struct boot_swap_table {
    uint8_t magic_primary_slot;
    uint8_t magic_secondary_slot;
+1 −1
Changes for boot/bootutil/src/bootutil_priv.h: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -185,7 +185,7 @@ _Static_assert(BOOT_IMAGE_NUMBER > 0, "Invalid value for BOOT_IMAGE_NUMBER");
#define BOOT_STATUS_SOURCE_SCRATCH      1
#define BOOT_STATUS_SOURCE_PRIMARY_SLOT 2

extern const uint32_t BOOT_MAGIC_SZ;
#define BOOT_MAGIC_SZ (sizeof boot_img_magic)

/**
 * Compatibility shim for flash sector type.
+5 −0
Changes for sim/mcuboot-sys/csupport/run.c: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -454,3 +454,8 @@ uint32_t boot_max_align(void)
{
    return BOOT_MAX_ALIGN;
}

uint32_t boot_magic_sz(void)
{
    return BOOT_MAGIC_SZ;
}
+2 −2
Changes for sim/mcuboot-sys/src/c.rs: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ pub fn boot_trailer_sz(align: u8) -> u32 {
}

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 @@ mod raw {

        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,