Commit 7e377ab1 authored by David Brown's avatar David Brown Committed by David Brown
Browse files

sim: Enable sim building with ram-load



Allow the sim to test configurations with MCUBOOT_RAM_LOAD defined.
This does not define any tests for this mode.

This adds definitions for simulated RAM offsets to the simulator.  This
will define the offset (from `IMAGE_RAM_BASE`) to where the simulated
RAM will be located.  For now, just give these somewhat reasonable
values so that we are able to at least compile the RAM_LOADING code in
the simulator.

Signed-off-by: default avatarDavid Brown <david.brown@linaro.org>
parent 4b82c671
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ enc-x25519 = ["mcuboot-sys/enc-x25519"]
enc-aes256-x25519 = ["mcuboot-sys/enc-aes256-x25519"]
bootstrap = ["mcuboot-sys/bootstrap"]
multiimage = ["mcuboot-sys/multiimage"]
ram-load = ["mcuboot-sys/ram-load"]
large-write = []
downgrade-prevention = ["mcuboot-sys/downgrade-prevention"]

+4 −0
Original line number Diff line number Diff line
@@ -68,6 +68,10 @@ bootstrap = []
# Support multiple images (currently 2 instead of 1).
multiimage = []

# Support simulation of ram-loading.  No swaps are performed, and the
# image is copied to RAM before loading it.
ram-load = []

# Check (in software) against version downgrades.
downgrade-prevention = []

+8 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ fn main() {
    let bootstrap = env::var("CARGO_FEATURE_BOOTSTRAP").is_ok();
    let multiimage = env::var("CARGO_FEATURE_MULTIIMAGE").is_ok();
    let downgrade_prevention = env::var("CARGO_FEATURE_DOWNGRADE_PREVENTION").is_ok();
    let ram_load = env::var("CARGO_FEATURE_RAM_LOAD").is_ok();

    let mut conf = cc::Build::new();
    conf.define("__BOOTSIM__", None);
@@ -56,6 +57,13 @@ fn main() {
        conf.define("MCUBOOT_DOWNGRADE_PREVENTION", None);
    }

    if ram_load {
        conf.define("MCUBOOT_RAM_LOAD", None);

        conf.define("IMAGE_EXECUTABLE_RAM_START", "0x10000");
        conf.define("IMAGE_EXECUTABLE_RAM_SIZE", "0x10000");
    }

    // Currently no more than one sig type can be used simultaneously.
    if vec![sig_rsa, sig_rsa3072, sig_ecdsa, sig_ed25519].iter()
        .fold(0, |sum, &v| sum + v as i32) > 1 {