Skip to content

Commit a21fd27

Browse files
de-nordicnordicjm
authored andcommitted
bootutil: Small logging improvements
Add dbg log on failed header validation to boot_validate_slot. Moved error log before code that takes post error actions. Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
1 parent e015209 commit a21fd27

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

boot/bootutil/src/loader.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,7 @@ boot_validate_slot(struct boot_loader_state *state, int slot,
632632
}
633633
#endif
634634
if (!boot_check_header_valid(state, slot)) {
635+
BOOT_LOG_DBG("boot_validate_slot: header validation failed %d", slot);
635636
fih_rc = FIH_FAILURE;
636637
} else {
637638
BOOT_HOOK_CALL_FIH(boot_image_check_hook, FIH_BOOT_HOOK_REGULAR,
@@ -644,16 +645,16 @@ boot_validate_slot(struct boot_loader_state *state, int slot,
644645
check_validity:
645646
#endif
646647
if (FIH_NOT_EQ(fih_rc, FIH_SUCCESS)) {
648+
#if !defined(__BOOTSIM__)
649+
BOOT_LOG_ERR("Image in the %s slot is not valid!",
650+
(slot == BOOT_SLOT_PRIMARY) ? "primary" : "secondary");
651+
#endif
647652
if ((slot != BOOT_SLOT_PRIMARY) || ARE_SLOTS_EQUIVALENT()) {
648653
boot_scramble_slot(fap, slot);
649654
/* Image is invalid, erase it to prevent further unnecessary
650655
* attempts to validate and boot it.
651656
*/
652657
}
653-
#if !defined(__BOOTSIM__)
654-
BOOT_LOG_ERR("Image in the %s slot is not valid!",
655-
(slot == BOOT_SLOT_PRIMARY) ? "primary" : "secondary");
656-
#endif
657658
fih_rc = FIH_NO_BOOTABLE_IMAGE;
658659
goto out;
659660
}

0 commit comments

Comments
 (0)