Skip to contentSkip to conversation

arm/trusted-firmware-m: add the tf-m-extras repository that some machines need

PATCH Applied Ross Burton 2 participants 8 messages Apr 20, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 arm/trusted-firmware-m: add the tf-m-extras repository that some machines need

Some machines use components from tf-m-extras, so fetch that too.

---
 .../trusted-firmware-m/trusted-firmware-m-1.7.0-src.inc      | 5 +++++
 .../recipes-bsp/trusted-firmware-m/trusted-firmware-m.inc    | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m-1.7.0-src.inc +5 -0
index 7d5b4b53..6a209c37 100644
@@ -12,11 +12,13 @@ SRC_URI_TRUSTED_FIRMWARE_M_TESTS ?= "git://git.trustedfirmware.org/TF-M/tf-m-tes
 SRC_URI_TRUSTED_FIRMWARE_M_MBEDTLS ?= "git://github.com/ARMmbed/mbedtls.git;protocol=https"
 SRC_URI_TRUSTED_FIRMWARE_M_MCUBOOT ?= "git://github.com/mcu-tools/mcuboot.git;protocol=https"
 SRC_URI_TRUSTED_FIRMWARE_M_QCBOR ?= "git://github.com/laurencelundblade/QCBOR.git;protocol=https"
+SRC_URI_TRUSTED_FIRMWARE_M_EXTRAS ?= "git://git.trustedfirmware.org/TF-M/tf-m-extras.git;protocol=https"
 SRC_URI  = "${SRC_URI_TRUSTED_FIRMWARE_M};branch=${SRCBRANCH_tfm};name=tfm;destsuffix=git/tfm \
             ${SRC_URI_TRUSTED_FIRMWARE_M_TESTS};branch=${SRCBRANCH_tfm-tests};name=tfm-tests;destsuffix=git/tf-m-tests \
             ${SRC_URI_TRUSTED_FIRMWARE_M_MBEDTLS};branch=${SRCBRANCH_mbedtls};name=mbedtls;destsuffix=git/mbedtls \
             ${SRC_URI_TRUSTED_FIRMWARE_M_MCUBOOT};branch=${SRCBRANCH_mcuboot};name=mcuboot;destsuffix=git/mcuboot \
             ${SRC_URI_TRUSTED_FIRMWARE_M_QCBOR};branch=${SRCBRANCH_qcbor};name=qcbor;destsuffix=git/qcbor \
+            ${SRC_URI_TRUSTED_FIRMWARE_M_EXTRAS};branch=${SRCBRANCH_tfm-extras};name=tfm-extras;destsuffix=git/tfm-extras \
             "
 
 # The required dependencies are documented in tf-m/config/config_default.cmake
@@ -35,6 +37,9 @@ SRCREV_mcuboot = "c657cbea75f2bb1faf1fceacf972a0537a8d26dd"
 # qcbor
 SRCBRANCH_qcbor ?= "master"
 SRCREV_qcbor = "b0e7033268e88c9f27146fa9a1415ef4c19ebaff"
+# TF-Mv1.7.0
+SRCBRANCH_tfm-extras ?= "master"
+SRCREV_tfm-extras = "daacaa6df3881e205bc03d75fc8fb688afe9f0f1"
 
 SRCREV_FORMAT = "tfm"
 
meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m.inc +1 -1
index 9062df8c..a753a3da 100644
@@ -72,7 +72,7 @@ EXTRA_OECMAKE += "${@bb.utils.contains('TFM_DEBUG', '1', '-DCMAKE_BUILD_TYPE=Deb
 # Verbose builds
 EXTRA_OECMAKE += "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
 
-EXTRA_OECMAKE += "-DMBEDCRYPTO_PATH=${S}/../mbedtls -DTFM_TEST_REPO_PATH=${S}/../tf-m-tests -DMCUBOOT_PATH=${S}/../mcuboot -DQCBOR_PATH=${S}/../qcbor"
+EXTRA_OECMAKE += "-DMBEDCRYPTO_PATH=${S}/../mbedtls -DTFM_TEST_REPO_PATH=${S}/../tf-m-tests -DTFM_EXTRAS_REPO_PATH=${S}/../tfm-extras -DMCUBOOT_PATH=${S}/../mcuboot -DQCBOR_PATH=${S}/../qcbor"
 
 export CMAKE_BUILD_PARALLEL_LEVEL = "${@oe.utils.parallel_make(d, False)}"
 
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/6 arm/trusted-firmware-m: clean up environment flags

