-
Notifications
You must be signed in to change notification settings - Fork 5
/
install_picorv32_riscv32i.sh
executable file
·54 lines (43 loc) · 2.25 KB
/
install_picorv32_riscv32i.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
#"***************************************************************************************************"
# common initialization
#"***************************************************************************************************"
# select master or some GitHub hash version, and whether or not to force a clean
THIS_CHECKOUT=master
THIS_CLEAN=true
# perform some version control checks on this file
./gitcheck.sh $0
# initialize some environment variables and perform some sanity checks
. ./init.sh
# we don't want tee to capture exit codes
set -o pipefail
#"***************************************************************************************************"
# check for valid riscv32 compiler
#"***************************************************************************************************"
/opt/riscv32i/bin/riscv32-unknown-elf-gcc --version > /dev/null
$SAVED_CURRENT_PATH/check_for_error.sh $? "$THIS_LOG"
# TODO if already installed, prompt user
pushd .
cd "$WORKSPACE"
echo "***************************************************************************************************"
echo " picorv32. Saving log to $THIS_LOG"
echo "***************************************************************************************************"
if [ ! -d "$WORKSPACE"/picorv32 ]; then
git clone --recursive https://github.com/cliffordwolf/picorv32.git 2>&1 | tee -a "$THIS_LOG"
$SAVED_CURRENT_PATH/check_for_error.sh $? "$THIS_LOG"
cd "$WORKSPACE"/picorv32
else
cd "$WORKSPACE"/picorv32
git fetch 2>&1 | tee -a "$THIS_LOG"
git pull 2>&1 | tee -a "$THIS_LOG"
$SAVED_CURRENT_PATH/check_for_error.sh $? "$THIS_LOG"
fi
# we are still in "$WORKSPACE"/picorv32
# download tools. We can run this multiple times. the tools won't be blindly re-downloaded
make download-tools
$SAVED_CURRENT_PATH/check_for_error.sh $? "$THIS_LOG"
# install *all four* riscv flavor toolchains:
# make -j$(nproc) build-tools
popd
echo "Completed $0 " | tee -a "$THIS_LOG"
echo "----------------------------------"