Build: Add SPM log support for platforms

As SPM log functions have implemented, add SPM log support for
all the platforms. Set default TFM_SPM_LOG_LEVEL equal to
TFM_SPM_LOG_LEVEL_INFO.

Change-Id: I4111a9ac3840497a70302bbddb19605f8feafe08
Signed-off-by: Shawn Shan <Shawn.Shan@arm.com>
diff --git a/config/config_default.cmake b/config/config_default.cmake
index afa0922..952ed40 100644
--- a/config/config_default.cmake
+++ b/config/config_default.cmake
@@ -22,6 +22,8 @@
 set(TFM_EXTRA_MANIFEST_LIST_PATH        ""          CACHE PATH      "Path to extra manifest file, used to declare extra partitions. Appended to standard TFM manifest")
 set(TFM_EXTRA_GENERATED_FILE_LIST_PATH  ""          CACHE PATH      "Path to extra generated file list. Appended to stardard TFM generated file list.")
 
+set(TFM_SPM_LOG_LEVEL                   2           CACHE STRING    "Set SPM log level as INFO level")
+
 ########################## BL2 #################################################
 
 set(MCUBOOT_IMAGE_NUMBER                2           CACHE STRING    "Whether to combine S and NS into either 1 image, or sign each seperately")
diff --git a/platform/CMakeLists.txt b/platform/CMakeLists.txt
old mode 100644
new mode 100755
index bf3ea53..04b6e1f
--- a/platform/CMakeLists.txt
+++ b/platform/CMakeLists.txt
@@ -44,6 +44,7 @@
         ext/common/tfm_hal_its.c
         ext/common/tfm_platform.c
         ext/common/uart_stdout.c
+        ext/common/tfm_hal_spm_logdev_peripheral.c
         $<$<BOOL:${PLATFORM_DUMMY_ATTEST_HAL}>:ext/common/template/attest_hal.c>
         $<$<BOOL:${PLATFORM_DUMMY_NV_COUNTERS}>:ext/common/template/nv_counters.c>
         $<$<BOOL:${PLATFORM_DUMMY_CRYPTO_KEYS}>:ext/common/template/crypto_keys.c>
@@ -61,6 +62,8 @@
 )
 
 target_compile_definitions(platform_s
+    PUBLIC
+        TFM_SPM_LOG_LEVEL=${TFM_SPM_LOG_LEVEL}
     PRIVATE
         $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION>
 )
diff --git a/secure_fw/spm/CMakeLists.txt b/secure_fw/spm/CMakeLists.txt
old mode 100644
new mode 100755
index 7f7921c..098e6bd
--- a/secure_fw/spm/CMakeLists.txt
+++ b/secure_fw/spm/CMakeLists.txt
@@ -34,6 +34,7 @@
         $<$<BOOL:${TFM_PARTITION_INITIAL_ATTESTATION}>:common/tfm_boot_data.c>
         common/tfm_core_utils.c
         common/utilities.c
+        common/spm_log.c
         $<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:cmsis_psa/tfm_multi_core.c>
         $<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:cmsis_psa/tfm_multi_core_mem_check.c>
         $<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:cmsis_psa/tfm_rpc.c>