Skip to content

Development with Terasic DE1-SoC

|

As a part of the YellowPirat project, we were using the Terasic DE1-SoC board for the development of the project. In this guide, you will find how we have configured the development environment for the board.

Prerequisites

  • Debian Linux
  • Quartus 23.1
  • GHDL and GTKWave

Debian Linux

It is recommended to use Debian Linux for the development of the project as the tools are tested on Debian and you might face issues on other distributions. There is two different ways to achieve this:

VM/Bare Metal

  1. Install Debian on a VM or on a bare metal machine. The ISO can be downloaded from the official Debian website.
  2. After installation, proceed with the next steps.

Distrobox

If you are already using a Linux as your main OS, you can use Distrobox to create a Debian container. The Distrobox makes it easy to integrate GUI applications with the host OS. It also tightly integrates the container with the host OS. You can find the installation instructions on the official Distrobox website. Here is a quick guide for Arch Linux.

  1. Configure a containerization system like Podman or Docker.

  2. Install Distrobox.

    Terminal window
    sudo pacman -S distrobox
  3. Create a new container.

    Terminal window
    distrobox create --image debian:12.6 -n YellowPirat --nvidia
  4. Enter the container.

    Terminal window
    distrobox enter YellowPirat
  5. Install necessary packages for container.

    Terminal window
    sudo apt update
    sudo apt upgrade -y
    sudo apt install nano git dbus-x11 policykit-1 fonts-dejavu-core alsa-utils libxft2 libxext6 libxrender1 libsm6 libxi6 libxtst6 libgtk-3-0 libqt5widgets5

Now you should have a Debian container ready to use. You can enter the container by running distrobox enter YellowPirat and exit simply by running exit.

Install Required Packages

After you have installed Debian we need to install some packages in order to work with the board. These can be installed by running the fallowing command.

Terminal window
sudo apt install ghdl gtkwave gcc-arm-linux-gnueabihf bison flex libssl-dev bc linux-source-6.1 debootstrap binfmt-support qemu-user-static
sudo update-binfmts --enable qemu-arm

Quartus 23.1

Quartus is the software used to program the FPGA on the board. You can install it like this:

  1. Add the repository.

    Terminal window
    echo "deb [arch=i386,amd64 trusted=yes lang=none] http://www.tha.de/homes/beckmanf/public/repository ./" | sudo tee /etc/apt/sources.list.d/quartus.list
  2. Update the package list.

    Terminal window
    sudo apt update
  3. Install Quartus.

    Terminal window
    sudo apt install quartus23
  4. Add the Quartus to the path.

    Terminal window
    echo "export PATH=$PATH:/opt/altera/23.1/quartus/bin" >> ~/.bashrc
    source ~/.bashrc

Quartus should be installed and ready to use. You can start it by running quartus in the terminal.

GHDL and GTKWave

GHDL and GTKWave are used to simulate the VHDL code. These can be installed like so:

Terminal window
sudo apt install ghdl gtkwave

Setup Development Environment

Now that you have installed all the necessary tools, we can start setting up the necessary bits to be able to develop for the board.

First, we need to clone the repository that contains the necessary scripts and files to work with the board.

Terminal window
git clone --recurse-submodules https://github.com/fredowski/dtsoc.git

Navigate to the directory of the repository.

Terminal window
cd dtsoc

Now, we need to set up the environment variables. You can do this by sourcing the activate.sh script.

Terminal window
source activate.sh

Quartus Project

To create a Quartus project, fallowing commands can be used.

Terminal window
make qip
make qpf
make compile
make rbf

You can now open the Quartus project by running quartus de1_soc_top.qpf.

Linux Kernel

The Linux kernel can be compiled by running the fallowing commands.

Terminal window
make kernel
make rootfs

There is two ways to flash the Linux kernel to the board, using the SD Card with U-Boot or programming it directly through USB Blaster.

SD Card with U-Boot

Start by building the U-Boot.

Terminal window
make u-boot

We can now format the SD Card and write the bootloader and kernel to it.

Terminal window
./format_sdcard.sh /dev/sdX
make sdcard

USB Blaster

This method is the default setup. You can Flash the kernel to the board through Quartus.

See also