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 | |
| 30 | #################### TF-M NS interface (header only) ########################### |
| 31 | |
| 32 | add_library(tfm_ns_interface INTERFACE) |
| 33 | |
| 34 | target_include_directories(tfm_ns_interface |
| 35 | INTERFACE |
| 36 | ${INTERFACE_INC_DIR} |
| 37 | ${CMAKE_BINARY_DIR}/generated/interface/include |
| 38 | ${INTERFACE_INC_DIR}/os_wrapper |
David Hu | 8e68325 | 2020-12-17 18:02:32 +0800 | [diff] [blame] | 39 | $<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:${INTERFACE_INC_DIR}/multi_core> |
David Hu | 98adf32 | 2020-09-01 16:18:46 +0800 | [diff] [blame] | 40 | $<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:${CMAKE_SOURCE_DIR}/platform/ext/cmsis> |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 41 | ) |
| 42 | |
| 43 | # PSA interface files are generated from a template |
| 44 | add_dependencies(tfm_ns_interface |
| 45 | tfm_generated_files |
| 46 | ) |
| 47 | |
| 48 | # Include selection of Secure Partitions from TF-M build. |
| 49 | # It can be replaced by NS side configurations later. |
| 50 | target_link_libraries(tfm_ns_interface |
| 51 | INTERFACE |
| 52 | tfm_partition_defs |
| 53 | ) |
| 54 | |
| 55 | target_compile_definitions(tfm_ns_interface |
| 56 | INTERFACE |
| 57 | $<$<BOOL:${TFM_PSA_API}>:TFM_PSA_API> |
| 58 | $<$<STREQUAL:${TEST_PSA_API},IPC>:PSA_API_TEST_IPC> |
| 59 | $<$<BOOL:${TFM_NS_CLIENT_IDENTIFICATION}>:TFM_NS_CLIENT_IDENTIFICATION> |
| 60 | $<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:TFM_MULTI_CORE_TOPOLOGY> |
David Hu | 402a298 | 2020-12-17 22:31:04 +0800 | [diff] [blame] | 61 | $<$<BOOL:${TFM_MULTI_CORE_NS_OS}>:TFM_MULTI_CORE_NS_OS> |
David Hu | 98adf32 | 2020-09-01 16:18:46 +0800 | [diff] [blame] | 62 | $<$<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] | 63 | $<$<BOOL:${FORWARD_PROT_MSG}>:FORWARD_PROT_MSG> |
| 64 | ) |
| 65 | |
| 66 | ###################### TF-M NS interface api (NS lib) ########################## |
| 67 | |
| 68 | add_library(tfm_api_ns STATIC) |
| 69 | |
| 70 | target_sources(tfm_api_ns |
| 71 | PRIVATE |
| 72 | $<$<BOOL:${TFM_NS_CLIENT_IDENTIFICATION}>:${INTERFACE_SRC_DIR}/tfm_nspm_svc_handler.c> |
| 73 | $<$<BOOL:${TFM_NS_CLIENT_IDENTIFICATION}>:${INTERFACE_SRC_DIR}/tfm_nspm_api.c> |
| 74 | ) |
| 75 | |
| 76 | if (${TFM_PSA_API}) |
| 77 | target_sources(tfm_api_ns PRIVATE |
| 78 | $<$<OR:$<BOOL:{$FORWARD_PROT_MSG}>,$<BOOL:${TFM_PARTITION_PLATFORM}>>:${INTERFACE_SRC_DIR}/tfm_platform_ipc_api.c> |
| 79 | $<$<OR:$<BOOL:{$FORWARD_PROT_MSG}>,$<BOOL:${TFM_PARTITION_PROTECTED_STORAGE}>>:${INTERFACE_SRC_DIR}/tfm_ps_ipc_api.c> |
| 80 | $<$<OR:$<BOOL:{$FORWARD_PROT_MSG}>,$<BOOL:${TFM_PARTITION_INTERNAL_TRUSTED_STORAGE}>>:${INTERFACE_SRC_DIR}/tfm_its_ipc_api.c> |
| 81 | $<$<OR:$<BOOL:{$FORWARD_PROT_MSG}>,$<BOOL:${TFM_PARTITION_CRYPTO}>>:${INTERFACE_SRC_DIR}/tfm_crypto_ipc_api.c> |
| 82 | $<$<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^] | 83 | $<$<BOOL:${TFM_PARTITION_FIRMWARE_UPDATE}>:${INTERFACE_SRC_DIR}/tfm_firmware_update_ipc_api.c> |
| 84 | ) |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 85 | |
| 86 | if (TFM_MULTI_CORE_TOPOLOGY) |
| 87 | target_sources(tfm_api_ns PRIVATE |
David Hu | 8e68325 | 2020-12-17 18:02:32 +0800 | [diff] [blame] | 88 | ${INTERFACE_SRC_DIR}/multi_core/tfm_multi_core_ns_api.c |
| 89 | ${INTERFACE_SRC_DIR}/multi_core/tfm_multi_core_psa_ns_api.c |
David Hu | 402a298 | 2020-12-17 22:31:04 +0800 | [diff] [blame] | 90 | $<$<BOOL:${TFM_MULTI_CORE_NS_OS}>:${INTERFACE_SRC_DIR}/multi_core/tfm_ns_mailbox_rtos_api.c> |
David Hu | 98adf32 | 2020-09-01 16:18:46 +0800 | [diff] [blame] | 91 | $<$<NOT:$<BOOL:${TFM_MULTI_CORE_NS_OS_MAILBOX_THREAD}>>:${INTERFACE_SRC_DIR}/multi_core/tfm_ns_mailbox.c> |
| 92 | $<$<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> |
| 93 | $<$<BOOL:${TEST_NS}>:${INTERFACE_SRC_DIR}/multi_core/tfm_ns_mailbox_test.c> |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 94 | ) |
| 95 | else() |
| 96 | target_sources(tfm_api_ns PRIVATE |
| 97 | ${INTERFACE_SRC_DIR}/tfm_ns_interface.c |
| 98 | ${INTERFACE_SRC_DIR}/tfm_psa_ns_api.c |
| 99 | ) |
| 100 | endif() |
| 101 | else() |
| 102 | target_sources(tfm_api_ns PRIVATE |
| 103 | $<$<BOOL:${TFM_PARTITION_PLATFORM}>:${INTERFACE_SRC_DIR}/tfm_platform_func_api.c> |
| 104 | $<$<BOOL:${TFM_PARTITION_AUDIT_LOG}>:${INTERFACE_SRC_DIR}/tfm_audit_func_api.c> |
| 105 | $<$<BOOL:${TFM_PARTITION_PROTECTED_STORAGE}>:${INTERFACE_SRC_DIR}/tfm_ps_func_api.c> |
| 106 | $<$<BOOL:${TFM_PARTITION_INTERNAL_TRUSTED_STORAGE}>:${INTERFACE_SRC_DIR}/tfm_its_func_api.c> |
| 107 | $<$<BOOL:${TFM_PARTITION_CRYPTO}>:${INTERFACE_SRC_DIR}/tfm_crypto_func_api.c> |
| 108 | $<$<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^] | 109 | $<$<BOOL:${TFM_PARTITION_FIRMWARE_UPDATE}>:${INTERFACE_SRC_DIR}/tfm_firmware_update_func_api.c> |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 110 | ${INTERFACE_SRC_DIR}/tfm_psa_ns_api.c |
| 111 | ${INTERFACE_SRC_DIR}/tfm_ns_interface.c |
| 112 | ) |
| 113 | endif() |
| 114 | |
| 115 | target_link_libraries(tfm_api_ns |
| 116 | PUBLIC |
| 117 | tfm_ns_interface |
| 118 | PRIVATE |
| 119 | platform_ns |
| 120 | # CMSIS is currently only required to provide the NS client IDs. In |
| 121 | # future, this should probably be made more OS agnostic |
| 122 | $<$<BOOL:${TFM_NS_CLIENT_IDENTIFICATION}>:CMSIS_5_tfm_ns> |
| 123 | ) |
| 124 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 125 | ############################# PSA test integration ############################# |
| 126 | |
Raef Coles | c922f25 | 2020-10-05 10:49:30 +0100 | [diff] [blame] | 127 | if(TEST_PSA_API AND NOT PSA_ARCH_TESTS_BINARY_PATH) |
| 128 | if(NOT SUITE) |
| 129 | set(SUITE ${TEST_PSA_API}) |
| 130 | endif() |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 131 | |
Øyvind Rønningstad | 205a34a | 2020-10-02 10:31:23 +0200 | [diff] [blame] | 132 | if (NOT DEFINED PSA_API_TEST_TARGET) |
| 133 | string(REGEX REPLACE ".*/" "" PSA_API_TEST_TARGET ${TFM_PLATFORM}) |
| 134 | endif() |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 135 | |
Raef Coles | c922f25 | 2020-10-05 10:49:30 +0100 | [diff] [blame] | 136 | if(NOT TARGET) |
| 137 | if (NOT "${TEST_PSA_API}" STREQUAL "IPC") |
| 138 | set(TARGET tgt_dev_apis_tfm_${PSA_API_TEST_TARGET}) |
| 139 | else() |
| 140 | set(TARGET tgt_ff_tfm_${PSA_API_TEST_TARGET}) |
| 141 | endif() |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 142 | endif() |
| 143 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 144 | |
Raef Coles | c922f25 | 2020-10-05 10:49:30 +0100 | [diff] [blame] | 145 | if(NOT PSA_INCLUDE_PATHS) |
David Hu | a1fee3d | 2020-12-30 11:06:37 +0800 | [diff] [blame] | 146 | set(PSA_INCLUDE_PATHS ${INTERFACE_INC_DIR}/ |
Raef Coles | 23d6a19 | 2020-10-22 15:43:38 +0100 | [diff] [blame] | 147 | ${CMAKE_BINARY_DIR}/generated/api-tests/platform/manifests/ |
Raef Coles | c922f25 | 2020-10-05 10:49:30 +0100 | [diff] [blame] | 148 | ${CMAKE_BINARY_DIR}/generated/interface/include |
| 149 | ) |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 150 | endif() |
| 151 | |
Raef Coles | c922f25 | 2020-10-05 10:49:30 +0100 | [diff] [blame] | 152 | if(NOT SP_HEAP_MEM_SUPP) |
Raef Coles | 06e6f65 | 2020-10-20 16:10:38 +0100 | [diff] [blame] | 153 | set(SP_HEAP_MEM_SUPP 0) |
Raef Coles | c922f25 | 2020-10-05 10:49:30 +0100 | [diff] [blame] | 154 | endif() |
| 155 | if(NOT PLATFORM_PSA_ISOLATION_LEVEL) |
| 156 | set(PLATFORM_PSA_ISOLATION_LEVEL ${TFM_ISOLATION_LEVEL}) |
| 157 | endif() |
| 158 | |
| 159 | if (NOT TOOLCHAIN) |
| 160 | if (${CMAKE_C_COMPILER_ID} STREQUAL GNU) |
| 161 | set(TOOLCHAIN GNUARM) |
| 162 | elseif (${CMAKE_C_COMPILER_ID} STREQUAL ARMClang) |
| 163 | set(TOOLCHAIN ARMCLANG) |
| 164 | endif() |
| 165 | endif() |
| 166 | |
| 167 | if (NOT CPU_ARCH) |
| 168 | if (${CMAKE_SYSTEM_ARCHITECTURE} STREQUAL armv8-m.main) |
| 169 | set(CPU_ARCH armv8m_ml) |
| 170 | elseif (${CMAKE_SYSTEM_ARCHITECTURE} STREQUAL armv8-m.base) |
| 171 | set(CPU_ARCH armv8m_bl) |
| 172 | elseif (${CMAKE_SYSTEM_ARCHITECTURE} STREQUAL armv7-m) |
| 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) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 178 | endif() |
| 179 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 180 | ############################# Test integration ################################# |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 181 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 182 | add_library(tfm_ns_integration_test STATIC EXCLUDE_FROM_ALL) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 183 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 184 | target_sources(tfm_ns_integration_test |
| 185 | PRIVATE |
| 186 | tfm_integ_test.c |
| 187 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 188 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 189 | target_include_directories(tfm_ns_integration_test |
| 190 | PUBLIC |
| 191 | . |
| 192 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 193 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 194 | target_link_libraries(tfm_ns_integration_test |
| 195 | PUBLIC |
| 196 | $<$<BOOL:${TEST_NS}>:tfm_ns_tests> |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 197 | tfm_test_framework_ns |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 198 | PRIVATE |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 199 | tfm_ns_interface |
| 200 | tfm_api_ns |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 201 | CMSIS_5_tfm_ns |
| 202 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 203 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 204 | target_compile_definitions(tfm_ns_integration_test |
| 205 | PUBLIC |
| 206 | $<$<BOOL:${TEST_NS}>:TEST_FRAMEWORK_NS> |
| 207 | $<$<BOOL:${TEST_S}>:TEST_FRAMEWORK_S> |
| 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 | ############################# TFM NS app ####################################### |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 211 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 212 | add_executable(tfm_ns) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 213 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 214 | target_sources(tfm_ns |
| 215 | PRIVATE |
| 216 | main_ns.c |
Kevin Peng | 0d3a381 | 2020-12-23 02:17:57 +0000 | [diff] [blame] | 217 | $<$<BOOL:${TEST_PSA_API}>:psa_api_test.c> |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 218 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 219 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 220 | target_link_libraries(tfm_ns |
| 221 | PRIVATE |
| 222 | platform_ns |
| 223 | CMSIS_5_tfm_ns |
| 224 | $<$<OR:$<BOOL:${TEST_NS}>,$<BOOL:${TEST_S}>>:tfm_ns_integration_test> |
Kevin Peng | 0d3a381 | 2020-12-23 02:17:57 +0000 | [diff] [blame] | 225 | $<$<BOOL:${TEST_PSA_API}>:val_nspe> |
| 226 | $<$<BOOL:${TEST_PSA_API}>:pal_nspe> |
| 227 | $<$<BOOL:${TEST_PSA_API}>:test_combine> |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 228 | $<$<NOT:$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>>:tfm_s_veneers> |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 229 | tfm_api_ns |
Kevin Peng | af60229 | 2020-10-20 17:49:52 +0800 | [diff] [blame] | 230 | tfm_ns_log |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 231 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 232 | |
Kevin Peng | 0d3a381 | 2020-12-23 02:17:57 +0000 | [diff] [blame] | 233 | target_compile_definitions(tfm_ns |
| 234 | PUBLIC |
| 235 | $<$<BOOL:${TEST_PSA_API}>:PSA_API_TEST_NS> |
| 236 | ) |
| 237 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 238 | set_target_properties(tfm_ns PROPERTIES |
| 239 | SUFFIX ".axf" |
| 240 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" |
| 241 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 242 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 243 | target_link_options(tfm_ns |
| 244 | PRIVATE |
| 245 | $<$<C_COMPILER_ID:GNU>:-Wl,-Map=${CMAKE_BINARY_DIR}/bin/tfm_ns.map> |
| 246 | $<$<C_COMPILER_ID:ARMClang>:--map> |
TTornblom | d35ffa0 | 2020-09-29 13:31:31 +0200 | [diff] [blame] | 247 | $<$<C_COMPILER_ID:IAR>:--map\;${CMAKE_BINARY_DIR}/bin/tfm_ns.map> |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 248 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 249 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 250 | add_convert_to_bin_target(tfm_ns) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 251 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 252 | ############################# CMSIS ############################################ |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 253 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 254 | include(FetchContent) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 255 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 256 | set(FETCHCONTENT_QUIET FALSE) |
| 257 | cmake_policy(SET CMP0079 NEW) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 258 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 259 | add_library(CMSIS_5_tfm_ns INTERFACE) |
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_sources(CMSIS_5_tfm_ns |
| 262 | INTERFACE |
| 263 | ${CMSIS_5_PATH}/RTOS2/RTX/Config/RTX_Config.c |
| 264 | ${CMSIS_5_PATH}/RTOS2/RTX/Source/rtx_lib.c |
| 265 | ${CMAKE_CURRENT_SOURCE_DIR}/os_wrapper_cmsis_rtos_v2.c |
| 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 | target_include_directories(CMSIS_5_tfm_ns |
| 269 | INTERFACE |
| 270 | ${CMSIS_5_PATH}/Core/Include |
| 271 | ${CMSIS_5_PATH}/RTOS2/Include |
| 272 | ${CMSIS_5_PATH}/RTOS2/RTX/Include |
| 273 | ${CMSIS_5_PATH}/RTOS2/RTX/Config |
| 274 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 275 | |
Raef Coles | 5ee45ed | 2020-09-24 11:25:44 +0100 | [diff] [blame] | 276 | target_link_libraries(CMSIS_5_tfm_ns |
| 277 | INTERFACE |
| 278 | platform_ns |
| 279 | ) |