Skip to contentSkip to conversation

arm-bsp/musca: remove trusted-firmware-m statements

PATCH New Ross Burton 1 participant 7 messages Dec 18, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/7 arm-bsp/musca: remove trusted-firmware-m statements

Musca doesn't build 'images' in the traditional sense yet, just trusted-firmware-m or Zephyr, so remove EXTRA_IMAGEDEPENDS.

Remove the preferred version for TF-M as we only ship one currently.

Change-Id I2fbd1230f6ba7a49aa093ca90fc38e676ba14633
---
 meta-arm-bsp/conf/machine/musca-b1.conf | 3 ---
 meta-arm-bsp/conf/machine/musca-s1.conf | 3 ---
 2 files changed, 6 deletions(-)
meta-arm-bsp/conf/machine/musca-b1.conf +0 -3
index 5b359bc..ac0bea0 100644
@@ -4,9 +4,6 @@
 #@NAME: Musca-B1 machine
 #@DESCRIPTION: Machine configuration for Musca-B1
 
-EXTRA_IMAGEDEPENDS += "virtual/trusted-firmware-m"
-PREFERRED_VERSION_trusted-firmware-m = "1.0"
-
 DEFAULTTUNE ?= "armv8m-main"
 require conf/machine/include/tune-cortexm33.inc
 
meta-arm-bsp/conf/machine/musca-s1.conf +0 -3
index 66e0a35..2dcdb50 100644
@@ -4,9 +4,6 @@
 #@NAME: Musca-S1 machine
 #@DESCRIPTION: Machine configuration for Musca-S1
 
-EXTRA_IMAGEDEPENDS += "virtual/trusted-firmware-m"
-PREFERRED_VERSION_trusted-firmware-m = "1.0"
-
 require conf/machine/include/tune-cortexm33.inc
 
 # GLIBC will not work with Cortex-M.
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/7 arm/trusted-firmware-m: don't use COMPATIBLE_MACHINE directly

COMPATIBLE_MACHINE is a wrapper around raising SkipRecipe, and as this recipe basically just needs TFM_PLATFORM set we can raise that if the variable is not set. This allows BSPs to set TFM_PLATFORM in their machine configuration instead of needing to bbappend.

Change-Id I8544ff14ac4689bfbea1f0ac68364b673abde6f1
---
 .../trusted-firmware-m/trusted-firmware-m_1.0.bb      | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.0.bb +7 -4
index 9b204b8..906f2f0 100644
@@ -46,14 +46,17 @@ DEPENDS += "python3-cryptography-native python3-pyasn1-native python3-cbor-nativ
 S = "${WORKDIR}/git/tfm"
 B = "${WORKDIR}/build"
 
-COMPATIBLE_MACHINE ?= "invalid"
-
 # Build for debug (set TFA_DEBUG to 1 to activate)
 TFM_DEBUG ?= "0"
 # Set target config
 TFM_CONFIG ?= "ConfigDefault.cmake"
-# Platform must be set for each machine
-TFM_PLATFORM ?= "invalid"
+
+# Platform must be set, ideally in the machine configuration.
+TFM_PLATFORM ?= ""
+python() {
+    if not d.getVar("TFM_PLATFORM"):
+        raise bb.parse.SkipRecipe("TFM_PLATFORM needs to be set")
+}
 
 # Uncomment, or copy these lines to your local.conf to use the Arm Clang compiler
 # from meta-arm-toolchain.
Signature · 1 line
2.25.1
#2 lore raw

PATCH 3/7 arm-bsp/trusted-firmware-m: move TFM_PLATFORM to machine configuration

In reply to Ross Burton

Now this can be easily set in the machine, do so.

Change-Id I964c78c8e1e8f845cc2c95193c4a795e12089d1a
---
 meta-arm-bsp/conf/machine/musca-b1.conf                       | 2 ++
 meta-arm-bsp/conf/machine/musca-s1.conf                       | 2 ++
 .../trusted-firmware-m/trusted-firmware-m_%.bbappend          | 4 ----
 3 files changed, 4 insertions(+), 4 deletions(-)
 delete mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m_%.bbappend
meta-arm-bsp/conf/machine/musca-b1.conf +2 -0
index ac0bea0..5300b75 100644
@@ -23,3 +23,5 @@ QB_MEM = "512k"
 ZEPHYR_BOARD = "v2m_musca_b1"
 ZEPHYR_INHERIT_CLASSES += "zephyr-qemuboot"
 ARCH_musca-b1 = "arm"
+
+TFM_PLATFORM = "MUSCA_B1"
meta-arm-bsp/conf/machine/musca-s1.conf +2 -0
index 2dcdb50..c4131a8 100644
@@ -8,3 +8,5 @@ require conf/machine/include/tune-cortexm33.inc
 
 # GLIBC will not work with Cortex-M.
 TCLIBC = "newlib"
+
+TFM_PLATFORM = "MUSCA_S1"
meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m_%.bbappend deleted +0 -4
deleted file mode 100644
index d7a099e..0000000
@@ -1,4 +0,0 @@
-COMPATIBLE_MACHINE = "musca-b1|musca-s1"
-
-TFM_PLATFORM_musca-b1 = "MUSCA_B1"
-TFM_PLATFORM_musca-s1 = "MUSCA_S1"
Signature · 1 line
2.25.1
#3 lore raw

PATCH 4/7 arm/trusted-firmware-m: remove more unneeded build dependencies

In reply to Ross Burton

TF-M uses the binary Arm toolchains currently, so we can inhibit all of the default dependencies.

Change-Id I38a7bda9570d9d63d3d81f0886c437f29929a0f5
---
 .../recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.0.bb  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.0.bb +2 -2
