cvw/bin/wally-tool-chain-install.sh

395 lines
17 KiB
Bash
Raw Normal View History

2024-06-22 20:05:29 +00:00
#!/bin/bash
###########################################
## Tool chain install script.
##
## Written: Ross Thompson ross1728@gmail.com
## Created: 18 January 2023
## Modified: 22 January 2023
## Modified: 23 March 2023
2024-06-30 22:48:28 +00:00
## Modified: 30 June 2024, Jordan Carlin jcarlin@hmc.edu
2024-06-22 20:05:29 +00:00
##
## Purpose: Open source tool chain installation script
##
## A component of the CORE-V-WALLY configurable RISC-V project.
## https://github.com/openhwgroup/cvw
##
2024-07-04 06:42:31 +00:00
## Copyright (C) 2021-24 Harvey Mudd College & Oklahoma State University
2024-06-22 20:05:29 +00:00
##
## SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
##
## Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file
## except in compliance with the License, or, at your option, the Apache License version 2.0. You
## may obtain a copy of the License at
##
## https:##solderpad.org/licenses/SHL-2.1/
##
## Unless required by applicable law or agreed to in writing, any work 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.
################################################################################################
# MODIFY FOR YOUR MACHINE
# Increasing NUM_THREADS will speed up parallel compilation of the tools
#NUM_THREADS=2 # for low memory machines > 16GiB
NUM_THREADS=8 # for >= 32GiB
#NUM_THREADS=16 # for >= 64GiB
2024-07-08 14:21:08 +00:00
# Colors
BOLD='\033[1m'
UNDERLINE='\033[4m'
SECTION_COLOR='\033[95m'$BOLD
OK_COLOR='\033[94m'
SUCCESS_COLOR='\033[92m'
WARNING_COLOR='\033[93m'
FAIL_COLOR='\033[91m'
ENDC='\033[0m' # Reset to default color
2024-07-04 05:26:10 +00:00
# Error handler
error() {
2024-07-08 13:50:29 +00:00
echo -e "${FAIL_COLOR}Error: $STATUS installation failed"
2024-07-04 05:26:10 +00:00
echo -e "Error on line ${BASH_LINENO[0]} with command $BASH_COMMAND${ENDC}"
exit 1
}
2024-07-08 14:21:08 +00:00
# Print section header
section_header() {
printf "${SECTION_COLOR}%$(tput cols)s" | tr ' ' '#'
printf "%$(tput cols)s" | tr ' ' '#'
echo -e "$1"
printf "%$(tput cols)s" | tr ' ' '#'
printf "%$(tput cols)s${ENDC}" | tr ' ' '#'
}
2024-07-04 06:42:31 +00:00
set -e # break on error
trap error ERR # run error handler on error
STATUS="setup" # keep track of what part of the installation is running for error messages
2024-07-04 05:26:10 +00:00
2024-07-04 06:42:31 +00:00
# Determine script directory to locate related scripts
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Get Linux distro and version
source "${dir}"/wally-distro-check.sh
2024-06-22 20:05:29 +00:00
# Check if root
ROOT=$( [ "${EUID:=$(id -u)}" = 0 ] && echo true || echo false);
2024-06-22 20:05:29 +00:00
2024-07-04 06:42:31 +00:00
# Set installation directory based on execution privileges
# If the script is run as root, the default installation path is /opt/riscv
# If the script is run as a user, the default installation path is ~/riscv
# The installation path can be overridden with an argument passed to the script.
if [ "$ROOT" = true ]; then
2024-06-29 07:29:01 +00:00
export RISCV="${1:-/opt/riscv}"
2024-06-22 20:05:29 +00:00
else
2024-06-29 07:29:01 +00:00
export RISCV="${1:-$HOME/riscv}"
2024-06-22 20:05:29 +00:00
fi
2024-07-04 06:42:31 +00:00
# Set environment variables
2024-06-22 20:05:29 +00:00
export PATH=$PATH:$RISCV/bin:/usr/bin
2024-06-29 08:26:48 +00:00
export PKG_CONFIG_PATH=$RISCV/lib64/pkgconfig:$RISCV/lib/pkgconfig:$RISCV/share/pkgconfig:$RISCV/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH
2024-06-22 20:05:29 +00:00
2024-07-04 06:42:31 +00:00
# Create installation directory
mkdir -p "$RISCV"
2024-06-22 20:05:29 +00:00
echo "Running as root: $ROOT"
echo "Installation path: $RISCV"
2024-07-04 06:42:31 +00:00
# Install/update system packages if root. Otherwise, check that packages are already installed.
2024-07-04 05:26:10 +00:00
STATUS="system packages"
if [ "$ROOT" = true ]; then
source "${dir}"/wally-package-install.sh
else
source "${dir}"/wally-package-install.sh --check
fi
2024-06-22 20:05:29 +00:00
2024-07-04 06:42:31 +00:00
# Enable newer version of gcc for older distros (required for QEMU/Verilator)
if [ "$FAMILY" = rhel ]; then
2024-07-04 06:42:31 +00:00
source /opt/rh/gcc-toolset-13/enable
elif [ "$UBUNTU_VERSION" = 20 ]; then
mkdir -p "$RISCV"/gcc-10/bin
for f in gcc cpp g++ gcc-ar gcc-nm gcc-ranlib gcov gcov-dump gcov-tool lto-dump; do
ln -vsf /usr/bin/$f-10 "$RISCV"/gcc-10/bin/$f
done
export PATH="$RISCV"/gcc-10/bin:$PATH
2024-06-22 20:05:29 +00:00
fi
2024-07-04 06:42:31 +00:00
# Create python virtual environment so the python command targets desired version of python
2024-06-22 20:05:29 +00:00
# and installed packages are isolated from the rest of the system.
2024-07-08 14:21:08 +00:00
section_header "Setting up Python Environment"
2024-07-04 05:26:10 +00:00
STATUS="python virtual environment"
2024-06-22 20:05:29 +00:00
cd "$RISCV"
if [ ! -e "$RISCV"/riscv-python/bin/activate ]; then
2024-06-29 07:29:01 +00:00
# If python3.12 is avaiable, use it. Otherise, use whatever version of python3 is installed.
if [ "$(which python3.12)" ]; then
python3.12 -m venv riscv-python
else
python3 -m venv riscv-python
fi
2024-06-30 22:48:28 +00:00
echo -e "${OK_COLOR}Python virtual environment created.\nInstalling pip packages.${ENDC}"
else
2024-07-04 06:42:31 +00:00
echo -e "${OK_COLOR}Python virtual environment already exists.\nUpdating pip packages.${ENDC}"
2024-06-22 20:05:29 +00:00
fi
2024-07-04 06:42:31 +00:00
2024-06-22 20:05:29 +00:00
source "$RISCV"/riscv-python/bin/activate # activate python virtual environment
# Install python packages
2024-07-04 05:26:10 +00:00
STATUS="python packages"
2024-06-22 20:05:29 +00:00
pip install -U pip
pip install -U sphinx sphinx_rtd_theme matplotlib scipy scikit-learn adjustText lief markdown pyyaml testresources riscv_config
pip install -U riscv_isac # to generate new tests, such as quads with fp_dataset.py
2024-07-04 06:42:31 +00:00
# z3 is needed for sail and not availabe from dnf for rhel 8
2024-06-22 20:05:29 +00:00
if [ "$RHEL_VERSION" = 8 ]; then
2024-06-29 08:26:48 +00:00
pip install -U z3-solver
2024-06-22 20:05:29 +00:00
fi
2024-07-04 06:42:31 +00:00
2024-06-22 20:05:29 +00:00
source "$RISCV"/riscv-python/bin/activate # reload python virtual environment
2024-06-30 22:48:28 +00:00
echo -e "${SUCCESS_COLOR}Python environment successfully configured.${ENDC}"
2024-06-22 20:05:29 +00:00
2024-07-04 06:42:31 +00:00
2024-06-29 08:23:38 +00:00
# Extra dependecies needed for older distros that don't have new enough versions available from package manager
if [ "$RHEL_VERSION" = 8 ] || [ "$UBUNTU_VERSION" = 20 ]; then
2024-06-29 07:29:01 +00:00
# Newer versin of glib required for Qemu.
# Anything newer than this won't build on red hat 8
2024-07-04 05:26:10 +00:00
STATUS="glib"
2024-06-29 07:29:01 +00:00
if [ ! -e "$RISCV"/include/glib-2.0 ]; then
2024-07-08 14:21:08 +00:00
section_header "Installing glib"
2024-07-04 06:42:31 +00:00
pip install -U meson # Meson is needed to build glib
2024-06-29 07:29:01 +00:00
cd "$RISCV"
wget https://download.gnome.org/sources/glib/2.70/glib-2.70.5.tar.xz
tar -xJf glib-2.70.5.tar.xz
rm glib-2.70.5.tar.xz
cd glib-2.70.5
meson setup _build --prefix="$RISCV"
meson compile -C _build
meson install -C _build
cd "$RISCV"
rm -rf glib-2.70.5
2024-06-30 22:48:28 +00:00
echo -e "${SUCCESS_COLOR}glib successfully installed${ENDC}"
2024-06-29 07:29:01 +00:00
fi
2024-06-29 08:23:38 +00:00
fi
# Newer version of gmp needed for sail-riscv model
if [ "$RHEL_VERSION" = 8 ]; then
2024-07-04 05:26:10 +00:00
STATUS="gmp"
2024-06-29 07:29:01 +00:00
if [ ! -e "$RISCV"/include/gmp.h ]; then
2024-07-08 14:21:08 +00:00
section_header "Installing gmp"
2024-06-29 07:29:01 +00:00
cd "$RISCV"
wget https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.xz
tar -xJf gmp-6.3.0.tar.xz
rm gmp-6.3.0.tar.xz
cd gmp-6.3.0
./configure --prefix="$RISCV"
make -j ${NUM_THREADS}
make install
cd "$RISCV"
rm -rf gmp-6.3.0
2024-06-30 22:48:28 +00:00
echo -e "${SUCCESS_COLOR}gmp successfully installed${ENDC}"
2024-06-29 07:29:01 +00:00
fi
2024-06-22 20:05:29 +00:00
fi
2024-07-04 06:42:31 +00:00
# RISC-V GNU Toolchain (https://github.com/riscv-collab/riscv-gnu-toolchain)
# The RISC-V GNU Toolchain includes the GNU Compiler Collection (gcc), GNU Binutils, Newlib,
# and the GNU Debugger Project (gdb). It is a collection of tools used to compile RISC-V programs.
2024-06-22 20:05:29 +00:00
# To install GCC from source can take hours to compile.
2024-06-29 07:29:01 +00:00
# This configuration enables multilib to target many flavors of RISC-V.
2024-06-22 20:05:29 +00:00
# This book is tested with GCC 13.2.0
2024-07-08 14:21:08 +00:00
section_header "Installing/Updating RISC-V GNU Toolchain"
2024-07-04 05:26:10 +00:00
STATUS="RISC-V GNU Toolchain"
2024-06-22 20:05:29 +00:00
cd "$RISCV"
2024-06-28 20:24:19 +00:00
if [[ ((! -e riscv-gnu-toolchain) && ($(git clone https://github.com/riscv/riscv-gnu-toolchain) || true)) || ($(cd riscv-gnu-toolchain; git fetch; git rev-parse HEAD) != $(cd riscv-gnu-toolchain; git rev-parse origin/master)) || (! -e $RISCV/riscv-gnu-toolchain/stamps/build-gcc-newlib-stage2) ]]; then
2024-06-29 07:29:01 +00:00
cd riscv-gnu-toolchain
2024-06-29 20:49:05 +00:00
git reset --hard && git clean -f && git checkout master && git pull
2024-06-29 07:29:01 +00:00
git pull
./configure --prefix="${RISCV}" --with-multilib-generator="rv32e-ilp32e--;rv32i-ilp32--;rv32im-ilp32--;rv32iac-ilp32--;rv32imac-ilp32--;rv32imafc-ilp32f--;rv32imafdc-ilp32d--;rv64i-lp64--;rv64ic-lp64--;rv64iac-lp64--;rv64imac-lp64--;rv64imafdc-lp64d--;rv64im-lp64--;"
make -j ${NUM_THREADS}
2024-06-30 22:48:28 +00:00
echo -e "${SUCCESS_COLOR}RISC-V GNU Toolchain successfully installed${ENDC}"
else
echo -e "${SUCCESS_COLOR}RISC-V GNU Toolchain already up to date${ENDC}"
2024-06-22 20:05:29 +00:00
fi
2024-07-04 06:42:31 +00:00
2024-06-22 20:05:29 +00:00
# elf2hex (https://github.com/sifive/elf2hex)
2024-07-04 06:42:31 +00:00
# The elf2hex utility to converts executable files into hexadecimal files for Verilog simulation.
2024-06-22 20:05:29 +00:00
# Note: The exe2hex utility that comes with Spike doesnt work for our purposes because it doesnt
# handle programs that start at 0x80000000. The SiFive version above is touchy to install.
# For example, if Python version 2.x is in your path, it wont install correctly.
# Also, be sure riscv64-unknown-elf-objcopy shows up in your path in $RISCV/riscv-gnu-toolchain/bin
# at the time of compilation, or elf2hex wont work properly.
2024-07-08 14:21:08 +00:00
section_header "Installing/Updating elf2hex"
2024-07-04 05:26:10 +00:00
STATUS="elf2hex"
2024-06-22 20:05:29 +00:00
cd "$RISCV"
export PATH=$RISCV/bin:$PATH
2024-06-28 20:24:19 +00:00
if [[ ((! -e elf2hex) && ($(git clone https://github.com/sifive/elf2hex.git) || true)) || ($(cd elf2hex; git fetch; git rev-parse HEAD) != $(cd elf2hex; git rev-parse origin/master)) || (! -e $RISCV/bin/riscv64-unknown-elf-elf2bin) ]]; then
2024-06-29 07:29:01 +00:00
cd elf2hex
git reset --hard && git clean -f && git checkout master && git pull
autoreconf -i
./configure --target=riscv64-unknown-elf --prefix="$RISCV"
make
make install
2024-06-30 22:48:28 +00:00
echo -e "${SUCCESS_COLOR}elf2hex successfully installed${ENDC}"
else
echo -e "${SUCCESS_COLOR}elf2hex already up to date${ENDC}"
2024-06-22 20:05:29 +00:00
fi
2024-07-04 06:42:31 +00:00
2024-06-22 20:05:29 +00:00
# QEMU (https://www.qemu.org/docs/master/system/target-riscv.html)
2024-07-04 06:42:31 +00:00
# QEMU is an open source machine emulator and virtualizer capable of emulating RISC-V
2024-07-08 14:21:08 +00:00
section_header "Installing/Updating QEMU"
2024-07-04 05:26:10 +00:00
STATUS="QEMU"
2024-06-22 20:05:29 +00:00
cd "$RISCV"
if [[ ((! -e qemu) && ($(git clone --recurse-submodules -j ${NUM_THREADS} https://github.com/qemu/qemu) || true)) || ($(cd qemu; git fetch; git rev-parse HEAD) != $(cd qemu; git rev-parse origin/master)) || (! -e $RISCV/include/qemu-plugin.h) ]]; then
2024-06-29 07:29:01 +00:00
cd qemu
git reset --hard && git clean -f && git checkout master && git pull --recurse-submodules -j ${NUM_THREADS}
2024-06-29 07:29:01 +00:00
./configure --target-list=riscv64-softmmu --prefix="$RISCV"
make -j ${NUM_THREADS}
make install
2024-06-30 22:48:28 +00:00
echo -e "${SUCCESS_COLOR}QEMU successfully installed${ENDC}"
else
echo -e "${SUCCESS_COLOR}QEMU already up to date${ENDC}"
2024-06-22 20:05:29 +00:00
fi
2024-07-04 06:42:31 +00:00
2024-06-22 20:05:29 +00:00
# Spike (https://github.com/riscv-software-src/riscv-isa-sim)
2024-07-04 06:42:31 +00:00
# Spike is a reference model for RISC-V. It is a functional simulator that can be used to run RISC-V programs.
2024-07-08 14:21:08 +00:00
section_header "Installing/Updating SPIKE"
2024-07-04 05:26:10 +00:00
STATUS="SPIKE"
2024-06-22 20:05:29 +00:00
cd "$RISCV"
2024-06-28 20:24:19 +00:00
if [[ ((! -e riscv-isa-sim) && ($(git clone https://github.com/riscv-software-src/riscv-isa-sim) || true)) || ($(cd riscv-isa-sim; git fetch; git rev-parse HEAD) != $(cd riscv-isa-sim; git rev-parse origin/master)) || (! -e $RISCV/lib/pkgconfig/riscv-riscv.pc) ]]; then
2024-06-29 07:29:01 +00:00
cd riscv-isa-sim
git reset --hard && git clean -f && git checkout master && git pull
mkdir -p build
cd build
../configure --prefix="$RISCV"
make -j ${NUM_THREADS}
make install
2024-06-30 22:48:28 +00:00
echo -e "${SUCCESS_COLOR}Spike successfully installed${ENDC}"
else
echo -e "${SUCCESS_COLOR}Spike already up to date${ENDC}"
2024-06-22 20:05:29 +00:00
fi
2024-07-04 06:42:31 +00:00
# Verilator (https://github.com/verilator/verilator)
# Verilator is a fast open-source Verilog simulator that compiles synthesizable Verilog code into C++ code.
# It is used for linting and simulation of Wally.
# Verilator needs to be built from source to get the latest version (Wally needs 5.021 or later).
2024-07-08 14:21:08 +00:00
section_header "Installing/Updating Verilator"
2024-07-04 05:26:10 +00:00
STATUS="Verilator"
2024-06-22 20:05:29 +00:00
cd "$RISCV"
2024-06-28 20:24:19 +00:00
if [[ ((! -e verilator) && ($(git clone https://github.com/verilator/verilator) || true)) || ($(cd verilator; git fetch; git rev-parse HEAD) != $(cd verilator; git rev-parse origin/master)) || (! -e $RISCV/share/pkgconfig/verilator.pc) ]]; then
2024-06-29 07:29:01 +00:00
unset VERILATOR_ROOT # For bash
cd verilator
git reset --hard && git clean -f && git checkout master && git pull
autoconf # Create ./configure script
./configure --prefix="$RISCV" # Configure and create Makefile
make -j ${NUM_THREADS} # Build Verilator itself (if error, try just 'make')
make install
2024-06-30 22:48:28 +00:00
echo -e "${SUCCESS_COLOR}Verilator successfully installed${ENDC}"
else
echo -e "${SUCCESS_COLOR}Verilator already up to date${ENDC}"
2024-06-22 20:05:29 +00:00
fi
2024-07-04 06:42:31 +00:00
2024-06-22 20:05:29 +00:00
cd "$RISCV"
if [ "$FAMILY" = rhel ]; then
2024-07-04 06:42:31 +00:00
# Install opam from binary disribution on rhel as it is not available from dnf
# Opam is needed to install the sail compiler
2024-07-08 14:21:08 +00:00
section_header "Installing/Updating Opam"
2024-07-04 05:26:10 +00:00
STATUS="Opam"
2024-06-29 07:29:01 +00:00
mkdir -p opam
cd opam
wget https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh
printf '%s\n' "$RISCV"/bin Y | sh install.sh # the print command provides $RISCV/bin as the installation path when prompted
cd "$RISCV"
rm -rf opam
2024-06-30 22:48:28 +00:00
echo -e "${SUCCESS_COLOR}Opam successfully installed/updated${ENDC}"
2024-06-22 20:05:29 +00:00
fi
2024-07-04 06:42:31 +00:00
# Sail Compiler (https://github.com/rems-project/sail)
# Sail is a formal specification language designed for describing the semantics of an ISA.
# It is used to generate the RISC-V Sail Model, which is the golden reference model for RISC-V.
# The Sail Compiler is written in OCaml, which is an object-oriented extension of ML, which in turn
# is a functional programming language suited to formal verification. The Sail compiler is installed
# with the opam OCaml package manager. It has so many dependencies that it can be difficult to install,
# but a binary release of it should be available soon, removing the need to use opam.
2024-07-08 14:21:08 +00:00
section_header "Installing/Updating Sail Compiler"
2024-07-04 05:26:10 +00:00
STATUS="Sail Compiler"
2024-07-08 13:50:29 +00:00
OPAMROOTISOK=1 # Silence warnings about running opam as root
2024-06-22 20:05:29 +00:00
cd "$RISCV"
opam init -y --disable-sandboxing
opam update -y
opam upgrade -y
opam switch create 5.1.0 || opam switch set 5.1.0
opam install sail -y
2024-06-30 22:48:28 +00:00
echo -e "${SUCCESS_COLOR}Sail Compiler successfully installed/updated${ENDC}"
2024-06-22 20:05:29 +00:00
2024-07-04 06:42:31 +00:00
# RISC-V Sail Model (https://github.com/riscv/sail-riscv)
# The RISC-V Sail Model is the golden reference model for RISC-V. It is written in Sail (described above)
2024-07-08 14:21:08 +00:00
section_header "Installing/Updating RISC-V Sail Model"
2024-07-04 05:26:10 +00:00
STATUS="RISC-V Sail Model"
2024-06-28 20:24:19 +00:00
if [[ ((! -e sail-riscv) && ($(git clone https://github.com/riscv/sail-riscv.git) || true)) || ($(cd sail-riscv; git fetch; git rev-parse HEAD) != $(cd sail-riscv; git rev-parse origin/master)) || (! -e $RISCV/bin/riscv_sim_RV32) ]]; then
2024-06-29 07:29:01 +00:00
eval $(opam config env)
cd sail-riscv
git reset --hard && git clean -f && git checkout master && git pull
export OPAMCLI=2.0 # Sail is not compatible with opam 2.1 as of 4/16/24
ARCH=RV64 make -j ${NUM_THREADS} c_emulator/riscv_sim_RV64
ARCH=RV32 make -j ${NUM_THREADS} c_emulator/riscv_sim_RV32
cd "$RISCV"
ln -sf ../sail-riscv/c_emulator/riscv_sim_RV64 bin/riscv_sim_RV64
ln -sf ../sail-riscv/c_emulator/riscv_sim_RV32 bin/riscv_sim_RV32
2024-06-30 22:48:28 +00:00
echo -e "${SUCCESS_COLOR}RISC-V Sail Model successfully installed${ENDC}"
else
echo -e "${SUCCESS_COLOR}RISC-V Sail Model already up to date${ENDC}"
2024-06-22 20:05:29 +00:00
fi
2024-07-04 06:42:31 +00:00
# RISCOF (https://github.com/riscv/riscof.git)
# RISCOF is a RISC-V compliance test framework that is used to run the RISC-V Arch Tests.
2024-07-08 14:21:08 +00:00
section_header "Installing/Updating RISCOF"
2024-07-04 05:26:10 +00:00
STATUS="RISCOF"
2024-06-22 20:05:29 +00:00
pip3 install git+https://github.com/riscv/riscof.git
2024-07-04 06:42:31 +00:00
# OSU Skywater 130 cell library (https://foss-eda-tools.googlesource.com/skywater-pdk/libs/sky130_osu_sc_t12)
# The OSU Skywater 130 cell library is a standard cell library that is used to synthesize Wally.
2024-07-08 14:21:08 +00:00
section_header "Installing/Updating OSU Skywater 130 cell library"
2024-07-04 05:26:10 +00:00
STATUS="OSU Skywater 130 cell library"
2024-06-22 20:05:29 +00:00
mkdir -p "$RISCV"/cad/lib
cd "$RISCV"/cad/lib
2024-06-28 20:24:19 +00:00
if [[ ((! -e sky130_osu_sc_t12) && ($(git clone https://foss-eda-tools.googlesource.com/skywater-pdk/libs/sky130_osu_sc_t12) || true)) || ($(cd sky130_osu_sc_t12; git fetch; git rev-parse HEAD) != $(cd sky130_osu_sc_t12; git rev-parse origin/main)) ]]; then
2024-06-29 07:29:01 +00:00
cd sky130_osu_sc_t12
git reset --hard && git clean -f && git checkout main && git pull
2024-06-30 22:48:28 +00:00
echo -e "${SUCCESS_COLOR}OSU Skywater library successfully installed${ENDC}"
else
echo -e "${SUCCESS_COLOR}OSU Skywater library already up to date${ENDC}"
2024-06-22 20:05:29 +00:00
fi
2024-07-04 06:42:31 +00:00
# Download site-setup scripts
# The site-setup script is used to set up the environment for the RISC-V tools and EDA tools by setting
# the PATH and other environment variables. It also sources the Python virtual environment.
2024-07-08 14:21:08 +00:00
section_header "Downloading Site Setup Script"
2024-07-04 05:26:10 +00:00
STATUS="site-setup scripts"
cd "$RISCV"
if [ ! -e "${RISCV}"/site-setup.sh ]; then
2024-06-29 07:29:01 +00:00
wget https://raw.githubusercontent.com/openhwgroup/cvw/main/site-setup.sh
wget https://raw.githubusercontent.com/openhwgroup/cvw/main/site-setup.csh
2024-07-04 06:42:31 +00:00
# Add necessary lines to site-setup script to activate newer version of gcc for older distros
2024-06-29 07:29:01 +00:00
if [ "$FAMILY" = rhel ]; then
2024-07-04 20:44:50 +00:00
echo "# Activate newer gcc version" >> site-setup.sh
2024-06-29 07:29:01 +00:00
echo "source /opt/rh/gcc-toolset-13/enable" >> site-setup.sh
elif [ "$UBUNTU_VERSION" = 20 ]; then
2024-07-04 20:44:50 +00:00
echo "# Activate newer gcc version" >> site-setup.sh
echo "export PATH=\$RISCV/gcc-10/bin:\$PATH" >> site-setup.sh
2024-07-04 20:44:50 +00:00
echo "# Activate newer gcc version" >> site-setup.csh
echo "prepend PATH \$RISCV/gcc-10/bin" >> site-setup.csh
2024-06-29 07:29:01 +00:00
fi
2024-06-30 22:48:28 +00:00
echo -e "${SUCCESS_COLOR}Site setup script successfully downloaded${ENDC}"
else
echo -e "${OK_COLOR}Site setup script already exists. Not checking for updates to avoid overwritng modifications${ENDC}"
fi
2024-06-30 22:48:28 +00:00
echo -e "${SUCCESS_COLOR}${BOLD}\n\nINSTALLATION SUCCESSFUL\n\n${ENDC}"