Raef Coles | 7d3545b | 2020-07-10 10:00:35 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Kevin Peng | a2b6802 | 2023-01-13 13:54:05 +0800 | [diff] [blame] | 2 | # Copyright (c) 2020-2023, Arm Limited. All rights reserved. |
Chris Brand | d079033 | 2022-05-20 13:36:30 -0700 | [diff] [blame] | 3 | # Copyright (c) 2022 Cypress Semiconductor Corporation (an Infineon company) |
| 4 | # or an affiliate of Cypress Semiconductor Corporation. All rights reserved. |
Raef Coles | 7d3545b | 2020-07-10 10:00:35 +0100 | [diff] [blame] | 5 | # |
| 6 | # SPDX-License-Identifier: BSD-3-Clause |
| 7 | # |
| 8 | #------------------------------------------------------------------------------- |
| 9 | |
Raef Coles | 6981732 | 2020-10-19 14:14:14 +0100 | [diff] [blame] | 10 | cmake_minimum_required(VERSION 3.15) |
Raef Coles | 7d3545b | 2020-07-10 10:00:35 +0100 | [diff] [blame] | 11 | cmake_policy(SET CMP0076 NEW) |
| 12 | cmake_policy(SET CMP0079 NEW) |
| 13 | |
Kevin Peng | 386374c | 2021-11-04 14:36:17 +0800 | [diff] [blame] | 14 | # Generate framework feature |
Kevin Peng | 710acf5 | 2021-11-16 11:42:41 +0800 | [diff] [blame] | 15 | set(PSA_FRAMEWORK_ISOLATION_LEVEL ${TFM_ISOLATION_LEVEL}) |
Kevin Peng | 386374c | 2021-11-04 14:36:17 +0800 | [diff] [blame] | 16 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/psa/framework_feature.h.in |
Kevin Peng | 710acf5 | 2021-11-16 11:42:41 +0800 | [diff] [blame] | 17 | ${CMAKE_BINARY_DIR}/generated/interface/include/psa/framework_feature.h |
| 18 | @ONLY) |
Raef Coles | 7d3545b | 2020-07-10 10:00:35 +0100 | [diff] [blame] | 19 | |
Kevin Peng | a2b6802 | 2023-01-13 13:54:05 +0800 | [diff] [blame] | 20 | if (EXISTS ${TARGET_PLATFORM_PATH}/preload_ns.cmake) |
| 21 | include(${TARGET_PLATFORM_PATH}/preload_ns.cmake) |
Raef Coles | e3bf94d | 2020-11-03 11:49:56 +0000 | [diff] [blame] | 22 | tfm_toolchain_reload_compiler() |
Chris Brand | d079033 | 2022-05-20 13:36:30 -0700 | [diff] [blame] | 23 | endif() |
| 24 | |
Raef Coles | 7d3545b | 2020-07-10 10:00:35 +0100 | [diff] [blame] | 25 | ###################### PSA interface (header only) ############################# |
| 26 | |
| 27 | add_library(psa_interface INTERFACE) |
| 28 | |
| 29 | target_include_directories(psa_interface |
| 30 | INTERFACE |
| 31 | ${CMAKE_CURRENT_SOURCE_DIR}/include |
| 32 | ${CMAKE_BINARY_DIR}/generated/interface/include |
Mark Horvath | fbc2c50 | 2022-09-09 16:16:07 +0200 | [diff] [blame] | 33 | $<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:${CMAKE_CURRENT_SOURCE_DIR}/include/multi_core> |
Raef Coles | 7d3545b | 2020-07-10 10:00:35 +0100 | [diff] [blame] | 34 | ) |
| 35 | |
Raef Coles | 7d3545b | 2020-07-10 10:00:35 +0100 | [diff] [blame] | 36 | target_link_libraries(psa_interface |
| 37 | INTERFACE |
Xinyu Zhang | cdbe362 | 2022-10-31 14:34:25 +0800 | [diff] [blame] | 38 | tfm_config |
Raef Coles | 7d3545b | 2020-07-10 10:00:35 +0100 | [diff] [blame] | 39 | ) |
| 40 | |
| 41 | target_compile_definitions(psa_interface |
| 42 | INTERFACE |
Raef Coles | 7d3545b | 2020-07-10 10:00:35 +0100 | [diff] [blame] | 43 | $<$<BOOL:${CONFIG_TFM_ENABLE_CTX_MGMT}>:CONFIG_TFM_ENABLE_CTX_MGMT> |
Xinyu Zhang | ae99e2d | 2023-07-28 14:03:29 +0800 | [diff] [blame] | 44 | $<$<BOOL:${TFM_ISOLATION_LEVEL}>:TFM_ISOLATION_LEVEL=${TFM_ISOLATION_LEVEL}> |
Chris Brand | ca81902 | 2022-07-19 09:25:15 -0700 | [diff] [blame] | 45 | $<$<BOOL:${CONFIG_TFM_USE_TRUSTZONE}>:CONFIG_TFM_USE_TRUSTZONE> |
Raef Coles | 7d3545b | 2020-07-10 10:00:35 +0100 | [diff] [blame] | 46 | $<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:TFM_MULTI_CORE_TOPOLOGY> |
Summer Qin | 2a29959 | 2022-02-07 17:37:10 +0800 | [diff] [blame] | 47 | $<$<BOOL:${CONFIG_TFM_PARTITION_META}>:CONFIG_TFM_PARTITION_META> |
Raef Coles | 7d3545b | 2020-07-10 10:00:35 +0100 | [diff] [blame] | 48 | ) |
| 49 | |
| 50 | ###################### PSA api (S lib) ######################################### |
| 51 | |
Kevin Peng | 8b8f7a4 | 2022-08-05 17:56:30 +0800 | [diff] [blame] | 52 | target_sources(tfm_sprt |
| 53 | PRIVATE |
Summer Qin | d23bbb3 | 2022-10-18 15:30:06 +0800 | [diff] [blame] | 54 | $<$<BOOL:${TFM_PARTITION_INITIAL_ATTESTATION}>:${CMAKE_CURRENT_SOURCE_DIR}/src/tfm_attest_api.c> |
| 55 | $<$<BOOL:${TFM_PARTITION_CRYPTO}>:${CMAKE_CURRENT_SOURCE_DIR}/src/tfm_crypto_api.c> |
| 56 | $<$<BOOL:${TFM_PARTITION_FIRMWARE_UPDATE}>:${CMAKE_CURRENT_SOURCE_DIR}/src/tfm_fwu_api.c> |
| 57 | $<$<BOOL:${TFM_PARTITION_INTERNAL_TRUSTED_STORAGE}>:${CMAKE_CURRENT_SOURCE_DIR}/src/tfm_its_api.c> |
| 58 | $<$<BOOL:${TFM_PARTITION_PLATFORM}>:${CMAKE_CURRENT_SOURCE_DIR}/src/tfm_platform_api.c> |
| 59 | $<$<BOOL:${TFM_PARTITION_PROTECTED_STORAGE}>:${CMAKE_CURRENT_SOURCE_DIR}/src/tfm_ps_api.c> |
Xinyu Zhang | 526bf5f | 2023-04-18 13:58:15 +0800 | [diff] [blame] | 60 | ${CMAKE_CURRENT_SOURCE_DIR}/src/tfm_psa_call.c |
Kevin Peng | 8b8f7a4 | 2022-08-05 17:56:30 +0800 | [diff] [blame] | 61 | ) |
| 62 | |
David Hu | 8b526d4 | 2020-11-27 20:59:52 +0800 | [diff] [blame] | 63 | ###################### Export configurations to NS ############################# |
| 64 | |
Mark Horvath | fbc2c50 | 2022-09-09 16:16:07 +0200 | [diff] [blame] | 65 | if (TFM_MULTI_CORE_TOPOLOGY) |
David Hu | 8b526d4 | 2020-11-27 20:59:52 +0800 | [diff] [blame] | 66 | 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] | 67 | ${CMAKE_BINARY_DIR}/generated/interface/include/tfm_mailbox_config.h |
David Hu | 8b526d4 | 2020-11-27 20:59:52 +0800 | [diff] [blame] | 68 | NEWLINE_STYLE UNIX |
| 69 | ) |
| 70 | endif() |