index 906f2f0..d35099d 100644
@@ -37,8 +37,8 @@ UPSTREAM_CHECK_GITTAGREGEX = "^TF-Mv(?P<pver>\d+(\.\d+)+)$"
 
 inherit python3native deploy
 
-# Baremetal, just need a compiler
-DEPENDS_remove = "virtual/${TARGET_PREFIX}compilerlibs virtual/libc"
+# Baremetal and we bring a compiler below
+INHIBIT_DEFAULT_DEPS = "1"
 
 DEPENDS += "cmake-native"
 DEPENDS += "python3-cryptography-native python3-pyasn1-native python3-cbor-native"
Signature · 1 line
2.25.1
#4 lore raw

PATCH 5/7 arm/trusted-firmware-m: improve CMake calls

In reply to Ross Burton

Use cmake more idiomatically, and enable verbose builds.

Change-Id I908af71f4662fab1dde9de86fc7a56ca3701e0c5
---
 .../trusted-firmware-m/trusted-firmware-m_1.0.bb           | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.0.bb +5 -2
index d35099d..630379a 100644
@@ -80,6 +80,9 @@ EXTRA_OECMAKE += "-DCOMPILER=${TFM_COMPILER}"
 EXTRA_OECMAKE += "${@bb.utils.contains('TFM_DEBUG', '1', '-DCMAKE_BUILD_TYPE=Debug', '', d)}"
 EXTRA_OECMAKE += "-DPROJ_CONFIG=${S}/configs/${TFM_CONFIG}"
 
+# Verbose builds
+EXTRA_OECMAKE += "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
+
 # Let the Makefile handle setting up the CFLAGS and LDFLAGS as it is a standalone application
 CFLAGS[unexport] = "1"
 LDFLAGS[unexport] = "1"
@@ -99,7 +102,7 @@ do_check_config() {
 
 do_configure[cleandirs] = "${B}"
 do_configure() {
-    cmake -G"Unix Makefiles" --build ${S} ${EXTRA_OECMAKE}
+    cmake -G"Unix Makefiles" ${S} ${EXTRA_OECMAKE}
 }
 
 # Invoke install here as there's no point in splitting compile from install: the
@@ -107,7 +110,7 @@ do_configure() {
 # rebuild. It also overrides the install prefix to be in the build tree, so you
 # can't use the usual install prefix variables.
 do_compile() {
-    oe_runmake install
+    cmake --build ./ -- install
 }
 
 do_install() {
Signature · 1 line
2.25.1
#5 lore raw

PATCH 6/7 arm/trusted-firmware-m: set PACKAGE_ARCH

In reply to Ross Burton

As this is machine-specific, set PACKAGE_ARCH to MACHINE.

Change-Id I4569bce706de8dea4ba98770960c0d40348a3fa2
---
 .../recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.0.bb    | 2 ++
 1 file changed, 2 insertions(+)
meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.0.bb +2 -0
index 630379a..9a56f53 100644
@@ -40,6 +40,8 @@ inherit python3native deploy
 # Baremetal and we bring a compiler below
 INHIBIT_DEFAULT_DEPS = "1"
 
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
 DEPENDS += "cmake-native"
 DEPENDS += "python3-cryptography-native python3-pyasn1-native python3-cbor-native"
 
Signature · 1 line
2.25.1
#6 lore raw

PATCH 7/7 arm/trusted-firmware-m: upgrade to 1.1

In reply to Ross Burton
Change-Id Id0c37b291b32072ebe61abcd908ed9a2ebf79365
---
 .../trusted-firmware-m/files/objcopy.patch    | 20 +++++++++
 ...are-m_1.0.bb => trusted-firmware-m_1.1.bb} | 42 +++++++++----------
 2 files changed, 41 insertions(+), 21 deletions(-)
 create mode 100644 meta-arm/recipes-bsp/trusted-firmware-m/files/objcopy.patch
 rename meta-arm/recipes-bsp/trusted-firmware-m/{trusted-firmware-m_1.0.bb => trusted-firmware-m_1.1.bb} (74%)
meta-arm/recipes-bsp/trusted-firmware-m/files/objcopy.patch new file +20 -0
new file mode 100644
index 0000000..5734c13
@@ -0,0 +1,20 @@
+The BFD target elf32-little has no specified machine, which trips the
+architecture sanity test.  Use elf32-littlearm to set the machine
+correctly.
+
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <[email protected]>
+
+diff --git a/cmake/Common/CompilerGNUARMCommon.cmake b/cmake/Common/CompilerGNUARMCommon.cmake
+index 32e805bb..2d3ea8e4 100644
+--- a/cmake/Common/CompilerGNUARMCommon.cmake
++++ b/cmake/Common/CompilerGNUARMCommon.cmake
+@@ -196,7 +196,7 @@ function(compiler_generate_hex_output TARGET)
+ endfunction()
+ 
+ function(compiler_generate_elf_output TARGET)
+-	add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_GNUARM_OBJCOPY} ARGS -O elf32-little $<TARGET_FILE:${TARGET}> $<TARGET_FILE_DIR:${TARGET}>/${TARGET}.elf)
++	add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_GNUARM_OBJCOPY} ARGS -O elf32-littlearm $<TARGET_FILE:${TARGET}> $<TARGET_FILE_DIR:${TARGET}>/${TARGET}.elf)
+ endfunction()
+ 
+ # Function for creating a new target that preprocesses a .c file
meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.1.bb renamed from meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.0.bb +21 -21

62 lines not on this page · raw message

Signature · 1 line
2.25.1