- For bare-metal systems you must follow the process described in
Configuring the HW-Link Project with the added step of
enabling the Export
Hardware (XSA) option for Emulation-HW and Hardware builds. This triggers the
creation of a fixed-XSA file used for building a bare-metal platform using data
found in the AI Engine graph and PL regions
of the design. Important: The fixed-XSA matches the specified build target of the Vitis compiler. So a hardware emulation capable fixed-XSA is generated from the
hw_emubuild target, and a hardware capable fixed-XSA is generated from the
hwbuild target.After enabling this option, build the emulation or hardware build as usual. The fixed-XSA file will be written to the output folder for the build.
- Create a bare-metal platform. Building bare-metal applications
requires a platform with a bare-metal domain. Because the
xilinx_vck190_base_202120_1base platform does not have one, you must create a custom platform with a bare-metal domain using the fixed-XSA file exported during the build process described above.
- 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
exported from the HW_Link project as described in Step 1.
- 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.
Building a bare-metal system requires a deviation from the standard application flow previously described. The branch in the process occurs at 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.