-
Notifications
You must be signed in to change notification settings - Fork 757
Additional dbg logging in MCUboot to allow easier finding of reason for image validation failure #2308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
283c6f5
to
f183240
Compare
f183240
to
bd265d2
Compare
boot/bootutil/src/bootutil_public.c
Outdated
@@ -783,6 +799,7 @@ boot_image_load_header(const struct flash_area *fa_p, | |||
|
|||
if (!boot_u32_safe_add(&size, hdr->ih_img_size, hdr->ih_hdr_size) || | |||
size >= flash_area_get_size(fa_p)) { | |||
BOOT_LOG_ERR("Incorrect image size"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should log them probably
boot/bootutil/src/encrypted.c
Outdated
@@ -411,6 +414,8 @@ boot_decrypt_key(const uint8_t *buf, uint8_t *enckey) | |||
uint8_t *cpend; | |||
size_t olen; | |||
#endif | |||
|
|||
BOOT_LOG_DBG("boot_decrypt_key:"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing some debug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I have done several of these as a general notification that code has entered specific function.
boot/bootutil/src/image_validate.c
Outdated
@@ -280,6 +287,8 @@ bootutil_find_key(uint8_t *keyhash, uint8_t keyhash_len) | |||
const struct bootutil_key *key; | |||
uint8_t hash[IMAGE_HASH_SIZE]; | |||
|
|||
BOOT_LOG_DBG("bootutil_find_key:"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
likewise here, the : makes it look like there is some expected output but other ones above do not have it when there is nothing to output
boot/bootutil/src/loader.c
Outdated
BOOT_LOG_DBG("boot_version_cmp: ver1 %d.%d.%d vs ver2 %d.%d.%d", | ||
ver1->iv_major, ver1->iv_minor, ver1->iv_revision, | ||
ver2->iv_major, ver2->iv_minor, ver2->iv_revision); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should just log the full versions part if the Kconfig is enabled, having it output in 2 parts is ugly
boot/bootutil/src/loader.c
Outdated
@@ -2340,6 +2357,8 @@ context_boot_go(struct boot_loader_state *state, struct boot_rsp *rsp) | |||
bool has_upgrade; | |||
volatile int fih_cnt; | |||
|
|||
BOOT_LOG_DBG("context_boot_go:"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
boot/bootutil/src/image_validate.c
Outdated
@@ -120,6 +124,7 @@ bootutil_img_hash(struct boot_loader_state *state, | |||
/* Encrypted images only exist in the secondary slot */ | |||
if (MUST_DECRYPT(fap, image_index, hdr) && | |||
!boot_enc_valid(enc_state, 1)) { | |||
BOOT_LOG_DBG("bootutil_img_hash Error: encrypted image found in primary slot"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
: should be before error and error should be lowercase like other instances
boot/bootutil/src/bootutil_public.c
Outdated
@@ -262,6 +264,7 @@ boot_read_swap_state(const struct flash_area *fap, | |||
off = boot_swap_info_off(fap); | |||
rc = flash_area_read(fap, off, &swap_info, sizeof swap_info); | |||
if (rc < 0) { | |||
BOOT_LOG_DBG("boot_read_swap_state: error %d reading state", rc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For all places where code exits with BOOT_EFLASH i would go with BOOT_LOG_ERR()
bd265d2
to
21a6163
Compare
Add additional log lines to allow easier tracking potential failures in image validation. Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Improve logging to make it easier to track image validation failures in development. Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
1609c02
to
a2b1cf2
Compare
24764d9
to
1609c02
Compare
No description provided.