Create and Build System Project - 2024.2 English - UG1702

Vitis Reference Guide (UG1702)

Document ID
UG1702
Release Date
2025-01-15
Version
2024.2 English
The Vitis Unified IDE supports Python APIs to create and build a system project. After building the AI Engine component and HLS component, the system project is created and built. The system project has a binary container where components such as AI Engine and HLS kernels must be added. After adding the components, update the configuration file to ensure that the appropriate v++ linking directives and connections are declared under the Connectivity section. If you want to use a custom configuration file, you must remove the configuration file created by the Vitis tool to avoid build issues connected to the config file. By default, the system project build considers the tool generated config file. To use the custom config file to build the system project, follow the steps below:
  1. Remove configuration file: remove_cfg_files([<config_file.cfg>],'<binary_container_name>')
  2. Add custom configuration file: add_cfg_files(['custom_config_file.cfg'],name='<container_name>')
Building the system project (v++ linking) through the Python API builds all the components added in the binary container, and also builds the system.
Table 1. Python APIs: System Project
Python API Description Python API Example
create_sys_project Creates a system project for the given template. 1 proj = client.create_sys_project(name='system_project', platform=<platform_path>)
add_container Adds a binary container with given kernels, and config files. proj.add_container(name='system_prj_lab1')
add_component Adds the specified component to the given system project

proj.add_component(name='aie_component', container_name=['system_prj_lab1'])

proj.add_component(name='hls_component', container_name=['system_prj_lab1'])

set_value Sets the value of the key in a specific section of a config file. Any earlier values for the key will be removed. The same is used as the one in HLS.

cfg.set_value(key='save-temps', value='1')

cfg.set_value(key='export_archive', value='1')

add_values Adds more repeated values for the key in a specific section of a config file. This will add one key=value assignment for each value. Any earlier values for the key will not be removed.

cfg.add_values(section='connectivity', key='sc', values=['mm2s_1.s:ai_engine_0.DataIn1'])

cfg.add_values(section='connectivity', key='sc', values=['ai_engine_0.DataOut1:s2mm_1.s'])

remove_cfg_files Remove configuration file from the component proj.remove_cfg_files(['<config_file.cfg>'],'<container_name>')
add_cfg_file Add configuration file to the component. proj.add_cfg_files(['<config_file.cfg>'], name='<container_name>')
build Initiates the build of a system project for the given build target. proj.build(target='hw')
  1. Accelerated flows are not supported for the Embedded installer.
The Python script to create a system project and build for target=Hardware to export Vitis metadata archive as illustrated below:
# Add package: Vitis Python CLI
import vitis

# Create a Vitis client object -
client = vitis.create_client()

# Set Vitis Workspace
client.set_workspace(path=<workspace_location>)

# Create system project
proj = client.create_sys_project(name='system_project', platform=platform_path)
# Add a binary container, and add components to it
proj.add_container(name='system_prj_lab1')
proj.add_component(name='aie_component',  container_name=['system_prj_lab1'])
proj.add_component(name='mm2s', container_name=['system_prj_lab1'])
proj.add_component(name='s2mm', container_name=['system_prj_lab1'])
# Populate the link config file
cfg = client.get_config_file(proj.project_location+'/hw_link/system_prj.cfg')
cfg.set_value(key='debug', value='1')
cfg.set_value(key='save-temps', value='1')
cfg.set_value(section='advanced', key='param', value='compiler.addOutputTypes=hw_export')
cfg.add_values(section='connectivity', key='sc', values=['mm2s_1.s:ai_engine_0.DataIn1'])
cfg.add_values(section='connectivity', key='sc', values=['ai_engine_0.DataOut1:s2mm_1.s'])

# Build System Project
proj.build(target='hw')
After building the system project, the output is generated at:
workspace>system_project>build>hw>hw_link