Skip to content

Commit 15effbf

Browse files
nvlsianpucarlescufi
authored andcommitted
Revert "[nrf noup] loader: Fix reading reset addr to support ext flash"
This reverts commit b0be469. Signed-off-by: Andrzej Puzdrowski <[email protected]>
1 parent b0be469 commit 15effbf

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

boot/bootutil/src/loader.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -917,9 +917,10 @@ boot_validated_swap_type(struct boot_loader_state *state,
917917
#if defined(PM_S1_ADDRESS) || defined(CONFIG_SOC_NRF5340_CPUAPP)
918918
const struct flash_area *secondary_fa =
919919
BOOT_IMG_AREA(state, BOOT_SECONDARY_SLOT);
920-
struct image_header *hdr = boot_img_hdr(state, BOOT_SECONDARY_SLOT);
920+
struct image_header *hdr = (struct image_header *)secondary_fa->fa_off;
921+
uint32_t vtable_addr = 0;
922+
uint32_t *vtable = 0;
921923
uint32_t reset_addr = 0;
922-
int rc = 0;
923924
/* Patch needed for NCS. Since image 0 (the app) and image 1 (the other
924925
* B1 slot S0 or S1) share the same secondary slot, we need to check
925926
* whether the update candidate in the secondary slot is intended for
@@ -929,19 +930,16 @@ boot_validated_swap_type(struct boot_loader_state *state,
929930
*/
930931

931932
if (hdr->ih_magic == IMAGE_MAGIC) {
932-
rc = flash_area_read(secondary_fa, hdr->ih_hdr_size +
933-
sizeof(uint32_t), &reset_addr,
934-
sizeof(reset_addr));
935-
if (rc != 0) {
936-
return BOOT_SWAP_TYPE_FAIL;
937-
}
933+
vtable_addr = (uint32_t)hdr + hdr->ih_hdr_size;
934+
vtable = (uint32_t *)(vtable_addr);
935+
reset_addr = vtable[1];
938936
#ifdef PM_S1_ADDRESS
939937
#ifdef PM_CPUNET_B0N_ADDRESS
940938
if(reset_addr < PM_CPUNET_B0N_ADDRESS)
941939
#endif
942940
{
943941
const struct flash_area *primary_fa;
944-
rc = flash_area_open(flash_area_id_from_multi_image_slot(
942+
int rc = flash_area_open(flash_area_id_from_multi_image_slot(
945943
BOOT_CURR_IMG(state),
946944
BOOT_PRIMARY_SLOT),
947945
&primary_fa);
@@ -983,12 +981,10 @@ boot_validated_swap_type(struct boot_loader_state *state,
983981
* available
984982
*/
985983
if (upgrade_valid && reset_addr > PM_CPUNET_B0N_ADDRESS) {
986-
struct image_header *hdr = (struct image_header *)secondary_fa->fa_off;
987-
uint32_t vtable_addr = (uint32_t)hdr + hdr->ih_hdr_size;
988-
uint32_t *net_core_fw_addr = (uint32_t *)(vtable_addr);
989984
uint32_t fw_size = hdr->ih_img_size;
985+
990986
BOOT_LOG_INF("Starting network core update");
991-
rc = pcd_network_core_update(net_core_fw_addr, fw_size);
987+
int rc = pcd_network_core_update(vtable, fw_size);
992988

993989
if (rc != 0) {
994990
swap_type = BOOT_SWAP_TYPE_FAIL;

0 commit comments

Comments
 (0)