Generating a System Device Tree Using XSCT - 2024.1 English

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

Document ID
UG1647
Release Date
2024-06-21
Version
2024.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.

The Software Command-Line tool (XSCT) is a tool that is used to create complete SDK workspaces using the batch mode, investigate the hardware and software, and debug and run the project from the command line. You can also use this tool to generate a system device tree. For more details on XSCT, see Software Command-Line Tool in the Vitis Embedded Software Development Flow Documentation (UG1400).

SDTGEN, also known as DTG++, is an XSCT package that uses Tcl and hardware 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>/2023.2/data/system-device-tree-xlnx location. The package 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
SDTGEN command that 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.
xsct% sdtgen set_dt_param -dir output_dts
xsct% 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
xsct% sdtgen set_dt_param -trace enable
 
#Command Help
xsct% 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
SDTGEN command that can return the value set for a given parameter. Example usage:
# Checking the dt parameters
xcst% sdtgen get_dt_param -board_dts
zcu102-rev1.0
xcst% sdtgen get_dt_param -dir
output_dts
xsct% sdtgen get_dt_param -xsa
design_1_wrapper.xsa
  
xsct% 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
SDTGEN command that generates the system device tree with the set parameters.

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

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