PULP Toolchain and SDK

PULP Toolchain installation

Ubuntu version: 22.04.4

Open new terminal to create new directory:

cd
cd /opt
sudo mkdir riscv_pulp
cd riscv_pulp
sudo mkdir bin

Setup path:

nano ~/.profile

Add

if [ -d "/opt/riscv_pulp" ] ; then
    PATH="/opt/riscv_pulp:$PATH"
fi

Invoke command below to take effect

source ~/.profile

Open new terminal to install toolchain:

Prerequisite

sudo apt-get update

sudo apt-get upgrade

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

Follow these steps to install toolchain:

git clone https://github.com/pulp-platform/pulp-riscv-gnu-toolchain

cd pulp-riscv-gnu-toolchain

Then update submodule

git submodule update --init --recursive

Because /opt/riscv/bin is in root, so must use sudo when make

./configure --prefix=/opt/riscv_pulp --with-arch=rv32imc --with-cmodel=medlow --enable-multilib

sudo make

PULP SDK installation

Open new terminal to install pulp-sdk

Prerequisite

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

Follow these steps:

pip install argcomplete pyelftools

pip install prettytable

Clone pulp SDK :

git clone https://github.com/pulp-platform/pulp-sdk.git

cd pulp-sdk

Then update submodule

git submodule update --init --recursive

Edit file pulp-sdk/configs/pulp-open.sh, put the command below under line 32

export PULP_RISCV_GCC_TOOLCHAIN=/opt/riscv_pulp

Build gvsoc

source configs/pulp-open.sh

make build

Note

Always run command source configs/pulp-open.sh to select board before running or doing anything in pulp-sdk directory

First simple test

Select board and then go to project

cd pulp-sdk

source configs/pulp-open.sh

cd tests/hello

Build project

make clean all run

The last line appear with Hello from FC without any error then you success.

../../_images/expulpsdk.png

Follow the command below to have gtkwave

make clean all run runner_args="--vcd"

This time view.gtkw with appear in project, as long as all.vcd in BUILD/PULP/GCC_RISCV folder.

../../_images/gtkwaveex.png

Run the code below to see wave

gtkwave /home/ryan/pulp-sdk/tests/hello/BUILD/PULP/GCC_RISCV/all.vcd /home/ryan/pulp-sdk/tests/hello/view.gtkw
../../_images/wave.png

Tip

To run other project outside pulp-sdk, just move project folder to path pulp-sdk/tests/ and then run.

Riscv GNU toolchain

Ubuntu version: 22.04.4

Open new terminal to create new directory:

cd
cd /opt
sudo mkdir riscv_gnu
cd riscv_gnu
sudo mkdir bin

Setup path:

nano ~/.profile

Add

if [ -d "/opt/riscv_gnu" ] ; then
    PATH="/opt/riscv_gnu:$PATH"
fi

Invoke command below to take effect

source ~/.profile

Open new terminal to install toolchain:

Prerequisite

sudo apt-get install autoconf automake autotools-dev curl python3 libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev

Follow these step to install:

git clone https://github.com/pulp-platform/riscv-gnu-toolchain.git

cd riscv-gnu-toolchain

Then update submodule

git submodule update --init --recursive

Because /opt/riscv_gnu/bin is in root, so must use sudo when make

./configure --prefix=/opt/riscv_gnu --with-arch=rv32imfcxpulpv3 --with-abi=ilp32 --enable-multilib

sudo make

References

[1]. Installation of pulp toolchain

[2]. Installation of pulp sdk

[3]. Installation of riscv gnu toolchain