Solution Zynq PL Programming With FPGA Manager

Table of Contents


The information on this page is specific to Zynq-7000 SoC devices.  The Zynq-7000 Programmable Logic (PL) can be programmed either using First Stage Boot-loader (FSBL), U-Boot or through Linux.
This page is provide the details about programming the PL from Linux world.


HW IP Features

  • Full-Bitstream and partial Bitstream loading.
  • Encrypted and Authenticated Bitstream loading.

Features supported in the Driver

  • Full-Bitstream Bitstream loading.
  • Encypted Bistream loading with Device-Key

Missing Features, Known Issues and Limitations

  • No support for partial Bitstream loading.
  • No support for Authenticated and Encrypted Bitstream loading.
  • It is capable of loading only .bin format files into PL. It does not support any other file format.

The descriptions in subsequent sections refer to use of Device Tree Overlay (DTO) fragments with FPGA manager framework. It has to be noted that the generation of DTO fragments are not supported in official Xilinx Petalinux release. 
Below sections describe steps for manual creation of pl.dtsi (contains the DTO fragment) to be used along with Xilinx 2018.3 Linux.

Kernel Configuration

The following config options should be enabled in order to use FPGA Manager (In zynq_defconfig this options are enabled by default)

Zynq FPGA Manager Configuration:
Select: Device Drivers ---> FPGA Configuration Framework

DT overlay ConfigFS interface Configuration:
This is required only if the user is using to the Bitstream using DTO
Select: Device Drivers --> Device Tree and Open Firmware support

Contiguous Memory Allocator Configuration:


Select: Kernel Features --> Contiguous Memory Allocator


Select: Device Drivers --> Generic Driver Options → DMA Contiguous Memory Allocator 


Reference Link for device-tree bindings:

FPGA programming using Device Tree Overlay (DTO)

The Device Tree Overlay (DTO) is used to reprogram an FPGA while Linux is running. The DTO overlay will add the child node and the fragments from the .dtbo file to the base device tree,, The newly added device node/drivers will be probed after bitstream programming
DTO contains:
  • Target FPGA Region
    - "target-path" or "target" - The insertion point where the the contents of the overlay will go into the live tree.
    target-path is a full path, while target is a phandle.

  • FPGA Image firmware file name
    - "firmware-name" - Specifies the name of the FPGA image file on the firmware search path.
    The search path is described in the firmware class documentation.

  • Image specific information
    - external-fpga-config : boolean, set if the FPGA has already been configured prior to Linux boot up.

  • Child devices
    - child nodes corresponding to hardware that will be loaded in this region of the FPGA.

Steps for programming the bitstream using overlay: Refer
Steps to remove the drivers got added as part of DTO: Refer


Tools Required

  • To support device-tree overlay the DTC compiler version should be >= 1.4.4

Images Required for testing

  • FSBL
  • u-boot
  • Linux Image (uImage)
    Refer below link to build the above images:
  • Device-tree (system.dtb)
    Device-tree Compilation with DT-Overlay
    A utility called device tree compiler (DTC) is used to compile the DTS file into a DTB file. DTC is part of the Linux source directory. linux-xlnx/scripts/dtc/ contains the source code for DTC and needs to be compiled in order to be used.
    • $ ./scripts/dtc -O dtb -o my_dts/system-top.dtb -b 0 -@ my_dts/system-top.dts
      Note: To support the device-tree overlay the base tree should be compile with -@ flags to generate the symbols.
  • Bin file
  • DTBO file

Generating .bin from .bit file using Bootgen
Full_Bitstream.bif file should contains the below lines:

Required Steps to Create the DT-Overlay Fragment for the Given HDF
  1. Clone the device-tree-xlnx repo:
    git clone

  2. Helper script: dt_overaly.tcl
    Command: xsct dt_overaly.tcl system.hdf ps7_cortexa9_0 device-tree-xlnx output_dir
    Example: xsct dt_overaly.tcl system.hdf ps7_cortexa9_0 ${DTS_REPO}/device-tree-xlnx overlay

The command will create the overlay file with the required DT-Overlay fragments (overlay/pl.dtsi)
Compiling a Device Tree Overlay Blob (.dtbo) file from the pl.dts file.
Example: ./scripts/dtc -O dtb -o pl.dtbo -b 0 -@ pl.dtsi
For more info about DTG please refer the below link

Test Procedure

Using Device Tree Overlay:

Steps to Load Full Bitstream
Once the Linux is up run the below commands to load the required Full Bitstream.
1) Set flags for Full Bitstream.
  • echo 0 > /sys/class/fpga_manager/fpga0/flags

2) Copy the Full Bitstream (.bin) and pl.dtbo files into firmware folder
  • mount /dev/mmcblk0p1 /media/
  • mkdir -p /lib/firmware
  • cp /media/design_1_wrapper.bit.bin /lib/firmware/design_1_wrapper.bit.bin
  • cp /media/pl.dtbo /lib/firmware/

3) Apply DTBO (To add device nodes)
  • mkdir /configfs
  • mount -t configfs configfs /configfs
  • cd /configfs/device-tree/overlays/
  • mkdir full
  • echo -n "pl.dtbo" > full/path

4) Steps to remove device nodes
  • rmdir full

Steps to Re-Load Full Bitstream
1) Remove The overlay file will be applied earlier.
  • rmdir full

2) Set flags for Full Bitstream.
  • echo 0 > /sys/class/fpga_manager/fpga0/flags

3) Copy the Full Bitstream and pl.dtbo files into firmware folder
  • cp /media/design_1_wrapper.bit.bin /lib/firmware/design_1_wrapper.bit.bin
  • cp /media/new-pl.dtbo /lib/firmware/

3) Apply DTBO
  • mkdir full
  • echo -n "new-pl.dtbo" > full/path

Expected Output Using DTBO

Using sysfs interface

Once the linux is up run the below commands to load the Bitstream.
1)Set flags for Full Bitstream.
  • echo 0 > /sys/class/fpga_manager/fpga0/flags

2) Loading Bitstream into PL.
  • mkdir -p /lib/firmware
  • cp /media/design_1_wrapper.bit.bin /lib/firmware/
  • echo design_1_wrapper.bit.bin > /sys/class/fpga_manager/fpga0/firmware

Steps for programming the Encrypted Bitstream

1)Set flags for Encrypted Bitstream

  • echo 0x4 > /sys/class/fpga_manager/fpga0/flags

2)Load the Bitstream

  • mkdir -p /lib/firmware
  • cp /media/enrypted.bit.bin /lib/firmware/
  • echo enrypted.bit.bin > /sys/class/fpga_manager/fpga0/firmware

Expected Output Using Sysfs

Change Log



  • fpga: zynq: Fix incorrect variable type


  • d390930 fpga: zynq: Fix incorrect variable type


  • None


  • None


  • None


  • None

  • None


  • None

Related Links