Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
David Hu | 48369db | 2020-12-17 17:31:54 +0800 | [diff] [blame] | 2 | # Copyright (c) 2020-2021, Arm Limited. All rights reserved. |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 8 | cmake_minimum_required(VERSION 3.13) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 9 | project(tfm_ns LANGUAGES ASM C) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 10 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 11 | # For multi-core projects, the NS app can be run on a different CPU to the |
| 12 | # Secure code. To facilitate this, we once again reload the compiler to load the |
| 13 | # setting for the NS CPU. Cmake settings are directory scoped so this affects |
| 14 | # anything loaded from or declared in this dir. |
| 15 | if (TFM_MULTI_CORE_TOPOLOGY) |
| 16 | include(${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake) |
Raef Coles | 34cffa7 | 2020-10-28 10:27:19 +0000 | [diff] [blame] | 17 | tfm_toolchain_reload_compiler() |
David Hu | 402a298 | 2020-12-17 22:31:04 +0800 | [diff] [blame] | 18 | |
| 19 | # Enable TFM_MULTI_CORE_NS_OS when building with tf-m-tests NS App. |
| 20 | set(TFM_MULTI_CORE_NS_OS ON CACHE BOOL "Enable NS RTOS support in NS mailbox") |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 21 | endif() |
| 22 | |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 23 | # In actual NS integration, NS side build should include the source files |
| 24 | # exported by TF-M build. |
| 25 | # Directly include interface folder to simplify the NS build in this demo, since |
| 26 | # install always occurs at the end of build. |
| 27 | set(INTERFACE_SRC_DIR ${CMAKE_SOURCE_DIR}/interface/src) |
| 28 | set(INTERFACE_INC_DIR ${CMAKE_SOURCE_DIR}/interface/include) |
| 29 | |
David Hu | cdc51fb | 2021-04-06 18:10:46 +0800 | [diff] [blame] | 30 | # NS interface implemented by NSPE |
| 31 | set(NS_INTERFACE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../ns_interface) |
| 32 | |
Xinyu Zhang | eebbea3 | 2021-09-01 15:26:39 +0800 | [diff] [blame^] | 33 | # nsid_manager |
| 34 | set(NSID_MGR_DIR ${NS_INTERFACE_DIR}/ns_client_ext) |
| 35 | |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 36 | #################### TF-M NS interface (header only) ########################### |
| 37 | |
| 38 | add_library(tfm_ns_interface INTERFACE) |
| 39 | |
David Hu | cdc51fb | 2021-04-06 18:10:46 +0800 | [diff] [blame] | 40 | # Include interface headers exported by TF-M |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 41 | target_include_directories(tfm_ns_interface |
| 42 | INTERFACE |
| 43 | ${INTERFACE_INC_DIR} |
| 44 | ${CMAKE_BINARY_DIR}/generated/interface/include |
David Hu | 8e68325 | 2020-12-17 18:02:32 +0800 | [diff] [blame] | 45 | $<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:${INTERFACE_INC_DIR}/multi_core> |
David Hu | 98adf32 | 2020-09-01 16:18:46 +0800 | [diff] [blame] | 46 | $<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:${CMAKE_SOURCE_DIR}/platform/ext/cmsis> |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 47 | ) |
| 48 | |
David Hu | cdc51fb | 2021-04-06 18:10:46 +0800 | [diff] [blame] | 49 | # Include NS local interface headers |
| 50 | target_include_directories(tfm_ns_interface |
| 51 | INTERFACE |
| 52 | ${NS_INTERFACE_DIR} |
Xinyu Zhang | eebbea3 | 2021-09-01 15:26:39 +0800 | [diff] [blame^] | 53 | ${NSID_MGR_DIR} |
David Hu | cdc51fb | 2021-04-06 18:10:46 +0800 | [diff] [blame] | 54 | ) |
| 55 | |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 56 | # PSA interface files are generated from a template |
| 57 | add_dependencies(tfm_ns_interface |
| 58 | tfm_generated_files |
| 59 | ) |
| 60 | |
| 61 | # Include selection of Secure Partitions from TF-M build. |
| 62 | # It can be replaced by NS side configurations later. |
| 63 | target_link_libraries(tfm_ns_interface |
| 64 | INTERFACE |
| 65 | tfm_partition_defs |
| 66 | ) |
| 67 | |
| 68 | target_compile_definitions(tfm_ns_interface |
| 69 | INTERFACE |
| 70 | $<$<BOOL:${TFM_PSA_API}>:TFM_PSA_API> |
| 71 | $<$<STREQUAL:${TEST_PSA_API},IPC>:PSA_API_TEST_IPC> |
Xinyu Zhang | eebbea3 | 2021-09-01 15:26:39 +0800 | [diff] [blame^] | 72 | $<$<BOOL:${TFM_NS_MANAGE_NSID}>:TFM_NS_MANAGE_NSID> |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 73 | $<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:TFM_MULTI_CORE_TOPOLOGY> |
David Hu | 402a298 | 2020-12-17 22:31:04 +0800 | [diff] [blame] | 74 | $<$<BOOL:${TFM_MULTI_CORE_NS_OS}>:TFM_MULTI_CORE_NS_OS> |
David Hu | 98adf32 | 2020-09-01 16:18:46 +0800 | [diff] [blame] | 75 | $<$<AND:$<BOOL:${TFM_MULTI_CORE_NS_OS_MAILBOX_THREAD}>,$<BOOL:${TFM_MULTI_CORE_NS_OS}>>:TFM_MULTI_CORE_NS_OS_MAILBOX_THREAD> |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 76 | $<$<BOOL:${FORWARD_PROT_MSG}>:FORWARD_PROT_MSG> |
| 77 | ) |
| 78 | |
| 79 | ###################### TF-M NS interface api (NS lib) ########################## |
| 80 | |
| 81 | add_library(tfm_api_ns STATIC) |
| 82 | |
Xinyu Zhang | eebbea3 | 2021-09-01 15:26:39 +0800 | [diff] [blame^] | 83 | target_sources(tfm_api_ns |
| 84 | PRIVATE |
| 85 | $<$<BOOL:${TFM_NS_MANAGE_NSID}>:${NSID_MGR_DIR}/tfm_nsid_manager.c> |
| 86 | ) |
| 87 | |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 88 | if (${TFM_PSA_API}) |
| 89 | target_sources(tfm_api_ns PRIVATE |
Jianliang Shen | 7a814e4 | 2021-10-18 15:25:39 +0800 | [diff] [blame] | 90 | $<$<OR:$<BOOL:${FORWARD_PROT_MSG}>,$<BOOL:${TFM_PARTITION_PLATFORM}>>:${INTERFACE_SRC_DIR}/tfm_platform_ipc_api.c> |
| 91 | $<$<OR:$<BOOL:${FORWARD_PROT_MSG}>,$<BOOL:${TFM_PARTITION_PROTECTED_STORAGE}>>:${INTERFACE_SRC_DIR}/tfm_ps_ipc_api.c> |
| 92 | $<$<OR:$<BOOL:${FORWARD_PROT_MSG}>,$<BOOL:${TFM_PARTITION_INTERNAL_TRUSTED_STORAGE}>>:${INTERFACE_SRC_DIR}/tfm_its_ipc_api.c> |
| 93 | $<$<OR:$<BOOL:${FORWARD_PROT_MSG}>,$<BOOL:${TFM_PARTITION_CRYPTO}>>:${INTERFACE_SRC_DIR}/tfm_crypto_ipc_api.c> |
| 94 | $<$<OR:$<BOOL:${FORWARD_PROT_MSG}>,$<BOOL:${TFM_PARTITION_INITIAL_ATTESTATION}>>:${INTERFACE_SRC_DIR}/tfm_initial_attestation_ipc_api.c> |
Sherry Zhang | 92c499a | 2021-03-08 18:14:15 +0800 | [diff] [blame] | 95 | $<$<BOOL:${TFM_PARTITION_FIRMWARE_UPDATE}>:${INTERFACE_SRC_DIR}/tfm_firmware_update_ipc_api.c> |
| 96 | ) |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 97 | |
| 98 | if (TFM_MULTI_CORE_TOPOLOGY) |
| 99 | target_sources(tfm_api_ns PRIVATE |
David Hu | 8e68325 | 2020-12-17 18:02:32 +0800 | [diff] [blame] | 100 | ${INTERFACE_SRC_DIR}/multi_core/tfm_multi_core_ns_api.c |
| 101 | ${INTERFACE_SRC_DIR}/multi_core/tfm_multi_core_psa_ns_api.c |
David Hu | 98adf32 | 2020-09-01 16:18:46 +0800 | [diff] [blame] | 102 | $<$<NOT:$<BOOL:${TFM_MULTI_CORE_NS_OS_MAILBOX_THREAD}>>:${INTERFACE_SRC_DIR}/multi_core/tfm_ns_mailbox.c> |
| 103 | $<$<AND:$<BOOL:${TFM_MULTI_CORE_NS_OS}>,$<BOOL:${TFM_MULTI_CORE_NS_OS_MAILBOX_THREAD}>>:${INTERFACE_SRC_DIR}/multi_core/tfm_ns_mailbox_thread.c> |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 104 | ) |
David Hu | cdc51fb | 2021-04-06 18:10:46 +0800 | [diff] [blame] | 105 | |
| 106 | # NS RTOS specific implementation of NS mailbox |
| 107 | target_sources(tfm_api_ns PRIVATE |
| 108 | $<$<BOOL:${TFM_MULTI_CORE_NS_OS}>:${NS_INTERFACE_DIR}/multi_core/tfm_ns_mailbox_rtos_api.c> |
shejia01 | e0dd80a | 2021-07-12 17:47:50 +0800 | [diff] [blame] | 109 | $<$<BOOL:${TEST_NS_MULTI_CORE}>:${NS_INTERFACE_DIR}/multi_core/tfm_ns_mailbox_test.c> |
David Hu | cdc51fb | 2021-04-06 18:10:46 +0800 | [diff] [blame] | 110 | ) |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 111 | else() |
| 112 | target_sources(tfm_api_ns PRIVATE |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 113 | ${INTERFACE_SRC_DIR}/tfm_psa_ns_api.c |
| 114 | ) |
David Hu | cdc51fb | 2021-04-06 18:10:46 +0800 | [diff] [blame] | 115 | |
| 116 | # NS specific implementation of NS interface dispacther |
| 117 | target_sources(tfm_api_ns PRIVATE |
| 118 | ${CMAKE_CURRENT_SOURCE_DIR}/tfm_ns_interface.c |
| 119 | ) |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 120 | endif() |
| 121 | else() |
| 122 | target_sources(tfm_api_ns PRIVATE |
| 123 | $<$<BOOL:${TFM_PARTITION_PLATFORM}>:${INTERFACE_SRC_DIR}/tfm_platform_func_api.c> |
| 124 | $<$<BOOL:${TFM_PARTITION_AUDIT_LOG}>:${INTERFACE_SRC_DIR}/tfm_audit_func_api.c> |
| 125 | $<$<BOOL:${TFM_PARTITION_PROTECTED_STORAGE}>:${INTERFACE_SRC_DIR}/tfm_ps_func_api.c> |
| 126 | $<$<BOOL:${TFM_PARTITION_INTERNAL_TRUSTED_STORAGE}>:${INTERFACE_SRC_DIR}/tfm_its_func_api.c> |
| 127 | $<$<BOOL:${TFM_PARTITION_CRYPTO}>:${INTERFACE_SRC_DIR}/tfm_crypto_func_api.c> |
| 128 | $<$<BOOL:${TFM_PARTITION_INITIAL_ATTESTATION}>:${INTERFACE_SRC_DIR}/tfm_initial_attestation_func_api.c> |
Sherry Zhang | 92c499a | 2021-03-08 18:14:15 +0800 | [diff] [blame] | 129 | $<$<BOOL:${TFM_PARTITION_FIRMWARE_UPDATE}>:${INTERFACE_SRC_DIR}/tfm_firmware_update_func_api.c> |
David Hu | cdc51fb | 2021-04-06 18:10:46 +0800 | [diff] [blame] | 130 | ) |
| 131 | |
| 132 | # NS specific implementation of NS interface dispacther |
| 133 | target_sources(tfm_api_ns PRIVATE |
| 134 | ${CMAKE_CURRENT_SOURCE_DIR}/tfm_ns_interface.c |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 135 | ) |
| 136 | endif() |
| 137 | |
| 138 | target_link_libraries(tfm_api_ns |
| 139 | PUBLIC |
| 140 | tfm_ns_interface |
| 141 | PRIVATE |
Sherry Zhang | 8342d7d | 2021-10-14 17:57:26 +0800 | [diff] [blame] | 142 | $<$<NOT:$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>>:tfm_s_veneers> |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 143 | platform_ns |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 144 | ) |
| 145 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 146 | ############################# PSA test integration ############################# |
| 147 | |
Raef Coles | c922f25 | 2020-10-05 10:49:30 +0100 | [diff] [blame] | 148 | if(TEST_PSA_API AND NOT PSA_ARCH_TESTS_BINARY_PATH) |
| 149 | if(NOT SUITE) |
| 150 | set(SUITE ${TEST_PSA_API}) |
| 151 | endif() |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 152 | |
Øyvind Rønningstad | 205a34a | 2020-10-02 10:31:23 +0200 | [diff] [blame] | 153 | if (NOT DEFINED PSA_API_TEST_TARGET) |
| 154 | string(REGEX REPLACE ".*/" "" PSA_API_TEST_TARGET ${TFM_PLATFORM}) |
| 155 | endif() |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 156 | |
Raef Coles | c922f25 | 2020-10-05 10:49:30 +0100 | [diff] [blame] | 157 | if(NOT TARGET) |
| 158 | if (NOT "${TEST_PSA_API}" STREQUAL "IPC") |
| 159 | set(TARGET tgt_dev_apis_tfm_${PSA_API_TEST_TARGET}) |
| 160 | else() |
| 161 | set(TARGET tgt_ff_tfm_${PSA_API_TEST_TARGET}) |
| 162 | endif() |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 163 | endif() |
| 164 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 165 | |
Raef Coles | c922f25 | 2020-10-05 10:49:30 +0100 | [diff] [blame] | 166 | if(NOT PSA_INCLUDE_PATHS) |
David Hu | a1fee3d | 2020-12-30 11:06:37 +0800 | [diff] [blame] | 167 | set(PSA_INCLUDE_PATHS ${INTERFACE_INC_DIR}/ |
Raef Coles | 23d6a19 | 2020-10-22 15:43:38 +0100 | [diff] [blame] | 168 | ${CMAKE_BINARY_DIR}/generated/api-tests/platform/manifests/ |
Raef Coles | c922f25 | 2020-10-05 10:49:30 +0100 | [diff] [blame] | 169 | ${CMAKE_BINARY_DIR}/generated/interface/include |
| 170 | ) |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 171 | endif() |
| 172 | |
Raef Coles | c922f25 | 2020-10-05 10:49:30 +0100 | [diff] [blame] | 173 | if(NOT SP_HEAP_MEM_SUPP) |
Raef Coles | 06e6f65 | 2020-10-20 16:10:38 +0100 | [diff] [blame] | 174 | set(SP_HEAP_MEM_SUPP 0) |
Raef Coles | c922f25 | 2020-10-05 10:49:30 +0100 | [diff] [blame] | 175 | endif() |
| 176 | if(NOT PLATFORM_PSA_ISOLATION_LEVEL) |
| 177 | set(PLATFORM_PSA_ISOLATION_LEVEL ${TFM_ISOLATION_LEVEL}) |
| 178 | endif() |
| 179 | |
| 180 | if (NOT TOOLCHAIN) |
| 181 | if (${CMAKE_C_COMPILER_ID} STREQUAL GNU) |
| 182 | set(TOOLCHAIN GNUARM) |
| 183 | elseif (${CMAKE_C_COMPILER_ID} STREQUAL ARMClang) |
| 184 | set(TOOLCHAIN ARMCLANG) |
| 185 | endif() |
| 186 | endif() |
| 187 | |
| 188 | if (NOT CPU_ARCH) |
| 189 | if (${CMAKE_SYSTEM_ARCHITECTURE} STREQUAL armv8-m.main) |
| 190 | set(CPU_ARCH armv8m_ml) |
| 191 | elseif (${CMAKE_SYSTEM_ARCHITECTURE} STREQUAL armv8-m.base) |
| 192 | set(CPU_ARCH armv8m_bl) |
| 193 | elseif (${CMAKE_SYSTEM_ARCHITECTURE} STREQUAL armv7-m) |
| 194 | set(CPU_ARCH armv7m) |
| 195 | endif() |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 196 | endif() |
| 197 | |
| 198 | add_subdirectory(${PSA_ARCH_TESTS_PATH}/api-tests ${CMAKE_CURRENT_BINARY_DIR}/psa_api_tests) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 199 | endif() |
| 200 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 201 | ############################# Test integration ################################# |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 202 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 203 | add_library(tfm_ns_integration_test STATIC EXCLUDE_FROM_ALL) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 204 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 205 | target_sources(tfm_ns_integration_test |
| 206 | PRIVATE |
| 207 | tfm_integ_test.c |
| 208 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 209 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 210 | target_include_directories(tfm_ns_integration_test |
| 211 | PUBLIC |
| 212 | . |
| 213 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 214 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 215 | target_link_libraries(tfm_ns_integration_test |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 216 | PRIVATE |
David Hu | acba69e | 2021-09-10 15:36:48 +0800 | [diff] [blame] | 217 | $<$<BOOL:${TEST_FRAMEWORK_NS}>:tfm_ns_tests> |
| 218 | $<$<BOOL:${TEST_FRAMEWORK_S}>:tfm_ns_interface> |
| 219 | $<$<BOOL:${TEST_FRAMEWORK_S}>:tfm_api_ns> |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 220 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 221 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 222 | target_compile_definitions(tfm_ns_integration_test |
| 223 | PUBLIC |
shejia01 | e0dd80a | 2021-07-12 17:47:50 +0800 | [diff] [blame] | 224 | $<$<BOOL:${TEST_FRAMEWORK_NS}>:TEST_FRAMEWORK_NS> |
| 225 | $<$<BOOL:${TEST_FRAMEWORK_S}>:TEST_FRAMEWORK_S> |
shejia01 | 26b2d78 | 2021-08-19 17:08:24 +0800 | [diff] [blame] | 226 | $<$<BOOL:${TFM_LIB_MODEL}>:TFM_LIB_MODEL> |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 227 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 228 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 229 | ############################# TFM NS app ####################################### |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 230 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 231 | add_executable(tfm_ns) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 232 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 233 | target_sources(tfm_ns |
| 234 | PRIVATE |
| 235 | main_ns.c |
Kevin Peng | 0d3a381 | 2020-12-23 02:17:57 +0000 | [diff] [blame] | 236 | $<$<BOOL:${TEST_PSA_API}>:psa_api_test.c> |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 237 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 238 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 239 | target_link_libraries(tfm_ns |
| 240 | PRIVATE |
| 241 | platform_ns |
| 242 | CMSIS_5_tfm_ns |
shejia01 | e0dd80a | 2021-07-12 17:47:50 +0800 | [diff] [blame] | 243 | $<$<OR:$<BOOL:${TEST_FRAMEWORK_NS}>,$<BOOL:${TEST_FRAMEWORK_S}>>:tfm_ns_integration_test> |
Kevin Peng | 0d3a381 | 2020-12-23 02:17:57 +0000 | [diff] [blame] | 244 | $<$<BOOL:${TEST_PSA_API}>:val_nspe> |
| 245 | $<$<BOOL:${TEST_PSA_API}>:pal_nspe> |
| 246 | $<$<BOOL:${TEST_PSA_API}>:test_combine> |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 247 | tfm_api_ns |
Kevin Peng | af60229 | 2020-10-20 17:49:52 +0800 | [diff] [blame] | 248 | tfm_ns_log |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 249 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 250 | |
Kevin Peng | 0d3a381 | 2020-12-23 02:17:57 +0000 | [diff] [blame] | 251 | target_compile_definitions(tfm_ns |
| 252 | PUBLIC |
| 253 | $<$<BOOL:${TEST_PSA_API}>:PSA_API_TEST_NS> |
| 254 | ) |
| 255 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 256 | set_target_properties(tfm_ns PROPERTIES |
| 257 | SUFFIX ".axf" |
| 258 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" |
| 259 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 260 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 261 | target_link_options(tfm_ns |
| 262 | PRIVATE |
| 263 | $<$<C_COMPILER_ID:GNU>:-Wl,-Map=${CMAKE_BINARY_DIR}/bin/tfm_ns.map> |
| 264 | $<$<C_COMPILER_ID:ARMClang>:--map> |
TTornblom | d35ffa0 | 2020-09-29 13:31:31 +0200 | [diff] [blame] | 265 | $<$<C_COMPILER_ID:IAR>:--map\;${CMAKE_BINARY_DIR}/bin/tfm_ns.map> |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 266 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 267 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 268 | add_convert_to_bin_target(tfm_ns) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 269 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 270 | ############################# CMSIS ############################################ |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 271 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 272 | include(FetchContent) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 273 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 274 | set(FETCHCONTENT_QUIET FALSE) |
| 275 | cmake_policy(SET CMP0079 NEW) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 276 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 277 | add_library(CMSIS_5_tfm_ns INTERFACE) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 278 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 279 | target_sources(CMSIS_5_tfm_ns |
| 280 | INTERFACE |
Xinyu Zhang | eebbea3 | 2021-09-01 15:26:39 +0800 | [diff] [blame^] | 281 | ${NSID_MGR_DIR}/tz_shim_layer.c |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 282 | ${CMSIS_5_PATH}/RTOS2/RTX/Config/RTX_Config.c |
| 283 | ${CMSIS_5_PATH}/RTOS2/RTX/Source/rtx_lib.c |
| 284 | ${CMAKE_CURRENT_SOURCE_DIR}/os_wrapper_cmsis_rtos_v2.c |
Xinyu Zhang | eebbea3 | 2021-09-01 15:26:39 +0800 | [diff] [blame^] | 285 | $<$<BOOL:${TFM_NS_MANAGE_NSID}>:${CMAKE_CURRENT_SOURCE_DIR}/tfm_nsid_map_table.c> |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 286 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 287 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 288 | target_include_directories(CMSIS_5_tfm_ns |
| 289 | INTERFACE |
| 290 | ${CMSIS_5_PATH}/Core/Include |
| 291 | ${CMSIS_5_PATH}/RTOS2/Include |
| 292 | ${CMSIS_5_PATH}/RTOS2/RTX/Include |
| 293 | ${CMSIS_5_PATH}/RTOS2/RTX/Config |
Xinyu Zhang | eebbea3 | 2021-09-01 15:26:39 +0800 | [diff] [blame^] | 294 | $<$<BOOL:${TFM_NS_MANAGE_NSID}>:${CMAKE_CURRENT_SOURCE_DIR}> |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 295 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 296 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 297 | target_link_libraries(CMSIS_5_tfm_ns |
| 298 | INTERFACE |
| 299 | platform_ns |
| 300 | ) |
Xinyu Zhang | eebbea3 | 2021-09-01 15:26:39 +0800 | [diff] [blame^] | 301 | |
| 302 | target_compile_definitions(CMSIS_5_tfm_ns |
| 303 | INTERFACE |
| 304 | $<$<BOOL:${TFM_NS_MANAGE_NSID}>:TFM_NS_MANAGE_NSID> |
| 305 | ) |