Skip to content

Commit 5e6f5e0

Browse files
committed
sim: Add multi-image config support to sim
Add support for building with multiple images to the simulator. Signed-off-by: David Brown <[email protected]>
1 parent 2bff647 commit 5e6f5e0

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

sim/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ validate-primary-slot = ["mcuboot-sys/validate-primary-slot"]
1414
enc-rsa = ["mcuboot-sys/enc-rsa"]
1515
enc-kw = ["mcuboot-sys/enc-kw"]
1616
bootstrap = ["mcuboot-sys/bootstrap"]
17+
multiimage = ["mcuboot-sys/multiimage"]
1718

1819
[dependencies]
1920
libc = "0.2.0"

sim/mcuboot-sys/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ enc-kw = []
3333
# Allow bootstrapping an empty/invalid primary slot from a valid secondary slot
3434
bootstrap = []
3535

36+
# Support multiple images (currently 2 instead of 1).
37+
multiimage = []
38+
3639
[build-dependencies]
3740
cc = "1.0.25"
3841

sim/mcuboot-sys/build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ fn main() {
1717
let enc_rsa = env::var("CARGO_FEATURE_ENC_RSA").is_ok();
1818
let enc_kw = env::var("CARGO_FEATURE_ENC_KW").is_ok();
1919
let bootstrap = env::var("CARGO_FEATURE_BOOTSTRAP").is_ok();
20+
let multiimage = env::var("CARGO_FEATURE_MULTIIMAGE").is_ok();
2021

2122
let mut conf = cc::Build::new();
2223
conf.define("__BOOTSIM__", None);
2324
conf.define("MCUBOOT_HAVE_LOGGING", None);
2425
conf.define("MCUBOOT_USE_FLASH_AREA_GET_SECTORS", None);
2526
conf.define("MCUBOOT_HAVE_ASSERT_H", None);
2627
conf.define("MCUBOOT_MAX_IMG_SECTORS", Some("128"));
28+
conf.define("MCUBOOT_IMAGE_NUMBER", Some(if multiimage { "2" } else { "1" }));
2729

2830
if bootstrap {
2931
conf.define("MCUBOOT_BOOTSTRAP", None);

sim/mcuboot-sys/csupport/generated_dts_board.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@
1212
#define DT_FLASH_AREA_IMAGE_0_ID 1
1313
#define DT_FLASH_AREA_IMAGE_1_ID 2
1414
#define DT_FLASH_AREA_IMAGE_SCRATCH_ID 3
15+
#define DT_FLASH_AREA_IMAGE_2_ID 4
16+
#define DT_FLASH_AREA_IMAGE_3_ID 5
1517

1618
#endif /*__GENERATED_DTS_BOARD_H__*/

0 commit comments

Comments
 (0)