Skip to content

Commit 457be0c

Browse files
fdcavalcantialmir-okato
authored andcommitted
bootutil: Fix some debug log format specifiers
Uses format specifiers from inttype.h to remove warnings during build. Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
1 parent f9ad3ee commit 457be0c

File tree

5 files changed

+21
-10
lines changed

5 files changed

+21
-10
lines changed

boot/bootutil/src/bootutil_area.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ boot_erase_region(const struct flash_area *fa, uint32_t off, uint32_t size, bool
206206
{
207207
int rc = 0;
208208

209-
BOOT_LOG_DBG("boot_erase_region: flash_area %p, offset %d, size %d, backwards == %d",
209+
BOOT_LOG_DBG("boot_erase_region: flash_area %p, offset %" PRIu32 ""
210+
", size %" PRIu32 ", backwards == %" PRIu8,
210211
fa, off, size, (int)backwards);
211212

212213
if (off >= flash_area_get_size(fa) || (flash_area_get_size(fa) - off) < size) {
@@ -304,7 +305,8 @@ boot_scramble_region(const struct flash_area *fa, uint32_t off, uint32_t size, b
304305
{
305306
int rc = 0;
306307

307-
BOOT_LOG_DBG("boot_scramble_region: %p %d %d %d", fa, off, size, (int)backwards);
308+
BOOT_LOG_DBG("boot_scramble_region: %p %" PRIu32 " %" PRIu32 " %d",
309+
fa, off, size, (int)backwards);
308310

309311
if (size == 0) {
310312
goto done;
@@ -330,13 +332,15 @@ boot_scramble_region(const struct flash_area *fa, uint32_t off, uint32_t size, b
330332
} else {
331333
end_offset = ALIGN_DOWN((off + size), write_block);
332334
}
333-
BOOT_LOG_DBG("boot_scramble_region: start offset %u, end offset %u", off, end_offset);
335+
BOOT_LOG_DBG("boot_scramble_region: start offset %" PRIu32 ", "
336+
"end offset %" PRIu32, off, end_offset);
334337

335338
while (off != end_offset) {
336339
/* Write over the area to scramble data that is there */
337340
rc = flash_area_write(fa, off, buf, write_block);
338341
if (rc != 0) {
339-
BOOT_LOG_DBG("boot_scramble_region: error %d for %p %d %u",
342+
BOOT_LOG_DBG("boot_scramble_region: error %d for %p "
343+
"%" PRIu32 " %u",
340344
rc, fa, off, (unsigned int)write_block);
341345
break;
342346
}

boot/bootutil/src/bootutil_img_hash.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
*/
2828

2929
#include <stdint.h>
30+
#include <inttypes.h>
3031
#include <flash_map_backend/flash_map_backend.h>
3132

3233
#include "bootutil/crypto/sha.h"
@@ -167,7 +168,8 @@ bootutil_img_hash(struct boot_loader_state *state,
167168
#endif
168169
if (rc) {
169170
bootutil_sha_drop(&sha_ctx);
170-
BOOT_LOG_DBG("bootutil_img_validate Error %d reading data chunk %p %u %u",
171+
BOOT_LOG_DBG("bootutil_img_validate Error %d reading data chunk "
172+
"%p %" PRIu32 " %" PRIu32,
171173
rc, fap, off, blk_sz);
172174
return rc;
173175
}

boot/bootutil/src/bootutil_public.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ boot_write_trailer(const struct flash_area *fap, uint32_t off,
350350
uint32_t align;
351351
int rc;
352352

353-
BOOT_LOG_DBG("boot_write_trailer: for %p at %d, size = %d",
353+
BOOT_LOG_DBG("boot_write_trailer: for %p at %" PRIu32 ", size = %d",
354354
fap, off, inlen);
355355

356356
align = flash_area_align(fap);

boot/bootutil/src/image_validate.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,8 @@ bootutil_img_validate(struct boot_loader_state *state,
294294
#else
295295
img_sz = it.tlv_end;
296296
#endif
297-
BOOT_LOG_DBG("bootutil_img_validate: TLV off %u, end %u", it.tlv_off, it.tlv_end);
297+
BOOT_LOG_DBG("bootutil_img_validate: TLV off %" PRIu32 ", end %" PRIu32,
298+
it.tlv_off, it.tlv_end);
298299

299300
if (img_sz > bootutil_max_image_size(state, fap)) {
300301
rc = -1;

boot/bootutil/src/tlv.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*/
2020

2121
#include <stddef.h>
22+
#include <inttypes.h>
2223

2324
#include "bootutil/bootutil.h"
2425
#include "bootutil/bootutil_log.h"
@@ -113,7 +114,8 @@ bootutil_tlv_iter_next(struct image_tlv_iter *it, uint32_t *off, uint16_t *len,
113114
return -1;
114115
}
115116

116-
BOOT_LOG_DBG("bootutil_tlv_iter_next: searching for %d (%d is any) starting at %d ending at %d",
117+
BOOT_LOG_DBG("bootutil_tlv_iter_next: searching for %d (%d is any) "
118+
"starting at %" PRIu32 " ending at %" PRIu32,
117119
it->type, IMAGE_TLV_ANY, it->tlv_off, it->tlv_end);
118120

119121
while (it->tlv_off < it->tlv_end) {
@@ -123,7 +125,8 @@ bootutil_tlv_iter_next(struct image_tlv_iter *it, uint32_t *off, uint16_t *len,
123125

124126
rc = LOAD_IMAGE_DATA(it->hdr, it->fap, it->tlv_off, &tlv, sizeof tlv);
125127
if (rc) {
126-
BOOT_LOG_DBG("bootutil_tlv_iter_next: load failed with %d for %p %d",
128+
BOOT_LOG_DBG("bootutil_tlv_iter_next: load failed with %d for %p "
129+
"%" PRIu32,
127130
rc, it->fap, it->tlv_off);
128131
return -1;
129132
}
@@ -141,7 +144,8 @@ bootutil_tlv_iter_next(struct image_tlv_iter *it, uint32_t *off, uint16_t *len,
141144
*off = it->tlv_off + sizeof(tlv);
142145
*len = tlv.it_len;
143146
it->tlv_off += sizeof(tlv) + tlv.it_len;
144-
BOOT_LOG_DBG("bootutil_tlv_iter_next: TLV %d found at %d (size %d)",
147+
BOOT_LOG_DBG("bootutil_tlv_iter_next: TLV %d found at %" PRIu32
148+
" (size %d)",
145149
tlv.it_type, *off, *len);
146150
return 0;
147151
}

0 commit comments

Comments
 (0)