Skip to content

Commit

Permalink
zephyr: Use flash_area_flatten in boot_set_next
Browse files Browse the repository at this point in the history
Switch from using flash_area_erase to flash_area_flatten.
The later function uses write on devices that do not have erase by
design, to scramble data.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
  • Loading branch information
de-nordic committed Nov 15, 2024
1 parent 4edb7fc commit b96fe4a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions boot/bootutil/src/bootutil_public.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,11 @@ boot_set_next(const struct flash_area *fa, bool active, bool confirm)
/* The image slot is corrupt. There is no way to recover, so erase the
* slot to allow future upgrades.
*/
#if !defined(CONFIG_MCUBOOT) && defined(__ZEPHYR__)
flash_area_flatten(fa, 0, flash_area_get_size(fa));
#else
flash_area_erase(fa, 0, flash_area_get_size(fa));
#endif
rc = BOOT_EBADIMAGE;
}
break;
Expand Down

0 comments on commit b96fe4a

Please sign in to comment.