Build: Align with tf-m-tests app build change
Specify tfm_api_ns/platform_ns target sources and includes.
Only add common files and files exported by TF-M secure build.
Leave others to NS builds.
Other minor changes to align with tf-m-tests app_broker build change.
Change-Id: I50056339494f626d22e000af0407055273fc4ad5
Signed-off-by: David Hu <david.hu@arm.com>
diff --git a/cmake/spe-CMakeLists.cmake b/cmake/spe-CMakeLists.cmake
index 3402ba3..1c56338 100644
--- a/cmake/spe-CMakeLists.cmake
+++ b/cmake/spe-CMakeLists.cmake
@@ -16,21 +16,36 @@
set_target_properties(tfm_config psa_interface PROPERTIES IMPORTED_GLOBAL True)
target_link_libraries(tfm_config INTERFACE psa_interface)
-add_library(tfm_api_ns)
+# In actual NS integration, NS side build should include the source files
+# exported by TF-M build.
+set(INTERFACE_SRC_DIR ${CMAKE_CURRENT_LIST_DIR}/interface/src)
+set(INTERFACE_INC_DIR ${CMAKE_CURRENT_LIST_DIR}/interface/include)
-file(GLOB spe_sources "interface/src/*.c")
+add_library(tfm_api_ns STATIC)
target_sources(tfm_api_ns
PRIVATE
- ${spe_sources}
- # NS specific implementation of NS interface dispatcher
- $<$<BOOL:${CONFIG_TFM_USE_TRUSTZONE}>:interface/src/os_wrapper/tfm_ns_interface_rtos.c>
+ $<$<BOOL:${TFM_PARTITION_PLATFORM}>:${INTERFACE_SRC_DIR}/tfm_platform_api.c>
+ $<$<BOOL:${TFM_PARTITION_PROTECTED_STORAGE}>:${INTERFACE_SRC_DIR}/tfm_ps_api.c>
+ $<$<BOOL:${TFM_PARTITION_INTERNAL_TRUSTED_STORAGE}>:${INTERFACE_SRC_DIR}/tfm_its_api.c>
+ $<$<BOOL:${TFM_PARTITION_CRYPTO}>:${INTERFACE_SRC_DIR}/tfm_crypto_api.c>
+ $<$<BOOL:${TFM_PARTITION_INITIAL_ATTESTATION}>:${INTERFACE_SRC_DIR}/tfm_attest_api.c>
+ $<$<BOOL:${TFM_PARTITION_FIRMWARE_UPDATE}>:${INTERFACE_SRC_DIR}/tfm_fwu_api.c>
)
+target_sources(tfm_api_ns
+ PRIVATE
+ $<$<BOOL:${TFM_PARTITION_NS_AGENT_MAILBOX}>:${INTERFACE_SRC_DIR}/multi_core/tfm_multi_core_ns_api.c>
+ $<$<BOOL:${TFM_PARTITION_NS_AGENT_MAILBOX}>:${INTERFACE_SRC_DIR}/multi_core/tfm_multi_core_psa_ns_api.c>
+ $<$<BOOL:${CONFIG_TFM_USE_TRUSTZONE}>:${INTERFACE_SRC_DIR}/tfm_psa_ns_api.c>
+)
+
+# Include interface headers exported by TF-M
target_include_directories(tfm_api_ns
PUBLIC
- interface/include
- interface/include/crypto_keys
+ ${INTERFACE_INC_DIR}
+ ${INTERFACE_INC_DIR}/crypto_keys
+ $<$<BOOL:${TFM_PARTITION_NS_AGENT_MAILBOX}>:${INTERFACE_INC_DIR}/multi_core>
)
add_library(platform_region_defs INTERFACE)
@@ -55,6 +70,11 @@
add_subdirectory(platform)
+target_sources(platform_ns
+ PRIVATE
+ $<$<BOOL:${PLATFORM_DEFAULT_UART_STDOUT}>:${CMAKE_CURRENT_SOURCE_DIR}/platform/ext/common/uart_stdout.c>
+)
+
target_link_libraries(tfm_api_ns
PUBLIC
platform_region_defs
diff --git a/config/spe_config.cmake.in b/config/spe_config.cmake.in
index 9a0f1ed..1ad677e 100644
--- a/config/spe_config.cmake.in
+++ b/config/spe_config.cmake.in
@@ -47,13 +47,15 @@
set(CONFIG_TFM_SPM_BACKEND @CONFIG_TFM_SPM_BACKEND@ CACHE STRING "The SPM backend")
set(TFM_MULTI_CORE_TOPOLOGY @TFM_MULTI_CORE_TOPOLOGY@ CACHE BOOL "Platform has multi core")
set(TFM_PARTITION_NS_AGENT_MAILBOX @TFM_PARTITION_NS_AGENT_MAILBOX@ CACHE BOOL "Enable the Mailbox agents")
-set(PLATFORM_DEFAULT_CRYPTO_KEYS @PLATFORM_DEFAULT_CRYPTO_KEYS@ CACHE BOOL "Use the default crypto keys")
set(PSA_FRAMEWORK_HAS_MM_IOVEC @PSA_FRAMEWORK_HAS_MM_IOVEC@ CACHE BOOL "Enable the MM-IOVEC feature")
set(TFM_ISOLATION_LEVEL @TFM_ISOLATION_LEVEL@ CACHE STRING "The TFM isolation level")
#set(TFM_MULTI_CORE_NS_OS @TFM_MULTI_CORE_NS_OS@)
#set(TFM_MULTI_CORE_NS_OS_MAILBOX_THREAD @TFM_MULTI_CORE_NS_OS_MAILBOX_THREAD@)
+set(PLATFORM_DEFAULT_CRYPTO_KEYS @PLATFORM_DEFAULT_CRYPTO_KEYS@ CACHE BOOL "Use the default crypto keys")
+set(PLATFORM_DEFAULT_UART_STDOUT @PLATFORM_DEFAULT_UART_STDOUT@ CACHE BOOL "Use default uart stdout implementation.")
+
# Testing related options.
set(TEST_PSA_API "@TEST_PSA_API@" CACHE STRING "Which (if any) of the PSA API tests should be compiled")
diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt
index 8dfdd73..3421566 100644
--- a/interface/CMakeLists.txt
+++ b/interface/CMakeLists.txt
@@ -40,6 +40,7 @@
$<$<BOOL:${CONFIG_TFM_USE_TRUSTZONE}>:CONFIG_TFM_USE_TRUSTZONE>
$<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:TFM_MULTI_CORE_TOPOLOGY>
$<$<BOOL:${CONFIG_TFM_PARTITION_META}>:CONFIG_TFM_PARTITION_META>
+ $<$<BOOL:${TEST_NS_MULTI_CORE}>:TFM_MULTI_CORE_TEST>
)
###################### PSA api (S lib) #########################################