In a bare-metal/standalone environment, AMD provides standalone board support package (BSP), drivers, and libraries for applications to use to reduce development effort. You can use theVitis platform component to configure and generate the BSP. To set up the Vitis Platform component and add a standalone domain for the bare-metal environment (refer to this link). To update the BSP with adding or removing libraries, see this link.
The top-level application for bare-metal systems must also integrate and manage the AI Engine graph and PL kernels. For more information, see Host Programming on Linux.
A typical bare-metal host application structure consists of #include statements, #define macros, object instantiations, helper functions, main function body. The following table describe these
with example code snippets.
| Type | Example | Usage | Comment |
|---|---|---|---|
| C/C++ include |
|
Optional | Recommended as it is used for general purpose functions like printf and memory management |
| AMD include |
|
Mandatory | Generated through board support package, and is used for accessing and controlling PL and AI Engineresources |
| Define |
|
Optional | Improves code readability |
| Object instance |
|
Mandatory | Creates object handle named gr for the AI Engine graph named mygraph. |
| AMD helper functions |
|
Optional | It is recommended to disable cache for bare-metal
applications. Xil_In32 and Xil_Out32 provide read and write access
to AXI4-Lite PL registers. |
| Main function |
|
Mandatory | Host application main body |
A complete bare-metal example is available in the Vitis Tutorials.