Install the sysroot
Go to common image extracted directory
./sdk.sh -d <Install Target Dir>to install the PetaLinux SDK. Use the
-doption to provide a full pathname to the output directory . (This is an example. . means current directory. ) and confirm.
The environment variable LD_LIBRARY_PATH must not be set when running this command.
Note: Sysroot is not mandatory components for the platform itself. It is the cross compile tool prepared for applications compilation.
Create the Vitis platform.
For this example, you will use the Vitis Unified IDE to create the Vitis Platform. Got to
WorkSpacedirectory and follow steps below to create the platform.
Run Vitis by typing
vitis -w .in the console.
-wis to specify the workspace.
.means the current worksapce directory.
In the Vitis Unified IDE, from menu select File > New Component > Platform to create a platform component.
On the Create Platform Component setup dialog
Enter the component name and location. For this example, type
zcu104_customand use default location. Click Next.
Click Broswe button, select the XSA file generated by the Vivado. In this case, it is
Note: If you want to create a platform with emulation support please click Emulation and select the emulation XSA file.
Set the operating system to linux.
Set the processor to psu_cortexa53.
Check the option Generate boot artifacts. Then click Next.
Note: Enabling this option will trigger the tool to automatically generate a PMU firmware domain and an FSBL (First Stage Boot Loader) domain into the platform
Review the summary and click Finish.
Note: After a few moments, the platform component will be prepared and available in the component view. Simultaneously, the platform configuration file,
vitis-comp.json, will be automatically displayed in the main view. Users can access the
vitis-comp.jsonfile by expanding the Settings section under the platform component.
Set up the software settings in the Platform configuration view by clicking the Linux On psu_cortexa53 domain, browse to the locations and select the directory or file needed to complete the dialog box for the following:
Display Name: update it as
Bif file: Click the button to generate bif file or click Browse to select existing bif file.
Note: The filenames in
<>are placeholders in the bif file. Vitis will replace the placeholders with the relative path to platform during platform packaging. V++ packager, which runs when building the final application#, would expand it further to the full path during image packaging. Filename placeholders point to the files in boot components directory. The filenames in boot directory need to match with placeholders in BIF file.
<bitstream>is a reserved keyword. V++ packager will replace it with the final system bit file.
Pre-Built Image Directory: Browse to xilinx-zynqmp-common-v2023.2 and click OK.
DTB File: Browse to mydevice/psu_cortexa53_0/device_tree_domain/bsp and select system.dtb, then click OK.
FAT32 Partition Directory: This directory is used to add additional file to the fat32 partition. User can set it according to your requirement.
QEMU Data: This Directory is used to add additional file for emulation. User can set it according tyour requirement.
Note:: Qemu Args File and Pmu Args File are populated by the tool automatically. If there are additional QEMU settings, please update it accordingly.
Select zcu104_custom platform component in the flow navigagor, then click the Build button to build the platform.
Note: The generated platform is placed in the export directory. BSP and source files are also provided for rebuilding the FSBL, if required, and are associated with the platform. The platform is ready to be used for application development.
Note: After compilation, users can locate the XPFM file by expanding the Output directory. This provides a logical view of the output. The actual path of platform file is under
workspace/zcu104_custom/export/zcu104_custom/directory. Users can also view the complete path of the platform file by simply hovering the mouse pointer over the XPFM file.
Note: The Vitis Unified IDE will find the boot-related files menntioned in the software components in begin of this step and place them in the boot folder of the platform.
If you create a Vitis application component in the same workspace as this platform component, you can find this platform available in the platform selection page in the application Creation wizard. If you want to reuse this platform in another workspace, add its path to the
PLATFORM_REPO_PATHSenvironment variable before launching the Vitis GUI, or use the “Add” button on the platform selection page of the Vitis GUI to add its path.
User could also use Vitis python command to create the platform component.
Click here to see how to use Vitis python command to create a Vitis platform
Create a python script. For example, here is the parts of platform_creation.py.
import vitis import argparse import os print("Platform generation") parser = argparse.ArgumentParser() parser.add_argument("--platform_name", type=str, dest="platform_name") parser.add_argument("--xsa_path", type=str, dest="xsa_path") parser.add_argument("--xsa-emu_path", type=str, dest="emuxsa_path") parser.add_argument("--boot", type=str, dest="boot") parser.add_argument("--dtb", type=str, dest="dtb") args = parser.parse_args() platform_name=args.platform_name xsa_path=args.xsa_path emuxsa_path=args.emuxsa_path dtb=args.dtb boot=args.boot print('args',args) client = vitis.create_client() client.set_workspace(path=os.getcwd()) platform = client.create_platform_component(name = platform_name, hw =xsa_path, os = "linux",cpu = "psu_cortexa53",emulation_xsa_path = emuxsa_path ) platform = client.get_platform_component(name=platform_name) domain = platform.get_domain(name="linux_psu_cortexa53") status = domain.update_name(new_name="xrt") status = domain.generate_bif() status = domain.add_boot_dir(path=boot) status = domain.set_dtb(path=dtb) status = platform.build()
This python script is for user to create a platform. It needs the following input values.
name: Platform name.
hw: Hardware XSA file location.
emulation_xsa_path: Hardware emulation XSA file location.
boot: pre-built image path.
dtb: DTB file path.
The following is the command brief explanation.
client.create_platform_componentis used to create a platform with standalone domain or the Linux domain.
domain.add_boot_diris used to set the pre-built image path.
domain.set_dtbis used to set the DTB file.
You can pass the values to the script directly by replacing the variable with the actual value, or pass the value to python script.
Here is an example of calling python script.
vitis -s platform_creation.py --platform_name <> --xsa_path <> --xsa-emu_path <> --boot <> --dtb <>