Skip to content

Commit

Permalink
[nrf noup] booutil: loader: Fixup for NSIB and multi-image
Browse files Browse the repository at this point in the history
Commit 8fe7070 broke bootloader updates
for nRF91 and non-multi image builds. This commit is fixing this by
restoring the previous functionality and `ifdef` out the new logic
needed for multi-image.

Ref. NCSDK-23305

Signed-off-by: Sigvart Hovland <sigvart.hovland@nordicsemi.no>
(cherry picked from commit 7429a98)
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
  • Loading branch information
sigvartmh authored and de-nordic committed Sep 29, 2023
1 parent 99001d0 commit 8c5b560
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion boot/bootutil/src/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,6 @@ boot_validated_swap_type(struct boot_loader_state *state,
if(reset_addr < PM_CPUNET_B0N_ADDRESS)
#endif
{
const struct flash_area *nsib_fa;
const struct flash_area *primary_fa;
rc = flash_area_open(flash_area_id_from_multi_image_slot(
BOOT_CURR_IMG(state), BOOT_PRIMARY_SLOT),
Expand All @@ -978,6 +977,9 @@ boot_validated_swap_type(struct boot_loader_state *state,

/* Check start and end of primary slot for current image */
if (reset_addr < primary_fa->fa_off) {
#if defined(CONFIG_SOC_NRF5340_CPUAPP) && defined(CONFIG_NRF53_MULTI_IMAGE_UPDATE)
const struct flash_area *nsib_fa;

/* NSIB upgrade slot */
rc = flash_area_open((uint32_t)_image_1_primary_slot_id,
&nsib_fa);
Expand All @@ -992,6 +994,10 @@ boot_validated_swap_type(struct boot_loader_state *state,
/* Set primary to be NSIB upgrade slot */
BOOT_IMG_AREA(state, 0) = nsib_fa;
}
#else
return BOOT_SWAP_TYPE_NONE;
#endif

} else if (reset_addr > (primary_fa->fa_off + primary_fa->fa_size)) {
/* The image in the secondary slot is not intended for any */
return BOOT_SWAP_TYPE_NONE;
Expand Down

0 comments on commit 8c5b560

Please sign in to comment.