|
3 | 3 | # |
4 | 4 | # SPDX-License-Identifier: Apache-2.0 |
5 | 5 |
|
6 | | -# Adds trusted-firmware-m as an external project, and provides output values |
7 | | -# that are required to link against the secure TF-M binary. |
| 6 | +# Adds trusted-firmware-m as an external project. |
| 7 | +# Also creates a target called 'tfm_api' |
| 8 | +# which can be linked into the app. |
8 | 9 | # |
9 | 10 | # When called from a Zephyr module, the following input values can be provided |
10 | 11 | # to configure the TF-M build: |
|
18 | 19 | # REGRESSION: Boolean if TF-M build includes building the TF-M regression tests |
19 | 20 | # BL2: Boolean if the TF-M build uses MCUboot. |
20 | 21 | # |
21 | | -# The following output values can also be used: |
22 | | -# |
23 | | -# OUT_VENEERS_FILE: The path and filename of the veneer library to link against, |
24 | | -# which identifies where the veneer functions are in memory. |
25 | | -# Should be added via "target_link_libraries" |
26 | | -# |
27 | 22 | # Example usage: |
28 | 23 | # |
29 | 24 | # trusted_firmware_build(BINARY_DIR ${CMAKE_BINARY_DIR}/tfm |
|
33 | 28 | # ISOLATION_LEVEL 2 |
34 | 29 | # REGRESSION |
35 | 30 | # BL2 True |
36 | | -# BUILD_PROFILE profile_small |
| 31 | +# BUILD_PROFILE profile_small) |
37 | 32 | function(trusted_firmware_build) |
38 | 33 | set(options IPC REGRESSION) |
39 | | - set(oneValueArgs BINARY_DIR BOARD OUT_INCLUDE_PATH BL2 ISOLATION_LEVEL CMAKE_BUILD_TYPE BUILD_PROFILE) |
| 34 | + set(oneValueArgs BINARY_DIR BOARD BL2 ISOLATION_LEVEL CMAKE_BUILD_TYPE BUILD_PROFILE) |
40 | 35 | cmake_parse_arguments(TFM "${options}" "${oneValueArgs}" "" ${ARGN}) |
41 | 36 |
|
42 | 37 | if(DEFINED TFM_BL2) |
@@ -69,11 +64,14 @@ function(trusted_firmware_build) |
69 | 64 |
|
70 | 65 |
|
71 | 66 | set(VENEERS_FILE ${TFM_BINARY_DIR}/secure_fw/s_veneers.o) |
72 | | - set(${TFM_OUT_VENEERS_FILE} ${VENEERS_FILE} PARENT_SCOPE) |
73 | | - set(${TFM_OUT_INCLUDE_PATH} ${TFM_BINARY_DIR}/install/export/tfm/include PARENT_SCOPE) |
74 | | - |
75 | 67 | set(PSA_API_NS_PATH ${TFM_BINARY_DIR}/interface/libpsa_api_ns.a) |
76 | 68 |
|
| 69 | + set(BUILD_BYPRODUCTS |
| 70 | + ${VENEERS_FILE} |
| 71 | + ${PSA_API_NS_PATH} |
| 72 | + ${BL2_HEX_FILE} |
| 73 | + ) |
| 74 | + |
77 | 75 | # Get the toolchain variant |
78 | 76 | # TODO: Add support for cross-compile toolchain variant |
79 | 77 | # TODO: Enforce GCC version check against TF-M compiler requirements |
@@ -109,10 +107,9 @@ function(trusted_firmware_build) |
109 | 107 | -DTFM_TOOLCHAIN_PREFIX=${TFM_TOOLCHAIN_PREFIX} |
110 | 108 | BUILD_ALWAYS True |
111 | 109 | USES_TERMINAL_BUILD True |
112 | | - BUILD_BYPRODUCTS ${VENEERS_FILE} ${PSA_API_NS_PATH} |
| 110 | + BUILD_BYPRODUCTS ${BUILD_BYPRODUCTS} |
113 | 111 | ) |
114 | 112 |
|
115 | | - # IPC mode source dependencies |
116 | 113 | add_library(tfm_api STATIC IMPORTED) |
117 | 114 | set_target_properties(tfm_api PROPERTIES |
118 | 115 | IMPORTED_LOCATION ${PSA_API_NS_PATH} |
|
0 commit comments