Build: Remove duplicate add_library(platform_ns)
Create a separate "ns" subdirectory of platform, to separate the build
of platform_ns, so that it can use the settings from preload_ns.cmake.
Signed-off-by: Chris Brand <chris.brand@cypress.com>
Change-Id: If814278414f2d2326167862f73bfd54110dbcbf7
diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt
index 0062d56..a38bd9c 100644
--- a/interface/CMakeLists.txt
+++ b/interface/CMakeLists.txt
@@ -22,12 +22,6 @@
tfm_toolchain_reload_compiler()
endif()
-if (TFM_MULTI_CORE_TOPOLOGY)
- # The platform target is created in this directory/file so that it has the
- # same settings as the main ns target.
- add_library(platform_ns STATIC EXCLUDE_FROM_ALL)
-endif()
-
###################### PSA interface (header only) #############################
add_library(psa_interface INTERFACE)
diff --git a/platform/CMakeLists.txt b/platform/CMakeLists.txt
index 74e1d75..c491540 100755
--- a/platform/CMakeLists.txt
+++ b/platform/CMakeLists.txt
@@ -1,5 +1,7 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
+# Copyright (c) 2022 Cypress Semiconductor Corporation (an Infineon company)
+# or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -8,16 +10,12 @@
cmake_policy(SET CMP0076 NEW)
cmake_policy(SET CMP0079 NEW)
+add_subdirectory(ns)
+
add_library(platform_s STATIC)
add_library(platform_region_defs INTERFACE)
add_library(platform_common_interface INTERFACE)
-# under the multicore topology, NS is declared in the same place as the PSA
-# interface so that it picks up the compiler definitions for the NS CPU
-if(NOT TFM_MULTI_CORE_TOPOLOGY)
- add_library(platform_ns STATIC EXCLUDE_FROM_ALL)
-endif()
-
if (BL2)
add_library(platform_bl2 STATIC)
endif()
@@ -112,37 +110,6 @@
${COMPILER_CP_FLAG}
)
-#========================= Platform Non-Secure ================================#
-
-target_sources(platform_ns
- PRIVATE
- $<$<BOOL:${PLATFORM_DEFAULT_UART_STDOUT}>:${CMAKE_CURRENT_SOURCE_DIR}/ext/common/uart_stdout.c>
- $<$<AND:$<NOT:$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>>,$<BOOL:${TEST_NS_ATTESTATION}>>:${CMAKE_CURRENT_SOURCE_DIR}/ext/common/template/tfm_initial_attest_pub_key.c>
-)
-
-target_link_libraries(platform_ns
- PUBLIC
- platform_common_interface
- platform_region_defs
- tfm_ns_interface
-)
-
-target_compile_definitions(platform_ns
- PUBLIC
- # CONFIG_TFM_FP
- $<$<STREQUAL:${CONFIG_TFM_FP},hard>:CONFIG_TFM_FP=2>
- $<$<STREQUAL:${CONFIG_TFM_FP},soft>:CONFIG_TFM_FP=0>
- $<$<BOOL:${TEST_NS_FPU}>:TEST_NS_FPU>
- $<$<BOOL:${CONFIG_TFM_ENABLE_FPU}>:CONFIG_TFM_ENABLE_FPU>
- PRIVATE
- $<$<BOOL:${TEST_NS_SLIH_IRQ}>:TEST_NS_SLIH_IRQ>
-)
-
-target_compile_options(platform_ns
- PUBLIC
- ${COMPILER_CP_FLAG}
-)
-
#========================= Platform BL2 =======================================#
if(BL2)
#TODO import policy
diff --git a/platform/ns/CMakeLists.txt b/platform/ns/CMakeLists.txt
new file mode 100755
index 0000000..aab3796
--- /dev/null
+++ b/platform/ns/CMakeLists.txt
@@ -0,0 +1,47 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
+# Copyright (c) 2022 Cypress Semiconductor Corporation (an Infineon company)
+# or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+cmake_minimum_required(VERSION 3.15)
+cmake_policy(SET CMP0076 NEW)
+cmake_policy(SET CMP0079 NEW)
+
+if (EXISTS ${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake)
+ include(${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake)
+ tfm_toolchain_reload_compiler()
+endif()
+
+add_library(platform_ns STATIC EXCLUDE_FROM_ALL)
+
+target_sources(platform_ns
+ PRIVATE
+ $<$<BOOL:${PLATFORM_DEFAULT_UART_STDOUT}>:${CMAKE_CURRENT_SOURCE_DIR}/../ext/common/uart_stdout.c>
+ $<$<AND:$<NOT:$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>>,$<BOOL:${TEST_NS_ATTESTATION}>>:${CMAKE_CURRENT_SOURCE_DIR}/../ext/common/template/tfm_initial_attest_pub_key.c>
+)
+
+target_link_libraries(platform_ns
+ PUBLIC
+ platform_common_interface
+ platform_region_defs
+ tfm_ns_interface
+)
+
+target_compile_definitions(platform_ns
+ PUBLIC
+ # CONFIG_TFM_FP
+ $<$<STREQUAL:${CONFIG_TFM_FP},hard>:CONFIG_TFM_FP=2>
+ $<$<STREQUAL:${CONFIG_TFM_FP},soft>:CONFIG_TFM_FP=0>
+ $<$<BOOL:${TEST_NS_FPU}>:TEST_NS_FPU>
+ $<$<BOOL:${CONFIG_TFM_ENABLE_FPU}>:CONFIG_TFM_ENABLE_FPU>
+ PRIVATE
+ $<$<BOOL:${TEST_NS_SLIH_IRQ}>:TEST_NS_SLIH_IRQ>
+)
+
+target_compile_options(platform_ns
+ PUBLIC
+ ${COMPILER_CP_FLAG}
+)