From 0174415bf56ad77851ff72af055d518c33c7e38a Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 18 Mar 2025 14:18:43 +0000 Subject: [PATCH] [nrf noup] boot: bootutil: Fix issue with network core update persisting nrf-squash! [nrf noup] boot: nrf53-specific customizations Fixes an issue whereby network core updates would persist when configured in update only mode and continually update on each reboot Signed-off-by: Jamie McCrae --- boot/bootutil/src/loader.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/boot/bootutil/src/loader.c b/boot/bootutil/src/loader.c index f9a9de71d..fdbab6522 100644 --- a/boot/bootutil/src/loader.c +++ b/boot/bootutil/src/loader.c @@ -1516,13 +1516,14 @@ boot_validated_swap_type(struct boot_loader_state *state, swap_type = BOOT_SWAP_TYPE_FAIL; } else { BOOT_LOG_INF("Done updating network core"); -#if defined(MCUBOOT_SWAP_USING_SCRATCH) || defined(MCUBOOT_SWAP_USING_MOVE) /* swap_erase_trailer_sectors is undefined if upgrade only - * method is used. There is no need to erase sectors, because - * the image cannot be reverted. + * method is used */ +#if defined(MCUBOOT_SWAP_USING_SCRATCH) || defined(MCUBOOT_SWAP_USING_MOVE) rc = swap_erase_trailer_sectors(state, secondary_fa); +#elif defined(MCUBOOT_OVERWRITE_ONLY) + rc = flash_area_erase(secondary_fa, 0, flash_area_get_size(secondary_fa)); #endif swap_type = BOOT_SWAP_TYPE_NONE; }