2021-04-05 04:55:34 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
# or more contributor license agreements. See the NOTICE file
|
|
|
|
# distributed with this work for additional information
|
|
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
|
|
# to you under the Apache License, Version 2.0 (the
|
|
|
|
# "License"); you may not use this file except in compliance
|
|
|
|
# with the License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing,
|
|
|
|
# software distributed under the License is distributed on an
|
|
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
# KIND, either express or implied. See the License for the
|
|
|
|
# specific language governing permissions and limitations
|
|
|
|
# under the License.
|
|
|
|
|
|
|
|
# Prerequisites for macOS
|
|
|
|
# - Xcode (cc, etc)
|
|
|
|
# - homebrew
|
|
|
|
# - autoconf
|
|
|
|
# - wget
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -o xtrace
|
|
|
|
|
2021-09-01 20:34:29 +02:00
|
|
|
WD=$(cd "$(dirname "$0")" && pwd)
|
|
|
|
WORKSPACE=$(cd "${WD}"/../../../ && pwd -P)
|
|
|
|
nuttx=${WORKSPACE}/nuttx
|
|
|
|
apps=${WORKSPACE}/apps
|
|
|
|
tools=${WORKSPACE}/tools
|
2021-04-05 04:55:34 +02:00
|
|
|
os=$(uname -s)
|
|
|
|
EXTRA_PATH=
|
|
|
|
|
|
|
|
function add_path {
|
2021-09-01 20:34:29 +02:00
|
|
|
PATH=$1:${PATH}
|
|
|
|
EXTRA_PATH=$1:${EXTRA_PATH}
|
2021-04-05 04:55:34 +02:00
|
|
|
}
|
|
|
|
|
2022-10-21 07:27:32 +02:00
|
|
|
function arm-clang-toolchain {
|
2022-12-10 11:05:41 +01:00
|
|
|
add_path "${tools}"/clang-arm-none-eabi/bin
|
2021-08-30 21:34:15 +02:00
|
|
|
|
2022-12-10 11:05:41 +01:00
|
|
|
if [ ! -f "${tools}/clang-arm-none-eabi/bin/clang" ]; then
|
2022-12-10 15:34:20 +01:00
|
|
|
local flavor
|
|
|
|
case ${os} in
|
|
|
|
Linux)
|
|
|
|
flavor=linux
|
|
|
|
;;
|
|
|
|
esac
|
2022-12-10 11:05:41 +01:00
|
|
|
cd "${tools}"
|
2022-12-10 15:34:20 +01:00
|
|
|
curl -O -L -s https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-14.0.0/LLVMEmbeddedToolchainForArm-14.0.0-${flavor}.tar.gz
|
|
|
|
tar zxf LLVMEmbeddedToolchainForArm-14.0.0-${flavor}.tar.gz
|
2022-11-22 16:26:54 +01:00
|
|
|
mv LLVMEmbeddedToolchainForArm-14.0.0 clang-arm-none-eabi
|
2022-10-21 07:27:32 +02:00
|
|
|
cp /usr/bin/clang-extdef-mapping-10 clang-arm-none-eabi/bin/clang-extdef-mapping
|
2022-12-10 15:34:20 +01:00
|
|
|
rm LLVMEmbeddedToolchainForArm-14.0.0-${flavor}.tar.gz
|
2021-08-30 21:34:15 +02:00
|
|
|
fi
|
2022-12-10 15:34:20 +01:00
|
|
|
|
2022-10-21 07:27:32 +02:00
|
|
|
clang --version
|
2021-04-05 04:55:34 +02:00
|
|
|
}
|
|
|
|
|
2022-10-21 07:27:32 +02:00
|
|
|
function arm-gcc-toolchain {
|
2022-12-10 11:05:41 +01:00
|
|
|
add_path "${tools}"/gcc-arm-none-eabi/bin
|
2022-10-21 07:27:32 +02:00
|
|
|
|
2022-12-10 11:05:41 +01:00
|
|
|
if [ ! -f "${tools}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc" ]; then
|
2022-10-21 07:27:32 +02:00
|
|
|
local flavor
|
|
|
|
case ${os} in
|
|
|
|
Darwin)
|
|
|
|
flavor=-darwin
|
|
|
|
;;
|
|
|
|
Linux)
|
|
|
|
flavor=
|
|
|
|
;;
|
|
|
|
esac
|
2022-12-10 11:05:41 +01:00
|
|
|
cd "${tools}"
|
2023-02-20 06:54:18 +01:00
|
|
|
wget --quiet https://developer.arm.com/-/media/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1${flavor}-x86_64-arm-none-eabi.tar.xz
|
|
|
|
xz -d arm-gnu-toolchain-12.2.rel1${flavor}-x86_64-arm-none-eabi.tar.xz
|
|
|
|
tar xf arm-gnu-toolchain-12.2.rel1${flavor}-x86_64-arm-none-eabi.tar
|
|
|
|
mv arm-gnu-toolchain-12.2.rel1${flavor}-x86_64-arm-none-eabi gcc-arm-none-eabi
|
|
|
|
rm arm-gnu-toolchain-12.2.rel1${flavor}-x86_64-arm-none-eabi.tar
|
2022-10-21 07:27:32 +02:00
|
|
|
fi
|
2022-12-10 15:34:20 +01:00
|
|
|
|
2022-10-21 07:27:32 +02:00
|
|
|
arm-none-eabi-gcc --version
|
2022-09-15 15:31:16 +02:00
|
|
|
}
|
|
|
|
|
2022-10-21 07:27:32 +02:00
|
|
|
function arm64-gcc-toolchain {
|
2022-12-10 11:05:41 +01:00
|
|
|
add_path "${tools}"/gcc-aarch64-none-elf/bin
|
2022-10-21 07:27:32 +02:00
|
|
|
|
2022-12-10 11:05:41 +01:00
|
|
|
if [ ! -f "${tools}/gcc-aarch64-none-elf/bin/aarch64-none-elf-gcc" ]; then
|
2022-10-21 07:27:32 +02:00
|
|
|
local flavor
|
2021-09-01 20:34:29 +02:00
|
|
|
case ${os} in
|
2021-04-05 04:55:34 +02:00
|
|
|
Darwin)
|
2022-10-21 07:27:32 +02:00
|
|
|
flavor=darwin-x86_64
|
|
|
|
;;
|
|
|
|
Linux)
|
|
|
|
flavor=x86_64
|
2021-04-05 04:55:34 +02:00
|
|
|
;;
|
|
|
|
esac
|
2022-12-10 11:05:41 +01:00
|
|
|
cd "${tools}"
|
2022-10-21 07:27:32 +02:00
|
|
|
wget --quiet https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel/gcc-arm-11.2-2022.02-${flavor}-aarch64-none-elf.tar.xz
|
|
|
|
xz -d gcc-arm-11.2-2022.02-${flavor}-aarch64-none-elf.tar.xz
|
|
|
|
tar xf gcc-arm-11.2-2022.02-${flavor}-aarch64-none-elf.tar
|
|
|
|
mv gcc-arm-11.2-2022.02-${flavor}-aarch64-none-elf gcc-aarch64-none-elf
|
|
|
|
rm gcc-arm-11.2-2022.02-${flavor}-aarch64-none-elf.tar
|
2021-04-05 04:55:34 +02:00
|
|
|
fi
|
2022-12-10 15:34:20 +01:00
|
|
|
|
2022-10-21 07:27:32 +02:00
|
|
|
aarch64-none-elf-gcc --version
|
|
|
|
}
|
|
|
|
|
|
|
|
function avr-gcc-toolchain {
|
|
|
|
if ! type avr-gcc &> /dev/null; then
|
|
|
|
case ${os} in
|
|
|
|
Darwin)
|
|
|
|
brew tap osx-cross/avr
|
|
|
|
brew install avr-gcc
|
|
|
|
;;
|
2022-12-10 15:34:20 +01:00
|
|
|
Linux)
|
|
|
|
apt-get install -y avr-libc gcc-avr
|
|
|
|
;;
|
2022-10-21 07:27:32 +02:00
|
|
|
esac
|
|
|
|
fi
|
2022-12-10 15:34:20 +01:00
|
|
|
|
|
|
|
avr-gcc --version
|
2022-10-21 07:27:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function binutils {
|
2022-12-10 11:05:41 +01:00
|
|
|
mkdir -p "${tools}"/bintools/bin
|
|
|
|
add_path "${tools}"/bintools/bin
|
2022-10-21 07:27:32 +02:00
|
|
|
|
|
|
|
if ! type objcopy &> /dev/null; then
|
|
|
|
case ${os} in
|
|
|
|
Darwin)
|
|
|
|
brew install binutils
|
|
|
|
# It is possible we cached prebuilt but did brew install so recreate
|
|
|
|
# symlink if it exists
|
2022-12-10 11:05:41 +01:00
|
|
|
rm -f "${tools}"/bintools/bin/objcopy
|
|
|
|
ln -s /usr/local/opt/binutils/bin/objcopy "${tools}"/bintools/bin/objcopy
|
2022-10-21 07:27:32 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
2022-12-10 15:34:20 +01:00
|
|
|
|
|
|
|
objcopy --version
|
2022-10-21 07:27:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function bloaty {
|
2022-12-10 11:05:41 +01:00
|
|
|
add_path "${tools}"/bloaty/bin
|
2022-12-10 15:34:20 +01:00
|
|
|
|
2022-12-10 11:05:41 +01:00
|
|
|
if [ ! -f "${tools}/bloaty/bin/bloaty" ]; then
|
2022-12-12 19:53:16 +01:00
|
|
|
git clone --branch main https://github.com/google/bloaty "${tools}"/bloaty-src
|
|
|
|
cd "${tools}"/bloaty-src
|
2022-11-21 05:46:51 +01:00
|
|
|
# Due to issues with latest MacOS versions use pinned commit.
|
|
|
|
# https://github.com/google/bloaty/pull/326
|
|
|
|
git checkout 52948c107c8f81045e7f9223ec02706b19cfa882
|
2022-12-10 11:05:41 +01:00
|
|
|
mkdir -p "${tools}"/bloaty
|
|
|
|
cmake -D BLOATY_PREFER_SYSTEM_CAPSTONE=NO -DCMAKE_SYSTEM_PREFIX_PATH="${tools}"/bloaty
|
2022-10-21 07:27:32 +02:00
|
|
|
make install -j 6
|
2022-12-13 00:16:13 +01:00
|
|
|
cd "${tools}"
|
|
|
|
rm -rf bloaty-src
|
2022-10-21 07:27:32 +02:00
|
|
|
fi
|
2022-12-10 15:34:20 +01:00
|
|
|
|
|
|
|
command bloaty --version
|
2022-10-21 07:27:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function c-cache {
|
2022-12-10 11:05:41 +01:00
|
|
|
add_path "${tools}"/ccache/bin
|
2022-10-21 07:27:32 +02:00
|
|
|
|
|
|
|
if ! type ccache &> /dev/null; then
|
|
|
|
case ${os} in
|
|
|
|
Darwin)
|
|
|
|
brew install ccache
|
|
|
|
;;
|
|
|
|
Linux)
|
2022-12-10 11:05:41 +01:00
|
|
|
cd "${tools}";
|
2022-10-21 07:27:32 +02:00
|
|
|
wget https://github.com/ccache/ccache/releases/download/v3.7.7/ccache-3.7.7.tar.gz
|
|
|
|
tar zxf ccache-3.7.7.tar.gz
|
2022-12-10 11:05:41 +01:00
|
|
|
cd ccache-3.7.7; ./configure --prefix="${tools}"/ccache; make; make install
|
|
|
|
cd "${tools}"; rm -rf ccache-3.7.7; rm ccache-3.7.7.tar.gz
|
2022-10-21 07:27:32 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
ccache --version
|
|
|
|
}
|
|
|
|
|
2022-12-10 15:34:20 +01:00
|
|
|
function clang-tidy {
|
|
|
|
if ! type clang-tidy &> /dev/null; then
|
|
|
|
case ${os} in
|
|
|
|
Linux)
|
|
|
|
apt-get install -y clang clang-tidy
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
command clang-tidy --version
|
2021-04-05 04:55:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function elf-toolchain {
|
2021-09-01 20:36:31 +02:00
|
|
|
if ! type x86_64-elf-gcc &> /dev/null; then
|
2021-09-01 20:34:29 +02:00
|
|
|
case ${os} in
|
2021-04-05 04:55:34 +02:00
|
|
|
Darwin)
|
|
|
|
brew install x86_64-elf-gcc
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
2022-12-12 19:33:30 +01:00
|
|
|
|
|
|
|
x86_64-elf-gcc --version
|
2021-04-05 04:55:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function gen-romfs {
|
2023-02-11 17:07:17 +01:00
|
|
|
if ! type genromfs &> /dev/null; then
|
|
|
|
case ${os} in
|
|
|
|
Darwin)
|
|
|
|
brew tap PX4/px4
|
|
|
|
brew install genromfs
|
|
|
|
;;
|
|
|
|
Linux)
|
|
|
|
apt-get install -y genromfs
|
|
|
|
;;
|
|
|
|
esac
|
2021-04-05 04:55:34 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function gperf {
|
2022-12-10 11:05:41 +01:00
|
|
|
add_path "${tools}"/gperf/bin
|
2021-04-05 04:55:34 +02:00
|
|
|
|
2022-12-10 11:05:41 +01:00
|
|
|
if [ ! -f "${tools}/gperf/bin/gperf" ]; then
|
|
|
|
cd "${tools}"
|
2021-04-05 04:55:34 +02:00
|
|
|
wget --quiet http://ftp.gnu.org/pub/gnu/gperf/gperf-3.1.tar.gz
|
|
|
|
tar zxf gperf-3.1.tar.gz
|
2022-12-10 11:05:41 +01:00
|
|
|
cd "${tools}"/gperf-3.1
|
|
|
|
./configure --prefix="${tools}"/gperf; make; make install
|
|
|
|
cd "${tools}"
|
2021-04-05 04:55:34 +02:00
|
|
|
rm -rf gperf-3.1; rm gperf-3.1.tar.gz
|
|
|
|
fi
|
2022-12-10 15:34:20 +01:00
|
|
|
|
|
|
|
command gperf --version
|
2021-04-05 04:55:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function kconfig-frontends {
|
2022-12-10 11:05:41 +01:00
|
|
|
add_path "${tools}"/kconfig-frontends/bin
|
2021-04-05 04:55:34 +02:00
|
|
|
|
2022-12-10 11:05:41 +01:00
|
|
|
if [ ! -f "${tools}/kconfig-frontends/bin/kconfig-conf" ]; then
|
2023-02-11 17:07:17 +01:00
|
|
|
git clone https://bitbucket.org/nuttx/tools.git "${tools}"/nuttx-tools
|
2022-12-10 11:05:41 +01:00
|
|
|
cd "${tools}"/nuttx-tools/kconfig-frontends
|
|
|
|
./configure --prefix="${tools}"/kconfig-frontends \
|
2021-04-05 04:55:34 +02:00
|
|
|
--disable-kconfig --disable-nconf --disable-qconf \
|
|
|
|
--disable-gconf --disable-mconf --disable-static \
|
|
|
|
--disable-shared --disable-L10n
|
|
|
|
# Avoid "aclocal/automake missing" errors
|
|
|
|
touch aclocal.m4 Makefile.in
|
|
|
|
make install
|
2022-12-13 00:16:13 +01:00
|
|
|
cd "${tools}"
|
|
|
|
rm -rf nuttx-tools
|
2021-04-05 04:55:34 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function mips-gcc-toolchain {
|
2022-12-12 03:47:46 +01:00
|
|
|
if [ ! -d "${tools}/pinguino-compilers" ]; then
|
2022-12-10 11:05:41 +01:00
|
|
|
cd "${tools}"
|
2021-04-05 04:55:34 +02:00
|
|
|
git clone https://github.com/PinguinoIDE/pinguino-compilers
|
|
|
|
fi
|
2022-12-10 15:34:20 +01:00
|
|
|
|
|
|
|
case ${os} in
|
|
|
|
Darwin)
|
|
|
|
add_path "${tools}"/pinguino-compilers/macosx/p32/bin
|
|
|
|
mips-elf-gcc --version
|
|
|
|
;;
|
|
|
|
Linux)
|
|
|
|
add_path "${tools}"/pinguino-compilers/linux64/p32/bin
|
|
|
|
p32-gcc --version
|
|
|
|
;;
|
|
|
|
esac
|
2021-04-05 04:55:34 +02:00
|
|
|
}
|
|
|
|
|
2022-10-21 07:27:32 +02:00
|
|
|
function python-tools {
|
|
|
|
# Python User Env
|
2022-12-10 15:34:20 +01:00
|
|
|
export PIP_USER=yes
|
|
|
|
export PYTHONUSERBASE=${tools}/pylocal
|
2022-10-21 07:27:32 +02:00
|
|
|
add_path "${PYTHONUSERBASE}"/bin
|
2022-12-16 14:21:34 +01:00
|
|
|
|
|
|
|
# Force the reinstall of python packages due to issues with GitHub
|
|
|
|
# cache restoration.
|
|
|
|
pip3 install --force-reinstall \
|
2022-11-21 05:46:51 +01:00
|
|
|
CodeChecker \
|
2023-01-31 13:49:52 +01:00
|
|
|
cvt2utf \
|
2022-11-21 05:46:51 +01:00
|
|
|
cxxfilt \
|
2023-04-12 20:05:05 +02:00
|
|
|
esptool==4.5.1 \
|
2022-12-16 14:21:34 +01:00
|
|
|
imgtool==1.9.0 \
|
2023-02-11 16:38:34 +01:00
|
|
|
kconfiglib \
|
2022-11-21 05:46:51 +01:00
|
|
|
pexpect==4.8.0 \
|
|
|
|
pyelftools \
|
|
|
|
pyserial==3.5 \
|
|
|
|
pytest==6.2.5 \
|
|
|
|
pytest-json==0.4.0 \
|
|
|
|
pytest-ordering==0.6 \
|
2022-12-16 14:21:34 +01:00
|
|
|
pytest-repeat==0.9.1
|
2022-10-21 07:27:32 +02:00
|
|
|
}
|
|
|
|
|
2021-04-05 04:55:34 +02:00
|
|
|
function riscv-gcc-toolchain {
|
2022-12-10 11:05:41 +01:00
|
|
|
add_path "${tools}"/riscv64-unknown-elf-gcc/bin
|
2021-04-05 04:55:34 +02:00
|
|
|
|
2022-12-10 11:05:41 +01:00
|
|
|
if [ ! -f "${tools}/riscv64-unknown-elf-gcc/bin/riscv64-unknown-elf-gcc" ]; then
|
2021-04-05 04:55:34 +02:00
|
|
|
local flavor
|
2021-09-01 20:34:29 +02:00
|
|
|
case ${os} in
|
2021-04-05 04:55:34 +02:00
|
|
|
Darwin)
|
|
|
|
flavor=x86_64-apple-darwin
|
|
|
|
;;
|
|
|
|
Linux)
|
|
|
|
flavor=x86_64-linux-ubuntu14
|
|
|
|
;;
|
|
|
|
esac
|
2022-12-10 11:05:41 +01:00
|
|
|
cd "${tools}"
|
2022-04-18 23:40:20 +02:00
|
|
|
wget --quiet https://static.dev.sifive.com/dev-tools/freedom-tools/v2020.12/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-${flavor}.tar.gz
|
2022-04-18 02:56:07 +02:00
|
|
|
tar zxf riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-${flavor}.tar.gz
|
|
|
|
mv riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-${flavor} riscv64-unknown-elf-gcc
|
|
|
|
rm riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-${flavor}.tar.gz
|
2021-04-05 04:55:34 +02:00
|
|
|
fi
|
2022-12-10 15:34:20 +01:00
|
|
|
|
2021-04-05 04:55:34 +02:00
|
|
|
riscv64-unknown-elf-gcc --version
|
|
|
|
}
|
|
|
|
|
2022-10-21 07:27:32 +02:00
|
|
|
function rust {
|
2022-12-10 11:05:41 +01:00
|
|
|
mkdir -p "${tools}"/rust/bin
|
|
|
|
add_path "${tools}"/rust/bin
|
2021-04-05 04:55:34 +02:00
|
|
|
|
2022-10-21 07:27:32 +02:00
|
|
|
if ! type rustc &> /dev/null; then
|
2021-09-01 20:34:29 +02:00
|
|
|
case ${os} in
|
2021-04-05 04:55:34 +02:00
|
|
|
Darwin)
|
2022-10-21 07:27:32 +02:00
|
|
|
brew install rust
|
2021-04-05 04:55:34 +02:00
|
|
|
;;
|
|
|
|
Linux)
|
2022-10-21 07:27:32 +02:00
|
|
|
# Currently Debian installed rustc doesn't support 2021 edition.
|
2022-12-10 11:05:41 +01:00
|
|
|
export CARGO_HOME=${tools}/rust
|
2022-10-21 07:27:32 +02:00
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
2021-04-05 04:55:34 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
2022-12-10 15:34:20 +01:00
|
|
|
|
|
|
|
rustc --version
|
2021-04-05 04:55:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function rx-gcc-toolchain {
|
2022-12-10 11:05:41 +01:00
|
|
|
add_path "${tools}"/renesas-toolchain/rx-elf-gcc/bin
|
2021-04-05 04:55:34 +02:00
|
|
|
|
2022-12-10 11:05:41 +01:00
|
|
|
if [ ! -f "${tools}/renesas-toolchain/rx-elf-gcc/bin/rx-elf-gcc" ]; then
|
2021-09-01 20:34:29 +02:00
|
|
|
case ${os} in
|
2021-04-05 04:55:34 +02:00
|
|
|
Linux)
|
|
|
|
# Download toolchain source code
|
|
|
|
# RX toolchain is built from source code. Once prebuilt RX toolchain is made available, the below code snippet can be removed.
|
2022-12-10 11:05:41 +01:00
|
|
|
mkdir -p "${tools}"/renesas-tools/rx/source; cd "${tools}"/renesas-tools/rx/source
|
2021-04-05 04:55:34 +02:00
|
|
|
wget --quiet https://gcc-renesas.com/downloads/d.php?f=rx/binutils/4.8.4.201803-gnurx/rx_binutils2.24_2018Q3.tar.gz \
|
|
|
|
-O rx_binutils2.24_2018Q3.tar.gz
|
|
|
|
tar zxf rx_binutils2.24_2018Q3.tar.gz
|
|
|
|
wget --quiet https://gcc-renesas.com/downloads/d.php?f=rx/gcc/4.8.4.201803-gnurx/rx_gcc_4.8.4_2018Q3.tar.gz \
|
|
|
|
-O rx_gcc_4.8.4_2018Q3.tar.gz
|
|
|
|
tar zxf rx_gcc_4.8.4_2018Q3.tar.gz
|
|
|
|
wget --quiet https://gcc-renesas.com/downloads/d.php?f=rx/newlib/4.8.4.201803-gnurx/rx_newlib2.2.0_2018Q3.tar.gz \
|
|
|
|
-O rx_newlib2.2.0_2018Q3.tar.gz
|
|
|
|
tar zxf rx_newlib2.2.0_2018Q3.tar.gz
|
|
|
|
|
|
|
|
# Install binutils
|
2022-12-10 11:05:41 +01:00
|
|
|
cd "${tools}"/renesas-tools/rx/source/binutils; chmod +x ./configure ./mkinstalldirs
|
|
|
|
mkdir -p "${tools}"/renesas-tools/rx/build/binutils; cd "${tools}"/renesas-tools/rx/build/binutils
|
|
|
|
"${tools}"/renesas-tools/rx/source/binutils/configure --target=rx-elf --prefix="${tools}"/renesas-toolchain/rx-elf-gcc \
|
2021-04-05 04:55:34 +02:00
|
|
|
--disable-werror
|
|
|
|
make; make install
|
|
|
|
|
|
|
|
# Install gcc
|
2022-12-10 11:05:41 +01:00
|
|
|
cd "${tools}"/renesas-tools/rx/source/gcc
|
2021-04-05 04:55:34 +02:00
|
|
|
chmod +x ./contrib/download_prerequisites ./configure ./move-if-change ./libgcc/mkheader.sh
|
|
|
|
./contrib/download_prerequisites
|
|
|
|
sed -i '1s/^/@documentencoding ISO-8859-1\n/' ./gcc/doc/gcc.texi
|
|
|
|
sed -i 's/@tex/\n&/g' ./gcc/doc/gcc.texi && sed -i 's/@end tex/\n&/g' ./gcc/doc/gcc.texi
|
2022-12-10 11:05:41 +01:00
|
|
|
mkdir -p "${tools}"/renesas-tools/rx/build/gcc; cd "${tools}"/renesas-tools/rx/build/gcc
|
|
|
|
"${tools}"/renesas-tools/rx/source/gcc/configure --target=rx-elf --prefix="${tools}"/renesas-toolchain/rx-elf-gcc \
|
2021-04-05 04:55:34 +02:00
|
|
|
--disable-shared --disable-multilib --disable-libssp --disable-libstdcxx-pch --disable-werror --enable-lto \
|
|
|
|
--enable-gold --with-pkgversion=GCC_Build_1.02 --with-newlib --enable-languages=c
|
|
|
|
make; make install
|
|
|
|
|
|
|
|
# Install newlib
|
2022-12-10 11:05:41 +01:00
|
|
|
cd "${tools}"/renesas-tools/rx/source/newlib; chmod +x ./configure
|
|
|
|
mkdir -p "${tools}"/renesas-tools/rx/build/newlib; cd "${tools}"/renesas-tools/rx/build/newlib
|
|
|
|
"${tools}"/renesas-tools/rx/source/newlib/configure --target=rx-elf --prefix="${tools}"/renesas-toolchain/rx-elf-gcc
|
2021-04-05 04:55:34 +02:00
|
|
|
make; make install
|
2022-12-10 11:05:41 +01:00
|
|
|
rm -rf "${tools}"/renesas-tools/
|
2021-04-05 04:55:34 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
2022-12-10 15:34:20 +01:00
|
|
|
|
2021-04-05 04:55:34 +02:00
|
|
|
rx-elf-gcc --version
|
|
|
|
}
|
|
|
|
|
2022-02-02 06:18:01 +01:00
|
|
|
function sparc-gcc-toolchain {
|
2022-12-10 11:05:41 +01:00
|
|
|
add_path "${tools}"/sparc-gaisler-elf-gcc/bin
|
2022-02-02 06:18:01 +01:00
|
|
|
|
2022-12-10 11:05:41 +01:00
|
|
|
if [ ! -f "${tools}/sparc-gaisler-elf-gcc/bin/sparc-gaisler-elf-gcc" ]; then
|
2022-02-02 06:18:01 +01:00
|
|
|
case ${os} in
|
|
|
|
Linux)
|
2022-12-10 11:05:41 +01:00
|
|
|
cd "${tools}"
|
2022-02-02 06:18:01 +01:00
|
|
|
wget --quiet https://www.gaisler.com/anonftp/bcc2/bin/bcc-2.1.0-gcc-linux64.tar.xz
|
|
|
|
xz -d bcc-2.1.0-gcc-linux64.tar.xz
|
|
|
|
tar xf bcc-2.1.0-gcc-linux64.tar
|
|
|
|
mv bcc-2.1.0-gcc sparc-gaisler-elf-gcc
|
|
|
|
rm bcc-2.1.0-gcc-linux64.tar
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
2022-12-10 15:34:20 +01:00
|
|
|
|
2022-02-02 06:18:01 +01:00
|
|
|
sparc-gaisler-elf-gcc --version
|
|
|
|
}
|
|
|
|
|
2022-10-21 07:27:32 +02:00
|
|
|
function xtensa-esp32-gcc-toolchain {
|
2022-12-10 11:05:41 +01:00
|
|
|
add_path "${tools}"/xtensa-esp32-elf/bin
|
2021-04-05 04:55:34 +02:00
|
|
|
|
2022-12-10 11:05:41 +01:00
|
|
|
if [ ! -f "${tools}/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc" ]; then
|
|
|
|
cd "${tools}"
|
2021-09-01 20:34:29 +02:00
|
|
|
case ${os} in
|
2021-04-05 04:55:34 +02:00
|
|
|
Darwin)
|
2023-03-17 05:37:56 +01:00
|
|
|
wget --quiet https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32-elf-12.2.0_20230208-x86_64-apple-darwin.tar.xz
|
|
|
|
xz -d xtensa-esp32-elf-12.2.0_20230208-x86_64-apple-darwin.tar.xz
|
|
|
|
tar xf xtensa-esp32-elf-12.2.0_20230208-x86_64-apple-darwin.tar
|
|
|
|
rm xtensa-esp32-elf-12.2.0_20230208-x86_64-apple-darwin.tar
|
2021-04-05 04:55:34 +02:00
|
|
|
;;
|
|
|
|
Linux)
|
2023-03-17 05:37:56 +01:00
|
|
|
wget --quiet https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32-elf-12.2.0_20230208-x86_64-linux-gnu.tar.xz
|
|
|
|
xz -d xtensa-esp32-elf-12.2.0_20230208-x86_64-linux-gnu.tar.xz
|
|
|
|
tar xf xtensa-esp32-elf-12.2.0_20230208-x86_64-linux-gnu.tar
|
|
|
|
rm xtensa-esp32-elf-12.2.0_20230208-x86_64-linux-gnu.tar
|
2021-04-05 04:55:34 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
2022-12-10 15:34:20 +01:00
|
|
|
|
2022-10-21 07:27:32 +02:00
|
|
|
xtensa-esp32-elf-gcc --version
|
2021-04-05 04:55:34 +02:00
|
|
|
}
|
|
|
|
|
2022-10-21 07:27:32 +02:00
|
|
|
function u-boot-tools {
|
|
|
|
if ! type mkimage &> /dev/null; then
|
2022-02-20 01:42:41 +01:00
|
|
|
case ${os} in
|
|
|
|
Darwin)
|
2022-10-21 07:27:32 +02:00
|
|
|
brew install u-boot-tools
|
2022-02-20 01:42:41 +01:00
|
|
|
;;
|
2022-12-10 15:34:20 +01:00
|
|
|
Linux)
|
|
|
|
apt-get install -y u-boot-tools
|
|
|
|
;;
|
2022-02-20 01:42:41 +01:00
|
|
|
esac
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2023-03-03 08:24:16 +01:00
|
|
|
function wasi-sdk {
|
|
|
|
add_path "${tools}"/wamrc
|
|
|
|
|
|
|
|
if [ ! -f "${tools}/wasi-sdk/bin/clang" ]; then
|
|
|
|
cd "${tools}"
|
|
|
|
mkdir wamrc
|
|
|
|
|
|
|
|
case ${os} in
|
|
|
|
Darwin)
|
|
|
|
wget --quiet https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-macos.tar.gz
|
|
|
|
tar xzf wasi-sdk-19.0-macos.tar.gz
|
|
|
|
mv wasi-sdk-19.0 wasi-sdk
|
|
|
|
cd wamrc
|
|
|
|
wget --quiet https://github.com/bytecodealliance/wasm-micro-runtime/releases/download/WAMR-1.1.2/wamrc-1.1.2-x86_64-macos-latest.tar.gz
|
|
|
|
tar xzf wamrc-1.1.2-x86_64-macos-latest.tar.gz
|
|
|
|
;;
|
|
|
|
Linux)
|
|
|
|
wget --quiet https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-linux.tar.gz
|
|
|
|
tar xzf wasi-sdk-19.0-linux.tar.gz
|
|
|
|
mv wasi-sdk-19.0 wasi-sdk
|
|
|
|
cd wamrc
|
|
|
|
wget --quiet https://github.com/bytecodealliance/wasm-micro-runtime/releases/download/WAMR-1.1.2/wamrc-1.1.2-x86_64-ubuntu-20.04.tar.gz
|
|
|
|
tar xzf wamrc-1.1.2-x86_64-ubuntu-20.04.tar.gz
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
export WASI_SDK_PATH="${tools}/wasi-sdk"
|
|
|
|
|
|
|
|
${WASI_SDK_PATH}/bin/clang --version
|
|
|
|
wamrc --version
|
|
|
|
}
|
|
|
|
|
2021-04-05 04:55:34 +02:00
|
|
|
function usage {
|
|
|
|
echo ""
|
|
|
|
echo "USAGE: $0 [-i] [-s] [-c] [-*] <testlist>"
|
|
|
|
echo " $0 -h"
|
|
|
|
echo ""
|
|
|
|
echo "Where:"
|
|
|
|
echo " -i install tools"
|
|
|
|
echo " -s setup repos"
|
|
|
|
echo " -c enable ccache"
|
|
|
|
echo " -* support all options in testbuild.sh"
|
|
|
|
echo " -h will show this help test and terminate"
|
|
|
|
echo " <testlist> select testlist file"
|
|
|
|
echo ""
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
function enable_ccache {
|
2022-12-10 11:29:47 +01:00
|
|
|
export CCACHE_DIR="${tools}"/ccache
|
2021-04-05 04:55:34 +02:00
|
|
|
}
|
|
|
|
|
2022-10-21 07:27:32 +02:00
|
|
|
function setup_links {
|
2022-12-10 11:05:41 +01:00
|
|
|
mkdir -p "${tools}"/ccache/bin/
|
|
|
|
ln -sf "$(which ccache)" "${tools}"/ccache/bin/aarch64-none-elf-gcc
|
|
|
|
ln -sf "$(which ccache)" "${tools}"/ccache/bin/aarch64-none-elf-g++
|
|
|
|
ln -sf "$(which ccache)" "${tools}"/ccache/bin/arm-none-eabi-gcc
|
|
|
|
ln -sf "$(which ccache)" "${tools}"/ccache/bin/arm-none-eabi-g++
|
|
|
|
ln -sf "$(which ccache)" "${tools}"/ccache/bin/avr-gcc
|
|
|
|
ln -sf "$(which ccache)" "${tools}"/ccache/bin/avr-g++
|
|
|
|
ln -sf "$(which ccache)" "${tools}"/ccache/bin/cc
|
|
|
|
ln -sf "$(which ccache)" "${tools}"/ccache/bin/c++
|
|
|
|
ln -sf "$(which ccache)" "${tools}"/ccache/bin/clang
|
|
|
|
ln -sf "$(which ccache)" "${tools}"/ccache/bin/clang++
|
|
|
|
ln -sf "$(which ccache)" "${tools}"/ccache/bin/gcc
|
|
|
|
ln -sf "$(which ccache)" "${tools}"/ccache/bin/g++
|
|
|
|
ln -sf "$(which ccache)" "${tools}"/ccache/bin/p32-gcc
|
|
|
|
ln -sf "$(which ccache)" "${tools}"/ccache/bin/riscv64-unknown-elf-gcc
|
|
|
|
ln -sf "$(which ccache)" "${tools}"/ccache/bin/riscv64-unknown-elf-g++
|
|
|
|
ln -sf "$(which ccache)" "${tools}"/ccache/bin/sparc-gaisler-elf-gcc
|
|
|
|
ln -sf "$(which ccache)" "${tools}"/ccache/bin/sparc-gaisler-elf-g++
|
|
|
|
ln -sf "$(which ccache)" "${tools}"/ccache/bin/x86_64-elf-gcc
|
|
|
|
ln -sf "$(which ccache)" "${tools}"/ccache/bin/x86_64-elf-g++
|
|
|
|
ln -sf "$(which ccache)" "${tools}"/ccache/bin/xtensa-esp32-elf-gcc
|
2022-10-21 07:27:32 +02:00
|
|
|
}
|
|
|
|
|
2021-04-05 04:55:34 +02:00
|
|
|
function setup_repos {
|
|
|
|
pushd .
|
2021-09-01 20:34:29 +02:00
|
|
|
if [ -d "${nuttx}" ]; then
|
|
|
|
cd "${nuttx}"; git pull
|
2021-04-05 04:55:34 +02:00
|
|
|
else
|
2022-11-22 19:59:48 +01:00
|
|
|
git clone https://github.com/apache/nuttx.git "${nuttx}"
|
2021-09-01 20:34:29 +02:00
|
|
|
cd "${nuttx}"
|
2021-04-05 04:55:34 +02:00
|
|
|
fi
|
|
|
|
git log -1
|
|
|
|
|
2021-09-01 20:34:29 +02:00
|
|
|
if [ -d "${apps}" ]; then
|
|
|
|
cd "${apps}"; git pull
|
2021-04-05 04:55:34 +02:00
|
|
|
else
|
2022-11-22 19:59:48 +01:00
|
|
|
git clone https://github.com/apache/nuttx-apps.git "${apps}"
|
2021-09-01 20:34:29 +02:00
|
|
|
cd "${apps}"
|
2021-04-05 04:55:34 +02:00
|
|
|
fi
|
|
|
|
git log -1
|
|
|
|
popd
|
|
|
|
}
|
|
|
|
|
|
|
|
function install_tools {
|
2022-12-10 11:05:41 +01:00
|
|
|
mkdir -p "${tools}"
|
|
|
|
|
|
|
|
case ${os} in
|
|
|
|
Darwin)
|
2023-03-03 08:24:16 +01:00
|
|
|
install="arm-gcc-toolchain arm64-gcc-toolchain avr-gcc-toolchain binutils bloaty elf-toolchain gen-romfs gperf kconfig-frontends mips-gcc-toolchain python-tools riscv-gcc-toolchain rust xtensa-esp32-gcc-toolchain u-boot-tools wasi-sdk c-cache"
|
2022-12-10 11:05:41 +01:00
|
|
|
mkdir -p "${tools}"/homebrew
|
|
|
|
export HOMEBREW_CACHE=${tools}/homebrew
|
|
|
|
;;
|
|
|
|
Linux)
|
2023-03-03 08:24:16 +01:00
|
|
|
install="arm-clang-toolchain arm-gcc-toolchain arm64-gcc-toolchain avr-gcc-toolchain binutils bloaty clang-tidy gen-romfs gperf kconfig-frontends mips-gcc-toolchain python-tools riscv-gcc-toolchain rust rx-gcc-toolchain sparc-gcc-toolchain xtensa-esp32-gcc-toolchain u-boot-tools wasi-sdk c-cache"
|
2022-12-10 11:05:41 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2021-04-05 04:55:34 +02:00
|
|
|
pushd .
|
2021-09-01 20:34:29 +02:00
|
|
|
for func in ${install}; do
|
|
|
|
${func}
|
2021-04-05 04:55:34 +02:00
|
|
|
done
|
|
|
|
popd
|
|
|
|
|
2022-10-21 07:27:32 +02:00
|
|
|
setup_links
|
2022-12-10 11:05:41 +01:00
|
|
|
echo PATH="${EXTRA_PATH}"/"${PATH}" > "${tools}"/env.sh
|
2021-04-05 04:55:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function run_builds {
|
|
|
|
local ncpus
|
|
|
|
|
2021-09-01 20:34:29 +02:00
|
|
|
case ${os} in
|
2021-04-05 04:55:34 +02:00
|
|
|
Darwin)
|
|
|
|
ncpus=$(sysctl -n hw.ncpu)
|
|
|
|
;;
|
|
|
|
Linux)
|
2021-09-01 20:34:29 +02:00
|
|
|
ncpus=$(grep -c ^processor /proc/cpuinfo)
|
2021-04-05 04:55:34 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2021-09-01 20:34:29 +02:00
|
|
|
options+="-j ${ncpus}"
|
2021-04-05 04:55:34 +02:00
|
|
|
|
2021-09-01 20:34:29 +02:00
|
|
|
for build in "${builds[@]}"; do
|
|
|
|
"${nuttx}"/tools/testbuild.sh ${options} -e "-Wno-cpp -Werror" "${build}"
|
2021-04-05 04:55:34 +02:00
|
|
|
done
|
2022-12-10 11:29:47 +01:00
|
|
|
|
|
|
|
if [ -d "${CCACHE_DIR}" ]; then
|
|
|
|
ccache -s
|
|
|
|
fi
|
2021-04-05 04:55:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
usage
|
|
|
|
fi
|
|
|
|
|
2021-09-01 20:34:29 +02:00
|
|
|
while [ -n "$1" ]; do
|
2021-04-05 04:55:34 +02:00
|
|
|
case "$1" in
|
|
|
|
-h )
|
|
|
|
usage
|
|
|
|
;;
|
|
|
|
-i )
|
|
|
|
install_tools
|
|
|
|
;;
|
|
|
|
-c )
|
|
|
|
enable_ccache
|
|
|
|
;;
|
|
|
|
-s )
|
|
|
|
setup_repos
|
|
|
|
;;
|
|
|
|
-* )
|
|
|
|
options+="$1 "
|
|
|
|
;;
|
|
|
|
* )
|
2021-09-01 20:34:29 +02:00
|
|
|
builds=( "$@" )
|
2021-04-05 04:55:34 +02:00
|
|
|
break
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
run_builds
|