configs.py: Refine argparse to select build command type
To make configs.py more flexible, argparse is updated as below:
1. Use "--config_params" to list the build config variables of the
input configuration.
2. Split the "build commands" into four types: "set_compiler",
"cmake_config", "cmake_build" and "post_build". Only print the
required type of commands.
Signed-off-by: Xinyu Zhang <xinyu.zhang@arm.com>
Change-Id: I550eb6218fdac34d2aa634e730aba8ccfb05dd52
diff --git a/build_helper/build_helper_configs.py b/build_helper/build_helper_configs.py
index 0137a8c..4acfc43 100755
--- a/build_helper/build_helper_configs.py
+++ b/build_helper/build_helper_configs.py
@@ -71,10 +71,10 @@
"artifact_capture_rex": (r'%(_tbm_build_dir_)s/bin'
r'/(\w+\.(?:axf|bin|hex))$'),
- # ALL commands will be executed for every build.
- # Other keys will append extra commands when matching target_platform
- "build_cmds": {"all": ["cmake --build ./ -- install"],
- "arm/musca_b1": [("srec_cat "
+ # 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/musca_b1": ("srec_cat "
"%(_tbm_build_dir_)s/bin/"
"bl2.bin "
"-Binary -offset 0xA000000 "
@@ -84,8 +84,8 @@
"-Binary -offset 0xA020000 "
"-fill 0xFF 0xA020000 0xA200000 "
"-o %(_tbm_build_dir_)s/bin/"
- "tfm.hex -Intel")],
- "arm/musca_s1": [("srec_cat "
+ "tfm.hex -Intel"),
+ "arm/musca_s1": ("srec_cat "
"%(_tbm_build_dir_)s/bin/"
"bl2.bin "
"-Binary -offset 0xA000000 "
@@ -95,20 +95,20 @@
"-Binary -offset 0xA020000 "
"-fill 0xFF 0xA020000 0xA200000 "
"-o %(_tbm_build_dir_)s/bin/"
- "tfm.hex -Intel")],
- "stm/stm32l562e_dk": [("echo 'STM32L562E-DK board post process';"
+ "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};"
- "popd")],
- "stm/b_u585i_iot02a": [("echo 'STM32U5 board post process';"
+ "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};"
- "popd")],
- "nxp/lpcxpresso55s69": [("echo 'LPCXpresso55S69 board post process\n';"
+ "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;"
"LN=$(grep -n 'JLinkExe' ${FLASH_FILE}|awk -F: '{print $1}');"
@@ -117,8 +117,8 @@
"cd %(_tbm_build_dir_)s/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';"
+ "popd"),
+ "cypress/psoc64": ("echo 'Sign binaries for Cypress PSoC64 platform';"
"pushd %(_tbm_build_dir_)s/..;"
"sudo /usr/local/bin/cysecuretools "
"--policy platform/ext/target/cypress/psoc64/security/policy/policy_multi_CM0_CM4_tfm.json "
@@ -134,7 +134,7 @@
"--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;"
- "popd")]
+ "popd")
},
# (Optional) If set will fail if those artefacts are missing post build