Build: Combine compile time MCUBoot switches

Remove multiple compile time MCUBoot switches and combine their
functionality into the 'MCUBOOT_UPGRADE_STRATEGY' switch.

Change-Id: Ibed68983ca0e2ed3c291d56514e8ad93ac0dbeba
Signed-off-by: David Vincze <david.vincze@arm.com>
diff --git a/platform/ext/Mps2AN519.cmake b/platform/ext/Mps2AN519.cmake
index 9d3c612..e392047 100644
--- a/platform/ext/Mps2AN519.cmake
+++ b/platform/ext/Mps2AN519.cmake
@@ -38,6 +38,9 @@
 
 if (BL2)
   set (BL2_LINKER_CONFIG ${BL2_SCATTER_FILE_NAME})
+  if (${MCUBOOT_UPGRADE_STRATEGY} STREQUAL "RAM_LOADING")
+      message(FATAL_ERROR "ERROR: RAM_LOADING upgrade strategy is not supported on target '${TARGET_PLATFORM}'.")
+  endif()
 endif()
 
 embedded_include_directories(PATH "${PLATFORM_DIR}/cmsis" ABSOLUTE)
@@ -166,10 +169,6 @@
   embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an519/cmsis_drivers" ABSOLUTE)
 endif()
 
-if (MCUBOOT_RAM_LOADING)
-	message (FATAL_ERROR "MCUBOOT_RAM_LOADING is not supported on " ${TARGET_PLATFORM})
-endif()
-
 if (NOT DEFINED BUILD_BOOT_SEED)
   message(FATAL_ERROR "Configuration variable BUILD_BOOT_SEED (true|false) is undefined!")
 elseif(BUILD_BOOT_SEED)
diff --git a/platform/ext/Mps2AN521.cmake b/platform/ext/Mps2AN521.cmake
index 80fe871..413bb1c 100644
--- a/platform/ext/Mps2AN521.cmake
+++ b/platform/ext/Mps2AN521.cmake
@@ -39,6 +39,9 @@
 
 if (BL2)
   set (BL2_LINKER_CONFIG ${BL2_SCATTER_FILE_NAME})
+  if (${MCUBOOT_UPGRADE_STRATEGY} STREQUAL "RAM_LOADING")
+      message(FATAL_ERROR "ERROR: RAM_LOADING upgrade strategy is not supported on target '${TARGET_PLATFORM}'.")
+  endif()
 endif()
 
 embedded_include_directories(PATH "${PLATFORM_DIR}/cmsis" ABSOLUTE)
@@ -167,10 +170,6 @@
   embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers" ABSOLUTE)
 endif()
 
-if (MCUBOOT_RAM_LOADING)
-	message (FATAL_ERROR "MCUBOOT_RAM_LOADING is not supported on " ${TARGET_PLATFORM})
-endif()
-
 if (NOT DEFINED BUILD_BOOT_SEED)
   message(FATAL_ERROR "Configuration variable BUILD_BOOT_SEED (true|false) is undefined!")
 elseif(BUILD_BOOT_SEED)
diff --git a/platform/ext/musca_a.cmake b/platform/ext/musca_a.cmake
index f3bd20d..b0d0e0a 100644
--- a/platform/ext/musca_a.cmake
+++ b/platform/ext/musca_a.cmake
@@ -168,17 +168,14 @@
 endif()
 
 if (NOT BL2)
-	message(STATUS "WARNING: BL2 is mandatory on target \"${TARGET_PLATFORM}\" Your choice was override.")
-	set(BL2 True)
-endif()
-
-if (NOT MCUBOOT_RAM_LOADING)
-	message(STATUS "WARNING: MCUBOOT_RAM_LOADING is mandatory on target \"${TARGET_PLATFORM}\" Your choice was override.")
-	set(MCUBOOT_RAM_LOADING True)
-endif()
-
-if (MCUBOOT_NO_SWAP)
-	message (FATAL_ERROR "MCUBOOT_NO_SWAP configuration is not supported on " ${TARGET_PLATFORM})
+    message(WARNING "BL2 is mandatory on target '${TARGET_PLATFORM}'. Your choice was overriden.")
+    set(BL2 True)
+    set(MCUBOOT_UPGRADE_STRATEGY "RAM_LOADING")
+else() #BL2 is True
+    if (NOT ${MCUBOOT_UPGRADE_STRATEGY} STREQUAL "RAM_LOADING")
+        message(WARNING "RAM_LOADING upgrade strategy is mandatory on target '${TARGET_PLATFORM}'. Your choice was overriden.")
+        set(MCUBOOT_UPGRADE_STRATEGY "RAM_LOADING")
+    endif()
 endif()
 
 if (NOT DEFINED BUILD_BOOT_SEED)
diff --git a/platform/ext/musca_b1.cmake b/platform/ext/musca_b1.cmake
index 3b63df3..28452dd 100644
--- a/platform/ext/musca_b1.cmake
+++ b/platform/ext/musca_b1.cmake
@@ -38,6 +38,10 @@
 
 if (BL2)
     set(BL2_LINKER_CONFIG ${BL2_SCATTER_FILE_NAME})
+    if (NOT ${MCUBOOT_UPGRADE_STRATEGY} STREQUAL "NO_SWAP")
+        message(WARNING "NO_SWAP upgrade strategy is mandatory on target '${TARGET_PLATFORM}'. Your choice was overriden.")
+        set(MCUBOOT_UPGRADE_STRATEGY "NO_SWAP")
+    endif()
 endif()
 
 embedded_include_directories(PATH "${PLATFORM_DIR}/cmsis" ABSOLUTE)
@@ -164,10 +168,6 @@
     embedded_include_directories(PATH "${PLATFORM_DIR}/driver" ABSOLUTE)
 endif()
 
-if (MCUBOOT_RAM_LOADING)
-    message(FATAL_ERROR "MCUBOOT_RAM_LOADING is not supported on " ${TARGET_PLATFORM})
-endif()
-
 if (NOT DEFINED BUILD_BOOT_SEED)
   message(FATAL_ERROR "Configuration variable BUILD_BOOT_SEED (true|false) is undefined!")
 elseif(BUILD_BOOT_SEED)