Raef Coles | 7d3545b | 2020-07-10 10:00:35 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Sherry Zhang | f58f2bd | 2022-01-10 17:21:11 +0800 | [diff] [blame] | 2 | # Copyright (c) 2020-2022, Arm Limited. All rights reserved. |
Raef Coles | 7d3545b | 2020-07-10 10:00:35 +0100 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
Raef Coles | 6981732 | 2020-10-19 14:14:14 +0100 | [diff] [blame] | 8 | cmake_minimum_required(VERSION 3.15) |
Raef Coles | 7d3545b | 2020-07-10 10:00:35 +0100 | [diff] [blame] | 9 | cmake_policy(SET CMP0076 NEW) |
| 10 | cmake_policy(SET CMP0079 NEW) |
| 11 | |
Kevin Peng | 386374c | 2021-11-04 14:36:17 +0800 | [diff] [blame] | 12 | # Generate framework feature |
Kevin Peng | 710acf5 | 2021-11-16 11:42:41 +0800 | [diff] [blame] | 13 | set(PSA_FRAMEWORK_ISOLATION_LEVEL ${TFM_ISOLATION_LEVEL}) |
Kevin Peng | 386374c | 2021-11-04 14:36:17 +0800 | [diff] [blame] | 14 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/psa/framework_feature.h.in |
Kevin Peng | 710acf5 | 2021-11-16 11:42:41 +0800 | [diff] [blame] | 15 | ${CMAKE_BINARY_DIR}/generated/interface/include/psa/framework_feature.h |
| 16 | @ONLY) |
Raef Coles | 7d3545b | 2020-07-10 10:00:35 +0100 | [diff] [blame] | 17 | |
| 18 | if (TFM_MULTI_CORE_TOPOLOGY) |
| 19 | include(${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake) |
Raef Coles | e3bf94d | 2020-11-03 11:49:56 +0000 | [diff] [blame] | 20 | tfm_toolchain_reload_compiler() |
Raef Coles | 7d3545b | 2020-07-10 10:00:35 +0100 | [diff] [blame] | 21 | # The platform target is created in this directory/file so that it has the |
| 22 | # same settings as the main ns target. |
David Hu | 1d2329a | 2020-12-16 19:17:06 +0800 | [diff] [blame] | 23 | add_library(platform_ns STATIC EXCLUDE_FROM_ALL) |
Raef Coles | 7d3545b | 2020-07-10 10:00:35 +0100 | [diff] [blame] | 24 | endif() |
| 25 | |
| 26 | ###################### PSA interface (header only) ############################# |
| 27 | |
| 28 | add_library(psa_interface INTERFACE) |
| 29 | |
| 30 | target_include_directories(psa_interface |
| 31 | INTERFACE |
| 32 | ${CMAKE_CURRENT_SOURCE_DIR}/include |
| 33 | ${CMAKE_BINARY_DIR}/generated/interface/include |
David Hu | 04969a4 | 2020-06-14 21:25:35 +0800 | [diff] [blame] | 34 | $<$<OR:$<BOOL:${FORWARD_PROT_MSG}>,$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>>:${CMAKE_CURRENT_SOURCE_DIR}/include/multi_core> |
Raef Coles | 7d3545b | 2020-07-10 10:00:35 +0100 | [diff] [blame] | 35 | ) |
| 36 | |
| 37 | # PSA interface files are generated from a template |
| 38 | add_dependencies(psa_interface |
| 39 | tfm_generated_files |
| 40 | ) |
| 41 | |
| 42 | target_link_libraries(psa_interface |
| 43 | INTERFACE |
| 44 | tfm_partition_defs |
| 45 | ) |
| 46 | |
| 47 | target_compile_definitions(psa_interface |
| 48 | INTERFACE |
| 49 | $<$<BOOL:${TFM_PSA_API}>:TFM_PSA_API> |
Raef Coles | 7d3545b | 2020-07-10 10:00:35 +0100 | [diff] [blame] | 50 | $<$<BOOL:${CONFIG_TFM_ENABLE_CTX_MGMT}>:CONFIG_TFM_ENABLE_CTX_MGMT> |
| 51 | $<$<BOOL:${TFM_ISOLATION_LEVEL}>:TFM_LVL=${TFM_ISOLATION_LEVEL}> |
Raef Coles | 7d3545b | 2020-07-10 10:00:35 +0100 | [diff] [blame] | 52 | $<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:TFM_MULTI_CORE_TOPOLOGY> |
Mark Horvath | b9ac0d5 | 2020-09-09 10:48:22 +0200 | [diff] [blame] | 53 | $<$<BOOL:${FORWARD_PROT_MSG}>:FORWARD_PROT_MSG=${FORWARD_PROT_MSG}> |
Summer Qin | 2a29959 | 2022-02-07 17:37:10 +0800 | [diff] [blame] | 54 | $<$<BOOL:${CONFIG_TFM_PARTITION_META}>:CONFIG_TFM_PARTITION_META> |
Kevin Peng | d4ccd08 | 2022-02-28 14:16:37 +0800 | [diff] [blame] | 55 | $<$<BOOL:${CONFIG_TFM_DOORBELL_API}>:CONFIG_TFM_DOORBELL_API=1> |
Raef Coles | 7d3545b | 2020-07-10 10:00:35 +0100 | [diff] [blame] | 56 | ) |
| 57 | |
| 58 | ###################### PSA api (S lib) ######################################### |
| 59 | |
| 60 | target_sources(tfm_secure_api |
| 61 | INTERFACE |
Ken Liu | 82e3eac | 2021-10-14 16:19:13 +0800 | [diff] [blame] | 62 | $<$<BOOL:${TFM_PSA_API}>:${CMAKE_CURRENT_SOURCE_DIR}/src/tfm_psa_call_pack.c> |
Raef Coles | 7d3545b | 2020-07-10 10:00:35 +0100 | [diff] [blame] | 63 | ) |
David Hu | 8b526d4 | 2020-11-27 20:59:52 +0800 | [diff] [blame] | 64 | |
| 65 | ###################### Export configurations to NS ############################# |
| 66 | |
| 67 | if (TFM_MULTI_CORE_TOPOLOGY OR FORWARD_PROT_MSG) |
| 68 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/multi_core/tfm_mailbox_config.h.in |
David Hu | 186a129 | 2021-09-13 09:05:52 +0800 | [diff] [blame] | 69 | ${CMAKE_BINARY_DIR}/generated/interface/include/tfm_mailbox_config.h |
David Hu | 8b526d4 | 2020-11-27 20:59:52 +0800 | [diff] [blame] | 70 | NEWLINE_STYLE UNIX |
| 71 | ) |
| 72 | endif() |