How to program FPGA from HPS (de10-nano)

Great!

I’ve been planning on getting to the device overlay method but just haven’t yet made the time. Below is a very sloppy cut-n-paste dump of a text file with some notes I’ve collected while briefly looking into it (rocketboards, etc). Maybe something here will be helpful as well.

Cheers!

----------- pasted below ------

Early IO release

====================================================
Programming from Linux using Device Tree Overlays

I solved the issue myself. The approach to use Device Trees and programming the
FPGA under Linux has changed fundamentally. There is no /dev/fpga0 device anymore.

Instead, Linux uses Device Tree Overlays now. See the WS2 Linux Kernel Introdution
lab for examples.

The Device Tree Overlay as well as the FPGA RBF file have to reside in /lib/firmware.
To load the overlay, mount the configfs filesystem and create a new directory in the overlay subfolder:

mkdir /config
mount -t configfs configfs /config
mkdir /config/device-tree/overlays/test

Then write the name of your Device Tree Overlay file to a file with name “path”:

echo overlay.dtb > /config/device-tree/overlays/test/path

The kernel driver will then look for the file in “/lib/firmware” and load it into the
default device tree, that came with the kernel.

If you want to load a RBF file into the FPGA, you have to replace external-fpga-config;
with firmware-name = “socfpga.rbf”; in the example overlay file from the WS2 lab.