1#-------------------------------------------------------------------------------
2# Copyright (c) 2020-2023, Arm Limited. All rights reserved.
3# Copyright (c) 2022-2023 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        DESTINATION ${INSTALL_INTERFACE_INC_DIR})
39
40install(FILES       ${INTERFACE_INC_DIR}/tfm_ns_client_ext.h
41        DESTINATION ${INSTALL_INTERFACE_INC_DIR})
42
43install(FILES       ${CMAKE_SOURCE_DIR}/secure_fw/include/config_tfm.h
44        DESTINATION ${INSTALL_INTERFACE_INC_DIR})
45install(FILES       ${CMAKE_SOURCE_DIR}/config/config_base.h
46        DESTINATION ${INSTALL_INTERFACE_INC_DIR})
47
48install(FILES       ${INTERFACE_INC_DIR}/tfm_psa_call_pack.h
49        DESTINATION ${INSTALL_INTERFACE_INC_DIR})
50install(FILES       ${CMAKE_BINARY_DIR}/generated/interface/include/psa/framework_feature.h
51        DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa)
52
53if (TFM_PARTITION_NS_AGENT_MAILBOX)
54    install(FILES       ${INTERFACE_INC_DIR}/multi_core/tfm_multi_core_api.h
55                        ${INTERFACE_INC_DIR}/multi_core/tfm_ns_mailbox.h
56                        ${INTERFACE_INC_DIR}/multi_core/tfm_mailbox.h
57                        ${INTERFACE_INC_DIR}/multi_core/tfm_ns_mailbox_test.h
58                        ${CMAKE_BINARY_DIR}/generated/interface/include/tfm_mailbox_config.h
59            DESTINATION ${INSTALL_INTERFACE_INC_DIR})
60endif()
61
62if (TFM_PARTITION_PROTECTED_STORAGE)
63    install(FILES       ${INTERFACE_INC_DIR}/psa/protected_storage.h
64            DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa)
65    install(FILES       ${INTERFACE_INC_DIR}/tfm_ps_defs.h
66            DESTINATION ${INSTALL_INTERFACE_INC_DIR})
67endif()
68
69if (TFM_PARTITION_INTERNAL_TRUSTED_STORAGE)
70    install(FILES       ${INTERFACE_INC_DIR}/psa/internal_trusted_storage.h
71                        ${INTERFACE_INC_DIR}/psa/storage_common.h
72            DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa)
73    install(FILES       ${INTERFACE_INC_DIR}/tfm_its_defs.h
74            DESTINATION ${INSTALL_INTERFACE_INC_DIR})
75endif()
76
77if (TFM_PARTITION_CRYPTO)
78    install(FILES       ${INTERFACE_INC_DIR}/psa/crypto_extra.h
79                        ${INTERFACE_INC_DIR}/psa/crypto_compat.h
80                        ${INTERFACE_INC_DIR}/psa/crypto.h
81                        ${INTERFACE_INC_DIR}/psa/crypto_client_struct.h
82                        ${INTERFACE_INC_DIR}/psa/crypto_platform.h
83                        ${INTERFACE_INC_DIR}/psa/crypto_sizes.h
84                        ${INTERFACE_INC_DIR}/psa/crypto_struct.h
85                        ${INTERFACE_INC_DIR}/psa/crypto_types.h
86                        ${INTERFACE_INC_DIR}/psa/crypto_values.h
87            DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa)
88    install(FILES       ${INTERFACE_INC_DIR}/tfm_crypto_defs.h
89            DESTINATION ${INSTALL_INTERFACE_INC_DIR})
90endif()
91
92if (TFM_PARTITION_INITIAL_ATTESTATION)
93    install(FILES       ${INTERFACE_INC_DIR}/psa/initial_attestation.h
94            DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa)
95    install(FILES       ${INTERFACE_INC_DIR}/tfm_attest_defs.h
96                        ${INTERFACE_INC_DIR}/tfm_attest_iat_defs.h
97            DESTINATION ${INSTALL_INTERFACE_INC_DIR})
98endif()
99
100if(TFM_PARTITION_PLATFORM)
101    install(FILES       ${INTERFACE_INC_DIR}/tfm_platform_api.h
102            DESTINATION ${INSTALL_INTERFACE_INC_DIR})
103endif()
104
105if(TFM_PARTITION_FIRMWARE_UPDATE)
106    install(FILES       ${INTERFACE_INC_DIR}/psa/update.h
107                        ${CMAKE_BINARY_DIR}/generated/interface/include/psa/fwu_config.h
108            DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa)
109    install(FILES       ${INTERFACE_INC_DIR}/tfm_fwu_defs.h
110            DESTINATION ${INSTALL_INTERFACE_INC_DIR})
111endif()
112
113if(PLATFORM_DEFAULT_CRYPTO_KEYS)
114    install(DIRECTORY   ${INTERFACE_INC_DIR}/crypto_keys
115            DESTINATION ${INSTALL_INTERFACE_INC_DIR})
116endif()
117
118####################### export sources #########################################
119
120if (TFM_PARTITION_NS_AGENT_MAILBOX)
121    install(FILES       ${INTERFACE_SRC_DIR}/multi_core/tfm_ns_mailbox.c
122                        ${INTERFACE_SRC_DIR}/multi_core/tfm_multi_core_ns_api.c
123                        ${INTERFACE_SRC_DIR}/multi_core/tfm_multi_core_psa_ns_api.c
124                        ${INTERFACE_SRC_DIR}/multi_core/tfm_ns_mailbox_thread.c
125            DESTINATION ${INSTALL_INTERFACE_SRC_DIR}/multi_core)
126endif()
127
128if (TFM_PARTITION_NS_AGENT_TZ)
129    install(FILES       ${INTERFACE_SRC_DIR}/tfm_psa_ns_api.c
130            DESTINATION ${INSTALL_INTERFACE_SRC_DIR})
131endif()
132
133    install(DIRECTORY   ${INTERFACE_INC_DIR}/os_wrapper
134            DESTINATION ${INSTALL_INTERFACE_INC_DIR})
135
136if (CONFIG_TFM_USE_TRUSTZONE)
137    install(DIRECTORY   ${INTERFACE_SRC_DIR}/os_wrapper
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    if (PLATFORM_DEFAULT_IMAGE_SIGNING)
181        install(FILES $<TARGET_OBJECTS:signing_layout_s>
182            DESTINATION ${INSTALL_IMAGE_SIGNING_DIR}/layout_files)
183
184        if(MCUBOOT_IMAGE_NUMBER GREATER 1)
185            install(FILES $<TARGET_OBJECTS:signing_layout_ns>
186                    DESTINATION ${INSTALL_IMAGE_SIGNING_DIR}/layout_files)
187    endif()
188
189        install(FILES ${MCUBOOT_KEY_NS}
190                DESTINATION ${INSTALL_IMAGE_SIGNING_DIR}/keys)
191    else()
192        install(FILES ${MCUBOOT_KEY_S}
193                DESTINATION ${INSTALL_IMAGE_SIGNING_DIR}/keys)
194    endif()
195endif()
196
197if(TFM_PARTITION_FIRMWARE_UPDATE)
198    install(FILES       ${INTERFACE_SRC_DIR}/tfm_fwu_api.c
199            DESTINATION ${INSTALL_INTERFACE_SRC_DIR})
200endif()
201
202###################### Install for NS regression tests #########################
203
204include(${CMAKE_SOURCE_DIR}/lib/ext/tf-m-tests/install.cmake)
205
206##################### Platform-specific installation ###########################
207include(${TARGET_PLATFORM_PATH}/install.cmake OPTIONAL)
208