1#------------------------------------------------------------------------------- 2# Copyright (c) 2020-2023, Arm Limited. All rights reserved. 3# Copyright (c) 2022 Cypress Semiconductor Corporation (an Infineon company) 4# or an affiliate of Cypress Semiconductor Corporation. All rights reserved. 5# 6# SPDX-License-Identifier: BSD-3-Clause 7# 8#------------------------------------------------------------------------------- 9 10cmake_minimum_required(VERSION 3.15) 11cmake_policy(SET CMP0076 NEW) 12cmake_policy(SET CMP0079 NEW) 13 14# Generate framework feature 15set(PSA_FRAMEWORK_ISOLATION_LEVEL ${TFM_ISOLATION_LEVEL}) 16configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/psa/framework_feature.h.in 17 ${CMAKE_BINARY_DIR}/generated/interface/include/psa/framework_feature.h 18 @ONLY) 19 20###################### PSA interface (header only) ############################# 21 22add_library(psa_interface INTERFACE) 23 24target_include_directories(psa_interface 25 INTERFACE 26 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> 27 $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/generated/interface/include> 28 $<BUILD_INTERFACE:$<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:${CMAKE_CURRENT_SOURCE_DIR}/include/multi_core>> 29) 30 31target_link_libraries(psa_interface 32 INTERFACE 33 tfm_config 34) 35 36target_compile_definitions(psa_interface 37 INTERFACE 38 $<$<BOOL:${CONFIG_TFM_ENABLE_CTX_MGMT}>:CONFIG_TFM_ENABLE_CTX_MGMT> 39 $<$<BOOL:${TFM_ISOLATION_LEVEL}>:TFM_ISOLATION_LEVEL=${TFM_ISOLATION_LEVEL}> 40 $<$<BOOL:${CONFIG_TFM_USE_TRUSTZONE}>:CONFIG_TFM_USE_TRUSTZONE> 41 $<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:TFM_MULTI_CORE_TOPOLOGY> 42 $<$<BOOL:${CONFIG_TFM_PARTITION_META}>:CONFIG_TFM_PARTITION_META> 43 $<$<BOOL:${TEST_NS_MULTI_CORE}>:TFM_MULTI_CORE_TEST> 44) 45 46###################### PSA api (S lib) ######################################### 47 48target_sources(tfm_sprt 49 PRIVATE 50 $<$<BOOL:${TFM_PARTITION_INITIAL_ATTESTATION}>:${CMAKE_CURRENT_SOURCE_DIR}/src/tfm_attest_api.c> 51 $<$<BOOL:${TFM_PARTITION_CRYPTO}>:${CMAKE_CURRENT_SOURCE_DIR}/src/tfm_crypto_api.c> 52 $<$<BOOL:${TFM_PARTITION_FIRMWARE_UPDATE}>:${CMAKE_CURRENT_SOURCE_DIR}/src/tfm_fwu_api.c> 53 $<$<BOOL:${TFM_PARTITION_INTERNAL_TRUSTED_STORAGE}>:${CMAKE_CURRENT_SOURCE_DIR}/src/tfm_its_api.c> 54 $<$<BOOL:${TFM_PARTITION_PLATFORM}>:${CMAKE_CURRENT_SOURCE_DIR}/src/tfm_platform_api.c> 55 $<$<BOOL:${TFM_PARTITION_PROTECTED_STORAGE}>:${CMAKE_CURRENT_SOURCE_DIR}/src/tfm_ps_api.c> 56 ${CMAKE_CURRENT_SOURCE_DIR}/src/tfm_psa_call.c 57) 58 59###################### Export configurations to NS ############################# 60 61if (TFM_MULTI_CORE_TOPOLOGY) 62 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/multi_core/tfm_mailbox_config.h.in 63 ${CMAKE_BINARY_DIR}/generated/interface/include/tfm_mailbox_config.h 64 NEWLINE_STYLE UNIX 65 ) 66endif() 67