Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | #------------------------------------------------------------------------------- |
Xinyu Zhang | ff5d771 | 2022-01-14 13:48:59 +0800 | [diff] [blame] | 3 | # Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved. |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 4 | # |
| 5 | # SPDX-License-Identifier: BSD-3-Clause |
| 6 | # |
| 7 | #------------------------------------------------------------------------------- |
| 8 | |
| 9 | # |
| 10 | # Builds a single configuration on Trusted Firmware M. |
| 11 | # Relies on environment variables pre-populated. |
| 12 | # These variables can be obtained using configs.py. |
| 13 | # Expected to have trusted-firmware-m cloned to same level as this git tree |
| 14 | # |
| 15 | |
| 16 | set -ex |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 17 | |
| 18 | if [ -z "$CONFIG_NAME" ] ; then |
| 19 | echo "Set CONFIG_NAME to run a build." |
| 20 | exit 1 |
| 21 | fi |
| 22 | |
Karl Zhang | 4a45dac | 2020-06-10 14:03:10 +0800 | [diff] [blame] | 23 | set +e |
| 24 | echo "output current build environment" |
| 25 | cat /etc/issue |
| 26 | uname -a |
| 27 | grep -c ^processor /proc/cpuinfo |
Karl Zhang | 4a45dac | 2020-06-10 14:03:10 +0800 | [diff] [blame] | 28 | cmake --version |
| 29 | python --version |
| 30 | make --version |
| 31 | |
| 32 | set -ex |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 33 | build_commands=$(python3 tf-m-ci-scripts/configs.py -b -g all $CONFIG_NAME) |
| 34 | |
Xinyu Zhang | 433771e | 2022-04-01 16:49:17 +0800 | [diff] [blame] | 35 | if [ $CODE_COVERAGE_EN = "TRUE" ] && [[ $CONFIG_NAME =~ "GCC" ]] ; then |
Karl Zhang | b0c9d69 | 2021-01-08 16:30:31 +0800 | [diff] [blame] | 36 | build_commands=${build_commands/toolchain_GNUARM.cmake/toolchain_GNUARM.cmake -DTFM_CODE_COVERAGE=True} |
Karl Zhang | f6f467e | 2020-07-10 16:24:45 +0800 | [diff] [blame] | 37 | echo "Flag: Add compiler flag for build with code coverage supported." |
| 38 | echo $build_commands |
| 39 | fi |
| 40 | |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 41 | if [ -z "$build_commands" ] ; then |
| 42 | echo "No build commands found." |
| 43 | exit 1 |
| 44 | fi |
| 45 | |
Xinyu Zhang | e0aa69c | 2021-03-13 13:33:55 +0800 | [diff] [blame] | 46 | cnt=$(ls trusted-firmware-m/lib/ext/mbedcrypto/*.patch 2> /dev/null | wc -l) |
| 47 | if [ "$cnt" != "0" ] ; then |
| 48 | cd mbedtls |
| 49 | git apply ../trusted-firmware-m/lib/ext/mbedcrypto/*.patch |
| 50 | cd - |
| 51 | fi |
Xinyu Zhang | b708f57 | 2020-09-15 11:43:46 +0800 | [diff] [blame] | 52 | |
Xinyu Zhang | e0aa69c | 2021-03-13 13:33:55 +0800 | [diff] [blame] | 53 | cnt=$(ls trusted-firmware-m/lib/ext/psa_arch_tests/*.patch 2> /dev/null | wc -l) |
| 54 | if [ "$cnt" != "0" ] ; then |
| 55 | cd psa-arch-tests |
| 56 | git apply ../trusted-firmware-m/lib/ext/psa_arch_tests/*.patch |
| 57 | cd - |
| 58 | fi |
| 59 | |
Xinyu Zhang | c9e44ca | 2021-12-01 14:52:50 +0800 | [diff] [blame] | 60 | psa_qcbor_link="https://github.com/laurencelundblade/QCBOR.git" |
| 61 | psa_qcbor_path="$(pwd)/psa_qcbor" |
| 62 | psa_qcbor_cfg_cmake="psa-arch-tests/api-tests/tools/cmake/common/CMakeExternal.cmake" |
| 63 | sed -i "s#$psa_qcbor_link#$psa_qcbor_path#g" $psa_qcbor_cfg_cmake |
| 64 | |
Xinyu Zhang | e0aa69c | 2021-03-13 13:33:55 +0800 | [diff] [blame] | 65 | rm -rf trusted-firmware-m/build |
| 66 | mkdir trusted-firmware-m/build |
| 67 | cd trusted-firmware-m/build |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 68 | |
| 69 | eval "set -ex ; $build_commands" |