Building a Bare-Metal System - 2023.2 English

Vitis Unified Software Platform Documentation: Application Acceleration Development (UG1393)

Document ID
UG1393
Release Date
2023-12-13
Version
2023.2 English
Building a bare-metal system requires a few additional steps from the Linux-based system flow previously described. The specific steps required are described here.
  1. Build the bare-metal platform.

    Building bare-metal applications requires a bare-metal domain in the platform. The base platform xilinx_vck190_base_202320_1 does not have a bare-metal domain, which means you must create a custom platform from the base platform. You must create a custom platform because the PS application needs bare-metal drivers for the PL kernels in the design.

    Starting with the xsa file generated by the v++ linking process as described in Linking the System use the following shell script:

    generate-platform.sh -name vck190_baremetal -hw <filename>.xsa \
    							-domain psv_cortexa72_0:standalone

    where:

    • -name vck190_baremetal: Specifies a name for the new platform. In this example the platform will be written to: ./vck190_baremetal/export/vck190_baremetal
    • -hw <filename>.xsa: Specifies the name of the input xsa file generated during the v++ --link command.
      Note: The .xsa file must be for the hardware target as generated by the v++ --link command.
    • -domain psv_cortexa72_0:standalone: Specifies the processor domain and operating system to create in the new platform.

    You can add the new platform to your platform repository by adding the file location to your $PLATFORM_REPO_PATHS environment variable. This makes it accessible to the Vitis unified IDE for instance, or allows you to specify the platform in command-lines by simply referring to the 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 across the flow.
  2. Compile and link the PS application as described in Compiling and Linking Host Code for Bare-Metal in AI Engine Tools and Flows User Guide (UG1076). You will specify the custom platform drivers to include in the build.
  3. Package the System

    Finally, you must run the v++ --package command to generate the final boot-able image (PDI) for running the design on the bare-metal platform. This command produces the SD card content for booting the device and running the application, as described in Packaging the System

    v++ -p -t hw \
        -f xilinx_vck190_base_202310_1 \
        libadf.a project.xsa \
        --package.out_dir ./sd_card \
        --package.domain aiengine \
        --package.defer_aie_run \
        --package.boot_mode sd \
        --package.ps_elf main.elf,a72-0 \
        -o aie_graph.xclbin
    Tip: For bare-metal ELF files running on PS cores, you should also add the package.ps_elf option to the --package command.

    The use of --package.defer_aie_run is related to the way the AI Engine graph is run. If the application is loaded and launched at boot time, this option is not required. If your host application launches and controls the graph, then you need to use these options when compiling and packaging your system.

    The ./sd_card folder, specified by the --out_dir option, contains the following files produced for the hardware build:

    |-- BOOT.BIN	//BOOT.BIN file containing PDI and the application ELF
    |-- boot_image.bif	  //bootgen input file used to create BOOT.BIN
    `-- sd_card              //SD card folder
        |-- aie_graph.xclbin     //xclbin output file (not used)
        `-- BOOT.BIN         //BOOT.BIN file containing PDI and the application ELF

    Copy the contents of the sd_card folder to an SD card to create a boot device for your system.

Now you have built the bare-metal system, you can run it or debug it.