The Vitis Unified IDEsupports Python APIs to create and build a system project.
After building the AI Engine component and HLS component, Vitis builds the system project. The project has a binary container. Add components such as AI Engine and HLS component to the binary container. Update the configuration file to ensure you declare the appropriate v++ linking directives and connections under the Connectivity section.
- Remove configuration file:
remove_cfg_files([<config_file.cfg>],'<binary_container_name>') - Add custom configuration file:
add_cfg_files(['custom_config_file.cfg'],name='<container_name>')
| Python API | Description | Python API Example |
|---|---|---|
| create_sys_project | Creates a system project for the template. 1 |
proj =
client.create_sys_project(name='system_project',
platform=<platform_path>)
|
| add_container | Adds a binary container with given modules, and config files. |
proj.add_container(name='system_prj_lab1')
|
| add_component | Adds the specified component to the given system project |
|
| set_value | Sets the value of the key in a specific section of a config file. Vitis removes earlier values for the key. HLS uses the same value. |
|
| add_values | Adds more repeated values for the key in a specific section of a config file. This adds one key=value assignment for each value. Does not remove earlier values for the key. |
|
| remove_cfg_files | Remove configuration files from the component |
proj.remove_cfg_files(['<config_file.cfg>'],'<container_name>')
|
| add_cfg_file | Adds configuration files 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')
|
|
||
target=Hardware to export Vitis metadata
archive.# 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')
workspace>system_project>build>hw>hw_link