工程建立相关
设置工作空间
api文档
set_workspace(path)
set_workspace:
Set the given workspace path.
Prototype:
client.set_workspace(path = <workspace_location>)
Required Arguments:
path = <workspace_location>
Path for the workspace to be set.
Returns:
True
Workspace is successfully set.
Exception
Failed to set the workspace.
Examples:
client.set_workspace(“/home/vitis_project”)
建立硬件平台
$COMPONENT_LOCATION应该是当前目录的地址
platform = client.create_platform_component(name = "script_test",hw_design = "$COMPONENT_LOCATION/../Top_Module.xsa",os = "standalone",cpu = "ps7_cortexa9_0",domain_name = "standalone_ps7_cortexa9_0")
api文档
create_platform_component(name, hw_design='', desc=None, os=None, cpu=None, domain_name=None, template=None, no_boot_bsp=False, fsbl_target=None, fsbl_path=None, pmufw_Elf=None, emu_design='', platform_xpfm_path='', is_pmufw_req=False, generate_dtb=True, advanced_options={})
create_platform_component:
Create a new platform.
Prototype:
platform = client.create_platform_component(name = <platform_name>,
hw_design = <handoff_file>, desc = <description>, os = <os>, cpu = <processor>, domain_name = <domain_name>, template = <template_name>, no_boot_bsp = <bool>, fsbl_target = <fsbl_target>, fsbl_path = <path>, pmufw_Elf = <path>, emu_design = <xsa_path>, platform_xpfm_path = <xpfm_path>, is_pmufw_req = <bool>, generate_dtb = <bool>, advanced_options = {})
Required Arguments:
name = <platform_name>
Name of the platform.
hw_design = <handoff_file>
Hardware description file to be used to create the platform.
emu_design = <xsa_path>
Path to the emulation xsa on which the component is created.
platform_xpfm_path = <xpfm_path>
Xpfm path of existing platorm.
Optional Arguments:
desc = <description>
Description of the platform.
os = <os>
The OS to be used to create the default domain.
cpu = <processor>
The processor to be used to create the default domain.
domain_name = <domain_name>
Name of the domain to be created in the platform.
template = <template_name>
Template for creating domain in case of Baremetal platform. “Empty” (Default)
no_boot_bsp = <bool>
Mark the platform to build without generating boot components.
fsbl_target = <fsbl_target>
Processor-type for which the existing fsbl has to be generated. This option is valid only for ZU+. “psu_cortexa53_0” (Default)
fsbl_path = <path>
Fsbl path for custom fsbl. This option is used when no_boot_bsp is opted.
pmufw_Elf = <path>
Prebuilt fsbl.elf to be used as boot component. This option is used when no_boot_bsp is opted.
is_pmufw_req = <bool>
Mark the platform to create PMU Firmware boot domain. This option is false by default.
generate_dtb = <bool>
Enables the automatic creation of a Device Tree Blob (DTB) file. True by default.
advanced_options = <dict>
Advanced options for sdt creation. Use create_advanced_options_dict to create dict for advanced options.
Returns:
Object reference for the newly created platform.
Examples:
platform = client.create_platform_component(name = “platform”, hw_design = “zcu102”,
cpu = “psu_cortexa53_0”, os = “standalone”, domain_name = “standalone_a53”)
查找根目录下的硬件平台
name是自己之前创建的硬件平台名字
api文档
find_platforms_in_repos(_name_)[](#vitis.cli_client.Embedded.find_platforms_in_repos "Permalink to this definition")
find_platforms_in_repos:
Get list of platform xpfm paths matching with provided pattern.
Prototype:
platform_xfpm_list = client.find_platforms_in_repos(name = <pattern>)
Required Arguments:
name = <pattern>
String or python supported regular expression.
Returns:
Returns list of matched platform xpfm paths, else an exception is raised.
Examples:
platform_xpfm_list = client.find_platforms_in_repos(“vck190”) platform_xpfm_list = client.find_platforms_in_repos(“vck190.*dfx”)
创建软件平台
测试用例,platform = "$COMPONENT_LOCATION/../platform/export/platform/platform.xpfm"可以替换成先用find_platforms_in_repos函数找到硬件平台的路径
comp = client.create_app_component(name="test1",platform = "$COMPONENT_LOCATION/../platform/export/platform/platform.xpfm",domain = "standalone_ps7_cortexa9_0",template = "hello_world")
api文档
create_app_component(name, platform, domain=None, cpu=None, os=None, template=None)
create_app_component:
Create an application component.
Prototype:
app_comp = client.create_app_component(name = <comp_name>,
platform = <platform>, domain = <domain>, template = <template>, cpu = <cpu>, os = <os>)
Required Arguments:
name = <comp_name>
Application component name.
platform = <platform>
Platform for which component is to be created. In case of baremetal platforms, user can specify the domain along with platform.
CPU and OS are required in case no platform is provided.
Optional Argument:
template = <template>
Template for the component to be created.
domain = <domain>
Specify the domain when there is more than one domain on the platform.
Returns:
App component object.
Examples:
app_comp = client.create_app_component(name = app1,
platform = platform_xpfm, template = ‘empty’)
切换当前平台(硬件或者软件平台都是这个函数)
platform = client.get_component(name="script_test")
删除平台
client.delete_component(name="xuartps_hello_world_example")
添加或删除源文件
添加文件
status = comp.import_files(from_loc="$COMPONENT_LOCATION/../hello_world/src", files=["helloworld.c"], dest_dir_in_cmp = "src")
status = comp.import_files(from_loc="$COMPONENT_LOCATION/../hello_world/src", files=["helloworld.h"], dest_dir_in_cmp = "src")
status = comp.import_files(from_loc="$COMPONENT_LOCATION/../hello_world/src", files=["lvgl"], dest_dir_in_cmp = "src")
导入文件api文档
import_files(from_loc, files=None, dest_dir_in_cmp=None)
import_files:
Import files to the component.
Prototype:
status = component.import_files(from_loc = <Location of src or
config file(s) path>, files = [“file1”,..]**, dest_dir_in_cmp = <Dest location or config file(s) path>)
Required Arguments:
from_loc = <Location of src or config file(s) path>
From The location can be a directory/file, the path can be absolute/relative.
Optional Arguments:
files = [“file1”,..]**
List of files to be imported from the given from_loc path. Whole folder is imported if files are not mentioned.
dest_dir_in_cmp = <Dest location or config file(s) path>
Destination folder name, created if directory doesn’t exist. Files are imported directly to the component folder if destination folder is not given.
Returns:
True
Files imported successfully.
Exception
File could not be imported.
Examples:
component.import_files(from_loc = ‘/tmp/dir1’,
files = [‘file1.txt’,’file2.cpp’], dest_dir_in_cmp = ‘src’)
删除文件api文档
remove_files(files)
remove_files:
Remove files from the component.
Prototype:
status = component.remove_files(files = [“file1”,..]**)
Required Arguments:
files = [“file1”,..]**
List of files to be removed from the component.
Returns:
True
Files imported successfully.
Exception
File could not be imported.
Examples:
component.remove_files(files = [‘/src/file1.txt’] ) component.remove_files(files = [‘/src/file1.txt’, ‘file2.cfg’])
app添加或删除 头文件路径与链接外部库
比如添加头文件路径key = “USER_INCLUDE_DIRECTORIES”, values = [“/tmp/test1”, “/tmp/test2”])
链接外部数学库key = “USER_LINK_LIBRARIES”, values = [“m”])
append_app_config(key, values)
append_app_config:
Append the value to the provided build setting. Append option is only supported for ‘USER_COMPILE_DEFINITIONS’,’USER_LINK_LIBRARIES’ ,’USER_UNDEFINE_SYMBOLS’,’USER_INCLUDE_DIRECTORIES’.
Prototype:
status = component.append_app_config(key = <setting>,
values = [“value1”,..]**)
Required arguments:
key = <setting>
Configuration parameter to be updated.
value = <value>
New value(s) to be appended in the configuration parameter value.
Returns:
True
Build configuration updated successfully.
Exception
Failed to update the configuration.
Examples:
status = component.append_app_config(key = “USER_INCLUDE_DIRECTORIES”, values = [“/tmp/test1”, “/tmp/test2”])
删除的api文档如下
remove_app_config(key, values)
remove_app_config:
Remove the value from the provided build setting. Remove option is only supported for ‘USER_COMPILE_DEFINITIONS’,’USER_LINK_LIBRARIES’ ,’USER_UNDEFINE_SYMBOLS’,’USER_INCLUDE_DIRECTORIES’.
Prototype:
status = component.remove_app_config(key = <setting>,
values = [“value1”,..]**)
Required arguments:
key = <setting>
Configuration parameter to be updated.
value = [“value1”,..]**
Value(s) to be removed from the configuration parameter value.
Returns:
True
Build configuration updated successfully.
Exception
Failed to update the configuration.
Examples:
status = component.remove_app_config(
key = “USER_INCLUDE_DIRECTORIES”, values = “/tmp/test1”)
设置堆栈大小
首先要获取与host_component对应的链接器脚本对象。
get_ld_script(path=None)
get_ld_script:
Get the linker script object corresponding to the host_component.
Prototype:
status = ldfile.get_ld_script(path = <ld_path>)
Optional Arguments:
path = <ld_path>
Linker script path to be edited. lscript.ld associated with the host component will be considered by default.
Returns:
Linker script file object.
Examples:
status = ldfile.get_ld_script()
set_stack_size(size)
set_stack_size:
Update the stack size in the linker script.
Prototype:
status = ldfile.set_stack_size(size = <stack_size>)
Required Arguments:
size = <stack_size>
New size for the memory region.
Returns:
True
Updated the stack size.
Exception
Stack size could not be updated.
Examples:
status = ldfile.set_stack_size(size = <stack_size>)
set_heap_size(size)
set_heap_size:
Update the heap size in the linker script.
Prototype:
status = ldfile.set_heap_size(size = <heap_size>)
Required Arguments:
size = <heap_size>
New size for the memory region.
Returns:
True
Updated the heap size.
Exception
Heap size could not be updated.
Examples:
status = ldfile.set_heap_size(size = <heap_size>)
设置地址分配
update_memory_region(name, base_address, size)
update_memory_region:
Update an existing memory region in the linker script.
Prototype:
status = ldfile.update_memory_region(name = <name>,
base_address = <base_addres>, size = <size>)
Required Arguments:
name = <name>
Name for the new memory region to be updated.
base_address = <base_address>
New base address for the memory region.
size = <size>
New size for the memory region.
Returns:
True
Updated the memory region.
Exception
Memory region could not be updated.
Examples:
status = ldfile.update_memory_region(name = <name>,
base_address = <base_addres>, size = <size>)
Comments NOTHING