Generating a System Device Tree Using SDTGen - 2025.1 English - UG1647

Porting Guide for embeddedsw Components System Device Tree Based Build Flow (UG1647)

Document ID
UG1647
Release Date
2025-06-11
Version
2025.1 English
The system device tree represents complete hardware information in the form of device trees. All peripheral information and its properties, memories, clusters, SoC peripheral information, and soft IP information that are available in the hardware design are represented in a Linux-like device tree structure.

SDTGen, also known as DTG++, is a Tcl based tool that uses HSI APIs to read the hardware information from the XSA and put it in device tree format. The Tcl source files for this package can be found in the <Installed Vitis Path>/data/system-device-tree-xlnx location. The tool sources the device_tree.tcl file from <above_path>/device_tree/data/device_tree.tcl and exports the following three procs as commands:

set_dt_param
Takes user inputs such as the Vivado XSA file and the device tree output directory. It can also be used to set the device tree parameters such as the board file and custom dts file. Example usage:
# Setting the device tree parameters. Multiple parameter setting in one line is also allowed.
sdtgen% set_dt_param -dir output_dts
sdtgen% set_dt_param -xsa design_1_wrapper.xsa -board_dts zcu102-rev1.0
 
# Enabling the trace i.e. the flow of tcl procs that are getting invoked during sdt generation. The default trace option is disabled
sdtgen% set_dt_param -trace enable
 
#Command Help
sdtgen% set_dt_param -help
Usage: set/get_dt_param [OPTION]
    -xsa                   Vivado hw design file
    -board_dts             board specific file
    -dir                   Directory where the dt files will be generated
    -trace                 Enable sdtgen traces
get_dt_param
Returns the value set for a given parameter. Example usage:
# Checking the dt parameters
sdtgen% get_dt_param -board_dts
zcu102-rev1.0
sdtgen% get_dt_param -dir
output_dts
sdtgen% get_dt_param -xsa
design_1_wrapper.xsa
  
sdtgen% get_dt_param -help
Usage: set/get_dt_param [OPTION]
    -xsa                   Vivado hw design file
    -board_dts             board specific file
    -dir                   Directory where the dt files will be generated
    -trace                 Enable sdtgen traces
generate_sdt
Generates the system device tree with the set parameters.

To generate a system device tree using SDTGen, follow these steps:

  1. Launch SDTGen.
  2. Execute your code. A usage example is shown below:
    # Generic command for building any SDT targeting Bare-metal use cases.
    Launch sdtgen from Vitis tool
    linux# sdtgen
    sdtgen% set_dt_param -dir dts -xsa design_1_wrapper.xsa
    sdtgen% generate_sdt
      
    # Command for building Zynq SDT targeting Linux use cases
    Launch sdtgen from Vitis tool
    linux# sdtgen
    sdtgen% set_dt_param -board_dts zc702 -dir dts -xsa design_1_wrapper.xsa
    sdtgen% generate_sdt