Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Table of Contents
maxLevel3
outlinetrue
excludeTable of Contents
stylenone



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
Anchor
perfapm-server
perfapm-server


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.

    Code Block
    languagebash
    themeMidnight
    % cd $TRD_HOME/workspaces/ws_perfapm-server
    % vitis -workspace . &


  • Click 'Import Project' from the welcome screen, Choose 'Eclipse workspace' and select next.


    Image Removed         Image Added

  • 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'.
  • Double click on 'perfapm-server_system.sprj' and close the dialog box for platform.

                     Image Removed  Image Added


  • from the top menu tab choose 'File' →  'New platform', enter Project name as 'hw_platform_0' and select 'Next'.

            Image RemovedImage Added

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

Image Removed             Image Added

  • In the System Project Settings tab, Add the new custom platform generated from xsa. Click Yes on the dialog box, when prompted to change the platform.

Image Removed       Image Added

  • double click on 'perfapm-ctl.prj' in the Elplorer tab, and click 'Navigate to BSP settings'

Image Removed         Image Added

  • modify BSP settings for Cortexr5_1 processor

Image Removed   Image Added

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

Image Removed     Image Added

  • Right-click on the perfapm-server system  and select 'Build Project'.


Image Removed                                                    Image Added

  • Copy the generated perfapm-server executable to the dm4 SD card directory.

    Code Block
    themeMidnight
    % 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.

...

  • 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.

    Code Block
    themeMidnight
    % 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.


    Code Block
    languagebash
    themeMidnight
    % 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.

    Code Block
    languagebash
    themeMidnight
    % 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.

    Code Block
    languagebash
    themeMidnight
    % 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.

    Code Block
    languagebash
    themeMidnight
    % 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

    Code Block
    languagebash
    themeMidnight
    % 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

    Code Block
    languagebash
    themeMidnight
    % 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:

    Code Block
    languagebash
    themeMidnight
    % perfapm-client-test


  • Below is a sample output of the application on the serial console:

    Code Block
    languagebash
    themeMidnight
    |----------------------------------------------------------------------|
    |                      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




...