bootutil: Show error if flash area open fails

Shows an error if a particular flash area fails to open

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This commit is contained in:
Jamie McCrae 2023-09-25 11:12:20 +01:00 committed by Jamie
parent ae2aeedfe8
commit 2929a975c7
1 changed files with 11 additions and 0 deletions

View File

@ -2064,11 +2064,22 @@ context_boot_go(struct boot_loader_state *state, struct boot_rsp *rsp)
fa_id = flash_area_id_from_multi_image_slot(image_index, slot); fa_id = flash_area_id_from_multi_image_slot(image_index, slot);
rc = flash_area_open(fa_id, &BOOT_IMG_AREA(state, slot)); rc = flash_area_open(fa_id, &BOOT_IMG_AREA(state, slot));
assert(rc == 0); assert(rc == 0);
if (rc != 0) {
BOOT_LOG_ERR("Failed to open flash area ID %d (image %d slot %d): %d, "
"cannot continue", fa_id, image_index, (int8_t)slot, rc);
FIH_PANIC;
}
} }
#if MCUBOOT_SWAP_USING_SCRATCH #if MCUBOOT_SWAP_USING_SCRATCH
rc = flash_area_open(FLASH_AREA_IMAGE_SCRATCH, rc = flash_area_open(FLASH_AREA_IMAGE_SCRATCH,
&BOOT_SCRATCH_AREA(state)); &BOOT_SCRATCH_AREA(state));
assert(rc == 0); assert(rc == 0);
if (rc != 0) {
BOOT_LOG_ERR("Failed to open scratch flash area: %d, cannot continue", rc);
FIH_PANIC;
}
#endif #endif
/* Determine swap type and complete swap if it has been aborted. */ /* Determine swap type and complete swap if it has been aborted. */