From 685a70813c44926f885cfa2b8f8f0d03128a9b34 Mon Sep 17 00:00:00 2001 From: Mason Tran Date: Mon, 18 Dec 2023 16:04:58 -0500 Subject: [PATCH] [script] update scripts to install ARM GNU Toolchain 12 This is compiler is a requirement for GSDK 4.4.0 --- .github/workflows/build.yml | 23 ++++++++--------------- script/bootstrap | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d3b9ad3e..477f85f2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,18 +50,12 @@ jobs: fail-fast: false matrix: include: - - gcc_ver: 6 - gcc_download_url: https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2017q2/gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2 - gcc_extract_dir: gcc-arm-none-eabi-6-2017-q2-update - - gcc_ver: 7 - gcc_download_url: https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2 - gcc_extract_dir: gcc-arm-none-eabi-7-2018-q2-update - - gcc_ver: 9 - gcc_download_url: https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 - gcc_extract_dir: gcc-arm-none-eabi-9-2019-q4-major - - gcc_ver: 10.3 - gcc_download_url: https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 - gcc_extract_dir: gcc-arm-none-eabi-10.3-2021.10 + - gcc_ver: 12.2.Rel1 + gcc_download_url: https://developer.arm.com/-/media/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz + gcc_extract_dir: arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi + - gcc_ver: 12.3.Rel1 + gcc_download_url: https://developer.arm.com/-/media/Files/downloads/gnu/12.3.rel1/binrel/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi.tar.xz + gcc_extract_dir: arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi steps: - uses: actions/checkout@v4 @@ -83,9 +77,8 @@ jobs: - name: Bootstrap run: | - cd /tmp - wget --tries 4 --no-check-certificate --quiet ${{ matrix.gcc_download_url }} -O gcc-arm.tar.bz2 - tar xjf gcc-arm.tar.bz2 + script/bootstrap packages + script/bootstrap arm_toolchain - name: Build run: | diff --git a/script/bootstrap b/script/bootstrap index b4c1bbc2..bb32ad6b 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -55,7 +55,8 @@ install_packages_apt() python3-pip \ git-lfs \ unzip \ - wget + wget \ + xz-utils } install_packages_opkg() @@ -118,6 +119,38 @@ do_bootstrap_silabs() echo "Bootstrapping silabs" "${repo_dir}"/script/bootstrap_silabs } + +install_arm_toolchain() +{ + local url=${1-"https://developer.arm.com/-/media/Files/downloads/gnu/12.3.rel1/binrel/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi.tar.xz"} + local extract_dir=${2-"arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi"} + + local toolchain_dir="${HOME}/.local" + + # Check if the toolchain is already present at the desired location + if command -v ${toolchain_dir}/${extract_dir}/bin/arm-none-eabi-gcc; then + echo "'arm-none-eabi-gcc' found. Skipping GNU ARM Embedded toolchain install" + ${toolchain_dir}/${extract_dir}/bin/arm-none-eabi-gcc --version + return + fi + + echo 'Installing GNU ARM Embedded Toolchain...' + + # Download + local tarball=gcc-arm.tar.xz + wget --tries 4 --no-check-certificate --quiet ${url} -O ${toolchain_dir}/${tarball} + + # Extract + mkdir -p ${toolchain_dir}/${extract_dir} + tar xvf ${toolchain_dir}/${tarball} --directory ${toolchain_dir}/${extract_dir} --strip-components=1 + + # Link + sudo ln -s -f ${toolchain_dir}/${extract_dir}/bin/* /usr/local/bin/ + + # Cleanup + rm -rf ${toolchain_dir}/${tarball} +} + main() { if [ $# == 0 ]; then @@ -126,6 +159,8 @@ main() do_bootstrap_silabs elif [ "$1" == 'packages' ]; then install_packages + elif [ "$1" == 'arm_toolchain' ]; then + install_arm_toolchain elif [ "$1" == 'openthread' ]; then do_bootstrap_openthread elif [ "$1" == 'python' ]; then