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
|
|
|
|
prebuilt=${WORKSPACE}/prebuilt
|
2021-04-05 04:55:34 +02:00
|
|
|
os=$(uname -s)
|
|
|
|
EXTRA_PATH=
|
|
|
|
|
2021-09-01 20:34:29 +02:00
|
|
|
case ${os} in
|
2021-04-05 04:55:34 +02:00
|
|
|
Darwin)
|
|
|
|
install="python-tools u-boot-tools elf-toolchain gen-romfs kconfig-frontends arm-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain avr-gcc-toolchain c-cache binutils"
|
2021-09-01 20:34:29 +02:00
|
|
|
mkdir -p "${prebuilt}"/homebrew
|
2021-04-05 04:55:34 +02:00
|
|
|
export HOMEBREW_CACHE=${prebuilt}/homebrew
|
|
|
|
# https://github.com/actions/virtual-environments/issues/2322#issuecomment-749211076
|
|
|
|
rm -rf /usr/local/bin/2to3
|
|
|
|
# https://github.com/osx-cross/homebrew-avr/issues/205#issuecomment-760637996
|
|
|
|
brew update --quiet
|
|
|
|
;;
|
|
|
|
Linux)
|
|
|
|
install="python-tools gen-romfs gperf kconfig-frontends arm-gcc-toolchain mips-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain rx-gcc-toolchain c-cache"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
function python-tools {
|
|
|
|
# Python User Env
|
|
|
|
PIP_USER=yes
|
|
|
|
export PIP_USER
|
2021-09-01 20:34:29 +02:00
|
|
|
PYTHONUSERBASE=${prebuilt}/pylocal
|
2021-04-05 04:55:34 +02:00
|
|
|
export PYTHONUSERBASE
|
2021-09-01 20:34:29 +02:00
|
|
|
add_path "${PYTHONUSERBASE}"/bin
|
2021-04-05 04:55:34 +02:00
|
|
|
pip3 install pexpect
|
2021-08-30 21:34:15 +02:00
|
|
|
|
|
|
|
# MCUboot's tool for image signing and key management
|
|
|
|
if ! command -v imgtool &> /dev/null; then
|
|
|
|
pip3 install imgtool
|
|
|
|
fi
|
2021-04-05 04:55:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function u-boot-tools {
|
|
|
|
if ! type mkimage > /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 u-boot-tools
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function elf-toolchain {
|
|
|
|
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
|
|
|
|
x86_64-elf-gcc --version
|
|
|
|
}
|
|
|
|
|
|
|
|
function gen-romfs {
|
2021-09-01 20:34:29 +02:00
|
|
|
add_path "${prebuilt}"/genromfs/usr/bin
|
2021-04-05 04:55:34 +02:00
|
|
|
|
2021-09-01 20:34:29 +02:00
|
|
|
if [ ! -f "${prebuilt}/genromfs/usr/bin/genromfs" ]; then
|
|
|
|
if [ ! -d "${tools}" ]; then
|
|
|
|
git clone https://bitbucket.org/nuttx/tools.git "${tools}"
|
2021-04-05 04:55:34 +02:00
|
|
|
fi
|
2021-09-01 20:34:29 +02:00
|
|
|
mkdir -p "${prebuilt}"; cd "${tools}"
|
|
|
|
tar zxf genromfs-0.5.2.tar.gz -C "${prebuilt}"
|
|
|
|
cd "${prebuilt}"/genromfs-0.5.2
|
|
|
|
make install PREFIX="${prebuilt}"/genromfs
|
|
|
|
cd "${prebuilt}"
|
2021-04-05 04:55:34 +02:00
|
|
|
rm -rf genromfs-0.5.2
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function gperf {
|
2021-09-01 20:34:29 +02:00
|
|
|
add_path "${prebuilt}"/gperf/bin
|
2021-04-05 04:55:34 +02:00
|
|
|
|
2021-09-01 20:34:29 +02:00
|
|
|
if [ ! -f "${prebuilt}/gperf/bin/gperf" ]; then
|
|
|
|
cd "${prebuilt}"
|
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
|
2021-09-01 20:34:29 +02:00
|
|
|
cd "${prebuilt}"/gperf-3.1
|
|
|
|
./configure --prefix="${prebuilt}"/gperf; make; make install
|
|
|
|
cd "${prebuilt}"
|
2021-04-05 04:55:34 +02:00
|
|
|
rm -rf gperf-3.1; rm gperf-3.1.tar.gz
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function kconfig-frontends {
|
2021-09-01 20:34:29 +02:00
|
|
|
add_path "${prebuilt}"/kconfig-frontends/bin
|
2021-04-05 04:55:34 +02:00
|
|
|
|
2021-09-01 20:34:29 +02:00
|
|
|
if [ ! -f "${prebuilt}/kconfig-frontends/bin/kconfig-conf" ]; then
|
|
|
|
cd "${tools}"/kconfig-frontends
|
|
|
|
./configure --prefix="${prebuilt}"/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
|
2021-09-01 20:34:29 +02:00
|
|
|
cd "${tools}"; git clean -xfd
|
2021-04-05 04:55:34 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function bloaty {
|
2021-09-01 20:34:29 +02:00
|
|
|
add_path "${prebuilt}"/bloaty/bin
|
|
|
|
if [ ! -f "${prebuilt}/bloaty/bin/bloaty" ]; then
|
2021-04-05 04:55:34 +02:00
|
|
|
git clone --depth 1 --branch v1.1 https://github.com/google/bloaty bloaty-src
|
|
|
|
cd bloaty-src
|
2021-09-01 20:34:29 +02:00
|
|
|
mkdir -p "${prebuilt}"/bloaty
|
|
|
|
cmake -DCMAKE_SYSTEM_PREFIX_PATH="${prebuilt}"/bloaty
|
2021-04-05 04:55:34 +02:00
|
|
|
make install -j 6
|
2021-09-01 20:34:29 +02:00
|
|
|
cd "${prebuilt}"
|
2021-04-05 04:55:34 +02:00
|
|
|
rm -rf bloaty-src
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function arm-gcc-toolchain {
|
2021-09-01 20:34:29 +02:00
|
|
|
add_path "${prebuilt}"/gcc-arm-none-eabi/bin
|
2021-04-05 04:55:34 +02:00
|
|
|
|
2021-09-01 20:34:29 +02:00
|
|
|
if [ ! -f "${prebuilt}/gcc-arm-none-eabi/bin/arm-none-eabi-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=mac
|
|
|
|
;;
|
|
|
|
Linux)
|
|
|
|
flavor=x86_64-linux
|
|
|
|
;;
|
|
|
|
esac
|
2021-09-01 20:34:29 +02:00
|
|
|
cd "${prebuilt}"
|
2021-04-05 04:55:34 +02:00
|
|
|
wget --quiet https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-${flavor}.tar.bz2
|
|
|
|
tar jxf gcc-arm-none-eabi-9-2019-q4-major-${flavor}.tar.bz2
|
|
|
|
mv gcc-arm-none-eabi-9-2019-q4-major gcc-arm-none-eabi
|
|
|
|
rm gcc-arm-none-eabi-9-2019-q4-major-${flavor}.tar.bz2
|
|
|
|
fi
|
|
|
|
arm-none-eabi-gcc --version
|
|
|
|
}
|
|
|
|
|
|
|
|
function mips-gcc-toolchain {
|
2021-09-01 20:34:29 +02:00
|
|
|
add_path "${prebuilt}"/pinguino-compilers/linux64/p32/bin
|
2021-04-05 04:55:34 +02:00
|
|
|
|
2021-09-01 20:34:29 +02:00
|
|
|
if [ ! -f "${prebuilt}/pinguino-compilers/linux64/p32/bin/p32-gcc" ]; then
|
|
|
|
cd "${prebuilt}"
|
2021-04-05 04:55:34 +02:00
|
|
|
git clone https://github.com/PinguinoIDE/pinguino-compilers
|
|
|
|
fi
|
|
|
|
p32-gcc --version
|
|
|
|
}
|
|
|
|
|
|
|
|
function riscv-gcc-toolchain {
|
2021-09-01 20:34:29 +02:00
|
|
|
add_path "${prebuilt}"/riscv64-unknown-elf-gcc/bin
|
2021-04-05 04:55:34 +02:00
|
|
|
|
2021-09-01 20:34:29 +02:00
|
|
|
if [ ! -f "${prebuilt}/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
|
2021-09-01 20:34:29 +02:00
|
|
|
cd "${prebuilt}"
|
2021-04-05 04:55:34 +02:00
|
|
|
wget --quiet https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-${flavor}.tar.gz
|
|
|
|
tar zxf riscv64-unknown-elf-gcc-8.3.0-2019.08.0-${flavor}.tar.gz
|
|
|
|
mv riscv64-unknown-elf-gcc-8.3.0-2019.08.0-${flavor} riscv64-unknown-elf-gcc
|
|
|
|
rm riscv64-unknown-elf-gcc-8.3.0-2019.08.0-${flavor}.tar.gz
|
|
|
|
fi
|
|
|
|
riscv64-unknown-elf-gcc --version
|
|
|
|
}
|
|
|
|
|
|
|
|
function xtensa-esp32-gcc-toolchain {
|
2021-09-01 20:34:29 +02:00
|
|
|
add_path "${prebuilt}"/xtensa-esp32-elf/bin
|
2021-04-05 04:55:34 +02:00
|
|
|
|
2021-09-01 20:34:29 +02:00
|
|
|
if [ ! -f "${prebuilt}/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc" ]; then
|
|
|
|
cd "${prebuilt}"
|
|
|
|
case ${os} in
|
2021-04-05 04:55:34 +02:00
|
|
|
Darwin)
|
|
|
|
wget --quiet https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_2_0-esp-2019r2-macos.tar.gz
|
|
|
|
tar xzf xtensa-esp32-elf-gcc8_2_0-esp-2019r2-macos.tar.gz
|
|
|
|
rm xtensa-esp32-elf-gcc8_2_0-esp-2019r2-macos.tar.gz
|
|
|
|
;;
|
|
|
|
Linux)
|
|
|
|
wget --quiet https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-rc2-linux-amd64.tar.xz
|
|
|
|
xz -d xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-rc2-linux-amd64.tar.xz
|
|
|
|
tar xf xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-rc2-linux-amd64.tar
|
|
|
|
rm xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-rc2-linux-amd64.tar
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
xtensa-esp32-elf-gcc --version
|
|
|
|
pip3 install esptool
|
|
|
|
}
|
|
|
|
|
|
|
|
function avr-gcc-toolchain {
|
|
|
|
if ! type avr-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 tap osx-cross/avr
|
2021-06-08 14:13:04 +02:00
|
|
|
brew install avr-gcc
|
2021-04-05 04:55:34 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function rx-gcc-toolchain {
|
2021-09-01 20:34:29 +02:00
|
|
|
add_path "${prebuilt}"/renesas-toolchain/rx-elf-gcc/bin
|
2021-04-05 04:55:34 +02:00
|
|
|
|
2021-09-01 20:34:29 +02:00
|
|
|
if [ ! -f "${prebuilt}/renesas-toolchain/rx-elf-gcc/bin/rx-elf-gcc" ]; then
|
|
|
|
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.
|
2021-09-01 20:34:29 +02:00
|
|
|
mkdir -p "${prebuilt}"/renesas-tools/rx/source; cd "${prebuilt}"/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
|
2021-09-01 20:34:29 +02:00
|
|
|
cd "${prebuilt}"/renesas-tools/rx/source/binutils; chmod +x ./configure ./mkinstalldirs
|
|
|
|
mkdir -p "${prebuilt}"/renesas-tools/rx/build/binutils; cd "${prebuilt}"/renesas-tools/rx/build/binutils
|
|
|
|
"${prebuilt}"/renesas-tools/rx/source/binutils/configure --target=rx-elf --prefix="${prebuilt}"/renesas-toolchain/rx-elf-gcc \
|
2021-04-05 04:55:34 +02:00
|
|
|
--disable-werror
|
|
|
|
make; make install
|
|
|
|
|
|
|
|
# Install gcc
|
2021-09-01 20:34:29 +02:00
|
|
|
cd "${prebuilt}"/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
|
2021-09-01 20:34:29 +02:00
|
|
|
mkdir -p "${prebuilt}"/renesas-tools/rx/build/gcc; cd "${prebuilt}"/renesas-tools/rx/build/gcc
|
|
|
|
"${prebuilt}"/renesas-tools/rx/source/gcc/configure --target=rx-elf --prefix="${prebuilt}"/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
|
2021-09-01 20:34:29 +02:00
|
|
|
cd "${prebuilt}"/renesas-tools/rx/source/newlib; chmod +x ./configure
|
|
|
|
mkdir -p "${prebuilt}"/renesas-tools/rx/build/newlib; cd "${prebuilt}"/renesas-tools/rx/build/newlib
|
|
|
|
"${prebuilt}"/renesas-tools/rx/source/newlib/configure --target=rx-elf --prefix="${prebuilt}"/renesas-toolchain/rx-elf-gcc
|
2021-04-05 04:55:34 +02:00
|
|
|
make; make install
|
2021-09-01 20:34:29 +02:00
|
|
|
rm -rf "${prebuilt}"/renesas-tools/
|
2021-04-05 04:55:34 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
rx-elf-gcc --version
|
|
|
|
}
|
|
|
|
|
|
|
|
function c-cache {
|
2021-09-01 20:34:29 +02:00
|
|
|
add_path "${prebuilt}"/ccache/bin
|
2021-04-05 04:55:34 +02:00
|
|
|
|
|
|
|
if ! type ccache > /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 ccache
|
|
|
|
;;
|
|
|
|
Linux)
|
2021-09-01 20:34:29 +02:00
|
|
|
cd "${prebuilt}";
|
2021-04-05 04:55:34 +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
|
2021-09-01 20:34:29 +02:00
|
|
|
cd ccache-3.7.7; ./configure --prefix="${prebuilt}"/ccache; make; make install
|
|
|
|
cd "${prebuilt}"; rm -rf ccache-3.7.7; rm ccache-3.7.7.tar.gz
|
2021-04-05 04:55:34 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
ccache --version
|
2021-09-01 20:34:29 +02:00
|
|
|
mkdir -p "${prebuilt}"/ccache/bin/
|
|
|
|
ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/x86_64-elf-gcc
|
|
|
|
ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/x86_64-elf-g++
|
|
|
|
ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/cc
|
|
|
|
ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/c++
|
|
|
|
ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/clang
|
|
|
|
ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/clang++
|
|
|
|
ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/gcc
|
|
|
|
ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/g++
|
|
|
|
ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/arm-none-eabi-gcc
|
|
|
|
ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/arm-none-eabi-g++
|
|
|
|
ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/p32-gcc
|
|
|
|
ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/riscv64-unknown-elf-gcc
|
|
|
|
ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/riscv64-unknown-elf-g++
|
|
|
|
ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/xtensa-esp32-elf-gcc
|
|
|
|
ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/avr-gcc
|
|
|
|
ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/avr-g++
|
2021-04-05 04:55:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function binutils {
|
2021-09-01 20:34:29 +02:00
|
|
|
mkdir -p "${prebuilt}"/bintools/bin
|
|
|
|
add_path "${prebuilt}"/bintools/bin
|
2021-04-05 04:55:34 +02:00
|
|
|
|
|
|
|
if ! type objcopy > /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 binutils
|
|
|
|
# It is possible we cached prebuilt but did brew install so recreate
|
|
|
|
# simlink if it exists
|
2021-09-01 20:34:29 +02:00
|
|
|
rm -f "${prebuilt}"/bintools/bin/objcopy
|
|
|
|
ln -s /usr/local/opt/binutils/bin/objcopy "${prebuilt}"/bintools/bin/objcopy
|
2021-04-05 04:55:34 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
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 {
|
|
|
|
export USE_CCACHE=1;
|
|
|
|
ccache -z
|
|
|
|
ccache -M 5G;
|
|
|
|
ccache -s
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2021-09-01 20:34:29 +02:00
|
|
|
git clone https://github.com/apache/incubator-nuttx.git "${nuttx}"
|
|
|
|
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
|
2021-09-01 20:34:29 +02:00
|
|
|
git clone https://github.com/apache/incubator-nuttx-apps.git "${apps}"
|
|
|
|
cd "${apps}"
|
2021-04-05 04:55:34 +02:00
|
|
|
fi
|
|
|
|
git log -1
|
|
|
|
popd
|
|
|
|
}
|
|
|
|
|
|
|
|
function install_tools {
|
|
|
|
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
|
|
|
|
|
2021-09-01 20:34:29 +02:00
|
|
|
echo PATH="${EXTRA_PATH}"/"${PATH}" > "${prebuilt}"/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
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|