Build: Specify compiler path in bash
This patch is to prepare CI scripts to support multi compiler versions.
All versions of compilers will be installed by DockerFile to specific
path. The paths will be recoreded in env variables.
Every single config build job can select the needed compiler version
and add the specific compiler path to env PATH.
By default, GCC v7.3.1 & ARMClang 6.13 are choosen.
Signed-off-by: Xinyu Zhang <xinyu.zhang@arm.com>
Change-Id: Id4bafadfd28e95a14dc26c7641bcf9611c65e58a
diff --git a/build-docs.sh b/build-docs.sh
index ee6b01b..569eb2d 100755
--- a/build-docs.sh
+++ b/build-docs.sh
@@ -1,6 +1,6 @@
#!/bin/bash
#-------------------------------------------------------------------------------
-# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -13,6 +13,8 @@
set -ex
+export PATH=$PATH:$GCC_7_3_1_PATH
+
mkdir -p ${WORKSPACE}/trusted-firmware-m/build/docs
cd ${WORKSPACE}/trusted-firmware-m/build/docs
diff --git a/run-build.sh b/run-build.sh
index 34373d8..9c2d2f5 100755
--- a/run-build.sh
+++ b/run-build.sh
@@ -1,6 +1,6 @@
#!/bin/bash
#-------------------------------------------------------------------------------
-# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -25,12 +25,20 @@
cat /etc/issue
uname -a
grep -c ^processor /proc/cpuinfo
-armclang --version
-arm-none-eabi-gcc --version
cmake --version
python --version
make --version
+# Export specific compiler path to env PATH
+compiler_path="${COMPILER_VERSION}_PATH"
+export PATH=$PATH:"${!compiler_path}"
+# Show compiler version
+if [ $COMPILER_VERSION =~ "ARMCLANG" ] ; then
+ armclang --version
+else
+ arm-none-eabi-gcc --version
+fi
+
set -ex
build_commands=$(python3 tf-m-ci-scripts/configs.py -b -g all $CONFIG_NAME)
diff --git a/tfm_ci_pylib/tfm_build_manager.py b/tfm_ci_pylib/tfm_build_manager.py
index 1b0f7c8..d8a58bb 100644
--- a/tfm_ci_pylib/tfm_build_manager.py
+++ b/tfm_ci_pylib/tfm_build_manager.py
@@ -120,6 +120,19 @@
super(TFM_Build_Manager, self).__init__(name="TFM_Build_Manager")
+ def set_compiler_version(self, config):
+ compiler_version = ""
+ # Set GCC version
+ if "GNUARM" in config.toolchain_file:
+ # Use GCC v7.3.1 by default
+ compiler_version = "GCC_7_3_1"
+ # Set ARMClang version
+ elif "ARMCLANG" in config.toolchain_file:
+ # Use ARMClang v6.13 by default
+ compiler_version = "ARMCLANG_6_13"
+
+ return compiler_version
+
def get_config(self):
return list(self._tbm_build_cfg.keys())
@@ -137,6 +150,7 @@
"CONFIG_NAME={}",
"TFM_PLATFORM={}",
"TOOLCHAIN_FILE={}",
+ "COMPILER_VERSION={}",
"LIB_MODEL={}",
"ISOLATION_LEVEL={}",
"TEST_REGRESSION={}",
@@ -157,6 +171,7 @@
config,
config_details.tfm_platform,
config_details.toolchain_file,
+ self.set_compiler_version(config_details),
config_details.lib_model,
config_details.isolation_level,
config_details.test_regression,