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 <[email protected]>
(cherry picked from commit 7429a98)
Signed-off-by: Dominik Ermel <[email protected]>
(cherry picked from commit 8c5b560)
(cherry picked from commit 745cf4e)
Signed-off-by: Dominik Ermel <[email protected]>
  • Loading branch information
sigvartmh authored and de-nordic committed Dec 15, 2023
1 parent c3b33eb commit 0d43674
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

1 comment on commit 0d43674

@optical-o
Copy link

@optical-o optical-o commented on 0d43674 Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@de-nordic This breaks non-multi-image Immutable Bootloader update by returning BOOT_SWAP_TYPE_NONE.
The image in the secondary slot is not recognized due to the return.

Please sign in to comment.