sim: Add multi-image config support to sim

Add support for building with multiple images to the simulator.

Signed-off-by: David Brown <david.brown@linaro.org>
This commit is contained in:
David Brown 2019-04-04 10:50:05 +07:00 committed by David Brown
parent 2bff647d8f
commit 5e6f5e0165
4 changed files with 8 additions and 0 deletions

View File

@ -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"

View File

@ -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"

View File

@ -17,6 +17,7 @@ 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);
@ -24,6 +25,7 @@ fn main() {
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);

View File

@ -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__*/