dfu: make flash_img write to flash on buffer full

flash_img subsystem writes data to flash only when the amount of data to
be written is larger than available buffer space. This commit modifies
this behavior to write data to flash as soon as the buffer is full.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
This commit is contained in:
Piotr Mienkowski 2019-07-19 09:33:56 +02:00 committed by Carles Cufí
commit a75fc4199f

View file

@ -162,7 +162,7 @@ int flash_img_buffered_write(struct flash_img_context *ctx, u8_t *data,
int rc = 0;
int buf_empty_bytes;
while ((len - processed) >
while ((len - processed) >=
(buf_empty_bytes = CONFIG_IMG_BLOCK_BUF_SIZE - ctx->buf_bytes)) {
memcpy(ctx->buf + ctx->buf_bytes, data + processed,
buf_empty_bytes);