Lab 03: Software app for a SoC with LiTeX

Objectives

  1. Develop a software baremetal app

  2. Deploy and test your software in a simulation environment

Prerequisites

Firstly we will configure the environnement for the lab.

LiteX installation and setup has been done in a Python virtual environment, so activate it:

source venv/pyenv-litex/bin/activate

To generate the software you need a software toolchain. For LiteX to use the toolchain you have to configure it:

export PATH="INSTALL-PATH/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14/bin:$PATH"

All the materials for the lab are available in the following folder:

cd hands-on/lab03

Baremetal app

To create a baremetal app a good starting point is to use the demo app provided in LiteX.

cp -r ../third_party/litex/litex/soc/software/demo myapp

Look at the main.c file and try to add your own function in the menu that will display “Awesome Winter School 2022!”.

Finally test your programm in Verilator:

make soc_sim_gateware
make soc_sim_myapp
make soc_sim_myapp_run

Take aways

There is existing project with Linux and RTOS (Zephyr, Tock OS):