Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Summer Qin | 153f3df | 2022-11-17 15:51:02 +0800 | [diff] [blame] | 2 | # Copyright (c) 2020-2023, Arm Limited. All rights reserved. |
BohdanHunko | 75ee82b | 2023-02-03 14:47:01 +0200 | [diff] [blame] | 3 | # Copyright (c) 2022-2023 Cypress Semiconductor Corporation (an Infineon company) |
Chris Brand | 592c98e | 2022-05-20 14:46:54 -0700 | [diff] [blame] | 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. |
Kevin Peng | 6b219f7 | 2023-01-13 12:00:49 +0800 | [diff] [blame] | 17 | if (EXISTS ${TARGET_PLATFORM_PATH}/preload_ns.cmake) |
| 18 | include(${TARGET_PLATFORM_PATH}/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 | |
Kevin Peng | 7c54c5d | 2023-07-10 17:33:54 +0800 | [diff] [blame] | 40 | ############################# TF-M NS interface ##################################### |
| 41 | add_library(tfm_api_ns STATIC) |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 42 | |
David Hu | cdc51fb | 2021-04-06 18:10:46 +0800 | [diff] [blame] | 43 | # Include interface headers exported by TF-M |
Kevin Peng | 7c54c5d | 2023-07-10 17:33:54 +0800 | [diff] [blame] | 44 | target_include_directories(tfm_api_ns |
| 45 | PUBLIC |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 46 | ${INTERFACE_INC_DIR} |
| 47 | ${CMAKE_BINARY_DIR}/generated/interface/include |
Chris Brand | 5c8b639 | 2022-05-20 14:46:12 -0700 | [diff] [blame] | 48 | $<$<BOOL:${TFM_PARTITION_NS_AGENT_MAILBOX}>:${INTERFACE_INC_DIR}/multi_core> |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 49 | ) |
| 50 | |
David Hu | cdc51fb | 2021-04-06 18:10:46 +0800 | [diff] [blame] | 51 | # Include NS local interface headers |
Kevin Peng | 7c54c5d | 2023-07-10 17:33:54 +0800 | [diff] [blame] | 52 | target_include_directories(tfm_api_ns |
| 53 | PUBLIC |
David Hu | cdc51fb | 2021-04-06 18:10:46 +0800 | [diff] [blame] | 54 | ${NS_INTERFACE_DIR} |
Xinyu Zhang | eebbea3 | 2021-09-01 15:26:39 +0800 | [diff] [blame] | 55 | ${NSID_MGR_DIR} |
David Hu | cdc51fb | 2021-04-06 18:10:46 +0800 | [diff] [blame] | 56 | ) |
| 57 | |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 58 | # Include selection of Secure Partitions from TF-M build. |
| 59 | # It can be replaced by NS side configurations later. |
Kevin Peng | 7c54c5d | 2023-07-10 17:33:54 +0800 | [diff] [blame] | 60 | target_link_libraries(tfm_api_ns |
| 61 | PUBLIC |
Xinyu Zhang | 0e8266b | 2023-06-19 18:19:31 +0800 | [diff] [blame] | 62 | tfm_config |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 63 | ) |
| 64 | |
Kevin Peng | 7c54c5d | 2023-07-10 17:33:54 +0800 | [diff] [blame] | 65 | target_compile_definitions(tfm_api_ns |
| 66 | PUBLIC |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 67 | $<$<STREQUAL:${TEST_PSA_API},IPC>:PSA_API_TEST_IPC> |
Xinyu Zhang | eebbea3 | 2021-09-01 15:26:39 +0800 | [diff] [blame] | 68 | $<$<BOOL:${TFM_NS_MANAGE_NSID}>:TFM_NS_MANAGE_NSID> |
Xinyu Zhang | 92fe758 | 2021-09-24 17:11:49 +0800 | [diff] [blame] | 69 | $<$<BOOL:${TEST_NS_MANAGE_NSID}>:TEST_NS_MANAGE_NSID> |
Chris Brand | 5c8b639 | 2022-05-20 14:46:12 -0700 | [diff] [blame] | 70 | $<$<BOOL:${CONFIG_TFM_USE_TRUSTZONE}>:CONFIG_TFM_USE_TRUSTZONE> |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 71 | $<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:TFM_MULTI_CORE_TOPOLOGY> |
David Hu | e7b7317 | 2022-10-12 22:26:41 +0800 | [diff] [blame] | 72 | $<$<BOOL:${TFM_PARTITION_NS_AGENT_MAILBOX}>:TFM_PARTITION_NS_AGENT_MAILBOX> |
David Hu | 402a298 | 2020-12-17 22:31:04 +0800 | [diff] [blame] | 73 | $<$<BOOL:${TFM_MULTI_CORE_NS_OS}>:TFM_MULTI_CORE_NS_OS> |
David Hu | 98adf32 | 2020-09-01 16:18:46 +0800 | [diff] [blame] | 74 | $<$<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] | 75 | ) |
| 76 | |
Kevin Peng | 7c54c5d | 2023-07-10 17:33:54 +0800 | [diff] [blame] | 77 | target_compile_options(tfm_api_ns |
| 78 | PUBLIC |
Kevin Peng | 06108cd | 2022-06-09 11:37:39 +0800 | [diff] [blame] | 79 | ${COMPILER_CP_FLAG} |
| 80 | ) |
| 81 | |
Xinyu Zhang | eebbea3 | 2021-09-01 15:26:39 +0800 | [diff] [blame] | 82 | target_sources(tfm_api_ns |
| 83 | PRIVATE |
| 84 | $<$<BOOL:${TFM_NS_MANAGE_NSID}>:${NSID_MGR_DIR}/tfm_nsid_manager.c> |
| 85 | ) |
| 86 | |
Summer Qin | d13f55b | 2022-10-09 11:29:57 +0800 | [diff] [blame] | 87 | target_sources(tfm_api_ns PRIVATE |
Summer Qin | adddea5 | 2022-10-18 15:33:48 +0800 | [diff] [blame] | 88 | $<$<BOOL:${TFM_PARTITION_PLATFORM}>:${INTERFACE_SRC_DIR}/tfm_platform_api.c> |
| 89 | $<$<BOOL:${TFM_PARTITION_PROTECTED_STORAGE}>:${INTERFACE_SRC_DIR}/tfm_ps_api.c> |
| 90 | $<$<BOOL:${TFM_PARTITION_INTERNAL_TRUSTED_STORAGE}>:${INTERFACE_SRC_DIR}/tfm_its_api.c> |
| 91 | $<$<BOOL:${TFM_PARTITION_CRYPTO}>:${INTERFACE_SRC_DIR}/tfm_crypto_api.c> |
| 92 | $<$<BOOL:${TFM_PARTITION_INITIAL_ATTESTATION}>:${INTERFACE_SRC_DIR}/tfm_attest_api.c> |
| 93 | $<$<BOOL:${TFM_PARTITION_FIRMWARE_UPDATE}>:${INTERFACE_SRC_DIR}/tfm_fwu_api.c> |
Summer Qin | d13f55b | 2022-10-09 11:29:57 +0800 | [diff] [blame] | 94 | ) |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 95 | |
Summer Qin | d13f55b | 2022-10-09 11:29:57 +0800 | [diff] [blame] | 96 | if (TFM_PARTITION_NS_AGENT_MAILBOX) |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 97 | target_sources(tfm_api_ns PRIVATE |
Summer Qin | d13f55b | 2022-10-09 11:29:57 +0800 | [diff] [blame] | 98 | ${INTERFACE_SRC_DIR}/multi_core/tfm_multi_core_ns_api.c |
| 99 | ${INTERFACE_SRC_DIR}/multi_core/tfm_multi_core_psa_ns_api.c |
| 100 | $<$<NOT:$<BOOL:${TFM_MULTI_CORE_NS_OS_MAILBOX_THREAD}>>:${INTERFACE_SRC_DIR}/multi_core/tfm_ns_mailbox.c> |
| 101 | $<$<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> |
| 102 | ) |
| 103 | |
| 104 | # NS RTOS specific implementation of NS mailbox |
| 105 | target_sources(tfm_api_ns PRIVATE |
| 106 | $<$<BOOL:${TFM_MULTI_CORE_NS_OS}>:${NS_INTERFACE_DIR}/multi_core/tfm_ns_mailbox_rtos_api.c> |
| 107 | $<$<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] | 108 | ) |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 109 | endif() |
| 110 | |
Chris Brand | 5c8b639 | 2022-05-20 14:46:12 -0700 | [diff] [blame] | 111 | target_sources(tfm_api_ns PRIVATE |
Summer Qin | d13f55b | 2022-10-09 11:29:57 +0800 | [diff] [blame] | 112 | $<$<BOOL:${CONFIG_TFM_USE_TRUSTZONE}>:${INTERFACE_SRC_DIR}/tfm_psa_ns_api.c> |
BohdanHunko | 75ee82b | 2023-02-03 14:47:01 +0200 | [diff] [blame] | 113 | # NS specific implementation of NS interface dispatcher |
| 114 | $<$<BOOL:${CONFIG_TFM_USE_TRUSTZONE}>:${INTERFACE_SRC_DIR}/os_wrapper/tfm_ns_interface_rtos.c> |
Chris Brand | 5c8b639 | 2022-05-20 14:46:12 -0700 | [diff] [blame] | 115 | ) |
| 116 | |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 117 | target_link_libraries(tfm_api_ns |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 118 | PRIVATE |
Chris Brand | 5c8b639 | 2022-05-20 14:46:12 -0700 | [diff] [blame] | 119 | $<$<BOOL:${CONFIG_TFM_USE_TRUSTZONE}>:tfm_s_veneers> |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 120 | platform_ns |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 121 | ) |
| 122 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 123 | ############################# PSA test integration ############################# |
| 124 | |
Raef Coles | c922f25 | 2020-10-05 10:49:30 +0100 | [diff] [blame] | 125 | if(TEST_PSA_API AND NOT PSA_ARCH_TESTS_BINARY_PATH) |
| 126 | if(NOT SUITE) |
| 127 | set(SUITE ${TEST_PSA_API}) |
| 128 | endif() |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 129 | |
Kevin Peng | 7cf20ef | 2023-03-27 15:29:58 +0800 | [diff] [blame] | 130 | if (NOT DEFINED PSA_API_TEST_TARGET OR PSA_API_TEST_TARGET STREQUAL "") |
Øyvind Rønningstad | 205a34a | 2020-10-02 10:31:23 +0200 | [diff] [blame] | 131 | string(REGEX REPLACE ".*/" "" PSA_API_TEST_TARGET ${TFM_PLATFORM}) |
| 132 | endif() |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 133 | |
Raef Coles | c922f25 | 2020-10-05 10:49:30 +0100 | [diff] [blame] | 134 | if(NOT TARGET) |
| 135 | if (NOT "${TEST_PSA_API}" STREQUAL "IPC") |
| 136 | set(TARGET tgt_dev_apis_tfm_${PSA_API_TEST_TARGET}) |
| 137 | else() |
| 138 | set(TARGET tgt_ff_tfm_${PSA_API_TEST_TARGET}) |
| 139 | endif() |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 140 | endif() |
| 141 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 142 | |
Raef Coles | c922f25 | 2020-10-05 10:49:30 +0100 | [diff] [blame] | 143 | if(NOT PSA_INCLUDE_PATHS) |
David Hu | a1fee3d | 2020-12-30 11:06:37 +0800 | [diff] [blame] | 144 | set(PSA_INCLUDE_PATHS ${INTERFACE_INC_DIR}/ |
Raef Coles | 23d6a19 | 2020-10-22 15:43:38 +0100 | [diff] [blame] | 145 | ${CMAKE_BINARY_DIR}/generated/api-tests/platform/manifests/ |
Raef Coles | c922f25 | 2020-10-05 10:49:30 +0100 | [diff] [blame] | 146 | ${CMAKE_BINARY_DIR}/generated/interface/include |
| 147 | ) |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 148 | endif() |
| 149 | |
Raef Coles | c922f25 | 2020-10-05 10:49:30 +0100 | [diff] [blame] | 150 | if(NOT SP_HEAP_MEM_SUPP) |
Raef Coles | 06e6f65 | 2020-10-20 16:10:38 +0100 | [diff] [blame] | 151 | set(SP_HEAP_MEM_SUPP 0) |
Raef Coles | c922f25 | 2020-10-05 10:49:30 +0100 | [diff] [blame] | 152 | endif() |
| 153 | if(NOT PLATFORM_PSA_ISOLATION_LEVEL) |
| 154 | set(PLATFORM_PSA_ISOLATION_LEVEL ${TFM_ISOLATION_LEVEL}) |
| 155 | endif() |
| 156 | |
| 157 | if (NOT TOOLCHAIN) |
| 158 | if (${CMAKE_C_COMPILER_ID} STREQUAL GNU) |
| 159 | set(TOOLCHAIN GNUARM) |
| 160 | elseif (${CMAKE_C_COMPILER_ID} STREQUAL ARMClang) |
| 161 | set(TOOLCHAIN ARMCLANG) |
| 162 | endif() |
| 163 | endif() |
| 164 | |
| 165 | if (NOT CPU_ARCH) |
Chris Brand | ddcf529 | 2021-10-27 13:50:35 -0700 | [diff] [blame] | 166 | if (${TFM_SYSTEM_ARCHITECTURE} STREQUAL armv8-m.main) |
Raef Coles | c922f25 | 2020-10-05 10:49:30 +0100 | [diff] [blame] | 167 | set(CPU_ARCH armv8m_ml) |
Chris Brand | ddcf529 | 2021-10-27 13:50:35 -0700 | [diff] [blame] | 168 | elseif (${TFM_SYSTEM_ARCHITECTURE} STREQUAL armv8-m.base) |
Raef Coles | c922f25 | 2020-10-05 10:49:30 +0100 | [diff] [blame] | 169 | set(CPU_ARCH armv8m_bl) |
Dávid Házi | 43aeb69 | 2023-03-30 10:22:27 +0200 | [diff] [blame] | 170 | elseif (${TFM_SYSTEM_ARCHITECTURE} STREQUAL armv8.1-m.main) |
| 171 | set(CPU_ARCH armv81m_ml) |
Chris Brand | ddcf529 | 2021-10-27 13:50:35 -0700 | [diff] [blame] | 172 | elseif (${TFM_SYSTEM_ARCHITECTURE} STREQUAL armv7-m) |
Raef Coles | c922f25 | 2020-10-05 10:49:30 +0100 | [diff] [blame] | 173 | set(CPU_ARCH armv7m) |
| 174 | endif() |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 175 | endif() |
| 176 | |
| 177 | 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] | 178 | |
| 179 | if (TEST_PSA_API STREQUAL IPC) |
| 180 | target_include_directories(tfm_partitions |
| 181 | INTERFACE |
| 182 | ${CMAKE_BINARY_DIR}/generated/api-tests/platform/manifests |
| 183 | ) |
| 184 | |
| 185 | target_sources(tfm_psa_rot_partition_driver_partition |
| 186 | PRIVATE |
| 187 | ${CMAKE_BINARY_DIR}/generated/api-tests/platform/manifests/auto_generated/intermedia_driver_partition_psa.c |
| 188 | ) |
| 189 | target_link_libraries(tfm_psa_rot_partition_driver_partition |
| 190 | PRIVATE |
| 191 | psa_interface |
| 192 | platform_s |
| 193 | ) |
| 194 | target_compile_definitions(tfm_psa_rot_partition_driver_partition |
| 195 | PRIVATE |
| 196 | CONFIG_TFM_BUILDING_SPE=1 |
Xinyu Zhang | 03d6a93 | 2023-07-28 14:09:33 +0800 | [diff] [blame] | 197 | TFM_ISOLATION_LEVEL=${TFM_ISOLATION_LEVEL} |
Raef Coles | 4817eb8 | 2022-01-18 12:33:24 +0000 | [diff] [blame] | 198 | ) |
| 199 | |
| 200 | target_sources(tfm_app_rot_partition_client_partition |
| 201 | PRIVATE |
| 202 | ${CMAKE_BINARY_DIR}/generated/api-tests/platform/manifests/auto_generated/intermedia_client_partition_psa.c |
| 203 | ) |
| 204 | target_link_libraries(tfm_app_rot_partition_client_partition |
| 205 | PRIVATE |
| 206 | psa_interface |
| 207 | platform_s |
| 208 | ) |
| 209 | target_compile_definitions(tfm_app_rot_partition_client_partition |
| 210 | PRIVATE |
| 211 | CONFIG_TFM_BUILDING_SPE=1 |
Xinyu Zhang | 03d6a93 | 2023-07-28 14:09:33 +0800 | [diff] [blame] | 212 | TFM_ISOLATION_LEVEL=${TFM_ISOLATION_LEVEL} |
Raef Coles | 4817eb8 | 2022-01-18 12:33:24 +0000 | [diff] [blame] | 213 | ) |
| 214 | |
| 215 | target_sources(tfm_app_rot_partition_server_partition |
| 216 | PRIVATE |
| 217 | ${CMAKE_BINARY_DIR}/generated/api-tests/platform/manifests/auto_generated/intermedia_server_partition_psa.c |
| 218 | ) |
| 219 | target_link_libraries(tfm_app_rot_partition_server_partition |
| 220 | PRIVATE |
| 221 | psa_interface |
| 222 | platform_s |
| 223 | ) |
| 224 | target_compile_definitions(tfm_app_rot_partition_server_partition |
| 225 | PRIVATE |
| 226 | CONFIG_TFM_BUILDING_SPE=1 |
Xinyu Zhang | 03d6a93 | 2023-07-28 14:09:33 +0800 | [diff] [blame] | 227 | TFM_ISOLATION_LEVEL=${TFM_ISOLATION_LEVEL} |
Raef Coles | 4817eb8 | 2022-01-18 12:33:24 +0000 | [diff] [blame] | 228 | ) |
| 229 | |
| 230 | target_sources(tfm_partitions |
| 231 | INTERFACE |
| 232 | ${CMAKE_BINARY_DIR}/generated/api-tests/platform/manifests/auto_generated/load_info_driver_partition_psa.c |
| 233 | ${CMAKE_BINARY_DIR}/generated/api-tests/platform/manifests/auto_generated/load_info_client_partition_psa.c |
| 234 | ${CMAKE_BINARY_DIR}/generated/api-tests/platform/manifests/auto_generated/load_info_server_partition_psa.c |
| 235 | ) |
| 236 | |
| 237 | target_link_libraries(tfm_partitions |
| 238 | INTERFACE |
| 239 | tfm_psa_rot_partition_driver_partition |
| 240 | tfm_app_rot_partition_client_partition |
| 241 | tfm_app_rot_partition_server_partition |
| 242 | ) |
| 243 | endif() |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 244 | endif() |
| 245 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 246 | ############################# Test integration ################################# |
Kevin Peng | 7f78a8f | 2023-07-21 14:15:54 +0800 | [diff] [blame] | 247 | if(CONFIG_TFM_ERPC_TEST_FRAMEWORK) |
| 248 | add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../erpc/server/app ${CMAKE_CURRENT_BINARY_DIR}/erpc) |
Summer Qin | 153f3df | 2022-11-17 15:51:02 +0800 | [diff] [blame] | 249 | endif() |
| 250 | |
Kevin Peng | 342ec68 | 2022-04-29 10:36:58 +0800 | [diff] [blame] | 251 | add_library(tfm_test_app STATIC EXCLUDE_FROM_ALL) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 252 | |
Kevin Peng | 342ec68 | 2022-04-29 10:36:58 +0800 | [diff] [blame] | 253 | target_sources(tfm_test_app |
chesun01 | a985c00 | 2023-04-12 16:16:12 +0800 | [diff] [blame] | 254 | PUBLIC |
| 255 | $<$<BOOL:${CONFIG_GNU_SYSCALL_STUB_ENABLED}>:${CMAKE_SOURCE_DIR}/platform/ext/common/syscalls_stub.c> |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 256 | PRIVATE |
Summer Qin | 153f3df | 2022-11-17 15:51:02 +0800 | [diff] [blame] | 257 | $<$<NOT:$<BOOL:${CONFIG_TFM_ERPC_TEST_FRAMEWORK}>>:test_app.c> |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 258 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 259 | |
Kevin Peng | 342ec68 | 2022-04-29 10:36:58 +0800 | [diff] [blame] | 260 | target_include_directories(tfm_test_app |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 261 | PUBLIC |
| 262 | . |
| 263 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 264 | |
Kevin Peng | 342ec68 | 2022-04-29 10:36:58 +0800 | [diff] [blame] | 265 | target_link_libraries(tfm_test_app |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 266 | PRIVATE |
David Hu | aecf997 | 2023-04-06 17:41:16 +0800 | [diff] [blame] | 267 | $<$<BOOL:${TFM_NS_REG_TEST}>:tfm_ns_tests> |
Kevin Peng | 342ec68 | 2022-04-29 10:36:58 +0800 | [diff] [blame] | 268 | $<$<BOOL:${TEST_PSA_API}>:val_nspe> |
| 269 | $<$<BOOL:${TEST_PSA_API}>:pal_nspe> |
| 270 | $<$<BOOL:${TEST_PSA_API}>:test_combine> |
Kevin Peng | 7f78a8f | 2023-07-21 14:15:54 +0800 | [diff] [blame] | 271 | $<$<BOOL:${CONFIG_TFM_ERPC_TEST_FRAMEWORK}>:erpc_app> |
Kevin Peng | 6e2e435 | 2022-05-11 11:18:54 +0800 | [diff] [blame] | 272 | tfm_api_ns |
Paul Sokolovsky | 5d7925e | 2022-03-15 12:13:53 +0300 | [diff] [blame] | 273 | tfm_log |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 274 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 275 | |
Kevin Peng | 342ec68 | 2022-04-29 10:36:58 +0800 | [diff] [blame] | 276 | target_compile_definitions(tfm_test_app |
Jianliang Shen | 407bfef | 2023-08-07 16:37:25 +0800 | [diff] [blame^] | 277 | PUBLIC |
David Hu | aecf997 | 2023-04-06 17:41:16 +0800 | [diff] [blame] | 278 | $<$<BOOL:${TFM_NS_REG_TEST}>:TFM_NS_REG_TEST> |
Kevin Peng | 342ec68 | 2022-04-29 10:36:58 +0800 | [diff] [blame] | 279 | $<$<BOOL:${TEST_PSA_API}>:PSA_API_TEST_NS> |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 280 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 281 | |
Jianliang Shen | 407bfef | 2023-08-07 16:37:25 +0800 | [diff] [blame^] | 282 | ############################# Profiling integration ############################ |
| 283 | |
| 284 | if(CONFIG_TFM_ENALBE_PROFILING) |
| 285 | add_subdirectory(${TFM_PROFILING_PATH}/profiling_cases/tfm_ns_profiling |
| 286 | ${CMAKE_CURRENT_BINARY_DIR}/profiling_cases) |
| 287 | endif() |
| 288 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 289 | ############################# TFM NS app ####################################### |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 290 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 291 | add_executable(tfm_ns) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 292 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 293 | target_sources(tfm_ns |
| 294 | PRIVATE |
| 295 | main_ns.c |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 296 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 297 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 298 | target_link_libraries(tfm_ns |
| 299 | PRIVATE |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 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 |
Kevin Peng | 3e612b8 | 2023-07-14 11:41:49 +0800 | [diff] [blame] | 303 | platform_ns |
Jianliang Shen | 407bfef | 2023-08-07 16:37:25 +0800 | [diff] [blame^] | 304 | $<$<BOOL:${CONFIG_TFM_ENALBE_PROFILING}>:tfm_ns_profiling> |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 305 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 306 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 307 | set_target_properties(tfm_ns PROPERTIES |
| 308 | SUFFIX ".axf" |
| 309 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" |
| 310 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 311 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 312 | target_link_options(tfm_ns |
| 313 | PRIVATE |
| 314 | $<$<C_COMPILER_ID:GNU>:-Wl,-Map=${CMAKE_BINARY_DIR}/bin/tfm_ns.map> |
| 315 | $<$<C_COMPILER_ID:ARMClang>:--map> |
TTornblom | d35ffa0 | 2020-09-29 13:31:31 +0200 | [diff] [blame] | 316 | $<$<C_COMPILER_ID:IAR>:--map\;${CMAKE_BINARY_DIR}/bin/tfm_ns.map> |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 317 | ) |
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 | add_convert_to_bin_target(tfm_ns) |
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 | ############################# CMSIS ############################################ |
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 | include(FetchContent) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 324 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 325 | set(FETCHCONTENT_QUIET FALSE) |
| 326 | cmake_policy(SET CMP0079 NEW) |
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 | add_library(CMSIS_5_tfm_ns INTERFACE) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 329 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 330 | target_sources(CMSIS_5_tfm_ns |
| 331 | INTERFACE |
Xinyu Zhang | eebbea3 | 2021-09-01 15:26:39 +0800 | [diff] [blame] | 332 | ${NSID_MGR_DIR}/tz_shim_layer.c |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 333 | ${CMSIS_5_PATH}/RTOS2/RTX/Config/RTX_Config.c |
| 334 | ${CMSIS_5_PATH}/RTOS2/RTX/Source/rtx_lib.c |
| 335 | ${CMAKE_CURRENT_SOURCE_DIR}/os_wrapper_cmsis_rtos_v2.c |
Xinyu Zhang | eebbea3 | 2021-09-01 15:26:39 +0800 | [diff] [blame] | 336 | $<$<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] | 337 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 338 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 339 | target_include_directories(CMSIS_5_tfm_ns |
| 340 | INTERFACE |
| 341 | ${CMSIS_5_PATH}/Core/Include |
| 342 | ${CMSIS_5_PATH}/RTOS2/Include |
| 343 | ${CMSIS_5_PATH}/RTOS2/RTX/Include |
| 344 | ${CMSIS_5_PATH}/RTOS2/RTX/Config |
Xinyu Zhang | eebbea3 | 2021-09-01 15:26:39 +0800 | [diff] [blame] | 345 | $<$<BOOL:${TFM_NS_MANAGE_NSID}>:${CMAKE_CURRENT_SOURCE_DIR}> |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 346 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 347 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 348 | target_link_libraries(CMSIS_5_tfm_ns |
| 349 | INTERFACE |
| 350 | platform_ns |
| 351 | ) |
Xinyu Zhang | eebbea3 | 2021-09-01 15:26:39 +0800 | [diff] [blame] | 352 | |
| 353 | target_compile_definitions(CMSIS_5_tfm_ns |
| 354 | INTERFACE |
| 355 | $<$<BOOL:${TFM_NS_MANAGE_NSID}>:TFM_NS_MANAGE_NSID> |
| 356 | ) |