From d4d9fa1ff6cdc3d3d5891a76076923b1c9ecb3dc Mon Sep 17 00:00:00 2001 From: David Harris Date: Wed, 10 May 2023 08:23:55 -0700 Subject: [PATCH] wally installation improvements: latest main branch of riscv-arch-test, updated install script --- addins/riscv-arch-test | 2 +- bin/wally-tool-chain-install.sh | 38 ++++++++++++++++++--------------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/addins/riscv-arch-test b/addins/riscv-arch-test index a3b7f0c2..873d16e7 160000 --- a/addins/riscv-arch-test +++ b/addins/riscv-arch-test @@ -1 +1 @@ -Subproject commit a3b7f0c2cf89652b8a0cba3146890c512ff8ba44 +Subproject commit 873d16e748ad60023dcdda3926144957c096e31d diff --git a/bin/wally-tool-chain-install.sh b/bin/wally-tool-chain-install.sh index ae84411a..2eddc136 100755 --- a/bin/wally-tool-chain-install.sh +++ b/bin/wally-tool-chain-install.sh @@ -29,7 +29,7 @@ # Use /opt/riscv for installation - may require running script with sudo export RISCV="${1:-/opt/riscv}" -export PATH=$PATH:$RISCV/bin +export PATH=$PATH:$RISCV/bin:/usr/bin set -e # break on error @@ -40,19 +40,20 @@ NUM_THREADS=8 # for >= 32GiB #NUM_THREADS=16 # for >= 64GiB sudo mkdir -p $RISCV +# *** need to update permissions to local user # Update and Upgrade tools (see https://itsfoss.com/apt-update-vs-upgrade/) -apt update -y -apt upgrade -y -apt install -y git gawk make texinfo bison flex build-essential python3 libz-dev libexpat-dev autoconf device-tree-compiler ninja-build libpixman-1-dev ncurses-base ncurses-bin libncurses5-dev dialog curl wget ftp libgmp-dev libglib2.0-dev python3-pip pkg-config opam z3 zlib1g-dev verilator automake autotools-dev libmpc-dev libmpfr-dev gperf libtool patchutils bc +sudo apt update -y +sudo apt upgrade -y +sudo apt install -y git gawk make texinfo bison flex build-essential python3 libz-dev libexpat-dev autoconf device-tree-compiler ninja-build libpixman-1-dev ncurses-base ncurses-bin libncurses5-dev dialog curl wget ftp libgmp-dev libglib2.0-dev python3-pip pkg-config opam z3 zlib1g-dev verilator automake autotools-dev libmpc-dev libmpfr-dev gperf libtool patchutils bc # Other python libraries used through the book. -pip3 install matplotlib scipy scikit-learn adjustText lief +sudo pip3 install matplotlib scipy scikit-learn adjustText lief # needed for Ubuntu 22.04, gcc cross compiler expects python not python2 or python3. if ! command -v python &> /dev/null then echo "WARNING: python3 was installed as python3 rather than python. Creating symlink." - ln -sf /usr/bin/python3 /usr/bin/python + sudo ln -sf /usr/bin/python3 /usr/bin/python fi # gcc cross-compiler (https://github.com/riscv-collab/riscv-gnu-toolchain) @@ -67,11 +68,12 @@ fi cd $RISCV git clone https://github.com/riscv/riscv-gnu-toolchain cd riscv-gnu-toolchain -git checkout 2023.01.31 #for 12.2.0; 2023.04.29 for 13.1 -#./configure --prefix=${RISCV} -./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--;" +#git checkout 2023.01.31 #for 12.2.0; 2023.04.29 for 13.1 +# Temporarily use the following commands until gcc-13 is part of riscv-gnu-toolchain (issue #1249) +git clone https://github.com/gcc-mirror/gcc -b releases/gcc-13 gcc-13 +./configure --prefix=/opt/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--;" --with-gcc-src=`pwd`/gcc-13 +#./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} -#make install # is this necessary # elf2hex (https://github.com/sifive/elf2hex) #The elf2hex utility to converts executable files into hexadecimal files for Verilog simulation. @@ -131,8 +133,9 @@ sed -i 's/--isa=rv64ic/--isa=rv64iac/' rv64i_m/privilege/Makefile.include #pip3 install chardet==3.0.4 #pip3 install urllib3==1.22 +cd $RISCV opam init -y --disable-sandboxing -opam switch create ocaml-base-compiler.4.06.1 +opam switch create ocaml-base-compiler.4.08.0 opam install sail -y eval $(opam config env) @@ -140,13 +143,14 @@ git clone https://github.com/riscv/sail-riscv.git cd sail-riscv # Current bug in Sail - use hash that works for Wally # (may remove later if Sail is ever fixed) -git checkout 4d05aa1698a0003a4f6f99e1380c743711c32052 +#git checkout 4d05aa1698a0003a4f6f99e1380c743711c32052 make -j ${NUM_THREADS} ARCH=RV32 make -j ${NUM_THREADS} -ARCH=RV64 make -j ${NUM_THREADS} -ln -sf $RISCV/sail-riscv/c_emulator/riscv_sim_RV64 /usr/bin/riscv_sim_RV64 -ln -sf $RISCV/sail-riscv/c_emulator/riscv_sim_RV32 /usr/bin/riscv_sim_RV32 +# next line seems redundant +#ARCH=RV64 make -j ${NUM_THREADS} +sudo ln -sf $RISCV/sail-riscv/c_emulator/riscv_sim_RV64 /usr/bin/riscv_sim_RV64 +sudo ln -sf $RISCV/sail-riscv/c_emulator/riscv_sim_RV32 /usr/bin/riscv_sim_RV32 -pip3 install testresources -pip3 install riscof --ignore-installed PyYAML +sudo pip3 install testresources +pip3 install git+https://github.com/riscv/riscof.git