Build: Put CONFIG_TFM_ENABLE_MEMORY_PROTECT flag to platform

The flag "CONFIG_TFM_ENABLE_MEMORY_PROTECT" is a platform-scope
option, move it to platform_s target.
Remove the isolation setup in library SPM code and reuse the one
of SPM HAL, since they are doing the same things.

Change-Id: I5766ddecc525ee2eda3f2e5989b31dd5c41fde6b
Signed-off-by: Mingyang Sun <mingyang.sun@arm.com>
diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt
index 37ecfbc..f68396d 100644
--- a/interface/CMakeLists.txt
+++ b/interface/CMakeLists.txt
@@ -45,7 +45,6 @@
         $<$<BOOL:${TFM_NS_CLIENT_IDENTIFICATION}>:TFM_NS_CLIENT_IDENTIFICATION>
         $<$<BOOL:${CONFIG_TFM_ENABLE_CTX_MGMT}>:CONFIG_TFM_ENABLE_CTX_MGMT>
         $<$<BOOL:${TFM_ISOLATION_LEVEL}>:TFM_LVL=${TFM_ISOLATION_LEVEL}>
-        $<$<OR:$<VERSION_GREATER:${TFM_ISOLATION_LEVEL},1>,$<STREQUAL:"${TEST_PSA_API}","IPC">>:CONFIG_TFM_ENABLE_MEMORY_PROTECT>
         $<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:TFM_MULTI_CORE_TOPOLOGY>
         $<$<BOOL:${TFM_MULTI_CORE_MULTI_CLIENT_CALL}>:TFM_MULTI_CORE_MULTI_CLIENT_CALL>
         $<$<BOOL:${FORWARD_PROT_MSG}>:FORWARD_PROT_MSG=${FORWARD_PROT_MSG}>
diff --git a/platform/CMakeLists.txt b/platform/CMakeLists.txt
index 6cd9bef..85f2c38 100755
--- a/platform/CMakeLists.txt
+++ b/platform/CMakeLists.txt
@@ -66,6 +66,7 @@
         TFM_SPM_LOG_LEVEL=${TFM_SPM_LOG_LEVEL}
     PRIVATE
         $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION>
+        $<$<OR:$<VERSION_GREATER:${TFM_ISOLATION_LEVEL},1>,$<STREQUAL:"${TEST_PSA_API}","IPC">>:CONFIG_TFM_ENABLE_MEMORY_PROTECT>
 )
 
 #========================= Platform Non-Secure ================================#
diff --git a/secure_fw/spm/cmsis_func/main.c b/secure_fw/spm/cmsis_func/main.c
index 304739d..2dde940 100644
--- a/secure_fw/spm/cmsis_func/main.c
+++ b/secure_fw/spm/cmsis_func/main.c
@@ -9,6 +9,7 @@
 #include "common/tfm_boot_data.h"
 #include "region.h"
 #include "spm_func.h"
+#include "tfm_hal_defs.h"
 #include "tfm_hal_platform.h"
 #include "tfm_irq_list.h"
 #include "tfm_nspm.h"
@@ -61,8 +62,8 @@
      * Access to any peripheral should be performed after programming
      * the necessary security components such as PPC/SAU.
      */
-    plat_err = tfm_spm_hal_init_isolation_hw();
-    if (plat_err != TFM_PLAT_ERR_SUCCESS) {
+    hal_status = tfm_hal_set_up_static_boundaries();
+    if (hal_status != TFM_HAL_SUCCESS) {
         return TFM_ERROR_GENERIC;
     }
 
@@ -135,12 +136,6 @@
         tfm_core_panic();
     }
 
-#ifdef CONFIG_TFM_ENABLE_MEMORY_PROTECT
-    if (tfm_spm_hal_setup_isolation_hw() != TFM_PLAT_ERR_SUCCESS) {
-        tfm_core_panic();
-    }
-#endif /* CONFIG_TFM_ENABLE_MEMORY_PROTECT */
-
     tfm_spm_partition_set_state(TFM_SP_CORE_ID, SPM_PARTITION_STATE_RUNNING);
 
     REGION_DECLARE(Image$$, ARM_LIB_STACK, $$ZI$$Base)[];