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
- Install Debian on a VM or on a bare metal machine. The ISO can be downloaded from the official Debian website.
- 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.
-
Install Distrobox.
Terminal window sudo pacman -S distrobox -
Create a new container.
Terminal window distrobox create --image debian:12.6 -n YellowPirat --nvidia -
Enter the container.
Terminal window distrobox enter YellowPirat -
Install necessary packages for container.
Terminal window sudo apt updatesudo apt upgrade -ysudo 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.
sudo apt install ghdl gtkwave gcc-arm-linux-gnueabihf bison flex libssl-dev bc linux-source-6.1 debootstrap binfmt-support qemu-user-staticsudo 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:
-
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 -
Update the package list.
Terminal window sudo apt update -
Install Quartus.
Terminal window sudo apt install quartus23 -
Add the Quartus to the path.
Terminal window echo "export PATH=$PATH:/opt/altera/23.1/quartus/bin" >> ~/.bashrcsource ~/.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:
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.
git clone --recurse-submodules https://github.com/fredowski/dtsoc.git
Navigate to the directory of the repository.
cd dtsoc
Now, we need to set up the environment variables. You can do this by sourcing the activate.sh
script.
source activate.sh
Quartus Project
To create a Quartus project, fallowing commands can be used.
make qipmake qpfmake compilemake 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.
make kernelmake 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.
make u-boot
We can now format the SD Card and write the bootloader and kernel to it.
./format_sdcard.sh /dev/sdXmake sdcard
USB Blaster
This method is the default setup. You can Flash the kernel to the board through Quartus.