boot: enable partial multi-image booting
Signed-off-by: Raef Coles <raef.coles@arm.com>
diff --git a/sim/mcuboot-sys/csupport/run.c b/sim/mcuboot-sys/csupport/run.c
index 9302a59..a51ced9 100644
--- a/sim/mcuboot-sys/csupport/run.c
+++ b/sim/mcuboot-sys/csupport/run.c
@@ -245,7 +245,7 @@
};
int invoke_boot_go(struct sim_context *ctx, struct area_desc *adesc,
- struct boot_rsp *rsp)
+ struct boot_rsp *rsp, int image_id)
{
int res;
struct boot_loader_state *state;
@@ -257,13 +257,23 @@
mbedtls_platform_set_calloc_free(calloc, free);
#endif
- // NOTE: cleared internally by context_boot_go
state = malloc(sizeof(struct boot_loader_state));
sim_set_flash_areas(adesc);
sim_set_context(ctx);
if (setjmp(ctx->boot_jmpbuf) == 0) {
+ boot_state_clear(state);
+
+#if BOOT_IMAGE_NUMBER > 1
+ if (image_id >= 0) {
+ memset(state->img_mask, 1, sizeof(state->img_mask));
+ state->img_mask[image_id] = 0;
+ }
+#else
+ (void) image_id;
+#endif /* BOOT_IMAGE_NUMBER > 1 */
+
res = context_boot_go(state, rsp);
sim_reset_flash_areas();
sim_reset_context();