Skip to content

Commit

Permalink
[script] update scripts to install ARM GNU Toolchain 12
Browse files Browse the repository at this point in the history
This is compiler is a requirement for GSDK 4.4.0
  • Loading branch information
lmnotran committed Dec 19, 2023
1 parent 4c7bb3a commit 5c6969f
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 16 deletions.
23 changes: 8 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand Down
38 changes: 37 additions & 1 deletion script/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ install_packages_apt()
python3-pip \
git-lfs \
unzip \
wget
wget \
xz-utils
}

install_packages_opkg()
Expand Down Expand Up @@ -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
Expand All @@ -126,6 +159,9 @@ main()
do_bootstrap_silabs
elif [ "$1" == 'packages' ]; then
install_packages
elif [ "$1" == 'arm_toolchain' ]; then
shift 1
install_arm_toolchain "$@"
elif [ "$1" == 'openthread' ]; then
do_bootstrap_openthread
elif [ "$1" == 'python' ]; then
Expand Down

0 comments on commit 5c6969f

Please sign in to comment.