FPGA AI Suite: SoC Design Example User Guide

ID 768979
Date 7/31/2024
Public
Document Table of Contents

5.2. Building the Bootable SD Card Image (.wic)

To create a bootable SD Card image (.wic file), the following components must be built:
  • Yocto Image
  • Yocto SDK Toolchain
  • Arm Cross-Compiled OpenVINO
  • Arm Cross-Compiled FPGA AI Suite Runtime Plugin
  • Arm Cross-Compiled Demonstration Applications
  • FPGA .sof/.rbf files

The create_hps_image.sh script performs the complete build process and combines all the necessary components into an SD card image that can be written to an SD card. For steps required to write an SD card image to an SD card, refer to Writing the SD Card Image (.wic) to an SD Card.

The SD card image is assembled using Yocto (https://yoctoproject.org).

You must have a build system that meets the minimum build requirements. For details, refer to https://docs.yoctoproject.org/3.4.1/ref-manual/system-requirements.html#supported-linux-distributions.

The commands to install the required packages are shown in Installing HPS Disk Image Build Prerequisites.

To perform the build, run the following commands:
cd $COREDLA_WORK/runtime
./create_hps_image.sh \
   -f <bitstream_directory>/hw/output_files \
   -o <output_directory> \
   -u \
   -m <FPGA_target>
where <FPGA_target> is arria10 or agilex7_dk_si_agi027fa
The following diagram illustrates the overall build process performed by the create_hps_image.sh script:
Figure 2.  FPGA AI Suite SoC Design Example Build Process

Build the Yocto boot SD card image and Yocto SDK toolchain

The FPGA AI Suite Soc design example uses the Yocto Project Poky Distribution.

The Yocto images are based on Golden System Reference Designs, which you can find at the following URL: https://www.rocketboards.org/foswiki/Documentation/GSRD.

To customize the Yocto Poky distribution, modify the recipes found in layer $COREDLA_ROOT/hps/ed4/yocto/meta-intel-coredla.

More details can be found in Yocto Build and Runtime Linux Environment.

The defined Yocto Image recipe is coredla-image and can be found in $COREDLA_ROOT/hps/ed4/yocto/meta-intel-coredla/recipes-image/coredla-image.bb.

A Yocto SDK is also built as part of the build and this SDK is used in subsequent build steps to cross-compile the software for the Arm HPS subsystem:
  • Agilex™ 7 :

    $COREDLA_WORK/runtime/build_Yocto/build/tmp/deploy/sdk/poky-glibc-x86_64-coredla-image-armv8a-agilex7_dk_si_agi027fa-toolchain-4.2.3.sh

  • Arria® 10 :

    $COREDLA_WORK/runtime/build_Yocto/build/tmp/deploy/sdk/poky-glibc-x86_64-lbs-image-poky-cortexa9t2hf-neon-arria10-toolchain-4.1.2.sh

The SD card image (WIC file) is in the following location:
  • Agilex™ 7 :

    $COREDLA_WORK/runtime/build_Yocto/build/tmp/deploy/images/agilex7_dk_si_agi027fa/*

  • Arria® 10 :

    $COREDLA_WORK/runtime/build_Yocto/build/tmp/deploy/images/arria10/*

By default, the create_hps_image.sh script builds Yocto from scratch. However, if a prebuilt Yocto build folder is available, you can specify the prebuilt Yocto folder via the -y option as follows:
./create_hps_image.sh \
   -y <prebuilt_Yocto_directory> 
   -f <bitstream_directory>/hw/output_files \
   -o <output_directory> 
   -u
   -m <FPGA_target>
where <FPGA_target> is arria10 or agilex7_dk_si_agi027fa

This -y option loads the Yocto SDK from <PREBUILT_YOCTO_DIR>/build/tmp/deploy/sdk/ and the .wic image from <PREBUILT_YOCTO_DIR>/build/tmp/deploy/images/arria10/ without rerunning a Yocto build.

Build the HPS Packages

The HPS packages are built by the build_hpspackages.sh script.

This script cross-compiles OpenCV, OpenVINO, and the Arm-based OpenVINO™ runtime plugin.

Build the runtime

The runtimes are built by the build_runtime.sh script.

This script cross-compiles the OpenVINO™ FPGA AI Suite runtime plugin and demonstration applications for the SoC devices.

Update the SD card image

The SD card image is updated by the update_sd_image.sh script.

This script takes the output products from the previous build steps and builds a bootable SD Card image.

The software binaries are installed to the Ext4 partition under the /home/root/app directory. The RTL fit_spl_fpga.itb file is copied to the Fat32 partition.

The SD card image is updated only if you specify the -u option of the create_hps_image.sh command along with the location of the FPGA bitstream directory through the -f option.

You can skip updating the SD card while building the rest of the SoC Example Design by omitting the -f and -u options:
./create_hps_image.sh \
   -o <output_directory> \
   -m <FPGA_target>
where <FPGA_target> is arria10 or agilex7_dk_si_agi027fa
When you skip updating the SD card image, you can build bitstreams and an HPS image (Yocto, HPS packages, FPGA AI Suite runtime) concurrently. You can update the SD card image (.wic file) image after all the files are ready:
./create_hps_image.sh \
   -y ./build_Yocto
   -f <bitstream_directory>/hw/output_files \
   -o <output_directory> \
   -u \
   -m <FPGA_target>
where <FPGA_target> is arria10 or agilex7_dk_si_agi027fa