Generate Device Tree Overlay - 2023.2 English

Vitis Tutorials: Vitis Platform Creation (XD101)

Document ID
XD101
Release Date
2023-12-26
Version
2023.2 English

Because the KV260 loads the PL after Linux boots up, the PL IP information in the platform needs to be loaded dynamically as device tree overlay. One additional requirement for the KV260 acceleration platform software is to generate the device tree overlay for the platform PL IPs. This device tree overlay serves two purposes:

  1. It needs to have ZOCL node so that XRT driver can be loaded properly.

  2. It can include any configurations of the PL IP in the platform logic designed in step 1.

The device tree information for PL in your application is loaded after Linux boot together with the XCLBIN file which contains the PL bitstream. A device tree overlay (DTBO) can be loaded and unloaded in Linux. For more information about DTBO, refer to https://lkml.org/lkml/2012/11/5/615.

AMD provides a new command, createdts, executed in the XSCT tool to generate device tree from XSA file exported from the AMD Vivado™ Design Suite.

Run the following steps to generate DTBO from XSA

  1. Generate device tree file.

    source <Vitis_tool_install_dir>/settings64.sh
    cd WrokSpace
    xsct
    createdts -hw kv260_hardware_platform/kv260_hardware_platform.xsa -zocl -out . \
    -platform-name mydevice -git-branch xlnx_rel_v2023.2 -overlay -compile
    

    The createdts command has the following input values. Specify them as you need.

    • -platform-name: Platform name

    • -hw: Hardware XSA file with path

    • -out: Specify the output directory

    • -git-branch: Device tree branch

    • -zocl: Enable the zocl driver support

    • -overlay: Enable the device tree overlay support

    • -compile: Specify the option to compile the device tree to DTB file

    The following information would show in XSCT console. Ignore the warning and that also means you succeed to get system.dtb file which is located in <mydevice/psu_cortexa53_0/device_tree_domain/bsp>.

    pl.dtsi:9.21-32.4: Warning (unit_address_vs_reg): /amba_pl@0: node has a unit name, but no reg property                                                      
    system-top.dts:26.9-29.4: Warning (unit_address_vs_reg): /memory: node has a reg or ranges property, but no unit name
    zynqmp.dtsi:790.43-794.6: Warning (pci_device_reg): /axi/pcie@fd0e0000/legacy-interrupt-controller: missing PCI reg property
    pl.dtsi:27.26-31.5: Warning (simple_bus_reg): /amba_pl@0/misc_clk_0: missing or empty reg/ranges property
    

    NOTE: The createdts command is used within the XSCT console to generate device tree files. This command requires several inputs to produce the desired device tree files. If you’re unsure about the specific options and their meanings, you can execute a help command to access detailed information. Additionally, it’s important to note that XSCT is a console tool integrated into Vitis. You can initiate it by typing xsct in the Linux terminal or, alternatively, select the Xilinx > XSCT Console option from the Vitis menu after launching the Vitis tool.

    NOTE: Device tree knowledge is a common know-how. Please refer to AMD Device tree WIKI page or Device Tree WIKI page for more information if you are not familiar with it.

    Execute the following command to exit XSCT console.

    exit
    
  2. Compile the dtsi to dtbo.

    Run the following command to build the dtsi file and create a directory to store the dtbo file.

    cd WrokSpace
    dtc -@ -O dtb -o mydevice/psu_cortexa53_0/device_tree_domain/bsp/pl.dtbo mydevice/psu_cortexa53_0/device_tree_domain/bsp/pl.dtsi
    mkdir dtg_output
    cp mydevice/psu_cortexa53_0/device_tree_domain/bsp/pl.dtbo dtg_output
    

    NOTE: dtc is device tree compiler. For more info about dtc, check its man page and source code.