Building a Bare-Metal System - 2023.1 English

AI Engine Tools and Flows User Guide (UG1076)

Document ID
UG1076
Release Date
2023-06-23
Version
2023.1 English
Building a bare-metal system requires a few additional steps from the standard application 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_202310_1 does not have a bare-metal domain, which mean you must create a platform with one. Starting from the v++ linking process as described in Linking the System, you must create a custom platform because the PS application needs drivers for the PL kernels in the design.

    Use the XSA generated during the link process to create a new platform using the following command:

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

    where:

    • -name vck190_baremetal: Specifies a name for the platform that will be created. The platform will be created according to the specified name. In this example it 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. The <filename> will be the same as the file name specified for the .xclbin output.
    • -domain psv_cortexa72_0:standalone: Specifies the processor domain and operating system to apply to 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 IDE for instance, or allows you to specify the platform in command-lines by simply referring to the name rather than the whole path.

    Note: 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. For details, see Compiling and Linking Host Code for Bare-Metal.
  3. Package the System

    Finally, you must run the package process 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. Refer to Packaging for more information. This requires the use of the v++ --package command as follows:

    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, these options are not required. If your host application launches and controls the graph, then you need to use these options when compiling and packaging your system as described in Deploying the 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.