Boot: Remove format specifier macros
This patch removes the format specifier macros used in the formatted
input/output functions. The 8-bit types (e.g. PRIu8) requires the
C99 I/O format support to be enabled, otherwise the usage of these
macros results in undefined behaviour. TF-M uses the newlib-nano
standard library implementation which by default does not support
these format macros.
Change-Id: I36acf18aabbc675db56232671f7186f6745d4152
Signed-off-by: David Vincze <david.vincze@arm.com>
diff --git a/bl2/ext/mcuboot/bootutil/src/loader.c b/bl2/ext/mcuboot/bootutil/src/loader.c
index 0a40342..c49fd31 100644
--- a/bl2/ext/mcuboot/bootutil/src/loader.c
+++ b/bl2/ext/mcuboot/bootutil/src/loader.c
@@ -1571,17 +1571,16 @@
#else /* MCUBOOT_NO_SWAP || MCUBOOT_RAM_LOADING */
-#define BOOT_LOG_IMAGE_INFO(area, hdr, state) \
- BOOT_LOG_INF("Image %"PRIu32": version=%"PRIu8".%"PRIu8".%"PRIu16"" \
- ".%"PRIu32", magic=%5s, image_ok=0x%x", \
- (area), \
- (hdr)->ih_ver.iv_major, \
- (hdr)->ih_ver.iv_minor, \
- (hdr)->ih_ver.iv_revision, \
- (hdr)->ih_ver.iv_build_num, \
- ((state)->magic == BOOT_MAGIC_GOOD ? "good" : \
- (state)->magic == BOOT_MAGIC_UNSET ? "unset" : \
- "bad"), \
+#define BOOT_LOG_IMAGE_INFO(area, hdr, state) \
+ BOOT_LOG_INF("Image %u: version=%u.%u.%u+%u, magic=%5s, image_ok=0x%x", \
+ (area), \
+ (hdr)->ih_ver.iv_major, \
+ (hdr)->ih_ver.iv_minor, \
+ (hdr)->ih_ver.iv_revision, \
+ (hdr)->ih_ver.iv_build_num, \
+ ((state)->magic == BOOT_MAGIC_GOOD ? "good" : \
+ (state)->magic == BOOT_MAGIC_UNSET ? "unset" : \
+ "bad"), \
(state)->image_ok)
struct image_slot_version {
@@ -1666,8 +1665,8 @@
fa_id = flash_area_id_from_image_slot(slot);
rc = boot_read_swap_state_by_id(fa_id, &slot_state);
if (rc != 0) {
- BOOT_LOG_ERR("Error during reading image trailer from slot:"
- " %"PRIu32"", slot);
+ BOOT_LOG_ERR("Error during reading image trailer from slot: %u",
+ slot);
continue;
}
@@ -1685,7 +1684,7 @@
BOOT_LOG_IMAGE_INFO(slot, hdr, &slot_state);
} else {
- BOOT_LOG_INF("Image %"PRIu32": No valid image", slot);
+ BOOT_LOG_INF("Image %u: No valid image", slot);
}
}
@@ -1728,7 +1727,7 @@
uint32_t img_sz;
if (dst % 4 != 0) {
- BOOT_LOG_INF("Cannot copy the image to the SRAM address 0x%"PRIx32" "
+ BOOT_LOG_INF("Cannot copy the image to the SRAM address 0x%lx "
"- the load address must be aligned with 4 bytes due to SRAM "
"restrictions", dst);
return BOOT_EBADARGS;
@@ -1852,15 +1851,15 @@
rc = boot_copy_image_to_sram(slot, newest_image_header);
if (rc != 0) {
rc = BOOT_EBADIMAGE;
- BOOT_LOG_INF("Could not copy image from slot 0x%"PRIx32" in "
- "the Flash to load address 0x%"PRIx32" in SRAM, "
+ BOOT_LOG_INF("Could not copy image from slot 0x%lx in "
+ "the Flash to load address 0x%lx in SRAM, "
"aborting..",
slot,
newest_image_header->ih_load_addr);
goto out;
} else {
BOOT_LOG_INF("Image has been copied from slot %d in flash to "
- "SRAM address 0x%"PRIx32"",
+ "SRAM address 0x%lx",
slot,
newest_image_header->ih_load_addr);
}
@@ -1874,7 +1873,7 @@
goto out;
}
- BOOT_LOG_INF("Booting image from SRAM at address 0x%"PRIx32"",
+ BOOT_LOG_INF("Booting image from SRAM at address 0x%lx",
newest_image_header->ih_load_addr);
} else {
#endif /* MCUBOOT_RAM_LOADING */