Skip to content

Commit 5c0959b

Browse files
tomchyrlubos
authored andcommitted
[nrf noup] loader: nrf53: Fix downgrade prevention
Allow to enable a simple downgrade prevention in nRF53 network core sequential updates. Ref: NCSIDB-1487 Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no> (cherry picked from commit 910d0b6)
1 parent ba4a2e4 commit 5c0959b

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

boot/bootutil/src/loader.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,8 +1354,21 @@ boot_validated_swap_type(struct boot_loader_state *state,
13541354
uint32_t vtable_addr = (uint32_t)hdr + hdr->ih_hdr_size;
13551355
uint32_t *net_core_fw_addr = (uint32_t *)(vtable_addr);
13561356
uint32_t fw_size = hdr->ih_img_size;
1357+
1358+
#if defined(MCUBOOT_DOWNGRADE_PREVENTION) && defined(CONFIG_SOC_NRF5340_CPUAPP) && \
1359+
!defined(CONFIG_NRF53_MULTI_IMAGE_UPDATE) && defined(CONFIG_PCD_APP) && \
1360+
defined(CONFIG_PCD_READ_NETCORE_APP_VERSION)
1361+
BOOT_LOG_INF("Checking network core version");
1362+
rc = pcd_version_cmp_net(secondary_fa, hdr);
1363+
1364+
if (rc >= 0) {
1365+
BOOT_LOG_INF("Starting network core update");
1366+
rc = pcd_network_core_update(net_core_fw_addr, fw_size);
1367+
}
1368+
#else
13571369
BOOT_LOG_INF("Starting network core update");
13581370
rc = pcd_network_core_update(net_core_fw_addr, fw_size);
1371+
#endif
13591372

13601373
if (rc != 0) {
13611374
swap_type = BOOT_SWAP_TYPE_FAIL;

0 commit comments

Comments
 (0)