cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Creating an Acceleration Platform for Vitis Part Three: Packaging an Accelerated Platform in Vitis

Moderator
Moderator
1 0 450

This is the third blog entry in the Acceleration series. Previously, we discussed how to create the hardware and software projects. In this blog we will discuss how this is all packaged together in Vitis™.

You can find the other parts at the links below:

Part One: Creating the hardware project for the Acceleration Platform in Vivado

Part Two:  Creating the software project for the Acceleration Platform in PetaLinux 

Part Four: Testing the Custom Acceleration Platform in Vitis 

 

When we accelerate a software function in Vitis (create a kernel), we are creating a Hardware IP core and the resulting infrastructure to connect this to the existing platform.

To do this, Vitis needs to rebuild your platform. Vitis uses the XSA to rebuild the Vivado project. It will then append the updated hardware and then re-spin the Vivado project.

Everything else will remain static, except for the bitstream and the generated kernel application of course. So our boot image cannot be static. Instead we provide a BIF that has placeholders for the images that will be created in Vitis. 

Also, In order for the kernel to be able to execute, we need to cross-compile for our target hardware. Here, we use the sysroot created in PetaLinux. 

Preparing the Images:

This step is not really needed, but I have organized the platform files for ease of use. The important thing to remember is the boot images location when creating the BIF file, as we are using placeholders. 

mkdir -p sw_comp/src/a53/xrt/image
mkdir sw_comp/src/boot
  • Copy the image.ub, boot.scr and rootfs.cpio.gz from the PetaLinux image/linux folder to sw_comp/src/a53/xrt/image 
  • Copy the bl31.elf, uboot.elf, zynqmp_fsbl (renamed fsbl.elf), pmufw.elf from the PetaLinux image/linux folder to sw_comp/src/boot
Create the BIF:

The BIF file is used in bootgen to create the SD boot image.

This contains the location of all of the partitions in the BOOT.BIN file. A template can be seen below.

It is important to note that here we are just providing placeholder file names, not the actual file name. The tools will add the path to the files. This is why I recommend having all of these files in the same boot folder. The zcu104_base will be the name of our platform.

the_ROM_image:
{
  [fsbl_config] a53_x64
  [bootloader] <zcu104_base/boot/fsbl.elf>
  [pmufw_image] <zcu104_base/boot/pmufw.elf>
  [destination_device=pl] <bitstream>
  [destination_cpu=a53-0, exception_level=el-3, trustzone] <zcu104_base/boot/bl31.elf>
  [destination_cpu=a53-0, exception_level=el-2] <zcu104_base/boot/u-boot.elf>
}
  • Copy the linux.bif to sw_comp/src/boot
Create the init.sh script

This is the script that will be run when booting to set up the XRT, and pass the name of the platform to the ZOCL.

cp ./platform_desc.txt /etc/xocl.txt
export XILINX_XRT=/usr
  • Copy the init.sh to sw_comp/src/a53/xrt/image 
Create the platform_desc.txt

This passes the name of the platform to the XRT. The name here should match the platform name given in Vivado:

zcu104_base
  • Copy the platform_desc.txt to sw_comp/src/a53/xrt/image 
Create the QEMU files:

The Vitis IDE supports both software and hardware emulation. The QEMU is used to do this. However, we need to pass the QEMU machine details.

We need to do this for the PMU, using pmu_args.txt

-M
microblaze-fdt
-device
loader,file=<pmufw.elf>
-machine-path
.
-display
none
  • Copy the pmu_args.txt to sw_comp/src/boot

We also need to pass the PSU machine details, via qemu_args.txt:

-M
arm-generic-fdt
-serial
mon:stdio
-global
xlnx,zynqmp-boot.cpu-num=0
-global
xlnx,zynqmp-boot.use-pmufw=true
-net
nic
-net
nic
-net
nic
-net
nic
-net
user
-m
4G
-device
loader,file=<bl31.elf>,cpu-num=0
-device
loader,file=<u-boot.elf>
-boot
mode=5
  • Copy the qemu_args.txt to sw_comp/src/boot

Package the Platform in Vitis:

Launch Vitis, and Select Create Platform Project:

stephenm_0-1597252660001.png

Use the same name as is given in the BIF:

stephenm_1-1597252687033.png

Select Create from hardware specification (XSA):

stephenm_2-1597252712822.png

Select the OS and Linux, then deselect generate boot components (we have these created already from PetaLinux):

stephenm_3-1597252784623.png

Note: The warning here is just stating that the sysroots will need to be added. 

Populate the software images created in the previous blog entry:

stephenm_0-1597311972841.png

Then Build:

stephenm_5-1597253236452.png

Once this is competed, the platform will be placed in export\zcu104_base.... and that's it.

For the next part of this guide, see part four: Testing a Custom Acceleration Platform in Vitis