blob: bc216b8077cbe94f3d5e957c2afa615e4f1181c6 [file] [log] [blame]
Raef Coles7d3545b2020-07-10 10:00:35 +01001#-------------------------------------------------------------------------------
David Hu04969a42020-06-14 21:25:35 +08002# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
Raef Coles7d3545b2020-07-10 10:00:35 +01003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
Raef Coles69817322020-10-19 14:14:14 +01008cmake_minimum_required(VERSION 3.15)
Raef Coles7d3545b2020-07-10 10:00:35 +01009cmake_policy(SET CMP0076 NEW)
10cmake_policy(SET CMP0079 NEW)
11
Kevin Peng386374c2021-11-04 14:36:17 +080012# Generate framework feature
13configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/psa/framework_feature.h.in
14 ${CMAKE_BINARY_DIR}/generated/interface/include/psa/framework_feature.h)
Raef Coles7d3545b2020-07-10 10:00:35 +010015
16if (TFM_MULTI_CORE_TOPOLOGY)
17 include(${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake)
Raef Colese3bf94d2020-11-03 11:49:56 +000018 tfm_toolchain_reload_compiler()
Raef Coles7d3545b2020-07-10 10:00:35 +010019 # The platform target is created in this directory/file so that it has the
20 # same settings as the main ns target.
David Hu1d2329a2020-12-16 19:17:06 +080021 add_library(platform_ns STATIC EXCLUDE_FROM_ALL)
Raef Coles7d3545b2020-07-10 10:00:35 +010022endif()
23
24###################### PSA interface (header only) #############################
25
26add_library(psa_interface INTERFACE)
27
28target_include_directories(psa_interface
29 INTERFACE
30 ${CMAKE_CURRENT_SOURCE_DIR}/include
31 ${CMAKE_BINARY_DIR}/generated/interface/include
David Hu04969a42020-06-14 21:25:35 +080032 $<$<OR:$<BOOL:${FORWARD_PROT_MSG}>,$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>>:${CMAKE_CURRENT_SOURCE_DIR}/include/multi_core>
Raef Coles7d3545b2020-07-10 10:00:35 +010033)
34
35# PSA interface files are generated from a template
36add_dependencies(psa_interface
37 tfm_generated_files
38)
39
40target_link_libraries(psa_interface
41 INTERFACE
42 tfm_partition_defs
43)
44
45target_compile_definitions(psa_interface
46 INTERFACE
47 $<$<BOOL:${TFM_PSA_API}>:TFM_PSA_API>
Raef Coles7d3545b2020-07-10 10:00:35 +010048 $<$<BOOL:${CONFIG_TFM_ENABLE_CTX_MGMT}>:CONFIG_TFM_ENABLE_CTX_MGMT>
49 $<$<BOOL:${TFM_ISOLATION_LEVEL}>:TFM_LVL=${TFM_ISOLATION_LEVEL}>
Raef Coles7d3545b2020-07-10 10:00:35 +010050 $<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:TFM_MULTI_CORE_TOPOLOGY>
Mark Horvathb9ac0d52020-09-09 10:48:22 +020051 $<$<BOOL:${FORWARD_PROT_MSG}>:FORWARD_PROT_MSG=${FORWARD_PROT_MSG}>
Summer Qin2cd2ab72020-04-22 14:55:00 +080052 $<$<BOOL:${TFM_SP_META_PTR_ENABLE}>:TFM_SP_META_PTR_ENABLE>
Raef Coles7d3545b2020-07-10 10:00:35 +010053)
54
55###################### PSA api (S lib) #########################################
56
57target_sources(tfm_secure_api
58 INTERFACE
Ken Liu82e3eac2021-10-14 16:19:13 +080059 $<$<BOOL:${TFM_PSA_API}>:${CMAKE_CURRENT_SOURCE_DIR}/src/tfm_psa_call_pack.c>
Raef Coles7d3545b2020-07-10 10:00:35 +010060)
David Hu8b526d42020-11-27 20:59:52 +080061
62###################### Export configurations to NS #############################
63
64if (TFM_MULTI_CORE_TOPOLOGY OR FORWARD_PROT_MSG)
65 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/multi_core/tfm_mailbox_config.h.in
David Hu186a1292021-09-13 09:05:52 +080066 ${CMAKE_BINARY_DIR}/generated/interface/include/tfm_mailbox_config.h
David Hu8b526d42020-11-27 20:59:52 +080067 NEWLINE_STYLE UNIX
68 )
69endif()