From 098de833d5729abf009a22ca174067bd4a6be686 Mon Sep 17 00:00:00 2001 From: David Brown Date: Tue, 10 Dec 2019 11:58:01 -0700 Subject: [PATCH] boot: Clean up errors during sim test There are a few error messages printed by the boot code. In a normal platform, these are real errors, and really should print a message. However, in the simulator, we intentionally create these scenarios, and these errors only serve to distract from the rest of the test output. Conditionalize the error prints based on whether we are running in the simulator. Signed-off-by: David Brown --- boot/bootutil/src/loader.c | 2 ++ boot/bootutil/src/swap_move.c | 2 ++ boot/bootutil/src/swap_scratch.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/boot/bootutil/src/loader.c b/boot/bootutil/src/loader.c index 36ea7542..6dee2991 100644 --- a/boot/bootutil/src/loader.c +++ b/boot/bootutil/src/loader.c @@ -538,8 +538,10 @@ boot_validate_slot(struct boot_loader_state *state, int slot, * continue booting from the primary slot. */ } +#if !defined(__BOOTSIM__) BOOT_LOG_ERR("Image in the %s slot is not valid!", (slot == BOOT_PRIMARY_SLOT) ? "primary" : "secondary"); +#endif rc = -1; goto out; } diff --git a/boot/bootutil/src/swap_move.c b/boot/bootutil/src/swap_move.c index ab17b70b..ed21774e 100644 --- a/boot/bootutil/src/swap_move.c +++ b/boot/bootutil/src/swap_move.c @@ -162,7 +162,9 @@ swap_read_status_bytes(const struct flash_area *fap, /* This means there was an error writing status on the last * swap. Tell user and move on to validation! */ +#if !defined(__BOOTSIM__) BOOT_LOG_ERR("Detected inconsistent status!"); +#endif #if !defined(MCUBOOT_VALIDATE_PRIMARY_SLOT) /* With validation of the primary slot disabled, there is no way diff --git a/boot/bootutil/src/swap_scratch.c b/boot/bootutil/src/swap_scratch.c index 588bd288..8dc7ce0f 100644 --- a/boot/bootutil/src/swap_scratch.c +++ b/boot/bootutil/src/swap_scratch.c @@ -130,7 +130,9 @@ swap_read_status_bytes(const struct flash_area *fap, /* This means there was an error writing status on the last * swap. Tell user and move on to validation! */ +#if !defined(__BOOTSIM__) BOOT_LOG_ERR("Detected inconsistent status!"); +#endif #if !defined(MCUBOOT_VALIDATE_PRIMARY_SLOT) /* With validation of the primary slot disabled, there is no way