# -*- org-export-babel-evaluate: nil -*-
#+title: pulpissimo installation guide
Note: the following instructions are adapted from this [[https://singularitykchen.github.io/blog/2020/12/20/Tutorial-Configure-and-Run-Pulpissimo/][blog]] and my experience with the installation
* table of contents :toc:
- [[#system-status][system status]]
- [[#pulp-riscv-toolchain][pulp-riscv-toolchain]]
- [[#pulpissimo][pulpissimo]]
- [[#pulp-runtime][pulp-runtime]]
- [[#pulp-runtime-from-pulpissimo][pulp-runtime from pulpissimo]]
- [[#pulp-sdk][pulp-sdk]]
- [[#pulp-sdk-from-pulpissimo][pulp-sdk from pulpissimo]]
- [[#rebuild-sdk][rebuild sdk]]
- [[#build-rtl-platform][build RTL platform]]
- [[#run-example][run example]]
- [[#waiting-rtl-development][WAITING rtl development]]
- [[#waiting-virtual-platform][WAITING virtual platform]]
- [[#errors-during-installation][errors during installation]]
- [[#error-1-issue-275][error 1: issue 275]]
- [[#error-2-issue-340][error 2: issue 340]]
- [[#error-3-issue-385][error 3: issue 385]]
- [[#settings-to-use-after-installation][settings to use after installation]]
* system status
os: Ubuntu 20.04.6 LTS
gcc: 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
questa sim: Questa Intel starter FPGA Edition-64 2021.2
* pulp-riscv-toolchain
#+url: https://github.com/pulp-platform/pulp-riscv-gnu-toolchain/
#+begin_src sh
git clone --recursive https://github.com/pulp-platform/pulp-riscv-gnu-toolchain
#+end_src
or, download latest releases from: https://github.com/pulp-platform/pulp-riscv-gnu-toolchain/releases/
*requirements*
#+begin_src sh
sudo apt-get install autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev
# change owner of /opt/riscv to from root to user to avoid further complications
sudo mkdir /opt/riscv
sudo chown -R $USER:$USER /opt/riscv
#+end_src
install _newlib cross-compiler for all pulp variants_
#+begin_src sh
cd pulp-riscv-gnu-toolchain
# config
./configure --prefix=/opt/riscv --with-arch=rv32imc --with-cmodel=medlow --enable-multilib
# make
make
# add path
export RISCV=/opt/riscv
export PULP_RISCV_GCC_TOOLCHAIN=$RISCV
export PATH=$PATH:$RISCV/bin
#+end_src
* pulpissimo
:PROPERTIES:
:CUSTOM_ID: 21Jun2023-144552572__pulpissimo
:END:
#+url: https://github.com/pulp-platform/pulpissimo
#+begin_src sh
git clone https://github.com/pulp-platform/pulpissimo.git
#+end_src
or download from latest release: https://github.com/pulp-platform/pulpissimo/releases
I have used the released version: v7.0.0
#+begin_src sh
wget https://github.com/pulp-platform/pulpissimo/archive/refs/tags/v7.0.0.tar.gz
mkdir pulpissimo
tar -xvzf v7.0.0.tar.gz -C pulpissimo --strip-components 1
#+end_src
#+begin_src sh
# export VSIM_PATH=<pulpissimo root folder>/sim
export VSIM_PATH=$HOME/pulpissimo/sim
#+end_src
*requirements*
#+begin_src sh
pip3 install --user artifactory twisted prettytable sqlalchemy pyelftools 'openpyxl==2.6.4' xlsxwriter pyyaml numpy configparser pyvcd sphinx
#+end_src
* pulp-runtime
#+url: https://github.com/pulp-platform/pulp-runtime/tree/master
*requirements*
#+begin_src sh
sudo apt install python3-pip gawk texinfo libgmp-dev libmpfr-dev libmpc-dev
sudo pip3 install pyelftools
#+end_src
*following not recommended, build from pulpissimo makefile*: [[#pulp-runtime-from-pulpissimo][pulp-runtime from pulpissimo]]
#+begin_src sh
git clone https://github.com/pulp-platform/pulp-runtime.git
#+end_src
or download from latest release: https://github.com/pulp-platform/pulp-runtime/releases
*build*
Choose the configuration for which you want to compile the runtime, for example:
#+begin_src sh
source configs/pulp.sh
#+end_src
* pulp-runtime from pulpissimo
:PROPERTIES:
:CUSTOM_ID: 21Jun2023-191547382__pulp-runtime-from-pulpissimo
:END:
from pulpissimo root directory
#+begin_src sh
cd $HOME/pulpissimo
make pulp-runtime
cd ./pulp-runtime
source configs/pulpissimo.sh
#+end_src
* pulp-sdk
#+url: https://github.com/pulp-platform/pulp-sdk
*new pulp-sdk do not support pulpissimo, better to clone/build from pulpissimo repository* commands, jump to [[#pulp-sdk-from-pulpissimo][pulp-sdk from pulpissimo]]
*requirements*
#+begin_src sh
sudo apt-get install -y build-essential git libftdi-dev libftdi1 doxygen python3-pip libsdl2-dev curl cmake libusb-1.0-0-dev scons gtkwave libsndfile1-dev rsync autoconf automake texinfo libtool pkg-config libsdl2-ttf-dev
pip install --user argcomplete pyelftools
#+end_src
*download*
#+begin_src sh
git clone https://github.com/pulp-platform/pulp-sdk.git
#+end_src
or, download latest releases from: https://github.com/pulp-platform/pulp-sdk/releases
*build gvsoc*
#+begin_src sh
cd pulp-sdk
# Source the file corresponding to the desired configuration:
source configs/pulp-open.sh
make build
#+end_src
* pulp-sdk from pulpissimo
:PROPERTIES:
:CUSTOM_ID: 21Jun2023-210945860__pulp-sdk-from-pulpissimo
:END:
*build pulp-sdk*
#+begin_src sh
cd $HOME/pulpissimo
make build-pulp-sdk
source ./env/pulpissimo.sh
#+end_src
* rebuild sdk
:PROPERTIES:
:CUSTOM_ID: 21Jun2023-213048519__rebuild-sdk
:END:
only when required, not required for the installation
#+begin_src sh
cd $HOME/pulpissimo/pulp-sdk
make all
#+end_src
* build RTL platform
#+begin_src sh
cd $HOME/pulpissimo
# build rtl simulation
make checkout
# questasim/modelsim should be installed with 'vlib' command available
source setup/vsim.sh
make build
#+end_src
* run example
clone outside of 'pulpissimo' directory
*for the sdk*:
#+begin_src sh
git clone https://github.com/pulp-platform/pulp-rt-examples.git
#+end_src
=prepare the enviroment= in the *pulpissimo* root directory:
/do not why load both ~pulp-runtime~ and ~pulp-sdk~/
#+begin_src sh
# at the root directory of Pulpissimo
cd $HOME/pulpissimo
source ./pulp-runtime/configs/pulpissimo.sh
source ./env/pulpissimo.sh
source ./pulp-sdk/configs/pulpissimo.sh
#+end_src
if you get the following line then [[#rebuild-sdk][rebuild sdk]]
#+begin_example
bash: /pulpissimo/pulp-sdk/sourceme.sh: No such file or directory
#+end_example
#+begin_src sh
cd pulp-rt-examples/hello
# terminal output
make clean all run
# following commands not tested yet
# see waveform
make clean all
make run vsim/script=export_run.tcl
# for gui
make run gui=1
# save vcd file
make run vsim/script=export_run.tcl
#+end_src
*for the simple runtime*:
#+begin_src sh
git clone https://github.com/pulp-platform/pulp-runtime-examples.git
cd pulp-runtime-examples/hello
make clean all run
#+end_src
* WAITING rtl development
if rtl changed, rebuild again, after that execute the example to test
#+begin_src sh
cd pulpissimo
./generate-scripts
make clean build
#+end_src
* WAITING virtual platform
/not yet tested/
#+begin_src sh
source sourceme.sh
source configs/platform-gvsoc.sh
#+end_src
* errors during installation
** error 1: issue [[https://github.com/pulp-platform/pulpissimo/issues/275#issuecomment-934397013][275]]
=* Error (suppressible): (vopt-14401) Option specified: +acc=mnpr. Following acc options are now deprecated 'f' 'm' 'q' 't' 'x' 'y'.=
*solution*:
edit file: ~pulpissimo/sim/tcl_files/rtl_vopt.tcl~
replace: ~vopt +acc=mnpr~ to ~vopt +acc~ in *line 28 and 30*
** error 2: issue [[https://github.com/pulp-platform/pulpissimo/issues/340#issuecomment-1125981693][340]]
the ~floatparams~ flag is set on *line: 28* of ~pulpissimo/sim/tcl_files/rtl_vopt.tcl~
the answer mentions that removing the option may cause =crushing= the simulators and also break some testbench stuff, *so be aware of that*.
after fixing error 1 and 2, line: 28 will be:
#+begin_src sh
eval exec >@stdout vopt +acc -o vopt_tb tb_pulp $VSIM_IP_LIBS $VSIM_RTL_LIBS -work work
#+end_src
** error 3: issue [[https://github.com/pulp-platform/pulpissimo/issues/385][385]]
=GLIBCXX 3.4.XX not found in conda environment=
the error report may not match, I do not have the screenshot at the moment
*solution*:[[https://askubuntu.com/questions/1418016/glibcxx-3-4-30-not-found-in-conda-environment][followed from the link]]
- check if the required version is already in your system, (in my case it was)
- after that execute in the terminal:
~ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /home/<usrname>/anaconda3/lib/libstdc++.so.6~
* settings to use after installation
*export the following paths* or put it in ~.bashrc~ file
#+begin_src sh
export RISCV=/opt/riscv
export PULP_RISCV_GCC_TOOLCHAIN=$RISCV
export PATH=$PATH:$RISCV/bin
export VSIM_PATH=$HOME/pulpissimo/sim
#+end_src
*source the target for simulation*
#+begin_src sh
cd $HOME/pulpissimo/pulp-sdk
# Target select
source configs/pulpissimo.sh
# Platform select: env/pulpissimo loads it
# source configs/platform-rtl.sh
# SDK setup
source pkg/sdk/dev/sourceme.sh
# RTL setup
cd $HOME/pulpissimo
# source setup/vsim.sh
# better load more things
source env/pulpissimo.sh
# in case required
source ./pulp-runtime/configs/pulpissimo.sh
#+end_src