FPGA DE1-SoC Cyclone V Overlay Device Tree

1

I am trying to set the overlay device tree on Terasic Ubuntu 16.0 Desktop SD Card for programming the FPGA of DE1-SoC Cyclone V Terasic with MSEL to 00000 I have use the device tree sources socfpga_cyclone5_socdk.dts, socfpga_cyclone5_ghrd.dtsi, socfpga_cyclone5.dtsi, socfpga.dtsi from repository : kernel arm tree There isn’t a problem with the static or base device tree soc_system.dtb located on the boot partition of the SD card. I can see the device-tree after boot on /proc/device-tree/soc/. In socfpga_cyclone5_ghrd.dtsi file I have uncomment bridges nodes. This is the element add to node soc in socfpga.dtsi:

base_fpga_region: base-fpga-region {
         compatible = "fpga-region";
         fpga-mgr = <&fpga_mgr0>;
         fpga-bridges = <&fpga_bridge0>, <&fpga_bridge1>,
               <&fpga_bridge2>, <&fpga_bridge3>;

         #address-cells = <0x1>;
         #size-cells = <0x1>;
         ranges = <0x00000000 0x00000000 0xc0000000 0x20000000>,
            <0x00000001 0x00000000 0xff200000 0x00200000>;
    };

I have compiled socfpga_cyclone5_socdk.dts with dtc command and copy the blob file socfpga_cyclone5_socdk.dtb on boot partition of the SDCard.

The edition of the overlay device tree source de1soc.dts with the name de1soc.rbf of fpga image :

/dts-v1/;
/plugin/;
/ {
 fragment@0 {
    target-path = "/soc/base-fpga-region";
    #address-cells = <1>;
    #size-cells = <1>;
    __overlay__ {
       #address-cells = <1>;
       #size-cells = <1>;

       firmware-name = "de1soc.rbf";
       config-complete-timeout-us = <30000000>;
       };
    };
};

Compilation command for de1soc.dts : dtc -O dtb -o de1soc.dtb -b 0 -@ de1soc.dts forum While system boot the message about fpga manager & bridges is:

[ 1.914104] fpga_manager fpga0: Altera SOCFPGA FPGA Manager registered
[ 1.921251] altera_hps2fpga_bridge soc:fpgabridge@0: fpga bridge [hps2fpga] registered
[ 1.929390] altera_hps2fpga_bridge soc:fpgabridge@1: fpga bridge [lwhps2fpga] registered
[ 1.937688] altera_hps2fpga_bridge soc:fpgabridge@2: fpga bridge [fpga2hps] registered
[ 1.946043] altera_fpga2sdram_bridge soc:fpgabridge@3: fpga bridge [fpga2sdram] registered
[ 1.954299] altera_fpga2sdram_bridge soc:fpgabridge@3: driver initialized with handoff 00000000
[ 1.963314] fpga-region soc:base-fpga-region: FPGA Region probed

After boot Ubuntu Desktop on DE1-SoC from SDCard I have load the overlay device tree:

sudo cp de1soc.dtb /lib/firmware

convert de1soc.sof to rbf : quartus_cpf -c de1soc.sof de1soc.rbf

sudo cp de1soc.rbf /lib/firmware
mkdir /sys/kernel/config/device-tree/overlays/my_cv_fpga
ls /sys/kernel/config/device-tree/overlays/my_cv_fpga -> status, path and dtbo subfolders

sudo echo de1soc.dtb > /sys/kernel/config/device-tree/overlays/my_cv_fpga/path

I can see that the board begin the RBF file transfer but the Ubuntu System get to hang and I need to reboot the system

If I do cat de1soc.dtb > /sys/kernel/config/device-tree/overlays/my_cv_fpga/dtbo the result is the same.

With MSEL: 0000, FPGA is configured 16x programming from HPS, and with MSEL: 1010, FPGA is configured from HPS with compress programming. Perhaps the problem is that the MSEL must set to 01010, but then the system doesn’t boot I suppose because the initial FPGA programming during the boot is 16x with not compression, if that what changes I must do with the preloader and U-boot for to boot with MSEL 01010. Some ideas about what is wrong?

Thanks, Candido

linux
overlay
fpga
device-tree
cyclone
asked on Stack Overflow Nov 9, 2020 by candido

1 Answer

0

Did you try the u-boot to take care of the FPGA configuration? I found that to be relatively convenient and didn't bother with the DTB overlay concept. My u-boot environment (printenv) has among other stuff this:

bootcmd=run loadfpga; bridge enable; run distro_bootcmd
loadfpga=run loadfpgaimage; run loadfpganow
loadfpgaimage=load mmc 0:2 0x2000000 /boot/de10_default.rbf
loadfpganow=fpga load 0 0x2000000 6AEBE4

(I agree that the hard-coded length is ugly ;-)) You may stop booting (press any key), stay in u-boot add the environmental variables as you please e.g.:

setenv loadfpgaimage load mmc 0:2 0x2000000 /boot/de10_default.rbf

and test it out even without saving the environment by

run loadfpga

If your file is - as an example - of an incompatible format you may get error like:

7007204 bytes read in 351 ms (19 MiB/s)
Command 'load' failed: Error -6

There are good resources around but it takes time and experimenting getting it right. I found this link interesting: https://bitlog.it/20170820_building_embedded_linux_for_the_terasic_de10-nano.html Good luck.

answered on Stack Overflow Jan 17, 2021 by Martin Vana

User contributions licensed under CC BY-SA 3.0