Commit dcea564e authored by David Brown's avatar David Brown Committed by David Brown
Browse files

boot: Add capability for ram loading



The MCUBOOT_RAM_LOAD feature supports configurations where code is
loaded from flash into RAM before execution.  As such, it is not
necessary for upgrades to move data around in flash.

Signed-off-by: default avatarDavid Brown <david.brown@linaro.org>
parent 122f9e70
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ uint32_t bootutil_get_caps(void);
#define BOOTUTIL_CAP_ENC_X25519             (1<<13)
#define BOOTUTIL_CAP_BOOTSTRAP              (1<<14)
#define BOOTUTIL_CAP_AES256                 (1<<15)
#define BOOTUTIL_CAP_RAM_LOAD               (1<<16)

/*
 * Query the number of images this bootloader is configured for.  This
+3 −0
Original line number Diff line number Diff line
@@ -72,6 +72,9 @@ uint32_t bootutil_get_caps(void)
#if defined(MCUBOOT_AES_256)
    res |= BOOTUTIL_CAP_AES256;
#endif
#if defined(MCUBOOT_RAM_LOAD)
    res |= BOOTUTIL_CAP_RAM_LOAD;
#endif

    return res;
}
+7 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ pub enum Caps {
    EncX25519            = (1 << 13),
    Bootstrap            = (1 << 14),
    Aes256               = (1 << 15),
    RamLoad              = (1 << 16),
}

impl Caps {
@@ -39,6 +40,12 @@ impl Caps {
    pub fn get_num_images() -> usize {
        (unsafe { bootutil_get_num_images() }) as usize
    }

    /// Query if this configuration performs some kind of upgrade by writing to flash.
    pub fn modifies_flash() -> bool {
        // All other configurations perform upgrades by writing to flash.
        !Self::RamLoad.present()
    }
}

extern "C" {