RED-V Development Guide

Pages
Contributors: bboyho, Englandsaurus
Favorited Favorite 3

Software Installation (Zephyr RTOS)

Troubleshooting Tip: The Zephyr RTOS has been tested to work with Linux (Ubuntu v18.04.3, 64-bit) . You are free to follow the open source guides to use the OS of your choice, but our technical knowledge is limited to the content of this tutorial.

Again, there are a handful of development environments out there that are compatible with the RED-V but for the scope of this tutorial, we're going to be checking out Freedom Studio and Zephyr RTOS. Both development environments have a decent assembly of example code to help get you up and learning RISC-V. Let's check out the Zephyr RTOS software.

Installing Python

The next method to get started is using Zephyr RTOS. We've had the best luck using Zephyr on Linux-based operating systems, so we'd recommend using your favorite Linux distro. From there, we want to make sure we have Python 3 and pip installed, so run the following commands.

language:bash
sudo apt-get install python3
sudo apt-get install python3-dev python python3-pip
sudo pip3 install ipython
sudo pip3 install numpy
sudo pip3 install pyelftools

Installing CMake and Ninja

We'll need quite a few things like CMake and Ninja to compile things, so run the below code to get all of your dependencies set up.

language:bash
sudo apt-get install --no-install-recommends git cmake ninja-build gperf \
ccache dfu-util device-tree-compiler wget \
python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \
make gcc gcc-multilib

We'll also need to update CMake on our system, go ahead and download the package here. We used version 3.15.4 on Ubuntu v18.04.3 when writing this tutorial.

Run the below commands to extract, make, and install it.

language:bash
cd ~/Downloads
tar xvzf cmake-3.15.4.tar.gz
cd cmake-3.15.4
./configure
make
sudo make install

Installing West and Zephyr RTOS

Zephyr uses a tool called west to build code for and flash the RED-V, we'll want to install this as root to avoid any permissions issues. We used version 0.6.3 on Ubuntu v18.04.3 when writing this tutorial.

language:bash
sudo pip3 install west

We'll then want to create and initialize our west project, to do this, run the following.

language:bash
west init zephyrproject
cd zephyrproject
west update
sudo pip3 install -r zephyr/scripts/requirements.txt

We'll need the Zephyr SDK as well as this is where all of our toolchains are bundled. Grab it from GitHub and install it in your home directory. If you'd like to install a different version of the SDK, simply change the version number everywhere it shows up.

language:bash
cd ~/
wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.10.3/zephyr-sdk-0.10.3-setup.run
chmod +x zephyr-sdk-0.10.3-setup.run
./zephyr-sdk-0.10.3-setup.run -- -d ~/zephyr-sdk-0.10.3
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR=$HOME/zephyr-sdk-0.10.3

We'll also need to update our device tree compiler, follow the link below to find an appropriate download.

Run the commands below to install the new DTC.

language:bash
cd ~/Downloads
sudo apt install ./device-tree-compiler_1.4.7-1_amd64.deb