From 5045928723bda1c45e4d4b641725186dddff7b98 Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Fri, 8 Sep 2023 11:06:45 +0200 Subject: [PATCH] boot_serial: don't use '%j' length modifier with Zephyr's minimal libc The Zephyr's 'Minimal C library' doesn't support the '%j' length modifier when 'cbprintf' is configured with minimum features. Signed-off-by: Piotr Dymacz --- boot/boot_serial/src/boot_serial.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/boot/boot_serial/src/boot_serial.c b/boot/boot_serial/src/boot_serial.c index 4b3ccce74..80d09183a 100644 --- a/boot/boot_serial/src/boot_serial.c +++ b/boot/boot_serial/src/boot_serial.c @@ -596,8 +596,13 @@ static off_t erase_range(const struct flash_area *fap, off_t start, off_t end) } size = flash_sector_get_off(§) + flash_sector_get_size(§) - start; +#if defined(__ZEPHYR__) && defined(CONFIG_MINIMAL_LIBC) && defined(CONFIG_CBPRINTF_NANO) + BOOT_LOG_INF("Erasing range 0x%lx:0x%lx", (fap->fa_off + start), + (fap->fa_off + start + size - 1)); +#else BOOT_LOG_INF("Erasing range 0x%jx:0x%jx", (intmax_t)(fap->fa_off + start), (intmax_t)(fap->fa_off + start + size - 1)); +#endif rc = flash_area_erase(fap, start, size); if (rc != 0) {