The Vitis Unified IDE supports Python APIs to create and build a system project. After creating platform component and application component, the system project is created. The application components then can be added to the system project and built. Host components can also be built individually. However, when system project build is triggered using Python APIs, it builds all the components associated and the system.
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_component | Adds the specified component to the given system project |
proj.add_component(name = "host_component")
|
build | Initiates the build of a system project for the given build target. |
proj.build(target='hw')
|
|
The Python script to create a system project and build for target=Hardware to export Vitis metadata archive can be seen as:
# Add package: Vitis Python CLI
import vitis
# Create a Vitis client object
client = vitis.create_client()
# Set Vitis Workspace
client.set_workspace(path="./workspace")
# Defining names for platform, application_component and
plat_name="vck190_embd"
comp_name="standalone_embd_app"
# Create and build platform component for vck190 for standalone_psv_cortexa72
platform_obj=client.create_platform_component(name=plat_name, hw_design="vck190", cpu="psv_cortexa72_0", os="standalone")
platform_obj.build()
# This returns the platform xpfm path
platform_xpfm=client.find_platform_in_repos(plat_name)
# Create and build application component
comp = client.create_app_component(name=comp_name, platform = platform_xpfm, domain = "standalone_psv_cortexa72_0", template = "hello_world")
comp.build()
# Create system project
sys_proj = client.create_sys_project(name="system_project", platform=platform_xpfm, template="empty_accelerated_application")
# Add application component to the system project
sys_proj_comp = sys_proj.add_component(name="hello_world")
# Build system project
sys_proj_comp.build()
vitis.dispose()
Conclusion
Apart from the discussed examples, a few more Python command examples are provided in <VITIS_INSTALL_DIR>/2024.2/cli/examples.
For more details of all Vitis supported Python APIs, refer to the link: <vitis_install_path>cli/api_docs/build/html/vitis.html