Zynq UltraScale+ MPSoC Base TRD 2019.1 - Design Module 4

Table of Contents



Design Overview


This module demonstrates:
  • Boot RPU1 from APU master via remoteproc
  • Inter Process Communication (IPC)
    • APU master: RPMsg
    • RPU1 remote: OpenAMP
  • RPU1 Bare-metal application (server)
    • Reads performance counters and sends to APU
  • APU Linux application (client)
    • Receives performance counters from RPU1 and prints to UART0




Design Components


This module requires the following components:
  • petalinux_bsp
  • perfapm-server
  • perfapm-client-test


Build Flow Tutorials


This tutorial uses both XSDK and PetaLinux tools. It is recommended to use separate shells for each of the tools.

Perfapm-server Application


The performance monitor server application perfapm-server is a bare-metal application that executes on RPU-1. The firmware binary is loaded by the APU master at the end of the Linux boot process. RPU-1 and APU establish a communication channel using the OpenAMP framework. RPU-1 gathers performance data like memory throughput from the PS AXI performance monitor (APM) units and sends it across to the APU where the data is received by the perfapm-client library and then visualized on a plotted graph.
  • Create a new XSDK workspace.

    % cd $TRD_HOME/workspaces/ws_perfapm-server
    % xsdk -workspace . &
  • Click 'Import Project' from the welcome screen, browse to the current working directory and make sure the perfapm, perfapm-server, perfapm_bsp, and hw_platform_0 projects are selected. Click 'Finish'.
  • Right-click on the perfapm-server project and select 'Build Project'.
  • Copy the generated perfapm-server executable to the dm4 SD card directory.

    % mkdir -p $TRD_HOME/sd_card/dm4
    % cp perfapm-server/Debug/perfapm-server.elf $TRD_HOME/sd_card/dm4/

Perfapm-client-test Application (optional step)


The perfapm-client-test application receives performance counter values from RPU-1 and prints them to UART-0. It is by default built as part of the meta-user layer of the PetaLinux BSP. The corresponding yocto recipe and source files are located at $TRD_HOME/petalinux/bsp/project-spec/meta-user/recipes-apps/perfapm-client and the generated binary is located at /usr/bin/perfapm-client-test on the target rootfs.
To build the application outside the PetaLinux BSP, follow the steps below. 

  • Make sure you have sourced the SDX settings64.sh script before executing the below steps. This will add the ARM cross-compile toolchain to your PATH and set the XILINX_SDX environment variable.
  • Copy and extract the source files into a new workspace.

    % mkdir -p $TRD_HOME/workspaces/ws_perfapm-client
    % cd $TRD_HOME/workspaces/ws_perfapm-client
    % cp $TRD_HOME/petalinux/bsp/project-spec/meta-user/recipes-apps/perfapm-client/files/perfapm-client.zip .
    % unzip perfapm-client.zip
    % mkdir build work
  • Configure the project using cmake and generate eclipse project files. Build the project using make from the command line.  

  • Source the PetaLinux SDK environment setup script which sets the SDKTARGETSYSROOT environment variable which contains the target and host sysroot for building this application. This requires to complete the PetaLinux SDK installation step as described in Design Module 5.
    % cd build
    % CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ \
      cmake -G"Eclipse CDT4 - Unix Makefiles" -DCMAKE_ECLIPSE_EXECUTABLE=${XILINX_SDX}/eclipse/lnx64.o/eclipse \
      ../src
    % make -j
  • Alternatively you can build the project through the XSDK GUI.

    % cd ../work
    % xsdk -workspace . &
  • Click 'Import Project' from the welcome screen, browse to the $TRD_HOME/workspaces/ws_perfapm-client/build directory and make sure the listed project is selected. Click 'Finish'. 
  • Right-click the project and select 'Build Project'.
  • Copy the generated perfapm-client-test executable to the dm4 SD card directory.

    % cp $TRD_HOME/workspaces/ws_perfapm-client/build/perfapm-client-test/perfapm-client-test $TRD_HOME/sd_card/dm4

PetaLinux BSP


This tutorial shows how to build the Linux image and boot image using the PetaLinux build tool. This step assumes you have run through the PetaLinux config in DM1 previously.
  • Select the device-tree matching design module 4 and build all Linux image components. If you have run petalinux-build in a previous module, the build step will be incremental.

    % cd $TRD_HOME/petalinux/bsp/project-spec/meta-user/recipes-bsp/device-tree/files/
    % cp zcu102-base-dm4.dtsi system-user.dtsi
    % petalinux-build
  • Create a boot image

    % cd $TRD_HOME/petalinux/bsp/images/linux
    % petalinux-package --boot --bif=../../project-spec/boot/dm4.bif --force
  • Copy the generated images to the dm4 SD card directory

    % cp BOOT.BIN image.ub $TRD_HOME/sd_card/dm4



Run Flow Tutorial

  • See here for board setup instructions.
  • Copy all the files from the $TRD_HOME/sd_card/dm4 SD card directory to a FAT formatted SD card.
  • Power on the board to boot the images; make sure all power rail LEDs are lit green (Note: DS1 / FPGA_INIT_B LED remains Red as there is no bit stream to configure the FPGA).
  • Run the perfapm-client-test application:

    % perfapm-client-test
  • Below is a sample output of the application on the serial console:

    |----------------------------------------------------------------------|
    |                      Performance Monitor APP                         |
    |----------------------------------------------------------------------|
    |Slot                |Write Byte Cnt |Read Byte Cnt |Total RW Byte Cnt |
    |----------------------------------------------------------------------|
    |DDR Slot1           |         62614 |       231056 |           293670 |
    |DDR Slot2           |         70966 |       327328 |           398294 |
    |DDR Slot3           |             0 |    994784128 |        994784128 |
    |DDR Slot4           |             0 |            0 |                0 |
    |DDR Slot5           |             0 |            0 |                0 |
    |OCM APM             |            64 |            0 |               64 |
    |LPD_FPD             |          1472 |        69728 |            71200 |
    |----------------------------------------------------------------------|
    DDRAPM_SLOT_DP+HP0     throughput = 7.958273 gigabits/sec
    DDRAPM_SLOT_HP1+HP2    throughput = 0.000000 gigabits/sec
    DDRAPM_SLOT_HP3+FPDDMA throughput = 0.000000 gigabits/sec


Next Steps

© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy