Update split build support
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
Change-Id: I582379b4c133905575f28965ef656261e1204627
diff --git a/build_helper/build_helper_configs.py b/build_helper/build_helper_configs.py
index c95dafe..ebe61ae 100755
--- a/build_helper/build_helper_configs.py
+++ b/build_helper/build_helper_configs.py
@@ -46,6 +46,8 @@
# provided in the seed dictionary.
"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 " + \
@@ -54,28 +56,24 @@
"-DTEST_PSA_API=%(test_psa_api)s " + \
"-DBL2=%(with_bl2)s " + \
"-DTFM_PROFILE=%(profile)s " + \
- "-DCONFIG_TFM_BUILD_SPLIT=ON " + \
- "-DCMAKE_INSTALL_PREFIX=%(codebase_root_dir)s/../ci_build/api_ns " +\
"%(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 " + \
- "-S %(codebase_root_dir)s " + \
- "-B %(codebase_root_dir)s/../ci_build/spe_build ",
+ "-DTFM_EXTRAS_REPO_PATH=%(codebase_root_dir)s/../tf-m-extras ",
"nspe_config_template": "cmake -G Ninja " + \
- "%(test_regression)s " + \
+ "-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 " + \
- "-DCONFIG_SPE_PATH=%(codebase_root_dir)s/../ci_build/api_ns " + \
- "-S %(codebase_root_dir)s/../tf-m-tests/app_ns_test " + \
- "-B %(codebase_root_dir)s/../ci_build/nspe_build ",
+ "-DQCBOR_PATH=%(codebase_root_dir)s/../qcbor ",
# CMake build commands will be executed for every build.
- "spe_cmake_build": "cmake --build %(codebase_root_dir)s/../ci_build/spe_build -- install",
- "nspe_cmake_build": "cmake --build %(codebase_root_dir)s/../ci_build/nspe_build -- tfm_app_binaries",
+ "spe_cmake_build": "cmake --build %(ci_build_root_dir)s/spe -- install",
+ "nspe_cmake_build": "cmake --build %(ci_build_root_dir)s/nspe -- tfm_app_binaries",
"set_compiler_path": "export PATH=$PATH:$%(compiler)s_PATH",
@@ -83,57 +81,57 @@
# 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))$'),
# Keys will append extra commands when matching target_platform
- "post_build": {"arm/corstone1000": ("dd conv=notrunc bs=1 if=%(codebase_root_dir)s/../ci_build/spe_build/bin/bl1_1.bin of=%(codebase_root_dir)s/../ci_build/spe_build/bin/bl1.bin seek=0;"
- "dd conv=notrunc bs=1 if=%(codebase_root_dir)s/../ci_build/spe_build/bin/bl1_provisioning_bundle.bin of=%(codebase_root_dir)s/../ci_build/spe_build/bin/bl1.bin seek=40960;"
- "../platform/ext/target/arm/corstone1000/create-flash-image.sh %(codebase_root_dir)s/../ci_build/spe_build/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 "
- "%(codebase_root_dir)s/../ci_build/spe_build/bin/"
+ "%(ci_build_root_dir)s/spe/bin/"
"bl2.bin "
"-Binary -offset 0xA000000 "
"-fill 0xFF 0xA000000 0xA020000 "
- "%(codebase_root_dir)s/../ci_build/nspe_build/"
+ "%(ci_build_root_dir)s/nspe/"
"tfm_s_ns_signed.bin "
"-Binary -offset 0xA020000 "
"-fill 0xFF 0xA020000 0xA200000 "
- "-o %(codebase_root_dir)s/../ci_build/"
+ "-o %(ci_build_root_dir)s/"
"tfm.hex -Intel"),
"arm/musca_s1": ("srec_cat "
- "%(codebase_root_dir)s/../ci_build/spe_build/bin/"
+ "%(ci_build_root_dir)s/spe/bin/"
"bl2.bin "
"-Binary -offset 0xA000000 "
"-fill 0xFF 0xA000000 0xA020000 "
- "%(codebase_root_dir)s/../ci_build/nspe_build/"
+ "%(ci_build_root_dir)s/nspe/"
"tfm_s_ns_signed.bin "
"-Binary -offset 0xA020000 "
"-fill 0xFF 0xA020000 0xA200000 "
- "-o %(codebase_root_dir)s/../ci_build/"
+ "-o %(ci_build_root_dir)s/"
"tfm.hex -Intel"),
"stm/stm32l562e_dk": ("echo 'STM32L562E-DK board post process';"
# TODO: Confirm the path of postbuild.sh
- "%(codebase_root_dir)s/../ci_build/spe_build/postbuild.sh;"
- "pushd %(codebase_root_dir)s/../ci_build/spe_build;"
+ "%(ci_build_root_dir)s/spe/postbuild.sh;"
+ "pushd %(ci_build_root_dir)s/spe;"
"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};"
"popd"),
"stm/b_u585i_iot02a": ("echo 'STM32U5 board post process';"
# TODO: Confirm the path of postbuild.sh
- "%(codebase_root_dir)s/../ci_build/spe_build/postbuild.sh;"
- "pushd %(codebase_root_dir)s/../ci_build/spe_build;"
+ "%(ci_build_root_dir)s/spe/postbuild.sh;"
+ "pushd %(ci_build_root_dir)s/spe;"
"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};"
"popd"),
"nxp/lpcxpresso55s69": ("echo 'LPCXpresso55S69 board post process\n';"
- "if [ -f \"%(codebase_root_dir)s/../ci_build/spe_build/bin/bl2.hex\" ]; then FLASH_FILE='flash_bl2_JLink.py'; else FLASH_FILE='flash_JLink.py'; fi;"
+ "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};"
# TODO: Confirm which bin is needed? SPE or NSPE?
- "cd %(codebase_root_dir)s/../ci_build/spe_build/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"),
@@ -143,36 +141,36 @@
"--policy platform/ext/target/cypress/psoc64/security/policy/policy_multi_CM0_CM4_tfm.json "
"--target cy8ckit-064s0s2-4343w "
"sign-image "
- "--hex %(codebase_root_dir)s/../ci_build/spe_build/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 %(codebase_root_dir)s/../ci_build/nspe_build/bin/tfm_ns.hex "
+ "--hex %(ci_build_root_dir)s/nspe/bin/tfm_ns.hex "
"--image-type BOOT --image-id 16;"
- "mv %(codebase_root_dir)s/../ci_build/spe_build/bin/tfm_s.hex %(codebase_root_dir)s/../ci_build/spe_build/bin/tfm_s_signed.hex;"
- "mv %(codebase_root_dir)s/../ci_build/nspe_build/bin/tfm_ns.hex %(codebase_root_dir)s/../ci_build/nspe_build/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": [
- "%(codebase_root_dir)s/../ci_build/spe_build/bin/"
+ "%(ci_build_root_dir)s/spe/bin/"
"tfm_s.bin",
- "%(codebase_root_dir)s/../ci_build/nspe_build/"
+ "%(ci_build_root_dir)s/nspe/"
"tfm_ns.bin"],
"arm/musca_b1": [
- "%(codebase_root_dir)s/../ci_build/tfm.hex",
- "%(codebase_root_dir)s/../ci_build/spe_build/bin/"
+ "%(ci_build_root_dir)s/tfm.hex",
+ "%(ci_build_root_dir)s/spe/bin/"
"bl2.bin",
- "%(codebase_root_dir)s/../ci_build/spe_build/bin/"
+ "%(ci_build_root_dir)s/spe/bin/"
"tfm_sign.bin"],
"arm/musca_s1": [
- "%(codebase_root_dir)s/../ci_build/tfm.hex",
- "%(codebase_root_dir)s/../ci_build/spe_build/bin/"
+ "%(ci_build_root_dir)s/tfm.hex",
+ "%(ci_build_root_dir)s/spe/bin/"
"bl2.bin",
- "%(codebase_root_dir)s/../ci_build/spe_build/bin/"
+ "%(ci_build_root_dir)s/spe/bin/"
"tfm_sign.bin"]
}
}
diff --git a/lava_helper/lava_helper_configs.py b/lava_helper/lava_helper_configs.py
index 3ad4602..033ffb2 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": "nspe_build/tfm_s_ns_signed.bin",
- "bootloader": "spe_build/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": "spe_build/bl2.bin",
- "data": "nspe_build/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": "spe_build/bl2.bin",
- "data": "nspe_build/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": "spe_build/bl2.bin",
- "data": "nspe_build/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": "nspe_build/tfm_s_ns_signed.bin",
- "bootloader": "spe_build/bl2.bin"
+ "firmware": "nspe/tfm_s_ns_signed.bin",
+ "bootloader": "spe/bin/bl2.bin"
},
"monitors": {
# FPU test on AN521 qemu not supported yet
@@ -315,8 +315,8 @@
"poweroff_timeout": 5,
"platforms": {"cypress/psoc64": ""},
"binaries": {
- "spe": "spe_build/bin/tfm_s_signed.hex",
- "nspe": "nspe_build/bin/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/tfm_ci_pylib/tfm_build_manager.py b/tfm_ci_pylib/tfm_build_manager.py
index 6f25760..ed7cf3e 100644
--- a/tfm_ci_pylib/tfm_build_manager.py
+++ b/tfm_ci_pylib/tfm_build_manager.py
@@ -376,7 +376,9 @@
build_cfg["set_compiler_path"] += " ;\n{} --version".format(self.get_compiler_name(i.compiler))
# Overwrite parameters of build configs
- overwrite_params = {"codebase_root_dir": build_cfg["codebase_root_dir"],
+ 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,
@@ -396,6 +398,12 @@
if i.tfm_platform == "arm/musca_b1":
overwrite_params["test_psa_api"] += " -DOTP_NV_COUNTERS_RAM_EMULATION=ON"
+ # 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