Build: Simplify TFM_PLATFORM to support platform name only

Current TF-M build requires TFM_PLATFORM to be set as the relative
path to platform/ext/targets. If vendor platform folder structure
is changed, TFM_PLATFORM shall be adjusted accordingly, which may
break the backward combability of build command.

This patch will simplify the TFM_PLATFORM to support platform name
only. For example, -DTFM_PLATFORM=arm/msp2/an521 and
-DTFM_PLATFORM=an521 shall be both accepted.

Signed-off-by: Jianliang Shen <jianliang.shen@arm.com>
Change-Id: I3b03f6dfa88cc1ee8059f7802f717e86676c377d
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 03fe0ba..fb232c0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,20 +11,8 @@
 
 ############################ CONFIGURATION #####################################
 
-if (IS_ABSOLUTE "${TFM_PLATFORM}")
-    file(RELATIVE_PATH TFM_PLATFORM_RELATIVE_PATH
-        "${CMAKE_CURRENT_SOURCE_DIR}/platform/ext/target"
-        ${TFM_PLATFORM})
-    set(TFM_PLATFORM "${TFM_PLATFORM_RELATIVE_PATH}" CACHE STRING "Target platform set as an absolute path." FORCE)
-endif()
-
-# Some compiler flags depend on the CPU / platform config. This include should
-# be run before the toolchain file so the compiler can be configured properly.
-if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload.cmake)
-    Message(FATAL_ERROR "Unsupported TFM_PLATFORM ${TFM_PLATFORM}")
-else()
-    include(platform/ext/target/${TFM_PLATFORM}/preload.cmake)
-endif()
+# Configure TFM_PLATFORM
+include(${CMAKE_SOURCE_DIR}/config/tfm_platform.cmake)
 
 if(TFM_SYSTEM_MVE)
     message(FATAL_ERROR "Hardware MVE is currently not supported in TF-M")