dfu: introduce progressive erasing

Patch adds option for progressive erase of firmware image.
When using this, flash is erased as necessary when receiving
new firmware, instead of erasing the whole image slot at once.
This is useful on some hardware (like nRF52840) that has
long erase times, to prevent long wait times at the beginning
of the DFU process.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
This commit is contained in:
Andrzej Puzdrowski 2019-03-15 17:17:16 +01:00 committed by Anas Nashif
commit dffcfd8c79
5 changed files with 95 additions and 2 deletions

View file

@ -19,6 +19,9 @@ struct flash_img_context {
const struct flash_area *flash_area;
size_t bytes_written;
u16_t buf_bytes;
#ifdef CONFIG_IMG_ERASE_PROGRESSIVELY
off_t off_last;
#endif
};
/**

View file

@ -30,6 +30,13 @@
#define BOOT_IMG_VER_STRLEN_MAX 25 /* 255.255.65535.4294967295\0 */
/* Trailer: */
#define BOOT_MAX_ALIGN 8
#define BOOT_MAGIC_SZ 16
#define BOOT_TRAILER_IMG_STATUS_OFFS(bank_area) ((bank_area)->fa_size -\
BOOT_MAGIC_SZ -\
BOOT_MAX_ALIGN * 2)
/**
* @brief MCUboot image header representation for image version
*