Hi,
I'm using nRF Connect SDK v1.9.0
We're working on firmware running on an nRF9160 with TF-M enabled. We need to link with a library to is built with hard-float, so we need to enable it for our build. However, support is currently explicitly disabled, and I'm not sure if it needs to be any more.
The rationale for disabling it is described in:
https://github.com/zephyrproject-rtos/zephyr/issues/33956
However, newer versions of TF-M (including the one shipped with the latest SDK) support hard float, see
https://tf-m-user-guide.trustedfirmware.org/docs/integration_guide/tfm_fpu_support.html
The build system for Zephyr + TF-M + Nordic's SDK is quite complicated, so it's not the easiest thing to grok without spending a decent amount of time on it. If I remove the constraints and instruct TF-M to build with hard-float (see below), it gets some of the way there. However, when building `secure_fw/partitions/crypto/mbedcrypto/nrf_security_src/libmbedcrypto_base` soft float is used for some reason, so the build fails.
Basically my question is this:
Is it possible to add hard float support to TF-M builds? Can you provide guidance on how to do it?
My attempt so far:
diff --git zephyr/arch/arm/core/aarch32/Kconfig zephyr/arch/arm/core/aarch32/Kconfig index 7bce4abaf5..c6c1bb0c05 100644 --- zephyr/arch/arm/core/aarch32/Kconfig +++ zephyr/arch/arm/core/aarch32/Kconfig @@ -254,7 +254,7 @@ choice config FP_HARDABI bool "Floating point Hard ABI" - depends on !BUILD_WITH_TFM + # depends on !BUILD_WITH_TFM help This option selects the Floating point ABI in which hardware floating point instructions are generated and uses FPU-specific calling diff --git zephyr/modules/trusted-firmware-m/CMakeLists.txt zephyr/modules/trusted-firmware-m/CMakeLists.txt index fc38df1f0c..dcb65d138a 100644 --- zephyr/modules/trusted-firmware-m/CMakeLists.txt +++ zephyr/modules/trusted-firmware-m/CMakeLists.txt @@ -30,6 +30,8 @@ set(TFM_CRYPTO_MODULES if (CONFIG_BUILD_WITH_TFM) +list(APPEND TFM_CMAKE_ARGS -DCONFIG_TFM_SPE_FP=2) + if (CONFIG_TFM_IPC) list(APPEND TFM_CMAKE_ARGS -DTFM_LIB_MODEL=OFF) # PSA API awareness for the Non-Secure application diff --git modules/tee/tf-m/trusted-firmware-m/platform/ext/target/nordic_nrf/common/nrf9160/preload.cmake modules/tee/tf-m/trusted-firmware-m/platform/ext/target/nordic_nrf/common/nrf9160/preload.cmake index 30a739f2..910e0049 100644 --- modules/tee/tf-m/trusted-firmware-m/platform/ext/target/nordic_nrf/common/nrf9160/preload.cmake +++ modules/tee/tf-m/trusted-firmware-m/platform/ext/target/nordic_nrf/common/nrf9160/preload.cmake @@ -15,3 +15,4 @@ set(TFM_SYSTEM_PROCESSOR cortex-m33) set(TFM_SYSTEM_ARCHITECTURE armv8-m.main) set(TFM_SYSTEM_DSP OFF) +set(CONFIG_TFM_FP_ARCH "fpv5-sp-d16")
Some guidance would be very much appreciated
Thanks