The Vitis Unified IDE supports Python APIs
to create the application component. An application component can be created only with
platform=xpfm
. fixed.xsa is not supported. Thus, if you have a hardware design file
(fixed.xsa), create a platform component from
fixed.xsa
and use the platform component to create
an application component.
Python API | Description | Python API Example |
---|---|---|
create_app_component
|
Create an application component. |
app_comp =
client.create_app_component(name ='app_comp', platform =
<platform_path>, template = "empty")
|
set_app_config
|
Set the value of the provided build setting. Values can be single value or a list of values. |
app_comp.set_app_config(key = 'USER_LINK_LIBRARIES', values =
'xrt_coreutil')
|
set_sysroot
|
Set sysroot for
the app component. |
app_comp.set_sysroot(<sysroot_dir_path>)
|
build
|
Initiates the build of an application component. |
app_comp.build(target="hw")
|
The Python script to create an application component and build for
target=Hardware
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_location>)
# Create an application component:
app_comp = client.create_app_component(name ='ps_comp', platform = <platform_path>, template = "empty")
# Import sources to the component
app_comp.import_files(from_loc = <app_src_path>, files = ['host.cpp', 'host.h','data.h'], dest_dir_in_cmp = 'src')
#Add the directives in the USERconfig.cmake file
app_comp.set_app_config(key = 'USER_LINK_LIBRARIES', values = 'xrt_coreutil')
......
# Setting sysroot
app_comp.set_sysroot(<sysroot_dir_path>)
# Build Component
app_comp.build(target="hw")
After building an application component, the output products are
generated at:
workspace > app_component > build > hw