Loading FreeRTOS RPU firmware on VCK190 using remoteproc driver

This page demonstrates the usage of remoteproc kernel driver by the master processor (A72) on the VCK190 to load remote application firmware on the R5 processor. The example below has been tested on tool version 2020.2 and 2021.1

Table of Contents

Introduction

The kernel remoteproc driver is used in Linux userspace to perform life cycle management i.e. start, stop and firmware load on the remote processor. The kernel documentation for the remoteproc driver can be found here Documentation/remoteproc.txt .

In this example, we will be demonstrating how to to use the remoteproc driver on Versal platforms to load a FreeRTOS application on the remote processor.

Build FreeRTOS RPU firmware

  1. Launch Vitis IDE.

  2. File → New Application Project

  3. Create a new platform from hardware (XSA). Select from the included xsa’s or click on browse and import your xsa to create the platform project.

  4. Specify the application project name; freertos_hello_world_r50 and select psv_cortexr5_0 as the target processor from the list of processors.

  5. Create a new domain for your project. Select freertos10_xilinx as the Operating System from the drop down list.

  6. Select the FreeRTOS hello world template and hit Finish.

  7. Modify the lscript.ld so that the RPU application elf is running out of DDR. This section will also be carved out and reserved for the RPU firmware in the Linux device-tree so that it does not get used by Linux.

  8. Build the application project. The generated elf file in the Debug/Release folder of the application project will be installed in the rootfs of the PetaLinux project.

Build the PetaLinux project

Create a PetaLinux project using the VCK190 BSP (can be downloaded here https://www.xilinx.com/downloadNav/embedded-design-tools/2020-2.html) or your custom xsa. The steps below show how to install the FreeRTOS firmware ELF generated in Vitis described above and install it in the rootfs.

  1. Create a PetaLinux application 

    $ petalinux-create -t apps --template install -n freertos-hello-world-r50 --enable
  2. Replace the default application installed by the template with the freertos_hello_world elf built in Xilinx Vitis for the R5-0 processor into the project-spec/meta-user/recipes-apps/freertos-hello-world-r50/files/ folder.

    cp <vitis-app-proj>/Debug/freertos_hello_world_r50.elf <plnx-proj-root>/project-spec/meta-user/recipes-apps/freertos-hello-world-r50/files/
  3. Modify the recipe for the application to include the RPU firmware ELF built in Vitis into the the rootfs.

    $ vim project-spec/meta-user/recipes-apps/freertos-hello-world-r50/freertos-hello-world-r50.bb # # This file is the freertos-hello-world-r50 recipe. #   SUMMARY = "Simple freertos-hello-world-r50 application" SECTION = "PETALINUX/apps" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"   SRC_URI = "file://freertos_hello_world_r50.elf"   S = "${WORKDIR}" INSANE_SKIP_${PN} = "arch"   do_install() {          install -d ${D}/lib/firmware          install -m 0644 ${S}/freertos_hello_world_r50.elf ${D}/lib/firmware/freertos_hello_world_r50.elf }   FILES_${PN} = "/lib/firmware/freertos_hello_world_r50.elf"
  4. Copy the contents of the openamp.dtsi from <plnx-proj>/project-spec/meta-user/recipes-bsp/device-tree/files into the system-user.dtsi. Please see the dtsi below for reference. NOTE: the node entry for rproc_0_reserved has the same memory region as the one carved out in the lscript.ld in the Vitis application.

    1. system-user.dtsi for 2020.2

    2. system-user.dtsi for 2021.1

  5. Build the PetaLinux project and package the BOOT.bin

Running the firmware

SD Booting

  • Version 2020.2

From your <plnx-proj-root>/images/linux folder, copy the BOOT.bin, image.ub and boot.scr to the SD card.

  • Version 2021.1

From your <plnx-proj-root>/images/linux folder, copy BOOT.BIN ,Image , boot.scr , rootfs.cpio.gz.u-boot and system.dtb to SD card

Known issue: In 2020.x, the TTC is put in reset by the PM framework. As a workaround, you will need to request for the TTC node (PM_DEV_TTC_0 (0x18224024U)) using the SysFS interface.

The list of device nodes and their respective values can be found in the Versal Software Developers Guide UG1304 here https://www.xilinx.com/support/documentation/sw_manuals/xilinx2020_1/ug1304-versal-acap-ssdg.pdf#page=217

Load and start the firmware using remoteproc sysfs.

Below is a snippet of the boot console.

Booting using QEMU

In 2021.1, package the rootfs into the qemu_boot.img

Snippet of qemu boot console

Related Links

 





© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy