From 809b0e42feed3419686023a25168088312115f30 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 23 Aug 2024 06:57:41 +0100 Subject: [PATCH] bootutil: Add better mode selection checks Improves the mode selection checks to prevent selecting multiple conflicting modes as has been seen in TFM Signed-off-by: Jamie McCrae (cherry picked from commit 43a49a3b92055f518e4bad9e58e6ce63552a692b) --- boot/bootutil/src/bootutil_priv.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/boot/bootutil/src/bootutil_priv.h b/boot/bootutil/src/bootutil_priv.h index 32f996e7..208d189b 100644 --- a/boot/bootutil/src/bootutil_priv.h +++ b/boot/bootutil/src/bootutil_priv.h @@ -58,10 +58,16 @@ struct flash_area; defined(MCUBOOT_SWAP_USING_MOVE) + \ defined(MCUBOOT_DIRECT_XIP) + \ defined(MCUBOOT_RAM_LOAD) + \ - defined(MCUBOOT_FIRMWARE_LOADER)) > 1 + defined(MCUBOOT_FIRMWARE_LOADER) + \ + defined(MCUBOOT_SWAP_USING_SCRATCH)) > 1 #error "Please enable only one of MCUBOOT_OVERWRITE_ONLY, MCUBOOT_SWAP_USING_MOVE, MCUBOOT_DIRECT_XIP, MCUBOOT_RAM_LOAD or MCUBOOT_FIRMWARE_LOADER" #endif +#if !defined(MCUBOOT_DIRECT_XIP) && \ + defined(MCUBOOT_DIRECT_XIP_REVERT) +#error "MCUBOOT_DIRECT_XIP_REVERT cannot be enabled unless MCUBOOT_DIRECT_XIP is used" +#endif + #if !defined(MCUBOOT_OVERWRITE_ONLY) && \ !defined(MCUBOOT_SWAP_USING_MOVE) && \ !defined(MCUBOOT_DIRECT_XIP) && \