Skip to content

Commit 1dc74d7

Browse files
pdgendtcarlescufi
authored andcommitted
debug: coredump: flash backend: fix stream API data size
The stream api initialization for the coredump flash backend used an incorrect size. This commit subtracts the header size. Signed-off-by: Pieter De Gendt <[email protected]>
1 parent 06a624f commit 1dc74d7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

subsys/debug/coredump/coredump_backend_flash_partition.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ static int erase_flash_partition(void)
304304
static void coredump_flash_backend_start(void)
305305
{
306306
const struct device *flash_dev;
307-
size_t offset;
307+
size_t offset, header_size;
308308
int ret;
309309

310310
ret = partition_open();
@@ -325,15 +325,14 @@ static void coredump_flash_backend_start(void)
325325
* The header size is rounded up so the beginning of coredump
326326
* is aligned to write size (for easier read and seek).
327327
*/
328-
offset = backend_ctx.flash_area->fa_off;
329-
offset += ROUND_UP(sizeof(struct flash_hdr_t),
330-
FLASH_WRITE_SIZE);
328+
header_size = ROUND_UP(sizeof(struct flash_hdr_t), FLASH_WRITE_SIZE);
329+
offset = backend_ctx.flash_area->fa_off + header_size;
331330

332331
ret = stream_flash_init(&backend_ctx.stream_ctx, flash_dev,
333332
stream_flash_buf,
334333
sizeof(stream_flash_buf),
335334
offset,
336-
backend_ctx.flash_area->fa_size,
335+
backend_ctx.flash_area->fa_size - header_size,
337336
NULL);
338337
}
339338

0 commit comments

Comments
 (0)