Skip to content

Commit 900e29d

Browse files
de-nordicnordicjm
authored andcommitted
sim: Use boot_state_init and boot_state clear where required.
Replace boot_state_clear with boot_state_init where needed, and add boot_state_clear where missed. Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
1 parent 6ab9afc commit 900e29d

File tree

1 file changed

+5
-2
lines changed
  • sim/mcuboot-sys/csupport

1 file changed

+5
-2
lines changed

sim/mcuboot-sys/csupport/run.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ int invoke_boot_go(struct sim_context *ctx, struct area_desc *adesc,
264264
sim_set_context(ctx);
265265

266266
if (setjmp(ctx->boot_jmpbuf) == 0) {
267-
boot_state_clear(state);
267+
boot_state_init(state);
268268

269269
#if BOOT_IMAGE_NUMBER > 1
270270
if (image_id >= 0) {
@@ -276,12 +276,14 @@ int invoke_boot_go(struct sim_context *ctx, struct area_desc *adesc,
276276
#endif /* BOOT_IMAGE_NUMBER > 1 */
277277

278278
res = context_boot_go(state, rsp);
279+
boot_state_clear(state);
279280
sim_reset_flash_areas();
280281
sim_reset_context();
281282
free(state);
282283
/* printf("boot_go off: %d (0x%08x)\n", res, rsp->br_image_off); */
283284
return res;
284285
} else {
286+
boot_state_clear(state);
285287
sim_reset_flash_areas();
286288
sim_reset_context();
287289
free(state);
@@ -308,7 +310,7 @@ int invoke_boot_load_image_from_flash_to_sram(struct sim_context *ctx, struct ar
308310

309311
sim_set_flash_areas(adesc);
310312
sim_set_context(ctx);
311-
boot_state_clear(state);
313+
boot_state_init(state);
312314

313315
res = flash_area_open(FLASH_AREA_IMAGE_PRIMARY(0), &fa_p);
314316
if (res != 0) {
@@ -335,6 +337,7 @@ int invoke_boot_load_image_from_flash_to_sram(struct sim_context *ctx, struct ar
335337
}
336338

337339
flash_area_close(fa_p);
340+
boot_state_clear(state);
338341
sim_reset_flash_areas();
339342
sim_reset_context();
340343
free(state);

0 commit comments

Comments
 (0)