Skip to content

Commit dd47f4c

Browse files
joerchanstephanosio
authored andcommitted
modules: trusted-firmware-m: Allow application to use qcbor TF-M
QCBOR cannot be shipped with Zephyr. Allow the application to supply their own copy of QCBOR or let the TF-M build system automatically download this dependency. Signed-off-by: Joakim Andersson <[email protected]>
1 parent a79d208 commit dd47f4c

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

modules/trusted-firmware-m/CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ if (CONFIG_BUILD_WITH_TFM)
238238
message(FATAL_ERROR "Unsupported ZEPHYR_TOOLCHAIN_VARIANT: ${ZEPHYR_TOOLCHAIN_VARIANT}")
239239
endif()
240240

241-
if (CONFIG_TFM_PARTITION_INITIAL_ATTESTATION)
241+
if (CONFIG_TFM_PARTITION_INITIAL_ATTESTATION AND CONFIG_TFM_QCBOR_PATH STREQUAL "")
242242
# TODO: Remove this when QCBOR licensing issues w/t_cose have been resolved,
243243
# or only allow it when 'QCBOR_PATH' is set to a local path where QCBOR has
244244
# been manually downloaded by the user before starting the build.
@@ -248,7 +248,7 @@ if (CONFIG_BUILD_WITH_TFM)
248248
)
249249
endif()
250250

251-
if (CONFIG_TFM_PSA_TEST_INITIAL_ATTESTATION)
251+
if (CONFIG_TFM_PSA_TEST_INITIAL_ATTESTATION AND CONFIG_TFM_QCBOR_PATH STREQUAL "")
252252
# TODO: Remove this when QCBOR licensing issues w/t_cose have been resolved,
253253
# or only allow it when 'QCBOR_PATH' is set to a local path where QCBOR has
254254
# been manually downloaded by the user before starting the build.
@@ -258,6 +258,14 @@ if (CONFIG_BUILD_WITH_TFM)
258258
)
259259
endif()
260260

261+
if (CONFIG_TFM_QCBOR_PATH STREQUAL "DOWNLOAD")
262+
# Change CMake cache type to string to avoid QCBOR_PATH=/absolute/path/DOWNLOAD being set.
263+
set(QCBOR_PATH_TYPE ":STRING")
264+
endif()
265+
# Always set QCBOR_PATH, this will make sure that we don't automatically download this
266+
# dependency in the TF-M build system and it will fail when set to an invalid value.
267+
list(APPEND TFM_CMAKE_ARGS -DQCBOR_PATH${QCBOR_PATH_TYPE}=${CONFIG_TFM_QCBOR_PATH})
268+
261269
if(CONFIG_BOARD_LPCXPRESSO55S69_CPU0)
262270
# Supply path to NXP HAL sources used for TF-M build
263271
set(TFM_PLATFORM_NXP_HAL_FILE_PATH ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/platform/ext/target/nxp/)

modules/trusted-firmware-m/Kconfig.tfm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,17 @@ config TFM_MCUBOOT_PATH_DOWNLOAD
280280

281281
endchoice
282282

283+
config TFM_QCBOR_PATH
284+
string
285+
prompt "Path to QCBOR or DOWNLOAD to fetch automatically"
286+
default ""
287+
help
288+
Path to QCBOR for TF-M builds. Due to a license issue with this
289+
library Zephyr does not ship with this library.
290+
If the application wishes to still use this library they can point
291+
to their own checkout of this library, or set to DOWNLOAD to allow
292+
TF-M build system to automatically download this.
293+
283294
config TFM_MCUBOOT_DATA_SHARING
284295
bool "Share app-specific data between TF-M and MCUBoot"
285296
help

0 commit comments

Comments
 (0)