blob: 0062d56edda18ba5264818fef7c365e9edcac265 [file] [log] [blame]
Raef Coles7d3545b2020-07-10 10:00:35 +01001#-------------------------------------------------------------------------------
Sherry Zhangf58f2bd2022-01-10 17:21:11 +08002# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
Chris Brandd0790332022-05-20 13:36:30 -07003# Copyright (c) 2022 Cypress Semiconductor Corporation (an Infineon company)
4# or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
Raef Coles7d3545b2020-07-10 10:00:35 +01005#
6# SPDX-License-Identifier: BSD-3-Clause
7#
8#-------------------------------------------------------------------------------
9
Raef Coles69817322020-10-19 14:14:14 +010010cmake_minimum_required(VERSION 3.15)
Raef Coles7d3545b2020-07-10 10:00:35 +010011cmake_policy(SET CMP0076 NEW)
12cmake_policy(SET CMP0079 NEW)
13
Kevin Peng386374c2021-11-04 14:36:17 +080014# Generate framework feature
Kevin Peng710acf52021-11-16 11:42:41 +080015set(PSA_FRAMEWORK_ISOLATION_LEVEL ${TFM_ISOLATION_LEVEL})
Kevin Peng386374c2021-11-04 14:36:17 +080016configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/psa/framework_feature.h.in
Kevin Peng710acf52021-11-16 11:42:41 +080017 ${CMAKE_BINARY_DIR}/generated/interface/include/psa/framework_feature.h
18 @ONLY)
Raef Coles7d3545b2020-07-10 10:00:35 +010019
Chris Brandd0790332022-05-20 13:36:30 -070020if (EXISTS ${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake)
Raef Coles7d3545b2020-07-10 10:00:35 +010021 include(${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake)
Raef Colese3bf94d2020-11-03 11:49:56 +000022 tfm_toolchain_reload_compiler()
Chris Brandd0790332022-05-20 13:36:30 -070023endif()
24
25if (TFM_MULTI_CORE_TOPOLOGY)
Raef Coles7d3545b2020-07-10 10:00:35 +010026 # The platform target is created in this directory/file so that it has the
27 # same settings as the main ns target.
David Hu1d2329a2020-12-16 19:17:06 +080028 add_library(platform_ns STATIC EXCLUDE_FROM_ALL)
Raef Coles7d3545b2020-07-10 10:00:35 +010029endif()
30
31###################### PSA interface (header only) #############################
32
33add_library(psa_interface INTERFACE)
34
35target_include_directories(psa_interface
36 INTERFACE
37 ${CMAKE_CURRENT_SOURCE_DIR}/include
38 ${CMAKE_BINARY_DIR}/generated/interface/include
David Hu04969a42020-06-14 21:25:35 +080039 $<$<OR:$<BOOL:${FORWARD_PROT_MSG}>,$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>>:${CMAKE_CURRENT_SOURCE_DIR}/include/multi_core>
Raef Coles7d3545b2020-07-10 10:00:35 +010040)
41
42# PSA interface files are generated from a template
43add_dependencies(psa_interface
44 tfm_generated_files
45)
46
47target_link_libraries(psa_interface
48 INTERFACE
49 tfm_partition_defs
50)
51
52target_compile_definitions(psa_interface
53 INTERFACE
54 $<$<BOOL:${TFM_PSA_API}>:TFM_PSA_API>
Raef Coles7d3545b2020-07-10 10:00:35 +010055 $<$<BOOL:${CONFIG_TFM_ENABLE_CTX_MGMT}>:CONFIG_TFM_ENABLE_CTX_MGMT>
56 $<$<BOOL:${TFM_ISOLATION_LEVEL}>:TFM_LVL=${TFM_ISOLATION_LEVEL}>
Raef Coles7d3545b2020-07-10 10:00:35 +010057 $<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:TFM_MULTI_CORE_TOPOLOGY>
Mark Horvathb9ac0d52020-09-09 10:48:22 +020058 $<$<BOOL:${FORWARD_PROT_MSG}>:FORWARD_PROT_MSG=${FORWARD_PROT_MSG}>
Summer Qin2a299592022-02-07 17:37:10 +080059 $<$<BOOL:${CONFIG_TFM_PARTITION_META}>:CONFIG_TFM_PARTITION_META>
Kevin Pengd4ccd082022-02-28 14:16:37 +080060 $<$<BOOL:${CONFIG_TFM_DOORBELL_API}>:CONFIG_TFM_DOORBELL_API=1>
Raef Coles7d3545b2020-07-10 10:00:35 +010061)
62
63###################### PSA api (S lib) #########################################
64
65target_sources(tfm_secure_api
66 INTERFACE
Ken Liu82e3eac2021-10-14 16:19:13 +080067 $<$<BOOL:${TFM_PSA_API}>:${CMAKE_CURRENT_SOURCE_DIR}/src/tfm_psa_call_pack.c>
Raef Coles7d3545b2020-07-10 10:00:35 +010068)
David Hu8b526d42020-11-27 20:59:52 +080069
70###################### Export configurations to NS #############################
71
72if (TFM_MULTI_CORE_TOPOLOGY OR FORWARD_PROT_MSG)
73 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/multi_core/tfm_mailbox_config.h.in
David Hu186a1292021-09-13 09:05:52 +080074 ${CMAKE_BINARY_DIR}/generated/interface/include/tfm_mailbox_config.h
David Hu8b526d42020-11-27 20:59:52 +080075 NEWLINE_STYLE UNIX
76 )
77endif()