Skip to content

Commit 3895554

Browse files
simon-iversenmbolivar-nordic
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 <simon.iversen@nordicsemi.no> Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no> Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no> (cherry picked from commit b3e43db)
1 parent f8d7b0b commit 3895554

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

boot/bootutil/src/loader.c

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

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

0 commit comments

Comments
 (0)