Build: Change build commands to align with TF-M split build
TF-M build commands are changed by new feature "split build".
Update CI scripts to support this feature.
Signed-off-by: Xinyu Zhang <xinyu.zhang@arm.com>
Change-Id: If5a81ca7a1bd99ac8fb9f4850be89b48b76fcbe2
diff --git a/build_helper/build_helper_configs.py b/build_helper/build_helper_configs.py
index a67e093..276adc6 100755
--- a/build_helper/build_helper_configs.py
+++ b/build_helper/build_helper_configs.py
@@ -45,7 +45,9 @@
# Keys for the templace will come from the combinations of parameters
# provided in the seed dictionary.
- "config_template": "cmake -G Ninja " + \
+ "spe_config_template": "cmake -G Ninja " + \
+ "-S %(tfm_tests_root_dir)s/%(test_root_dir)s/spe " + \
+ "-B %(ci_build_root_dir)s/spe " + \
"-DTFM_PLATFORM=%(tfm_platform)s " + \
"-DTFM_TOOLCHAIN_FILE=%(codebase_root_dir)s/%(compiler)s " + \
"-DTFM_ISOLATION_LEVEL=%(isolation_level)s " + \
@@ -55,13 +57,23 @@
"-DBL2=%(with_bl2)s " + \
"-DTFM_PROFILE=%(profile)s " + \
"%(extra_params)s " + \
- "-DTFM_TEST_REPO_PATH=%(codebase_root_dir)s/../tf-m-tests " + \
+ "-DCONFIG_TFM_SOURCE_PATH=%(codebase_root_dir)s " + \
"-DMBEDCRYPTO_PATH=%(codebase_root_dir)s/../mbedtls " + \
"-DPSA_ARCH_TESTS_PATH=%(codebase_root_dir)s/../psa-arch-tests " + \
"-DMCUBOOT_PATH=%(codebase_root_dir)s/../mcuboot " + \
"-DQCBOR_PATH=%(codebase_root_dir)s/../qcbor " + \
- "-DTFM_EXTRAS_REPO_PATH=%(codebase_root_dir)s/../tf-m-extras " + \
- "%(codebase_root_dir)s",
+ "-DTFM_EXTRAS_REPO_PATH=%(codebase_root_dir)s/../tf-m-extras ",
+
+ "nspe_config_template": "cmake -G Ninja " + \
+ "-S %(tfm_tests_root_dir)s/%(test_root_dir)s " + \
+ "-B %(ci_build_root_dir)s/nspe " + \
+ "-DCONFIG_SPE_PATH=%(ci_build_root_dir)s/spe/api_ns " + \
+ "%(extra_params)s " + \
+ "-DQCBOR_PATH=%(codebase_root_dir)s/../qcbor ",
+
+ # CMake build commands will be executed for every build.
+ "spe_cmake_build": "cmake --build %(ci_build_root_dir)s/spe -- install",
+ "nspe_cmake_build": "cmake --build %(ci_build_root_dir)s/nspe --",
"set_compiler_path": "export PATH=$PATH:$%(compiler)s_PATH",
@@ -69,97 +81,101 @@
# tfm_build_manager will replace %(_tbm_build_dir_)s, %(_tbm_code_dir_)s,
# _tbm_target_platform_ with the paths set when building
- "artifact_capture_rex": (r'%(_tbm_build_dir_)s/bin'
+ "artifact_capture_rex": (r'%(ci_build_root_dir)s/nspe'
r'/(\w+\.(?:axf|bin|hex))$'),
- # CMake build commands will be executed for every build.
- "cmake_build": "cmake --build ./ -- install",
# Keys will append extra commands when matching target_platform
- "post_build": {"arm/corstone1000": ("dd conv=notrunc bs=1 if=%(_tbm_build_dir_)s/bin/bl1_1.bin of=%(_tbm_build_dir_)s/bin/bl1.bin seek=0;"
- "dd conv=notrunc bs=1 if=%(_tbm_build_dir_)s/bin/bl1_provisioning_bundle.bin of=%(_tbm_build_dir_)s/bin/bl1.bin seek=40960;"
- "../platform/ext/target/arm/corstone1000/create-flash-image.sh %(_tbm_build_dir_)s/bin/ cs1000.bin;"),
+ "post_build": {"arm/corstone1000": ("dd conv=notrunc bs=1 if=%(ci_build_root_dir)s/spe/bin/bl1_1.bin of=%(ci_build_root_dir)s/spe/bin/bl1.bin seek=0;"
+ "dd conv=notrunc bs=1 if=%(ci_build_root_dir)s/spe/bin/bl1_provisioning_bundle.bin of=%(ci_build_root_dir)s/spe/bin/bl1.bin seek=40960;"
+ "../platform/ext/target/arm/corstone1000/create-flash-image.sh %(ci_build_root_dir)s/spe/bin/ cs1000.bin;"),
"arm/musca_b1": ("srec_cat "
- "%(_tbm_build_dir_)s/bin/"
+ "%(ci_build_root_dir)s/spe/bin/"
"bl2.bin "
"-Binary -offset 0xA000000 "
"-fill 0xFF 0xA000000 0xA020000 "
- "%(_tbm_build_dir_)s/bin/"
+ "%(ci_build_root_dir)s/nspe/"
"tfm_s_ns_signed.bin "
"-Binary -offset 0xA020000 "
"-fill 0xFF 0xA020000 0xA200000 "
- "-o %(_tbm_build_dir_)s/bin/"
+ "-o %(ci_build_root_dir)s/"
"tfm.hex -Intel"),
"arm/musca_s1": ("srec_cat "
- "%(_tbm_build_dir_)s/bin/"
+ "%(ci_build_root_dir)s/spe/bin/"
"bl2.bin "
"-Binary -offset 0xA000000 "
"-fill 0xFF 0xA000000 0xA020000 "
- "%(_tbm_build_dir_)s/bin/"
+ "%(ci_build_root_dir)s/nspe/"
"tfm_s_ns_signed.bin "
"-Binary -offset 0xA020000 "
"-fill 0xFF 0xA020000 0xA200000 "
- "-o %(_tbm_build_dir_)s/bin/"
+ "-o %(ci_build_root_dir)s/"
"tfm.hex -Intel"),
"stm/stm32l562e_dk": ("echo 'STM32L562E-DK board post process';"
- "%(_tbm_build_dir_)s/postbuild.sh;"
- "pushd %(_tbm_build_dir_)s;"
- "BIN_FILES=$(grep -o '\/.*\.bin' TFM_UPDATE.sh | sed 's/^/bin/');"
- "tar jcf ./bin/stm32l562e-dk-tfm.tar.bz2 regression.sh TFM_UPDATE.sh ${BIN_FILES};"
+ "%(ci_build_root_dir)s/spe/api_ns/postbuild.sh;"
+ "pushd %(ci_build_root_dir)s/spe/api_ns;"
+ "mkdir -p image_signing/scripts ;"
+ "cp %(ci_build_root_dir)s/nspe/bin/tfm_ns_signed.bin image_signing/scripts ;"
+ "tar jcf ./bin/stm32l562e-dk-tfm.tar.bz2 regression.sh TFM_UPDATE.sh "
+ "bin/bl2.bin "
+ "bin/tfm_s_signed.bin "
+ "image_signing/scripts/tfm_ns_signed.bin ;"
"popd"),
"stm/b_u585i_iot02a": ("echo 'STM32U5 board post process';"
- "%(_tbm_build_dir_)s/postbuild.sh;"
- "pushd %(_tbm_build_dir_)s;"
- "BIN_FILES=$(grep -o '\/.*\.bin' TFM_UPDATE.sh | sed 's/^/bin/');"
- "tar jcf ./bin/b_u585i_iot02a-tfm.tar.bz2 regression.sh TFM_UPDATE.sh ${BIN_FILES};"
+ "%(ci_build_root_dir)s/spe/api_ns/postbuild.sh;"
+ "pushd %(ci_build_root_dir)s/spe/api_ns;"
+ "mkdir -p image_signing/scripts ;"
+ "cp %(ci_build_root_dir)s/nspe/bin/tfm_ns_signed.bin image_signing/scripts ;"
+ "tar jcf ./bin/stm32l562e-dk-tfm.tar.bz2 regression.sh TFM_UPDATE.sh "
+ "bin/bl2.bin "
+ "bin/tfm_s_signed.bin "
+ "image_signing/scripts/tfm_ns_signed.bin ;"
"popd"),
"nxp/lpcxpresso55s69": ("echo 'LPCXpresso55S69 board post process\n';"
- "if [ -f \"%(_tbm_build_dir_)s/bin/bl2.hex\" ]; then FLASH_FILE='flash_bl2_JLink.py'; else FLASH_FILE='flash_JLink.py'; fi;"
- "pushd %(_tbm_build_dir_)s/../platform/ext/target/nxp/lpcxpresso55s69/scripts;"
+ "if [ -f \"%(ci_build_root_dir)s/spe/bin/bl2.hex\" ]; then FLASH_FILE='flash_bl2_JLink.py'; else FLASH_FILE='flash_JLink.py'; fi;"
+ "pushd%(codebase_root_dir)s/platform/ext/target/nxp/lpcxpresso55s69/scripts;"
"LN=$(grep -n 'JLinkExe' ${FLASH_FILE}|awk -F: '{print $1}');"
"sed -i \"${LN}s/.*/ print('flash.jlink generated')/\" ${FLASH_FILE};"
"python3 ./${FLASH_FILE};"
- "cd %(_tbm_build_dir_)s/bin;"
+ "cd %(ci_build_root_dir)s/spe/bin;"
"BIN_FILES=$(grep loadfile flash.jlink | awk '{print $2}');"
"tar jcf lpcxpresso55s69-tfm.tar.bz2 flash.jlink ${BIN_FILES};"
"popd"),
"cypress/psoc64": ("echo 'Sign binaries for Cypress PSoC64 platform';"
- "pushd %(_tbm_build_dir_)s/..;"
+ "pushd %(codebase_root_dir)s/;"
"sudo /usr/local/bin/cysecuretools "
"--policy platform/ext/target/cypress/psoc64/security/policy/policy_multi_CM0_CM4_tfm.json "
"--target cy8ckit-064s0s2-4343w "
"sign-image "
- "--hex %(_tbm_build_dir_)s/bin/tfm_s.hex "
+ "--hex %(ci_build_root_dir)s/spe/bin/tfm_s.hex "
"--image-type BOOT --image-id 1;"
"sudo /usr/local/bin/cysecuretools "
"--policy platform/ext/target/cypress/psoc64/security/policy/policy_multi_CM0_CM4_tfm.json "
"--target cy8ckit-064s0s2-4343w "
"sign-image "
- "--hex %(_tbm_build_dir_)s/bin/tfm_ns.hex "
+ "--hex %(ci_build_root_dir)s/nspe/bin/tfm_ns.hex "
"--image-type BOOT --image-id 16;"
- "mv %(_tbm_build_dir_)s/bin/tfm_s.hex %(_tbm_build_dir_)s/bin/tfm_s_signed.hex;"
- "mv %(_tbm_build_dir_)s/bin/tfm_ns.hex %(_tbm_build_dir_)s/bin/tfm_ns_signed.hex;"
+ "mv %(ci_build_root_dir)s/spe/bin/tfm_s.hex %(ci_build_root_dir)s/spe/bin/tfm_s_signed.hex;"
+ "mv %(ci_build_root_dir)s/nspe/bin/tfm_ns.hex %(ci_build_root_dir)s/nspe/bin/tfm_ns_signed.hex;"
"popd")
},
# (Optional) If set will fail if those artefacts are missing post build
"required_artefacts": {"all": [
- "%(_tbm_build_dir_)s/bin/"
+ "%(ci_build_root_dir)s/spe/bin/"
"tfm_s.bin",
- "%(_tbm_build_dir_)s/bin/"
+ "%(ci_build_root_dir)s/nspe/"
"tfm_ns.bin"],
"arm/musca_b1": [
- "%(_tbm_build_dir_)s/bin/"
- "tfm.hex",
- "%(_tbm_build_dir_)s/bin/"
+ "%(ci_build_root_dir)s/tfm.hex",
+ "%(ci_build_root_dir)s/spe/bin/"
"bl2.bin",
- "%(_tbm_build_dir_)s/bin/"
+ "%(ci_build_root_dir)s/spe/bin/"
"tfm_sign.bin"],
"arm/musca_s1": [
- "%(_tbm_build_dir_)s/bin/"
- "tfm.hex",
- "%(_tbm_build_dir_)s/bin/"
+ "%(ci_build_root_dir)s/tfm.hex",
+ "%(ci_build_root_dir)s/spe/bin/"
"bl2.bin",
- "%(_tbm_build_dir_)s/bin/"
+ "%(ci_build_root_dir)s/spe/bin/"
"tfm_sign.bin"]
}
}
diff --git a/configs.py b/configs.py
index faef7f2..e83c7d9 100755
--- a/configs.py
+++ b/configs.py
@@ -73,7 +73,7 @@
"-b",
"--build_commands",
default=None,
- choices=['set_compiler', 'cmake_config', 'cmake_build', 'post_build'],
+ choices=['set_compiler', 'spe_cmake_config', 'nspe_cmake_config', 'spe_cmake_build', 'nspe_cmake_build', 'post_build'],
help="Print selected type of build commands to be run for current configuration."
)
PARSER.add_argument(
diff --git a/eclair/external_sources.ecl b/eclair/external_sources.ecl
index 2c9f30c..2e2ea30 100644
--- a/eclair/external_sources.ecl
+++ b/eclair/external_sources.ecl
@@ -18,9 +18,9 @@
-file_tag+={external, "^trusted-firmware-m/lib/ext/t_cose/.*$"}
# Ignore any auto-generated source files in build dir.
-# TODO make an exception for build/generated, in which source code is
+# TODO make an exception for ci_build/spe/build-spe/generated in which source code is
# built in TF-M binaries.
--file_tag+={external, "^trusted-firmware-m/build/.*$"}
+-file_tag+={external, "^ci_build/.*$"}
# Ignore compiler internal headers.
-file_tag+={external, "^/.+/compiler/gcc-.*$"}
diff --git a/jenkins/build-config.jpl b/jenkins/build-config.jpl
index 802f0e8..8d6df40 100644
--- a/jenkins/build-config.jpl
+++ b/jenkins/build-config.jpl
@@ -34,11 +34,14 @@
sh "tf-m-ci-scripts/run-build.sh"
}
stage("Post") {
- archiveArtifacts 'trusted-firmware-m/build/bin/**'
- archiveArtifacts 'trusted-firmware-m/build/install/interface/**'
+ archiveArtifacts 'ci_build/spe/bin/**'
+ archiveArtifacts 'ci_build/nspe/bin/**'
+ archiveArtifacts 'ci_build/nspe/*.bin'
+ archiveArtifacts 'ci_build/spe/api_ns/bin/**'
+ archiveArtifacts 'ci_build/spe/api_ns/interface/**'
def upstreamProject = getUpstreamJob()[0].upstreamProject
if (upstreamProject == "tf-m-build-and-test") {
- archiveArtifacts 'trusted-firmware-m/build/generated/**'
+ archiveArtifacts 'ci_build/spe/build-spe/generated/**'
}
if (upstreamProject == "tf-m-nightly-performance"){
//Creating a folder to store memory footprint artifacts and launching the memory footprint script.
@@ -48,7 +51,7 @@
}
}
} catch (Exception e) {
- archiveArtifacts artifacts: 'trusted-firmware-m/build/**', allowEmptyArchive: true
+ archiveArtifacts artifacts: 'ci_build/**', allowEmptyArchive: true
manager.buildFailure()
verify = -1
} finally {
diff --git a/lava_helper/codecov_helper.py b/lava_helper/codecov_helper.py
index c4466e2..b56982f 100644
--- a/lava_helper/codecov_helper.py
+++ b/lava_helper/codecov_helper.py
@@ -51,7 +51,7 @@
def dl_artifact(fname):
lava.fetch_file(
- metadata["build_job_url"] + "artifact/trusted-firmware-m/build/bin/" + fname,
+ metadata["build_job_url"] + "artifact/ci_build/spe/bin/" + fname,
os.path.join(job_dir, fname)
)
diff --git a/lava_helper/lava_create_jobs.py b/lava_helper/lava_create_jobs.py
index 3f60583..3c0e3dd 100755
--- a/lava_helper/lava_create_jobs.py
+++ b/lava_helper/lava_create_jobs.py
@@ -90,7 +90,7 @@
for binary_type, binary_name in config["binaries"].items():
params.update(
{
- "{}_url".format(binary_type): "{}/artifact/trusted-firmware-m/build/bin/{}".format(params["build_job_url"], binary_name)
+ "{}_url".format(binary_type): "{}/artifact/ci_build/{}".format(params["build_job_url"], binary_name)
}
)
diff --git a/lava_helper/lava_helper_configs.py b/lava_helper/lava_helper_configs.py
index 57d7f47..a5aeccf 100644
--- a/lava_helper/lava_helper_configs.py
+++ b/lava_helper/lava_helper_configs.py
@@ -102,8 +102,8 @@
"recovery_store_url": "https://ci.trustedfirmware.org/userContent/",
"platforms": {"arm/mps2/an521": "mps2_sse200_an512_new.tar.gz"},
"binaries": {
- "firmware": "tfm_s_ns_signed.bin",
- "bootloader": "bl2.bin"
+ "firmware": "nspe/tfm_s_ns_signed.bin",
+ "bootloader": "spe/bin/bl2.bin"
},
"monitors": {
'no_reg_tests': no_reg_tests_monitors,
@@ -128,8 +128,8 @@
"platforms": {"arm/mps3/corstone300/fvp": ""},
"data_bin_offset": "0x38000000",
"binaries": {
- "application": "bl2.axf",
- "data": "tfm_s_ns_signed.bin"
+ "application": "spe/bin/bl2.axf",
+ "data": "nspe/tfm_s_ns_signed.bin"
},
"monitors": {
'no_reg_tests': no_reg_tests_monitors,
@@ -171,8 +171,8 @@
"platforms": {"arm/mps2/an521": ""},
"data_bin_offset": "0x10080000",
"binaries": {
- "application": "bl2.axf",
- "data": "tfm_s_ns_signed.bin"
+ "application": "spe/bin/bl2.axf",
+ "data": "nspe/tfm_s_ns_signed.bin"
},
"monitors": {
'no_reg_tests': no_reg_tests_monitors,
@@ -197,8 +197,8 @@
"data_bin_offset": "0x10080000",
"cpu0_baseline": 1,
"binaries": {
- "application": "bl2.axf",
- "data": "tfm_s_ns_signed.bin"
+ "application": "spe/bin/bl2.axf",
+ "data": "nspe/tfm_s_ns_signed.bin"
},
"monitors": {
'no_reg_tests': no_reg_tests_monitors,
@@ -218,8 +218,8 @@
"poweroff_timeout": 1,
"platforms": {"arm/mps2/an521": ""},
"binaries": {
- "firmware": "tfm_s_ns_signed.bin",
- "bootloader": "bl2.bin"
+ "firmware": "nspe/tfm_s_ns_signed.bin",
+ "bootloader": "spe/bin/bl2.bin"
},
"monitors": {
# FPU test on AN521 qemu not supported yet
@@ -260,7 +260,7 @@
"poweroff_timeout": 5,
"platforms": {"stm/stm32l562e_dk": ""},
"binaries": {
- "tarball": "stm32l562e-dk-tfm.tar.bz2",
+ "tarball": "spe/api_ns/bin/stm32l562e-dk-tfm.tar.bz2",
},
"monitors": {
'reg_tests': reg_tests_monitors,
@@ -278,7 +278,7 @@
"poweroff_timeout": 2,
"platforms": {"stm/b_u585i_iot02a": ""},
"binaries": {
- "tarball": "b_u585i_iot02a-tfm.tar.bz2",
+ "tarball": "spe/api_ns/bin/b_u585i_iot02a-tfm.tar.bz2",
},
"monitors": {
'reg_tests': reg_tests_monitors,
@@ -315,8 +315,8 @@
"poweroff_timeout": 5,
"platforms": {"cypress/psoc64": ""},
"binaries": {
- "spe": "tfm_s_signed.hex",
- "nspe": "tfm_ns_signed.hex",
+ "spe": "spe/bin/tfm_s_signed.hex",
+ "nspe": "nspe/tfm_ns_signed.hex",
},
"monitors": {
'reg_tests': reg_tests_monitors,
diff --git a/run-build.sh b/run-build.sh
index a615757..572953b 100755
--- a/run-build.sh
+++ b/run-build.sh
@@ -20,7 +20,7 @@
# in each single build job.
function check_dependency_version() {
TFM_EXTRAS_PATH="${WORKSPACE}/tf-m-extras"
- TFM_EXTRAS_REFSPEC="$(get_cmake_cache ${WORKSPACE}/trusted-firmware-m/build TFM_EXTRAS_REPO_VERSION)"
+ TFM_EXTRAS_REFSPEC="$(get_cmake_cache ${WORKSPACE}/ci_build TFM_EXTRAS_REPO_VERSION)"
# Array containing "<repo path>;<refspec>" elements
dependency_repos=(
@@ -46,8 +46,10 @@
fi
set_compiler_cmd=$(python3 tf-m-ci-scripts/configs.py -b set_compiler $CONFIG_NAME)
-cmake_config_cmd=$(python3 tf-m-ci-scripts/configs.py -b cmake_config $CONFIG_NAME)
-cmake_build_cmd=$(python3 tf-m-ci-scripts/configs.py -b cmake_build -j ${BUILD_JOBS:-2} $CONFIG_NAME)
+spe_cmake_config_cmd=$(python3 tf-m-ci-scripts/configs.py -b spe_cmake_config $CONFIG_NAME)
+spe_cmake_build_cmd=$(python3 tf-m-ci-scripts/configs.py -b spe_cmake_build -j ${BUILD_JOBS:-2} $CONFIG_NAME)
+nspe_cmake_config_cmd=$(python3 tf-m-ci-scripts/configs.py -b nspe_cmake_config $CONFIG_NAME)
+nspe_cmake_build_cmd=$(python3 tf-m-ci-scripts/configs.py -b nspe_cmake_build -j ${BUILD_JOBS:-2} $CONFIG_NAME)
post_build_cmd=$(python3 tf-m-ci-scripts/configs.py -b post_build $CONFIG_NAME)
set +e
@@ -63,23 +65,23 @@
eval $set_compiler_cmd
if [ -n "$BUILD_TARGET" ]; then
- cmake_build_cmd=${cmake_build_cmd/-- install/-- $BUILD_TARGET}
+ spe_cmake_config_cmd=${spe_cmake_config_cmd/-- install/-- $BUILD_TARGET}
echo "Warning: BUILD_TARGET is set, will not run post_build_cmd"
post_build_cmd=""
fi
if [ "$CODE_COVERAGE_EN" = "TRUE" ] && [[ $CONFIG_NAME =~ "GCC" ]] ; then
- cmake_config_cmd=${cmake_config_cmd/toolchain_GNUARM.cmake/toolchain_GNUARM.cmake -DTFM_CODE_COVERAGE=True}
+ spe_cmake_config_cmd=${spe_cmake_config_cmd/toolchain_GNUARM.cmake/toolchain_GNUARM.cmake -DTFM_CODE_COVERAGE=True}
echo "Flag: Add compiler flag for build with code coverage supported."
echo $cmake_config_cmd
fi
-if [ -z "$cmake_config_cmd" ] ; then
+if [ -z "$spe_cmake_config_cmd" ] ; then
echo "No CMake config command found."
exit 1
fi
-if [ -z "$cmake_build_cmd" ] ; then
+if [ -z "$spe_cmake_build_cmd" ] ; then
echo "No CMake build command found."
exit 1
fi
@@ -102,20 +104,20 @@
git apply ../tf-m-ci-scripts/build_helper/platform_settings/*.patch
cd -
-rm -rf trusted-firmware-m/build
-mkdir trusted-firmware-m/build
-cd trusted-firmware-m/build
+rm -rf ci_build
+mkdir ci_build
+cd ci_build
set +e
-eval $cmake_config_cmd
+eval $spe_cmake_config_cmd
cmake_cfg_error=$?
set -e
check_dependency_version
-if [ $cmake_cfg_error != 0 ] ; then
- rm -rf trusted-firmware-m/build/*
- eval $cmake_config_cmd
+if [ "$spe_cmake_config_cmd" != 0 ] ; then
+ rm -rf ci_build/*
+ eval $spe_cmake_config_cmd
fi
-eval "$cmake_build_cmd; $post_build_cmd"
+eval "$spe_cmake_build_cmd; $nspe_cmake_config_cmd; $nspe_cmake_build_cmd; $post_build_cmd"
diff --git a/tfm_ci_pylib/tfm_build_manager.py b/tfm_ci_pylib/tfm_build_manager.py
index 53ef5c6..ed7cf3e 100644
--- a/tfm_ci_pylib/tfm_build_manager.py
+++ b/tfm_ci_pylib/tfm_build_manager.py
@@ -129,17 +129,17 @@
"""
config_details = self._tbm_build_cfg[config]
codebase_dir = os.path.join(os.getcwd(),"trusted-firmware-m")
- build_dir=os.path.join(os.getcwd(),"trusted-firmware-m/build")
build_config = self.get_build_config(config_details, config, \
silence=silence_stderr, \
- build_dir=build_dir, \
codebase_dir=codebase_dir, \
jobs=jobs)
build_commands = {
- 'set_compiler': build_config['set_compiler_path'],
- 'cmake_config': build_config['config_template'],
- 'cmake_build': build_config['cmake_build'],
- 'post_build': build_config['post_build']
+ 'set_compiler': build_config['set_compiler_path'],
+ 'spe_cmake_config': build_config['spe_config_template'],
+ 'nspe_cmake_config': build_config['nspe_config_template'],
+ 'spe_cmake_build': build_config['spe_cmake_build'],
+ 'nspe_cmake_build': build_config['nspe_cmake_build'],
+ 'post_build': build_config['post_build']
}
return build_commands
@@ -252,7 +252,6 @@
build_cfg = self.override_tbm_cfg_params(build_cfg,
["post_build",
- "required_artefacts",
"artifact_capture_rex"],
**over_dict)
@@ -337,12 +336,7 @@
print("Exported build report to file:", self._tbm_report)
save_json(self._tbm_report, full_rep)
- def get_build_config(self, i, name, silence=False, build_dir=None, codebase_dir=None, jobs=None):
- psa_build_dir = self._tbm_work_dir + "/" + name + "/BUILD"
- if not build_dir:
- build_dir = os.path.join(self._tbm_work_dir, name)
- else:
- psa_build_dir = os.path.join(build_dir, "../../psa-arch-tests/api-tests/build")
+ def get_build_config(self, i, name, silence=False, codebase_dir=None, jobs=None):
build_cfg = deepcopy(self.tbm_common_cfg)
if not codebase_dir:
codebase_dir = build_cfg["codebase_root_dir"]
@@ -374,14 +368,17 @@
jobs = os.cpu_count()
thread_no = " -j {} ".format(jobs)
- build_cfg["cmake_build"] += thread_no
+ build_cfg["spe_cmake_build"] += thread_no
+ build_cfg["nspe_cmake_build"] += thread_no
# Overwrite command lines to set compiler
build_cfg["set_compiler_path"] %= {"compiler": i.compiler}
build_cfg["set_compiler_path"] += " ;\n{} --version".format(self.get_compiler_name(i.compiler))
- # Overwrite command lines of cmake
- overwrite_params = {"codebase_root_dir": build_cfg["codebase_root_dir"],
+ # Overwrite parameters of build configs
+ overwrite_params = {"codebase_root_dir": build_cfg["codebase_root_dir"],
+ "tfm_tests_root_dir": build_cfg["codebase_root_dir"] + "/../tf-m-tests",
+ "ci_build_root_dir": build_cfg["codebase_root_dir"] + "/../ci_build",
"tfm_platform": i.tfm_platform,
"compiler": self.choose_toolchain(i.compiler),
"isolation_level": i.isolation_level,
@@ -400,8 +397,19 @@
overwrite_params["test_psa_api"] += " -DCC312_LEGACY_DRIVER_API_ENABLED=OFF"
if i.tfm_platform == "arm/musca_b1":
overwrite_params["test_psa_api"] += " -DOTP_NV_COUNTERS_RAM_EMULATION=ON"
- build_cfg["config_template"] %= overwrite_params
- build_cfg["post_build"] %= {"_tbm_build_dir_": build_dir}
+
+ # Test root dir
+ if i.test_psa_api != "OFF":
+ overwrite_params["test_root_dir"] = "tests_psa_arch"
+ else:
+ overwrite_params["test_root_dir"] = "tests_reg"
+
+ # Overwrite commands for building TF-M image
+ build_cfg["spe_config_template"] %= overwrite_params
+ build_cfg["nspe_config_template"] %= overwrite_params
+ build_cfg["spe_cmake_build"] %= overwrite_params
+ build_cfg["nspe_cmake_build"] %= overwrite_params
+ build_cfg["post_build"] %= overwrite_params
return build_cfg