Skip to content

Commit

Permalink
boot_serial: include flash area offset in log info
Browse files Browse the repository at this point in the history
Currently, log info in 'erase_range()' and 'bs_upload()' shows range
being erased/written relative to selected flash area which might be
misleading. Include flash area offset in output so that the absolute
addresses of the range being erased/written are shown.

Signed-off-by: Piotr Dymacz <[email protected]>
  • Loading branch information
pepe2k committed Sep 19, 2023
1 parent e974c8f commit 5785f1f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions boot/boot_serial/src/boot_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,8 @@ static off_t erase_range(const struct flash_area *fap, off_t start, off_t end)
}

size = flash_sector_get_off(&sect) + flash_sector_get_size(&sect) - start;
BOOT_LOG_INF("Erasing range 0x%jx:0x%jx", (intmax_t)start,
(intmax_t)(start + size - 1));
BOOT_LOG_INF("Erasing range 0x%jx:0x%jx", (intmax_t)(fap->fa_off + start),
(intmax_t)(fap->fa_off + start + size - 1));

rc = flash_area_erase(fap, start, size);
if (rc != 0) {
Expand Down Expand Up @@ -781,7 +781,8 @@ bs_upload(char *buf, int len)
rem_bytes = 0;
}

BOOT_LOG_INF("Writing at 0x%x until 0x%x", curr_off, curr_off + img_chunk_len);
BOOT_LOG_INF("Writing at 0x%lx until 0x%lx", fap->fa_off + curr_off,
fap->fa_off + curr_off + img_chunk_len);
/* Write flash aligned chunk, note that img_chunk_len now holds aligned length */
#if defined(MCUBOOT_SERIAL_UNALIGNED_BUFFER_SIZE) && MCUBOOT_SERIAL_UNALIGNED_BUFFER_SIZE > 0
if (flash_area_align(fap) > 1 &&
Expand Down

0 comments on commit 5785f1f

Please sign in to comment.