From 6ccb3defc147f8bf604b981c5eefb5b4c7f9ae22 Mon Sep 17 00:00:00 2001 From: alonamid Date: Fri, 8 Mar 2019 11:08:11 -0800 Subject: [PATCH] add toolchains --- .gitmodules | 6 ++++++ README.md | 4 ++++ build.sh | 19 +++++++++++++++++++ scripts/build-toolchains.sh | 37 +++++++++++++++++++++++++++++++++++++ toolchains/esp-tools | 1 + toolchains/riscv-tools | 1 + 6 files changed, 68 insertions(+) create mode 100644 build.sh create mode 100755 scripts/build-toolchains.sh create mode 160000 toolchains/esp-tools create mode 160000 toolchains/riscv-tools diff --git a/.gitmodules b/.gitmodules index 7b062654..72203f96 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,9 @@ [submodule "tools/firrtl"] path = tools/firrtl url = https://github.com/freechipsproject/firrtl +[submodule "riscv-tools"] + path = toolchains/riscv-tools + url = https://github.com/riscv/riscv-tools.git +[submodule "esp-tools"] + path = toolchains/esp-tools + url = https://github.com/ucb-bar/esp-tools.git diff --git a/README.md b/README.md index 53d1ab70..8f07c855 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # RISC-V Project Template +**THIS BRANCH IS UNDER DEVELOPMENT** +**IT CURRENTLY HAS MANY SUBMODULES** +**PLEASE RUN ./build.sh TO UPDATE SUBMODULES, UNLESS YOU WANT TO SPEND A LONG TIME WAITING FOR SUBMODULE TO CLONE** + This is a starter template for your custom RISC-V project. It will allow you to leverage the Chisel HDL and RocketChip SoC generator to produce a RISC-V SoC with MMIO-mapped peripherals, DMA, and custom accelerators. diff --git a/build.sh b/build.sh new file mode 100644 index 00000000..27005cbb --- /dev/null +++ b/build.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# exit script if any command fails +set -e +set -o pipefail + +unamestr=$(uname) +RDIR=$(pwd) + +# ignore riscv-tools for submodule init recursive +# you must do this globally (otherwise riscv-tools deep +# in the submodule tree will get pulled anyway +git config --global submodule.riscv-tools.update none +git config --global submodule.esp-tools.update none +git config --global submodule.experimental-blocks.update none +git submodule update --init --recursive #--jobs 8 +# unignore riscv-tools,catapult-shell2 globally +git config --global --unset submodule.riscv-tools.update +git config --global --unset submodule.experimental-blocks.update diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh new file mode 100755 index 00000000..ddf9b462 --- /dev/null +++ b/scripts/build-toolchains.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +# exit script if any command fails +set -e +set -o pipefail + +unamestr=$(uname) +RDIR=$(pwd) + +if [ $# -ne 0 ]; then + TOOLCHAIN=$1 + if [ $1 == "riscv" ]; then + TOOLCHAIN="riscv-tools" + elif [ $1 == "hwacha" ]; then + TOOLCHAIN="esp-tools" + fi +else + TOOLCHAIN="riscv-tools" +fi + +INSTALL_DIR="$TOOLCHAIN-install" +mkdir -p "$(pwd)/$INSTALL_DIR" + +RISCV="$(pwd)/$INSTALL_DIR" + +# install risc-v tools +export RISCV="$RISCV" +git submodule update --init --recursive toolchains/$TOOLCHAIN #--jobs 8 +cd "toolchains/$TOOLCHAIN" +export MAKEFLAGS="-j16" +./build.sh +cd $RDIR + +echo "export RISCV=$RISCV" > env.sh +echo "export PATH=$RISCV/bin:$RDIR/$DTCversion:\$PATH" >> env.sh +echo "export LD_LIBRARY_PATH=$RISCV/lib" >> env.sh +echo "Toolchain Build Complete!" diff --git a/toolchains/esp-tools b/toolchains/esp-tools new file mode 160000 index 00000000..f2e562c0 --- /dev/null +++ b/toolchains/esp-tools @@ -0,0 +1 @@ +Subproject commit f2e562c0f9089746c6beb15f04b00fbb48f2e9ae diff --git a/toolchains/riscv-tools b/toolchains/riscv-tools new file mode 160000 index 00000000..962bc098 --- /dev/null +++ b/toolchains/riscv-tools @@ -0,0 +1 @@ +Subproject commit 962bc09873071aa7816d5f805c6e5797a3b5bcf7