We don't need to unset CFLAGS and LDFLAGS as the CMake file doesn't respect them anyway.

Add CC to the unexport list for completeness, at least one of these is needed for now as the build fails without the unexports.

---
 .../recipes-bsp/trusted-firmware-m/trusted-firmware-m.inc     | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m.inc +1 -3
index a753a3da..09efaffa 100644
@@ -76,10 +76,8 @@ EXTRA_OECMAKE += "-DMBEDCRYPTO_PATH=${S}/../mbedtls -DTFM_TEST_REPO_PATH=${S}/..
 
 export CMAKE_BUILD_PARALLEL_LEVEL = "${@oe.utils.parallel_make(d, False)}"
 
-# Let the Makefile handle setting up the CFLAGS and LDFLAGS as it is a standalone application
-CFLAGS[unexport] = "1"
-LDFLAGS[unexport] = "1"
 AS[unexport] = "1"
+CC[unexport] = "1"
 LD[unexport] = "1"
 
 # python3-cryptography needs the legacy provider, so set OPENSSL_MODULES to the
Signature · 1 line
2.34.1
#2 lore raw

PATCH 3/6 arm/trusted-firmware-m: package .elf files in PN-dbg

In reply to Ross Burton

Some platforms install .elf files, so put those into the -dbg package. This means expanding the buildpaths QA exclusion.

Whilst here, expand the comments for the other INSANE_SKIP statements.

---
 .../recipes-bsp/trusted-firmware-m/trusted-firmware-m.inc  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m.inc +6 -1
