Commit bb644c7c authored by Michal Kozikowski's avatar Michal Kozikowski Committed by Andrzej Puzdrowski
Browse files

bootutil: loader: overwrite-only mode fix for trailer erase



This fixes issues when trying to erase secondary slot trailer for
platforms with MCUBOOT_SUPPORT_DEV_WITHOUT_ERASE set from flash driver.
Calling explicitly to 'scramble' region ensures we delete the trailer.

Signed-off-by: default avatarMichal Kozikowski <michal.kozikowski@nordicsemi.no>
parent 11982df9
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -1687,7 +1687,7 @@ boot_copy_image(struct boot_loader_state *state, struct boot_status *bs)
     * trailer that was left might trigger a new upgrade.
     */
    BOOT_LOG_DBG("erasing secondary header");
    rc = boot_erase_region(fap_secondary_slot,
    rc = boot_scramble_region(fap_secondary_slot,
                              boot_img_sector_off(state, BOOT_SECONDARY_SLOT, 0),
                              boot_img_sector_size(state, BOOT_SECONDARY_SLOT, 0), false);
    assert(rc == 0);
@@ -1695,7 +1695,7 @@ boot_copy_image(struct boot_loader_state *state, struct boot_status *bs)

    last_sector = boot_img_num_sectors(state, BOOT_SECONDARY_SLOT) - 1;
    BOOT_LOG_DBG("erasing secondary trailer");
    rc = boot_erase_region(fap_secondary_slot,
    rc = boot_scramble_region(fap_secondary_slot,
                              boot_img_sector_off(state, BOOT_SECONDARY_SLOT,
                                    last_sector),
                              boot_img_sector_size(state, BOOT_SECONDARY_SLOT,