Skip to content

Commit 129b631

Browse files
simon-iversenanangl
authored andcommitted
[nrf noup] bootutil: loader: Add check for netcore addr if NSIB enabled
Add check for netcore addr if NSIB is enabled so netcore updates works Ref. NCSIDB-696 Signed-off-by: Simon Iversen <[email protected]>
1 parent 855dfff commit 129b631

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

boot/bootutil/src/loader.c

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -933,21 +933,26 @@ boot_validated_swap_type(struct boot_loader_state *state,
933933
vtable = (uint32_t *)(vtable_addr);
934934
reset_addr = vtable[1];
935935
#ifdef PM_S1_ADDRESS
936-
const struct flash_area *primary_fa;
937-
int rc = flash_area_open(flash_area_id_from_multi_image_slot(
938-
BOOT_CURR_IMG(state),
939-
BOOT_PRIMARY_SLOT),
940-
&primary_fa);
936+
#ifdef PM_CPUNET_B0N_ADDRESS
937+
if(reset_addr < PM_CPUNET_B0N_ADDRESS)
938+
#endif
939+
{
940+
const struct flash_area *primary_fa;
941+
int rc = flash_area_open(flash_area_id_from_multi_image_slot(
942+
BOOT_CURR_IMG(state),
943+
BOOT_PRIMARY_SLOT),
944+
&primary_fa);
941945

942-
if (rc != 0) {
943-
return BOOT_SWAP_TYPE_FAIL;
944-
}
945-
/* Get start and end of primary slot for current image */
946-
if (reset_addr < primary_fa->fa_off ||
947-
reset_addr > (primary_fa->fa_off + primary_fa->fa_size)) {
948-
/* The image in the secondary slot is not intended for this image
949-
*/
950-
return BOOT_SWAP_TYPE_NONE;
946+
if (rc != 0) {
947+
return BOOT_SWAP_TYPE_FAIL;
948+
}
949+
/* Get start and end of primary slot for current image */
950+
if (reset_addr < primary_fa->fa_off ||
951+
reset_addr > (primary_fa->fa_off + primary_fa->fa_size)) {
952+
/* The image in the secondary slot is not intended for this image
953+
*/
954+
return BOOT_SWAP_TYPE_NONE;
955+
}
951956
}
952957
#endif /* PM_S1_ADDRESS */
953958
}

0 commit comments

Comments
 (0)