index 09efaffa..d0744423 100644
@@ -106,11 +106,16 @@ do_install() {
 
 FILES:${PN} = "/firmware"
 SYSROOT_DIRS += "/firmware"
+FILES:${PN}-dbg = "/firmware/*.elf"
 
 addtask deploy after do_install
 do_deploy() {
     cp -rf ${D}/firmware/* ${DEPLOYDIR}/
 }
 
-# Build paths are currently embedded
+# Build paths are currently embedded because it's impossible to pass -fdebug-prefix-map
 INSANE_SKIP:${PN} += "buildpaths"
+INSANE_SKIP:${PN}-dbg += "buildpaths"
+# Target binaries will be 32-bit Arm
+INSANE_SKIP:${PN} += "arch"
+INSANE_SKIP:${PN}-dbg += "arch"
Signature · 1 line
2.34.1
#3 lore raw

PATCH 4/6 arm-bsp/trusted-firmware-m: enable for Total Compute on RSS

In reply to Ross Burton

TF-M can be built for the Arm Runtime Security Subsystem on the Total Compute platform.

https://tf-m-user-guide.trustedfirmware.org/platform/arm/rss/readme.html

---
 .../trusted-firmware-m/trusted-firmware-m_1.7.%.bbappend       | 3 +++
 1 file changed, 3 insertions(+)
meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.7.%.bbappend +3 -0
index ec0e483b..a558cfee 100644
@@ -4,3 +4,6 @@ MACHINE_TFM_REQUIRE ?= ""
 MACHINE_TFM_REQUIRE:corstone1000 = "trusted-firmware-m-1.7.0-corstone1000.inc"
 
 require ${MACHINE_TFM_REQUIRE}
+
+COMPATIBLE_MACHINE:tc = "(tc1)"
+TFM_PLATFORM:tc = "arm/rss/tc"
Signature · 1 line
2.34.1
#4 lore raw

PATCH 5/6 arm/trusted-firmware-m-scripts: relocate to tfm directory

In reply to Ross Burton

From: Jon Mason <[email protected]>

Relocate to be with tfm to make it more obvious when a version update is needed

---
 .../trusted-firmware-m}/trusted-firmware-m-scripts-native.inc   | 0
 .../trusted-firmware-m-scripts-native_1.7.0.bb                  | 2 ++
 .../trusted-firmware-m-scripts-native_1.7.0.bb                  | 2 --
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename meta-arm/{recipes-devtools/trusted-firmware-m-scripts => recipes-bsp/trusted-firmware-m}/trusted-firmware-m-scripts-native.inc (100%)
 create mode 100644 meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m-scripts-native_1.7.0.bb
 delete mode 100644 meta-arm/recipes-devtools/trusted-firmware-m-scripts/trusted-firmware-m-scripts-native_1.7.0.bb
meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m-scripts-native.inc renamed from meta-arm/recipes-devtools/trusted-firmware-m-scripts/trusted-firmware-m-scripts-native.inc +0 -0
similarity index 100%
rename from meta-arm/recipes-devtools/trusted-firmware-m-scripts/trusted-firmware-m-scripts-native.inc
rename to meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m-scripts-native.inc
meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m-scripts-native_1.7.0.bb new file +2 -0
new file mode 100644
index 00000000..504846e0
@@ -0,0 +1,2 @@
+require recipes-bsp/trusted-firmware-m/trusted-firmware-m-1.7.0-src.inc
+require recipes-bsp/trusted-firmware-m/trusted-firmware-m-scripts-native.inc
meta-arm/recipes-devtools/trusted-firmware-m-scripts/trusted-firmware-m-scripts-native_1.7.0.bb deleted +0 -2
deleted file mode 100644
index 2e9e5249..00000000
@@ -1,2 +0,0 @@
-require recipes-bsp/trusted-firmware-m/trusted-firmware-m-1.7.0-src.inc
-require recipes-devtools/trusted-firmware-m-scripts/trusted-firmware-m-scripts-native.inc
Signature · 1 line
2.34.1
#5 lore raw

PATCH 6/6 CI: add TF-M to TC build

In reply to Ross Burton
---
 ci/tc1.yml | 2 ++
 1 file changed, 2 insertions(+)
ci/tc1.yml +2 -0
index fd9acbd2..d9a7cbfc 100644
@@ -2,8 +2,10 @@ header:
   version: 11
   includes:
     - ci/base.yml
+    - ci/meta-openembedded.yml
 
 machine: tc1
 
 target:
   - tc-artifacts-image
+  - trusted-firmware-m
Signature · 1 line
2.34.1
#6 lore raw

Re: [PATCH 6/6] CI: add TF-M to TC build

Quoted 1 line · Ross Burton

A slight rework of this patch was needed to apply cleanly on top of the tc1 patches pushed a few minutes prior to this series. The modified patch can be seen at
https://gitlab.com/jonmason00/meta-arm/-/commit/ea407ce849f7f181f5b43a2495436a720a32cbef

Thanks,
Jon

Quoted 23 lines
---
 ci/tc1.yml | 2 ++
 1 file changed, 2 insertions(+)
ci/tc1.yml +2 -0
index fd9acbd2..d9a7cbfc 100644
@@ -2,8 +2,10 @@ header:
   version: 11
   includes:
     - ci/base.yml
+    - ci/meta-openembedded.yml
 
 machine: tc1
 
 target:
   - tc-artifacts-image
+  - trusted-firmware-m
Signature · 1 line
2.34.1
Applied
#7 lore raw
In reply to Ross Burton
Quoted 1 line · Ross Burton

Some machines use components from tf-m-extras, so fetch that too.

Applied, thanks!

[1/6] arm/trusted-firmware-m: add the tf-m-extras repository that some machines need

      commit: a46ddc804e0cf5ab42014f66d278219dae71cac3
[2/6] arm/trusted-firmware-m: clean up environment flags
      commit: 387465c622b373e99cb0cccc7c426a5a18741eac
[3/6] arm/trusted-firmware-m: package .elf files in PN-dbg
      commit: 1596147a847ff76dd8848aa43ec5cef4b54b8aa3
[4/6] arm-bsp/trusted-firmware-m: enable for Total Compute on RSS
      commit: a091d49db1552f2ae4393369a1b4be81398986aa
[5/6] arm/trusted-firmware-m-scripts: relocate to tfm directory
      commit: 6405018cedf29114095cd20b2c35313a3fd9967b
[6/6] CI: add TF-M to TC build
      commit: ea407ce849f7f181f5b43a2495436a720a32cbef

Best regards,

Signature · 1 line
Jon Mason <[email protected]>