Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions subsys/dfu/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ config IMG_BLOCK_BUF_SIZE
Size (in Bytes) of buffer for image writer. Must be a multiple of
the access alignment required by used flash driver.

config SYS_LOG_IMG_MANAGER_LEVEL
config LOG_IMG_MANAGER_LEVEL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I would prefer IMG_MANAGER_LOG_LEVEL.

int "Image manager Log level"
depends on SYS_LOG && MCUBOOT_IMG_MANAGER
depends on LOG && MCUBOOT_IMG_MANAGER
default 0
range 0 4
help
Expand All @@ -50,11 +50,11 @@ config SYS_LOG_IMG_MANAGER_LEVEL

- 0 OFF: do not write

- 1 ERROR: only write SYS_LOG_ERR
- 1 ERROR: only write LOG_ERR

- 2 WARNING: write SYS_LOG_WRN in addition to previous level
- 2 WARNING: write LOG_WRN in addition to previous level

- 3 INFO: write SYS_LOG_INF in addition to previous levels
- 3 INFO: write LOG_INF in addition to previous levels

- 4 DEBUG: write SYS_LOG_DBG in addition to previous levels
- 4 DEBUG: write LOG_DBG in addition to previous levels
endmenu
25 changes: 13 additions & 12 deletions subsys/dfu/img_util/flash_img.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
* SPDX-License-Identifier: Apache-2.0
*/

#define SYS_LOG_DOMAIN "fota/flash_block"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_IMG_MANAGER_LEVEL
#include <logging/sys_log.h>
#define LOG_MODULE_NAME fota_flash_block
#define LOG_LEVEL CONFIG_LOG_IMG_MANAGER_LEVEL
#include <logging/log.h>
LOG_MODULE_REGISTER();

#include <zephyr/types.h>
#include <stddef.h>
Expand All @@ -34,15 +35,15 @@ static bool flash_verify(struct device *dev, off_t offset,
size = (len >= sizeof(temp)) ? sizeof(temp) : len;
rc = flash_read(dev, offset, &temp, size);
if (rc) {
SYS_LOG_ERR("flash_read error %d offset=0x%08"PRIx32,
rc, offset);
LOG_ERR("flash_read error %d offset=0x%08"PRIx32,
rc, offset);
break;
}

if (memcmp(data, &temp, size)) {
SYS_LOG_ERR("offset=0x%08"PRIx32" VERIFY FAIL. "
"expected: 0x%08x, actual: 0x%08x",
offset, temp, *(__packed u32_t*)data);
LOG_ERR("offset=0x%08"PRIx32" VERIFY FAIL. "
"expected: 0x%08x, actual: 0x%08x",
offset, temp, *(__packed u32_t*)data);
break;
}
len -= size;
Expand Down Expand Up @@ -70,8 +71,8 @@ static int flash_block_write(struct flash_img_context *ctx, off_t offset,
ctx->buf, CONFIG_IMG_BLOCK_BUF_SIZE);
flash_write_protection_set(ctx->dev, true);
if (rc) {
SYS_LOG_ERR("flash_write error %d offset=0x%08"PRIx32,
rc, offset + ctx->bytes_written);
LOG_ERR("flash_write error %d offset=0x%08"PRIx32,
rc, offset + ctx->bytes_written);
return rc;
}

Expand Down Expand Up @@ -102,8 +103,8 @@ static int flash_block_write(struct flash_img_context *ctx, off_t offset,
ctx->buf, CONFIG_IMG_BLOCK_BUF_SIZE);
flash_write_protection_set(ctx->dev, true);
if (rc) {
SYS_LOG_ERR("flash_write error %d offset=0x%08"PRIx32,
rc, offset + ctx->bytes_written);
LOG_ERR("flash_write error %d offset=0x%08"PRIx32,
rc, offset + ctx->bytes_written);
return rc;
}

Expand Down