Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
Need Forum Guidance? Click here

Search our FPGA Knowledge Articles here.
19197 Discussions

Loading rbf file on boot from within Linux...

Honored Contributor II

For both support & feature enhancement reasons, for us it is desirable to be able to load a new rbf configuration into the FPGA when booting Linux. A reboot to implement the change is fine. 


The target hardware is unavailable hence removing the SD card & replacing the rbf is not an option. 


The good news is that with the Yocto releases with the 3.12 kernel, the rbf file is loaded in exactly the way I'd like: on boot - the target rbf file is in /home/root called DE1_SoC_Computer.rbf and it is loaded by /etc/init.d/programfpga which contains the following: 

#!/bin/sh echo 0 > /sys/class/fpga-bridge/hps2fpga/enable echo 0 > /sys/class/fpga-bridge/fpga2hps/enable echo 0 > /sys/class/fpga-bridge/lwhps2fpga/enable dd if=/home/root/DE1_SoC_Computer.rbf of=/dev/fpga0 bs=1M echo 1 > /sys/class/fpga-bridge/hps2fpga/enable echo 1 > /sys/class/fpga-bridge/fpga2hps/enable echo 1 > /sys/class/fpga-bridge/lwhps2fpga/enable 


This is well documented in the Altera guide 'using linux on the de1-soc'. 




Except we are using one of the Ubuntu releases with the later kernel and no GUI. 

The files listed above don't exist, neither do the contents of /home/root including the corresponding .rbf file or the script /etc/init.d/programfpga. Under Yocto, the /sys/class/fpga* files are: 

root@de1soclinux:~# ls /sys/class/fpga* /sys/class/fpga: fpga0 /sys/class/fpga-bridge: fpga2hps hps2fpga lwhps2fpga root@de1soclinux:~# ls -R /sys/class/fpga* /sys/class/fpga: fpga0 /sys/class/fpga-bridge: fpga2hps hps2fpga lwhps2fpga 


I can't see/can't find any reference on how to do this under Ubuntu - and what the corresponding MSEL switches should be (mine are currently set to '00000'). 


Under Ubuntu, the /sys/class files are: 

root@DE1_SoC:~# ls -R /sys/class/fpga* /sys/class/fpga_bridge: br0 br1 br2 br3 /sys/class/fpga_manager: fpga0 /sys/class/fpga_region: region0 


For reasonable operational requirements this is a Most Useful Feature. I'd be very grateful if someone who knows how to do this under Linux Ubuntu Desktop with the 4.5 kernel will give me an good walk through please. 


Thank you very much in advance.
0 Kudos
0 Replies