Testing on Hardware - 2023.2 English

Libmetal and OpenAMP User Guide (UG1186)

Document ID
UG1186
Release Date
2023-11-07
Version
2023.2 English
  1. Go to your PetaLinux project:
    $ cd <plnx_proj>
  2. Build the PetaLinux project:
    $ petalinux-build
  3. Boot the RPU firmware built with AMD Vitis™ tools with the SD boot. Following is a BIF file example:
    the_ROM_image:
    
    {
    
    [fsbl_config] a53_x64
    
    [bootloader] <plnx_proj>/images/linux/zynqmp_fsbl.elf
    
    [destination_device=pl] <plnx_proj>/images/linux/system.bit
    
    [destination_cpu=pmu] <plnx_proj>/images/linux/pmufw.elf
    
    [destination_cpu=r5-0] <RPU firmware>
    
    [destination_cpu=a53-0, exception_level=el-3, trustzone] <plnx_proj>/images/linux/arm/bl31.elf
    
    [destination_cpu=a53-0, exception_level=el-2] <plnx_proj>/images/linux/u-boot.elf
    
    }
  4. To ensure that the user-space demo kernel drivers for rpmsg are not loaded, see the following two examples that demonstrate the ways it can be accomplished:
    • Before loading the RPU firmware remove the kernel modules using the following command: rm /lib/modules/6.1.30-xilinx-v2023.2/kernel/drivers/rpmsg/*
    • If the firmware is loaded, check lsmod to list down the modules loaded and use rmmod to remove the respective kernel loadable modules, perform the previous step to remove kernel modules and reload the firmware.
    xilinx-zcu102-20232: lsmod
    
    Module Size Used by
    
    uio_dmem_genirq 16384 0
    
    rpmsg_ctrl 16384 0
    
    rpmsg_char 16384 1 rpmsg_ctrl
    
    virtio_rpmsg_bus 20480 0
    
    rpmsg_ns 16384 1 virtio_rpmsg_bus
    
    rpmsg_core 16384 4 virtio_rpmsg_bus,rpmsg_char,rpmsg_ctrl,rpmsg_ns
    
    zynqmp_r5_remoteproc 20480 0
    
    cfg80211 360448 0
    
    uio_pdrv_genirq 16384 0
    
    zocl 196608 0
    
    
    xilinx-zcu102-20232:/lib/firmware# rmmod rpmsg_ctrl
    
    xilinx-zcu102-20232:/lib/firmware# rmmod rpmsg_char
    
    xilinx-zcu102-20232:/lib/firmware# rmmod virtio_rpmsg_bus
    
    xilinx-zcu102-20232:/lib/firmware# rmmod rpmsg_ns
    
    xilinx-zcu102-20232:/lib/firmware# rmmod rpmsg_core
    
  5. On the APU Linux target console, run the demo applications rpmsg-echo-ping-shared , matrix_multiply-shared , and rpc_demod-shared . This process produces output similar to the following:
    root@xilinx-zcu102-2019_1:~# rpmsg-echo-ping-shared
    
    metal: info:      metal_uio_dev_open: No IRQ for device 3ed20000.shm.
    
    Successfulinitializing rpmsg vdev
    
    Try to create rpmsg endpoint.
    
    Successfully created rpmsg endpoint.
    
    ly open shm device.
    
    Successfully added shared memory
    
    Successfully probed IPI device
    
    Successfully initialized Linux r5 remoteproc.
    
    Successfully initialized remoteproc
    
    Calling mmap resource table.
    
    Successfully mmap resource table.
    
    Successfully set resource table to remoteproc.
    
    Creating virtio...
    
    Successfully created virtio device.
    
    initializing rpmsg vdev
    
    echo test: sent : 488
    
    received payload number 471 of size 488
    
    **********************************
    
    Test Results: Error count = 0
    
    **********************************
    
    Quitting application .. Echo test end
    
    rpmsg_channel_deleted
    
    WARNING rx_vq: freeing non-empty virtqueue
    
    WARNING tx_vq: freeing non-empty virtqueue
    
    root@Xilinx-ZCU102-2019_1:~#
    
    # matrix_multiply-shared
    
    ...
    
    CLIENT> Matrix multiply: sent : 296
    
    CLIENT> Quitting application .. Matrix multiplication end
    
    CLIENT> **********************************
    
    CLIENT> Test Results: Error count = 0
    
    CLIENT> **********************************
    
    CLIENT> rpmsg_channel_deleted
    
    WARNING rx_vq: freeing non-empty virtqueue
    
    WARNING tx_vq: freeing non-empty virtqueue
    
    root@Xilinx-ZCU102-2019_1:~#
    
    # rpc_demod-shared
    
    login[1900]: root login on 'ttyPS0'
    
    root@Xilinx-ZCU102-2019_1:~# proxy_app-openamp
    
    ...
    
    Master> Remote proc resource initialized.
    
    Master> RPMSG channel has created.
    
    Remote>FreeRTOS Remote Procedure Call (RPC) Demonstration
    
    Remote>***************************************************
    
    Remote>Rpmsg based retargetting to proxy initialized..
    
    Remote>FileIO demo ..
    
    Remote>Creating a file on master and writing to it..
    
    … …
    
    Remote>Repeat demo ? (enter yes or no)
    
    no
    
    Remote>RPC retargetting quitting ...
    
    Remote> Firmware's rpmsg-openamp-demo-channel going down!
    
    Master>
    
    RPC service exiting !!
    
    Master> sending shutdown signal.
    
    WARNING rx_vq: freeing non-empty virtqueue
    
    WARNING tx_vq: freeing non-empty virtqueue
    
    root@Xilinx-ZCU102-2019_1:~#