Skip to content

Commit

Permalink
sim: Add multi-image config support to sim
Browse files Browse the repository at this point in the history
Add support for building with multiple images to the simulator.

Signed-off-by: David Brown <david.brown@linaro.org>
  • Loading branch information
d3zd3z committed Apr 17, 2019
1 parent 2bff647 commit 5e6f5e0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions sim/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ validate-primary-slot = ["mcuboot-sys/validate-primary-slot"]
enc-rsa = ["mcuboot-sys/enc-rsa"]
enc-kw = ["mcuboot-sys/enc-kw"]
bootstrap = ["mcuboot-sys/bootstrap"]
multiimage = ["mcuboot-sys/multiimage"]

[dependencies]
libc = "0.2.0"
Expand Down
3 changes: 3 additions & 0 deletions sim/mcuboot-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ enc-kw = []
# Allow bootstrapping an empty/invalid primary slot from a valid secondary slot
bootstrap = []

# Support multiple images (currently 2 instead of 1).
multiimage = []

[build-dependencies]
cc = "1.0.25"

Expand Down
2 changes: 2 additions & 0 deletions sim/mcuboot-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ fn main() {
let enc_rsa = env::var("CARGO_FEATURE_ENC_RSA").is_ok();
let enc_kw = env::var("CARGO_FEATURE_ENC_KW").is_ok();
let bootstrap = env::var("CARGO_FEATURE_BOOTSTRAP").is_ok();
let multiimage = env::var("CARGO_FEATURE_MULTIIMAGE").is_ok();

let mut conf = cc::Build::new();
conf.define("__BOOTSIM__", None);
conf.define("MCUBOOT_HAVE_LOGGING", None);
conf.define("MCUBOOT_USE_FLASH_AREA_GET_SECTORS", None);
conf.define("MCUBOOT_HAVE_ASSERT_H", None);
conf.define("MCUBOOT_MAX_IMG_SECTORS", Some("128"));
conf.define("MCUBOOT_IMAGE_NUMBER", Some(if multiimage { "2" } else { "1" }));

if bootstrap {
conf.define("MCUBOOT_BOOTSTRAP", None);
Expand Down
2 changes: 2 additions & 0 deletions sim/mcuboot-sys/csupport/generated_dts_board.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@
#define DT_FLASH_AREA_IMAGE_0_ID 1
#define DT_FLASH_AREA_IMAGE_1_ID 2
#define DT_FLASH_AREA_IMAGE_SCRATCH_ID 3
#define DT_FLASH_AREA_IMAGE_2_ID 4
#define DT_FLASH_AREA_IMAGE_3_ID 5

#endif /*__GENERATED_DTS_BOARD_H__*/

0 comments on commit 5e6f5e0

Please sign in to comment.