Files
chipyard/scripts/build-toolchains.sh
Jerry Zhao 3f5a204fd0 BOOM Bump w. Fromajo (#523)
* [uart] add uart adapter | add uart + adapter to all configs

* [uart] change pty define name | add uart to all configs that need it

* [uart] default to 115200 baudrate

* [dromajo] first working commit

* [dromajo] bump boom for commit-width > 1 fix

* [dromajo] adjust dromajo commits

* [dromajo] bump boom

* commit dromajo changes

* extra

* [dromajo] add block device to configs

* rebump older modules

* bump firesim

* [chipyard] enable dromajo in midas level simulation

* [testchipip] forgot to bump

* get rid of breaking things

* bump firesim

* bump boom

* Bump BOOM to ifu3 WIP

* bump firesim

* fix how memory is passed to dromajo

* bump boom and firesim

* fix merge issues

* add dromajo cosim bridge in chipyard

* move traceio back into testchipip (#488)

* refer to testchipip traceio in firechip (#490)

* Move TraceIO fragment to chipyard (#492)

* fix chipyard dromajo bridge (#493)

* Sboom dromajo bump (#501)

* [FireChip] Use clock in BridgeBinders

* [firesim] Update TraceGen BridgeBinder

* [Firechip] Add support for Tile <-> Uncore rational division

* [firesim] Update the multiclock test

* [firechip] Commit some Eagle X-related mock configs

* [firechip] Instantiate multiple TracerV bridges

* [Firechip] Include reset in tracerv tokens

* [TracerV] Drop the first token in comparison tests

* [Firechip] Make reverse instruction order in trace printf

* WARNING: Point at a fork of boom @ davidbiancolin

* [firesim] Update ClockBridge API

* Add Gemmini to README [ci skip] (#487)

* [firechip] Isolate all firesim-multiclock stuff in a single file

* add documentation on ring network and system bus

* Bump firesim for CI

* Bump FireSim

* Bump testchipip to dev

[ci skip]

* Bump FireSim

* [make] split up specific make vars/targets into frags (#499)

* [make] split up specific make vars/targets into frags

* [make] move dramsim and max-cycles into SIM_FLAGS

* [misc] move ariane configs to configs/ folder

* [dromajo] add dromajo

* [dromajo] bump for new traceio changes

* bump firesim

* bump firesim

* point to chipyard traceio

* bump boom

Co-authored-by: David Biancolin <david.biancolin@gmail.com>
Co-authored-by: Howard Mao <zhehao.mao@gmail.com>

* Support Dromajo + TracerV configurations

* [docs] add documentation for Dromajo in FireSim + Chipyard

* add a bit more docs

* [docs] bump docs

* [firesim] dump artefacts in firesim

* [firesim] update firesim

* [testchipip] remove extraneous items in testchipip

* [dromajo] prevent dromajo from breaking when params unset

* update firesim, dromajo, and testchipip

* [firesim] bump firesim

* [firesim] bump firesim

* [misc] bump firesim and testchipip for reviewer comments

* remove WithNoGPIO fragment

* bump firesim

* bump dromajo boom config

* bump firesim

* generate artefacts in firesim testsuite

Co-authored-by: abejgonzalez <abe.j.gonza@gmail.com>
Co-authored-by: Abraham Gonzalez <abe.gonzalez@berkeley.edu>
Co-authored-by: David Biancolin <david.biancolin@gmail.com>
Co-authored-by: Howard Mao <zhehao.mao@gmail.com>
2020-05-16 00:21:24 -07:00

149 lines
4.5 KiB
Bash
Executable File

#!/usr/bin/env bash
#this script is based on the firesim build toolchains script
# exit script if any command fails
set -e
set -o pipefail
RDIR=$(pwd)
CHIPYARD_DIR="${CHIPYARD_DIR:-$(git rev-parse --show-toplevel)}"
usage() {
echo "usage: ${0} [OPTIONS] [riscv-tools | esp-tools | ec2fast]"
echo ""
echo "Installation Types"
echo " riscv-tools: if set, builds the riscv toolchain (this is also the default)"
echo " esp-tools: if set, builds esp-tools toolchain used for the hwacha vector accelerator"
echo " ec2fast: if set, pulls in a pre-compiled RISC-V toolchain for an EC2 manager instance"
echo ""
echo "Options"
echo " --prefix PREFIX : Install destination. If unset, defaults to $(pwd)/riscv-tools-install"
echo " or $(pwd)/esp-tools-install"
echo " --help -h : Display this message"
exit "$1"
}
error() {
echo "${0##*/}: ${1}" >&2
}
die() {
error "$1"
exit "${2:--1}"
}
TOOLCHAIN="riscv-tools"
EC2FASTINSTALL="false"
RISCV=""
# getopts does not support long options, and is inflexible
while [ "$1" != "" ];
do
case $1 in
-h | --help | help )
usage 3 ;;
-p | --prefix )
shift
RISCV=$(realpath $1) ;;
riscv-tools | esp-tools)
TOOLCHAIN=$1 ;;
ec2fast )
EC2FASTINSTALL="true" ;;
* )
error "invalid option $1"
usage 1 ;;
esac
shift
done
if [ -z "$RISCV" ] ; then
INSTALL_DIR="$TOOLCHAIN-install"
RISCV="$(pwd)/$INSTALL_DIR"
fi
echo "Installing toolchain to $RISCV"
# install risc-v tools
export RISCV="$RISCV"
cd "${CHIPYARD_DIR}"
SRCDIR="$(pwd)/toolchains/${TOOLCHAIN}"
[ -d "${SRCDIR}" ] || die "unsupported toolchain: ${TOOLCHAIN}"
. ./scripts/build-util.sh
if [ "${EC2FASTINSTALL}" = true ] ; then
[ "${TOOLCHAIN}" = 'riscv-tools' ] ||
die "unsupported precompiled toolchain: ${TOOLCHAIN}"
echo '=> Fetching pre-built toolchain'
module=toolchains/riscv-tools/riscv-gnu-toolchain-prebuilt
git config --unset submodule."${module}".update || :
git submodule update --init --depth 1 "${module}"
echo '==> Verifying toolchain version hash'
# Find commit hash without initializing the submodule
hashsrc="$(git ls-tree -d HEAD "${SRCDIR}/riscv-gnu-toolchain" | {
unset IFS && read -r _ type obj _ &&
test -n "${obj}" && test "${type}" = 'commit' && echo "${obj}"
}; )" ||
die 'failed to obtain riscv-gnu-toolchain submodule hash' "$?"
read -r hashbin < "${module}/HASH" ||
die 'failed to obtain riscv-gnu-toolchain-prebuilt hash' "$?"
echo "==> ${hashsrc}"
[ "${hashsrc}" = "${hashbin}" ] ||
die "pre-built version mismatch: ${hashbin}"
echo '==> Installing pre-built toolchain'
"${MAKE}" -C "${module}" DESTDIR="${RISCV}" install
git submodule deinit "${module}" || :
else
"${MAKE}" --version | (
read -r makever
case ${makever} in
'GNU Make '[4-9]\.*|'GNU Make '[1-9][0-9]) ;;
*) false ;;
esac; ) || die 'obsolete make version; need GNU make 4.x or later'
module_prepare riscv-gnu-toolchain qemu
module_build riscv-gnu-toolchain --prefix="${RISCV}" --with-cmodel=medany
echo '==> Building GNU/Linux toolchain'
module_make riscv-gnu-toolchain linux
fi
module_all riscv-isa-sim --prefix="${RISCV}"
# build static libfesvr library for linking into firesim driver (or others)
echo '==> Installing libfesvr static library'
module_make riscv-isa-sim libfesvr.a
cp -p "${SRCDIR}/riscv-isa-sim/build/libfesvr.a" "${RISCV}/lib/"
CC= CXX= module_all riscv-pk --prefix="${RISCV}" --host=riscv64-unknown-elf
module_all riscv-tests --prefix="${RISCV}/riscv64-unknown-elf"
# Common tools (not in any particular toolchain dir)
SRCDIR="$(pwd)/toolchains" module_all libgloss --prefix="${RISCV}/riscv64-unknown-elf" --host=riscv64-unknown-elf
SRCDIR="$(pwd)/toolchains" module_all qemu --prefix="${RISCV}" --target-list=riscv64-softmmu
# make Dromajo
make -C $CHIPYARD_DIR/tools/dromajo/dromajo-src/src
cd "$RDIR"
# create specific env.sh
{
echo "export CHIPYARD_TOOLCHAIN_SOURCED=1"
echo "export RISCV=$(printf '%q' "$RISCV")"
echo "export PATH=\${RISCV}/bin:\${PATH}"
echo "export LD_LIBRARY_PATH=\${RISCV}/lib\${LD_LIBRARY_PATH:+":\${LD_LIBRARY_PATH}"}"
} > env-$TOOLCHAIN.sh
# create general env.sh
echo "source \$( realpath \$(dirname "\${BASH_SOURCE[0]:-\${\(%\):-%x}}") )/env-$TOOLCHAIN.sh" >> env.sh
echo "Toolchain Build Complete!"