- Create a bare-metal platform. Building bare-metal applications
requires a platform with a bare-metal domain. Because the
xilinx_vck190_base_202210_1base platform does not have one, you must create a custom platform with a bare-metal domain using the fixed-XSA file.
- Select the Vitis
IDE. This opens the New Platform
Project wizard as shown.
command in the
- Specify a Platform
project name and click Next to proceed. This displays the
page of the wizard where you specify an XSA to create the new platform.
Use the binary_container_1.xsa.
- After you select the XSA, the Vitis IDE reads the file, determines the
system and Processor for the domain defined by the XSA,
and populates it in the dialog box. Click Finish to create the platform project.Tip: The bare-metal platform is valid for either hardware emulation or hardware builds depending on the fixed-XSA selected for the platform.
- Click the Build
command to build the platform. A copy of the completed platform is
written to the export folder of the project, and shows in the
view for the project. As shown in the following figure, the exported
platform has the platform.xpfm
meta-data file, as well as the ./hw and ./sw
folders for the different elements of the platform.
The Vitis IDE automatically adds the new platform to your platform repository making it available to use in new projects. You can also add the file location to your
$PLATFORM_REPO_PATHSenvironment variable. This makes the platform accessible to the Vitis IDE, or allows you to specify the platform in command-lines by referring to the platform name rather than the whole path.Important: The generated platform will be used only for building the bare-metal PS application and is not used any other places in the flow.
- Select the Vitis IDE. This opens the New Platform Project wizard as shown.
- Create a new PS application project.
- Select the Vitis IDE. This opens the New Application Project wizard. command in the
- Click Next to skip past the first page, and display the Platform page as shown.
- Select the baremetal_platform you created in the last step, and
click Next to proceed.
- Provide an Application project name and click Next.
- Review the Domain page and click Next to proceed.
- On the Templates page, select Empty Application and click Finish to create the project. The project is opened in the Vitis IDE.
- Add the source code for the PS application, main.cpp, platform.cpp, and associated files written specifically
for the bare-metal project. Select the project in the
view, expand the folders, right-click the src folder, and click the Import Sources command () to open the dialog box
shown in the following figure. Select the files to add and click
- You must also add the bare-metal AI Engine control file (aie_control.cpp), which is created by
aiecompilercommand, and can be found in the ./Work/ps/c_rts folder. Select the src folder again, and click the Import Sources icon () to open the dialog box and add the aie_control.cpp file to the project.
- Finally, you must add to the Include paths for your
project. Right-click the bare-metal application project and select
C/C++ Build Settings as
This selection opens the Build Settings dialog box, as shown in the following figure. Select the Directories option as shown, and select the Add command () to add the new include paths. You will need to add an entry for the source files for your original AI Engine graph application. This is the src folder for the project described in Creating the AI Engine Graph Project and Top-Level System Project. This should point to a folder containing your AI Engine graph source files. Click Apply and Close to finish defining the include path.
With the updated Include path, select the Build () icon to build your project. When the build completes, you should see the ELF file for your bare-metal application.
- Package the system.
- With the ELF file produced for the PS application, you are ready to build the system-level project, and package the system for the bare-metal platform. You must run the package process to generate the final bootable image (PDI), and write the SD card content for booting the device and running the application. See Packaging for more information.
- In the system project created that was created when
you set up your AI Engine graph
project as discussed in Creating the AI Engine Graph Project and Top-Level System Project, add the following to the Packaging
--package.ps_elf ../../baremetal_app/Debug/baremetal_app.elf,a72-0Note: For debugging both the AI Engine graph, together with the bare-metal PS application, you should not add the
--packageoption specified in the previous example. If you want to debug only the AI Engine graph, then you need to add the option as described.
- Now build () the top-level system
This adds the ELF file you created in the bare-metal application project, assigns it to a processor core, and builds the system project. See the
--packageoption in the Vitis Compiler Command in the Vitis Unified Software Platform Documentation: Application Acceleration Development (UG1393) for more information.Note: In the Linux system, you added a PS application into the system project to build and debug as part of the system. Here you are building the PS application as part of a separate bare-metal project and adding it as a boot file for the package process in your top-level system.
Building a bare-metal system requires a deviation from the standard application flow previously described. The branch in the process occurs after the Configuring the HW-Link Project step, with the bare-metal system requiring an addition to that step and then following a new process. The specific steps required are detailed below.
Now that you have built the bare-metal system, you can continue to run or debug the application.
Important: You cannot debug the hardware emulation build for bare-metal projects in the Vitis IDE.