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