mirror of
https://git.yoctoproject.org/meta-arm
synced 2026-05-30 12:30:14 +00:00
arm/trusted-firmware-m: Enable regression test build
TF-M build system has introduced a ground-breaking change since v2.0.0. Enable TF-M regression test build, following build instructions in TF-M document [1]. Add the BUILD_REGRESSION_TESTS variable to enable regression test builds. Individual regression test suites can be selected by passing the appropriate TF-M CMake options through EXTRA_OECMAKE. If regression test is enabled, build TF-M and tests from tf-m-tests directory. The build files for Normal World build will be installed. [1]: https://trustedfirmware-m.readthedocs.io/en/latest/building/tests_build_instruction.html Signed-off-by: David Hu <david.hu2@arm.com> Signed-off-by: Gergely Kovacs <Gergely.Kovacs2@arm.com> Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
@@ -43,6 +43,11 @@ DEPENDS += "cmake-native \
|
|||||||
|
|
||||||
B = "${WORKDIR}/build"
|
B = "${WORKDIR}/build"
|
||||||
|
|
||||||
|
# Build TF-M regression tests instead of the default firmware.
|
||||||
|
# When enabled, the desired test suite options should be appended to
|
||||||
|
# EXTRA_OECMAKE (e.g. -DTEST_S=ON).
|
||||||
|
BUILD_REGRESSION_TESTS ?= "0"
|
||||||
|
|
||||||
# Build for debug (set TFM_DEBUG to 1 to activate)
|
# Build for debug (set TFM_DEBUG to 1 to activate)
|
||||||
TFM_DEBUG ?= "${FIRMWARE_DEBUG_BUILD}"
|
TFM_DEBUG ?= "${FIRMWARE_DEBUG_BUILD}"
|
||||||
|
|
||||||
@@ -53,11 +58,6 @@ python() {
|
|||||||
raise bb.parse.SkipRecipe("TFM_PLATFORM needs to be set")
|
raise bb.parse.SkipRecipe("TFM_PLATFORM needs to be set")
|
||||||
}
|
}
|
||||||
|
|
||||||
PACKAGECONFIG ??= ""
|
|
||||||
# Whether to integrate the test suite
|
|
||||||
PACKAGECONFIG[test-secure] = "-DTEST_S=ON,-DTEST_S=OFF"
|
|
||||||
PACKAGECONFIG[test-nonsecure] = "-DTEST_NS=ON,-DTEST_NS=OFF"
|
|
||||||
|
|
||||||
# Currently we only support using the Arm binary GCC
|
# Currently we only support using the Arm binary GCC
|
||||||
EXTRA_OECMAKE += "-DTFM_TOOLCHAIN_FILE=${S}/toolchain_GNUARM.cmake"
|
EXTRA_OECMAKE += "-DTFM_TOOLCHAIN_FILE=${S}/toolchain_GNUARM.cmake"
|
||||||
|
|
||||||
@@ -77,9 +77,12 @@ EXTRA_OECMAKE += "\
|
|||||||
-DQCBOR_PATH=${S}/external/qcbor \
|
-DQCBOR_PATH=${S}/external/qcbor \
|
||||||
-DT_COSE_PATH=${S}/external/t_cose \
|
-DT_COSE_PATH=${S}/external/t_cose \
|
||||||
-DTFM_EXTRAS_REPO_PATH=${S}/external/tfm-extras \
|
-DTFM_EXTRAS_REPO_PATH=${S}/external/tfm-extras \
|
||||||
-DTFM_TEST_REPO_PATH=${S}/external/tf-m-tests \
|
|
||||||
"
|
"
|
||||||
|
|
||||||
|
# tf-m-tests directory
|
||||||
|
# The directory can be overridden by local tf-m-tests folder path.
|
||||||
|
TFM_TESTS_DIR ?= "${S}/external/tf-m-tests"
|
||||||
|
|
||||||
export CMAKE_BUILD_PARALLEL_LEVEL = "${@oe.utils.parallel_make(d, False)}"
|
export CMAKE_BUILD_PARALLEL_LEVEL = "${@oe.utils.parallel_make(d, False)}"
|
||||||
|
|
||||||
AS[unexport] = "1"
|
AS[unexport] = "1"
|
||||||
@@ -92,7 +95,13 @@ export OPENSSL_MODULES = "${STAGING_LIBDIR_NATIVE}/ossl-modules"
|
|||||||
|
|
||||||
do_configure[cleandirs] = "${B}"
|
do_configure[cleandirs] = "${B}"
|
||||||
do_configure() {
|
do_configure() {
|
||||||
cmake -GNinja -S ${S} -B ${B} ${EXTRA_OECMAKE} ${PACKAGECONFIG_CONFARGS}
|
# When regression tests are enabled, TF-M is built under regression test
|
||||||
|
# directory.
|
||||||
|
if [ "${BUILD_REGRESSION_TESTS}" = "1" ]; then
|
||||||
|
cmake -GNinja -S ${TFM_TESTS_DIR}/tests_reg/spe -B ${B} -DCONFIG_TFM_SOURCE_PATH=${S} ${EXTRA_OECMAKE}
|
||||||
|
else
|
||||||
|
cmake -GNinja -S ${S} -B ${B} ${EXTRA_OECMAKE}
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Invoke install here as there's no point in splitting compile from install: the
|
# Invoke install here as there's no point in splitting compile from install: the
|
||||||
@@ -110,6 +119,15 @@ do_install() {
|
|||||||
find ${B}/bin \( -name '*.bin' -o -name '*.elf' \) -type f | while read -r file; do
|
find ${B}/bin \( -name '*.bin' -o -name '*.elf' \) -type f | while read -r file; do
|
||||||
install -m 0644 "$file" "${D}${FIRMWARE_DIR}"
|
install -m 0644 "$file" "${D}${FIRMWARE_DIR}"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Install for NS build
|
||||||
|
if [ -d "${B}/api_ns" ]; then
|
||||||
|
install -d -m 0755 ${D}/sysroot-only/api_ns
|
||||||
|
|
||||||
|
cd ${B}/api_ns
|
||||||
|
find . -type d -exec install -d -m 0755 ${D}/sysroot-only/api_ns/{} \;
|
||||||
|
find . -type f -exec install -m 0644 {} ${D}/sysroot-only/api_ns/{} \;
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build paths are currently embedded because it's impossible to pass -fdebug-prefix-map
|
# Build paths are currently embedded because it's impossible to pass -fdebug-prefix-map
|
||||||
|
|||||||
Reference in New Issue
Block a user