Zynq UltraScale+ MPSoC Base TRD 2020.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 Vitis 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 Vitis workspace.

    % cd $TRD_HOME/workspaces/ws_perfapm-server
    % vitis -workspace . &
  • Click 'Import Project' from the welcome screen, Choose 'Eclipse workspace' and select next.


         

  • Uncheck 'copy projects into workspace', browse to the current working directory and make sure the perfapm, perfapm-server, and perfapm-server_system are selected. Click 'Finish'.       
  • from the top menu tab choose 'File' →  'New platform', enter Project name as 'hw_platform_0' and select 'Next'.

         

  • Choose 'Create from hardware specification (XSA)' and browse to the xsa file in the 'hwfile' directory of 'ws_perfapm-server workspace',
  • Select operating system as 'standalone' and processor as 'psu_cortexr5_1' and click Finish.

             


  • if hw_platform_0 has (Out-of-date) written next to it, first right click on it and select 'Build Project'. application may not build if this step is skipped.
  • double click on 'perfapm.prj' in the Elplorer tab, and click 'Navigate to BSP settings'

         

  • modify BSP settings for Cortexr5_1 processor

   

  • under overview panel enable libraries 'libmetal' and 'openamp'.

     

  • if hw_platform_0 has (Out-of-date) written next to it, first right click on it and select 'Build Project'. perfapm-server system may not build if this step is skipped.
  • Right-click on the perfapm-server system  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 Vitis GUI.

    % cd ../work
    % Vitis -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 boot.scr $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