FPGA Readback using debugfs attributes

Linux Drivers

Release Date
2023-07-22

Linux FPGA Manager driver creates /sys/kernel/debug/fpga/ folder, which contains image attributes that provides readback contents.

  • readback_type :  /sys/module/zynqmp_fpga/parameters/readback_type readback_type is a module parameter which tells the readback type (default : 0) 0 – Configuration Register read 1 - Configuration Data read
  • image :  /sys/kernel/debug/fpga/<fpga>/image image is a debugfs attribute which provides the readback information based on the readback_type module param

Steps for Readback of Configuration Registers

S et flags for readback type

echo 0 > /sys/module/zynqmp_fpga/parameters/readback_type

Perform Readback operation by reading the image debug attribute

cat /sys/kernel/debug/fpga/fpga0/image

Example:

root@xilinx-zcu102-2018_3:~# echo 0 > /sys/module/zynqmp_fpga/parameters/readback_type
root@xilinx-zcu102-2018_3:~# cat /sys/kernel/debug/fpga/fpga0/image
zynqMP FPGA Configuration register contents are
CRC -->   0 
FAR -->   7fc0000   
FDRI -->      0 
FDRO -->      effffffe  
CMD -->   d 
CTRL0 -->     101   
MASK -->      0 
STAT -->      16907ffc  
LOUT -->      0 
COR0 -->      38003fe5  
MFWR -->      0 
CBC -->   0 
IDCODE -->    1484a093  
AXSS -->      0 
COR1 -->      400000    
WBSTR -->     0 
TIMER -->     0 
BOOTSTS -->   1 
CTRL1 -->     0 

Steps for Readback of Configuration DataFrames

S et flags for readback type

echo 1 > /sys/module/zynqmp_fpga/parameters/readback_type

Perform Readback operation by reading the image debug attribute

cat /sys/kernel/debug/fpga/fpga0/image

Example:

root@xilinx-zcu102-2018_3:~# echo 1 > /sys/module/zynqmp_fpga/parameters/readback_type
root@xilinx-zcu102-2018_3:~# cat /sys/kernel/debug/fpga/fpga0/image > reabackdata.bin
root@xilinx-zcu102-2018_3:~# hexdump readbackdata.bin > data.txt