subsys: dfu: img_util: Fix warning with ERR log

GCC complains because of wrong format. commit based on #7412

Signed-off-by: Ismael Fillonneau <ismael.fillonneau@stimio.fr>
This commit is contained in:
Ismael Fillonneau 2018-06-27 15:33:59 +02:00 committed by Anas Nashif
commit 4535b9443d

View file

@ -17,6 +17,7 @@
#include <flash.h> #include <flash.h>
#include <board.h> #include <board.h>
#include <dfu/flash_img.h> #include <dfu/flash_img.h>
#include <inttypes.h>
BUILD_ASSERT_MSG((CONFIG_IMG_BLOCK_BUF_SIZE % FLASH_WRITE_BLOCK_SIZE == 0), BUILD_ASSERT_MSG((CONFIG_IMG_BLOCK_BUF_SIZE % FLASH_WRITE_BLOCK_SIZE == 0),
"CONFIG_IMG_BLOCK_BUF_SIZE is not a multiple of " "CONFIG_IMG_BLOCK_BUF_SIZE is not a multiple of "
@ -33,13 +34,13 @@ static bool flash_verify(struct device *dev, off_t offset,
size = (len >= sizeof(temp)) ? sizeof(temp) : len; size = (len >= sizeof(temp)) ? sizeof(temp) : len;
rc = flash_read(dev, offset, &temp, size); rc = flash_read(dev, offset, &temp, size);
if (rc) { if (rc) {
SYS_LOG_ERR("flash_read error %d offset=0x%08x", SYS_LOG_ERR("flash_read error %d offset=0x%08"PRIx32,
rc, offset); rc, offset);
break; break;
} }
if (memcmp(data, &temp, size)) { if (memcmp(data, &temp, size)) {
SYS_LOG_ERR("offset=0x%08x VERIFY FAIL. " SYS_LOG_ERR("offset=0x%08"PRIx32" VERIFY FAIL. "
"expected: 0x%08x, actual: 0x%08x", "expected: 0x%08x, actual: 0x%08x",
offset, temp, *(__packed u32_t*)data); offset, temp, *(__packed u32_t*)data);
break; break;
@ -69,7 +70,7 @@ static int flash_block_write(struct flash_img_context *ctx, off_t offset,
ctx->buf, CONFIG_IMG_BLOCK_BUF_SIZE); ctx->buf, CONFIG_IMG_BLOCK_BUF_SIZE);
flash_write_protection_set(ctx->dev, true); flash_write_protection_set(ctx->dev, true);
if (rc) { if (rc) {
SYS_LOG_ERR("flash_write error %d offset=0x%08x", SYS_LOG_ERR("flash_write error %d offset=0x%08"PRIx32,
rc, offset + ctx->bytes_written); rc, offset + ctx->bytes_written);
return rc; return rc;
} }
@ -101,7 +102,7 @@ static int flash_block_write(struct flash_img_context *ctx, off_t offset,
ctx->buf, CONFIG_IMG_BLOCK_BUF_SIZE); ctx->buf, CONFIG_IMG_BLOCK_BUF_SIZE);
flash_write_protection_set(ctx->dev, true); flash_write_protection_set(ctx->dev, true);
if (rc) { if (rc) {
SYS_LOG_ERR("flash_write error %d offset=0x%08x", SYS_LOG_ERR("flash_write error %d offset=0x%08"PRIx32,
rc, offset + ctx->bytes_written); rc, offset + ctx->bytes_written);
return rc; return rc;
} }