Build: Move more config steps to post_config.cmake

Move config steps that are shared between Kconfig system and CMake
system to post_config.cmake.

Change-Id: Ia6d39c0b6bcfb3bdcc07ea14d408229555722aa0
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
diff --git a/config/config_base.cmake b/config/config_base.cmake
index d50d7b8..a51728a 100755
--- a/config/config_base.cmake
+++ b/config/config_base.cmake
@@ -72,9 +72,6 @@
 set(TFM_EXTRA_GENERATED_FILE_LIST_PATH  ""          CACHE PATH      "Path to extra generated file list. Appended to stardard TFM generated file list.")
 set(TFM_EXTRA_PARTITION_PATHS           ""          CACHE PATH      "List of extra Secure Partitions directories. An extra Secure Parition folder contains source code, CMakeLists.txt and manifest files")
 
-set(TFM_SPM_LOG_LEVEL                   TFM_SPM_LOG_LEVEL_SILENCE       CACHE STRING    "Set default SPM log level as INFO level")
-set(TFM_PARTITION_LOG_LEVEL             TFM_PARTITION_LOG_LEVEL_SILENCE   CACHE STRING    "Set default Secure Partition log level as INFO level")
-
 set(TFM_CODE_SHARING                    OFF         CACHE PATH      "Enable code sharing between MCUboot and secure firmware")
 set(CONFIG_TFM_BOOT_STORE_MEASUREMENTS  ON          CACHE BOOL      "Store measurement values from all the boot stages. Used for initial attestation token.")
 set(CONFIG_TFM_BOOT_STORE_ENCODED_MEASUREMENTS  ON  CACHE BOOL      "Enable storing of encoded measurements in boot.")
diff --git a/config/kconfig.cmake b/config/kconfig.cmake
index 02707dd..73f1696 100644
--- a/config/kconfig.cmake
+++ b/config/kconfig.cmake
@@ -276,16 +276,3 @@
 
 # Load project cmake configs generated by tfm_kconfig.py
 include(${KCONFIG_OUTPUT_DIR}/project_config.cmake)
-
-####################################################################################################
-
-# The Kconfig system does not cover all the config options for the time being.
-# So part of them still use the CMake config system.
-
-# Load regression configs overrided by platform
-if(EXISTS ${TARGET_PLATFORM_PATH}/reg_config_override.cmake)
-    include(${TARGET_PLATFORM_PATH}/reg_config_override.cmake)
-endif()
-
-# Load defaults, setting options not already set
-include(config/config_base.cmake)
diff --git a/config/post_config.cmake b/config/post_config.cmake
index 9925e1e..6872820 100644
--- a/config/post_config.cmake
+++ b/config/post_config.cmake
@@ -5,6 +5,14 @@
 #
 #-------------------------------------------------------------------------------
 
+# Load defaults, setting options not already set
+include(config/config_base.cmake)
+
+# Load regression configs overrided by platform
+if(EXISTS ${TARGET_PLATFORM_PATH}/reg_config_override.cmake)
+    include(${TARGET_PLATFORM_PATH}/reg_config_override.cmake)
+endif()
+
 # Fetch tf-m-tests repo during config, if NS or regression test is required.
 # Therefore tf-m-tests configs can be set with TF-M configs since their configs
 # are coupled.
diff --git a/config/set_config.cmake b/config/set_config.cmake
index 015349f..3966eb4 100644
--- a/config/set_config.cmake
+++ b/config/set_config.cmake
@@ -77,9 +77,6 @@
 # Include coprocessor configs
 include(config/cp_config_default.cmake)
 
-# Load defaults, setting options not already set
-include(config/config_base.cmake)
-
 # Set secure log configs
 # It also depends on regression test config.
 include(config/tfm_secure_log.cmake)
diff --git a/config/tfm_secure_log.cmake b/config/tfm_secure_log.cmake
index 48ca1d6..064b885 100644
--- a/config/tfm_secure_log.cmake
+++ b/config/tfm_secure_log.cmake
@@ -5,6 +5,9 @@
 #
 #-------------------------------------------------------------------------------
 
+set(TFM_SPM_LOG_LEVEL           TFM_SPM_LOG_LEVEL_SILENCE       CACHE STRING    "Set default SPM log level as INFO level")
+set(TFM_PARTITION_LOG_LEVEL     TFM_PARTITION_LOG_LEVEL_SILENCE   CACHE STRING    "Set default Secure Partition log level as INFO level")
+
 # Secure regression tests also require SP log function
 # Enable SP log raw dump when SP log level is higher than silence or TF-M
 # regression test is enabled.
diff --git a/lib/ext/tf-m-tests/reg_parse.cmake b/lib/ext/tf-m-tests/reg_parse.cmake
index eb56e3e..e3e9b64 100644
--- a/lib/ext/tf-m-tests/reg_parse.cmake
+++ b/lib/ext/tf-m-tests/reg_parse.cmake
@@ -43,8 +43,3 @@
 if (EXTRA_S_TEST_SUITE_PATH)
     set(TFM_S_REG_TEST ON)
 endif()
-
-# Load regression configs overrided by platform
-if (EXISTS ${TARGET_PLATFORM_PATH}/reg_config_override.cmake)
-    include(${TARGET_PLATFORM_PATH}/reg_config_override.cmake)
-endif()