1#------------------------------------------------------------------------------- 2# Copyright (c) 2020-2022, 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 10install(DIRECTORY ${CMAKE_BINARY_DIR}/bin/ 11 DESTINATION ${TFM_INSTALL_PATH}/outputs 12) 13 14set(INTERFACE_INC_DIR ${CMAKE_SOURCE_DIR}/interface/include) 15set(INTERFACE_SRC_DIR ${CMAKE_SOURCE_DIR}/interface/src) 16 17set(INSTALL_INTERFACE_INC_DIR ${TFM_INSTALL_PATH}/interface/include) 18set(INSTALL_INTERFACE_SRC_DIR ${TFM_INSTALL_PATH}/interface/src) 19set(INSTALL_INTERFACE_LIB_DIR ${TFM_INSTALL_PATH}/interface/lib) 20 21# export veneer lib 22if (CONFIG_TFM_USE_TRUSTZONE) 23 install(FILES ${CMAKE_BINARY_DIR}/secure_fw/s_veneers.o 24 DESTINATION ${INSTALL_INTERFACE_LIB_DIR}) 25endif() 26 27####################### export headers ######################################### 28 29install(FILES ${INTERFACE_INC_DIR}/psa/client.h 30 ${INTERFACE_INC_DIR}/psa/error.h 31 DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa) 32 33install(FILES ${CMAKE_BINARY_DIR}/generated/interface/include/psa_manifest/sid.h 34 DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa_manifest) 35 36install(FILES ${INTERFACE_INC_DIR}/tfm_api.h 37 ${INTERFACE_INC_DIR}/tfm_ns_interface.h 38 ${INTERFACE_INC_DIR}/psa_config.h 39 DESTINATION ${INSTALL_INTERFACE_INC_DIR}) 40 41install(FILES ${INTERFACE_INC_DIR}/tfm_ns_client_ext.h 42 DESTINATION ${INSTALL_INTERFACE_INC_DIR}) 43 44install(FILES ${CMAKE_BINARY_DIR}/generated/interface/include/config_impl.h 45 DESTINATION ${INSTALL_INTERFACE_INC_DIR}) 46 47install(FILES ${INTERFACE_INC_DIR}/tfm_psa_call_pack.h 48 DESTINATION ${INSTALL_INTERFACE_INC_DIR}) 49install(FILES ${CMAKE_BINARY_DIR}/generated/interface/include/psa/framework_feature.h 50 DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa) 51 52if (TFM_PARTITION_NS_AGENT_MAILBOX) 53 install(FILES ${INTERFACE_INC_DIR}/multi_core/tfm_multi_core_api.h 54 ${INTERFACE_INC_DIR}/multi_core/tfm_ns_mailbox.h 55 ${INTERFACE_INC_DIR}/multi_core/tfm_mailbox.h 56 ${INTERFACE_INC_DIR}/multi_core/tfm_ns_mailbox_test.h 57 ${CMAKE_BINARY_DIR}/generated/interface/include/tfm_mailbox_config.h 58 DESTINATION ${INSTALL_INTERFACE_INC_DIR}) 59endif() 60 61if (TFM_PARTITION_PROTECTED_STORAGE) 62 install(FILES ${INTERFACE_INC_DIR}/psa/protected_storage.h 63 DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa) 64 install(FILES ${INTERFACE_INC_DIR}/tfm_ps_defs.h 65 DESTINATION ${INSTALL_INTERFACE_INC_DIR}) 66endif() 67 68if (TFM_PARTITION_INTERNAL_TRUSTED_STORAGE) 69 install(FILES ${INTERFACE_INC_DIR}/psa/internal_trusted_storage.h 70 ${INTERFACE_INC_DIR}/psa/storage_common.h 71 DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa) 72 install(FILES ${INTERFACE_INC_DIR}/tfm_its_defs.h 73 DESTINATION ${INSTALL_INTERFACE_INC_DIR}) 74endif() 75 76if (TFM_PARTITION_CRYPTO) 77 install(FILES ${INTERFACE_INC_DIR}/psa/crypto_extra.h 78 ${INTERFACE_INC_DIR}/psa/crypto_compat.h 79 ${INTERFACE_INC_DIR}/psa/crypto.h 80 ${INTERFACE_INC_DIR}/psa/crypto_client_struct.h 81 ${INTERFACE_INC_DIR}/psa/crypto_platform.h 82 ${INTERFACE_INC_DIR}/psa/crypto_sizes.h 83 ${INTERFACE_INC_DIR}/psa/crypto_struct.h 84 ${INTERFACE_INC_DIR}/psa/crypto_types.h 85 ${INTERFACE_INC_DIR}/psa/crypto_values.h 86 DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa) 87 install(FILES ${INTERFACE_INC_DIR}/tfm_crypto_defs.h 88 DESTINATION ${INSTALL_INTERFACE_INC_DIR}) 89endif() 90 91if (TFM_PARTITION_INITIAL_ATTESTATION) 92 install(FILES ${INTERFACE_INC_DIR}/psa/initial_attestation.h 93 DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa) 94 install(FILES ${INTERFACE_INC_DIR}/tfm_attest_defs.h 95 ${INTERFACE_INC_DIR}/tfm_attest_iat_defs.h 96 DESTINATION ${INSTALL_INTERFACE_INC_DIR}) 97endif() 98 99if(TFM_PARTITION_PLATFORM) 100 install(FILES ${INTERFACE_INC_DIR}/tfm_platform_api.h 101 DESTINATION ${INSTALL_INTERFACE_INC_DIR}) 102endif() 103 104if(TFM_PARTITION_FIRMWARE_UPDATE) 105 install(FILES ${INTERFACE_INC_DIR}/psa/update.h 106 ${CMAKE_BINARY_DIR}/generated/interface/include/psa/fwu_config.h 107 DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa) 108 install(FILES ${INTERFACE_INC_DIR}/tfm_fwu_defs.h 109 DESTINATION ${INSTALL_INTERFACE_INC_DIR}) 110endif() 111 112if(PLATFORM_DEFAULT_CRYPTO_KEYS) 113 install(DIRECTORY ${INTERFACE_INC_DIR}/crypto_keys 114 DESTINATION ${INSTALL_INTERFACE_INC_DIR}) 115endif() 116 117####################### export sources ######################################### 118 119if (TFM_PARTITION_NS_AGENT_MAILBOX) 120 install(FILES ${INTERFACE_SRC_DIR}/multi_core/tfm_ns_mailbox.c 121 ${INTERFACE_SRC_DIR}/multi_core/tfm_multi_core_ns_api.c 122 ${INTERFACE_SRC_DIR}/multi_core/tfm_multi_core_psa_ns_api.c 123 ${INTERFACE_SRC_DIR}/multi_core/tfm_ns_mailbox_thread.c 124 DESTINATION ${INSTALL_INTERFACE_SRC_DIR}/multi_core) 125endif() 126 127if (TFM_PARTITION_NS_AGENT_TZ) 128 install(FILES ${INTERFACE_SRC_DIR}/tfm_psa_ns_api.c 129 DESTINATION ${INSTALL_INTERFACE_SRC_DIR}) 130 if (CONFIG_TFM_CONNECTION_BASED_SERVICE_API) 131 install(FILES ${INTERFACE_SRC_DIR}/tfm_psa_ns_connection_api.c 132 DESTINATION ${INSTALL_INTERFACE_SRC_DIR}) 133 endif() 134endif() 135 136if (CONFIG_TFM_USE_TRUSTZONE) 137 install(FILES ${INTERFACE_SRC_DIR}/tfm_ns_interface.c.example 138 DESTINATION ${INSTALL_INTERFACE_SRC_DIR}) 139endif() 140 141if (TFM_PARTITION_PROTECTED_STORAGE) 142 install(FILES ${INTERFACE_SRC_DIR}/tfm_ps_api.c 143 DESTINATION ${INSTALL_INTERFACE_SRC_DIR}) 144endif() 145 146if (TFM_PARTITION_INTERNAL_TRUSTED_STORAGE) 147 install(FILES ${INTERFACE_SRC_DIR}/tfm_its_api.c 148 DESTINATION ${INSTALL_INTERFACE_SRC_DIR}) 149endif() 150 151if (TFM_PARTITION_CRYPTO) 152 install(FILES ${INTERFACE_SRC_DIR}/tfm_crypto_api.c 153 DESTINATION ${INSTALL_INTERFACE_SRC_DIR}) 154endif() 155 156if (TFM_PARTITION_INITIAL_ATTESTATION) 157 install(FILES ${INTERFACE_SRC_DIR}/tfm_attest_api.c 158 DESTINATION ${INSTALL_INTERFACE_SRC_DIR}) 159endif() 160 161if(TFM_PARTITION_PLATFORM) 162 install(FILES ${INTERFACE_SRC_DIR}/tfm_platform_api.c 163 DESTINATION ${INSTALL_INTERFACE_SRC_DIR}) 164endif() 165 166 167##################### Export image signing information ######################### 168 169set(INSTALL_IMAGE_SIGNING_DIR ${TFM_INSTALL_PATH}/image_signing) 170 171if(BL2) 172 install(DIRECTORY bl2/ext/mcuboot/scripts 173 DESTINATION ${INSTALL_IMAGE_SIGNING_DIR}) 174 175 if (MCUBOOT_ENC_IMAGES) 176 install(FILES ${MCUBOOT_KEY_ENC} 177 DESTINATION ${INSTALL_IMAGE_SIGNING_DIR}/keys) 178 endif() 179 180 install(FILES $<TARGET_OBJECTS:signing_layout_s> 181 DESTINATION ${INSTALL_IMAGE_SIGNING_DIR}/layout_files) 182 183 if(MCUBOOT_IMAGE_NUMBER GREATER 1) 184 install(FILES $<TARGET_OBJECTS:signing_layout_ns> 185 DESTINATION ${INSTALL_IMAGE_SIGNING_DIR}/layout_files) 186 187 install(FILES ${MCUBOOT_KEY_NS} 188 DESTINATION ${INSTALL_IMAGE_SIGNING_DIR}/keys) 189 else() 190 install(FILES ${MCUBOOT_KEY_S} 191 DESTINATION ${INSTALL_IMAGE_SIGNING_DIR}/keys) 192 endif() 193endif() 194 195if(TFM_PARTITION_FIRMWARE_UPDATE) 196 install(FILES ${INTERFACE_SRC_DIR}/tfm_fwu_api.c 197 DESTINATION ${INSTALL_INTERFACE_SRC_DIR}) 198endif() 199 200##################### Platform-specific installation ########################### 201 202if (EXISTS ${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/install.cmake) 203 include(platform/ext/target/${TFM_PLATFORM}/install.cmake) 204endif() 205