Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: fixed broken UG link, TOC, formatting

OpenAMP 2019.1

Below is information to complement and clarify UG1186 "Getting Started Guide" for

This page is intended to complement  UG1186 "LibMetal and OpenAMP User Guide"  for Zynq-7000 and Zynq UltraScale+ MPSoC.


Quick try!


Here are the basic steps to boot Linux and run an openamp openAMP application using pre-built images.

e.g for ZCU102:
The echo-test application sends packets from Linux running on quad-core Cortex-A53 to a single cortex-R5 running FreeRTOS which send them back.
  • Extract files BOOT.BIN, image.ub and openamp.dtb files from a pre-built Petalinux BSP tarball to sdcard


    Code Block
    themeMidnight
    host shell$ tar xvf xilinx-zcu102-v2019.1-final.bsp --strip-components=4 --wildcards */BOOT.BIN */image.ub */openamp.dtb
    host shell$ cp BOOT.BIN image.ub openamp.dtb <your sd card>


Note: Alternatively, if you already created a Petalinux project with a provided BSP for your board, pre-built images can also be found under the <your project>/pre-built/linux/images/ directory.
  • Go to u-boot prompt and boot Linux from sdcard


    Code Block
    themeMidnight
    ...
    Hit any key to stop autoboot:  0 
    ZynqMP> mmcinfo && fatload mmc 0 ${netstart} ${kernel_img} &&  fatload mmc 0 0x14000000 openamp.dtb
    Device: sdhci@ff170000
    ...
    reading image.ub
    31514140 bytes read in 2063 ms (14.6 MiB/s)
    reading openamp.dtb
    38320 bytes read in 18 ms (2 MiB/s)
    ZynqMP> bootm $netstart $netstart 0x14000000
    ...


Note: As an alternative to all steps above to sd-boot, you can jtag-boot the board. For this you need to have connected a jtag cable, installed jtag drivers and created a Petalinux project using a provided BSP. You would then go into the <your project>/pre-built/linux/images directory and replace file system.dtb by openamp.dtb, then enter: "petalinux-boot --jtag --prebuilt 3"
  • At Linux login prompt enter 'root' for user and 'root' for password and run echo-test demo


    Code Block
    themeMidnight
    plnx_aarch64 login: root
    Password: 
    root@plnx_aarch64:~# echo image_echo_test > /sys/class/remoteproc/remoteproc0/firmware 
    root@plnx_aarch64:~# echo start > /sys/class/remoteproc/remoteproc0/state   
    [  177.375451] remoteproc remoteproc0: powering up ff9a0100.zynqmp_r5_rproc
    [  177.384705] remoteproc remoteproc0: Booting fw image image_echo_test, size 644144
    [  177.396832] remoteproc remoteproc0: registered virtio0 (type 7)
    [  177.399108] virtio_rpmsg_bus virtio0: rpmsg host is online
    [  177.412370] zynqmp_r5_remoteproc ff9a0100.zynqmp_r5_rproc: RPU boot from TCM.
    [  17Starting application...
    Try to init remoteproc resource
    Init remoteproc resource succeeded
    Waiting for events...
    7.422089] remoteproc remoteproc0: remote processor ff9a0100.zynqmp_r5_rproc is now up
    [  177.442121] virtio_rpmsg_bus virtio0: creating channel rpmsg-openamp-demo-channel addr 0x1
    root@plnx_aarch64:~# echo_test
     Echo test start 
     Open rpmsg dev! 
    


Docs and source code

Documents

  • The following document describes libmetal APIs:
    View file
    namelibmetal-doc-20170418.pdf

URLs to source code


Xilinx Openamp and Libmetal related code

The following location provide access to the code:

Additional examples



ZynqMP Linux Master running on APU with RPMsg in kernel space and 2 RPU slaves.


Enabling Linux Drivers and other packages
Proceed as indicated in UG1186 to enable Linux remoteproc driver support and other openamp packages.

Device tree:
  • Add the folloing to <petalinux project>/project-spec/meta-user/recipes-bsp/device-tree/file/system-user.dtsi
Code Block
themeMidnight
	/include/ "system-conf.dtsi"
/ {
    reserved-memory {
        #address-cells = <2>;
        #size-cells = <2>;
        ranges;
        rproc_0_dma_reserved: rproc@3ed40000{
            no-map;
            compatible = "shared-dma-pool";
            reg = <0x0 0x3ed40000 0x0 0x100000>;
        };
        rproc_0_fw_reserved: rproc@3ed00000 {
            no-map;
            reg = <0x0 0x3ed00000 0x0 0x40000>;
        };
         
        rproc_1_fw_reserved: rproc@3ee00000{
            no-map;
            reg = <0x0 0x3ef00000 0x0 0x40000>;
        };
 
        rproc_1_dma_reserved: rproc@3ee40000 {
            compatible = "shared-dma-pool";
            no-map;
            reg = <0x0 0x3ef40000 0x0 0x100000>; 
        };
    };
 
    zynqmp-rpu {
        compatible = "xlnx,zynqmp-r5-remoteproc-1.0";
        #address-cells = <2>;
        #size-cells = <2>;
        ranges;
        core_conf = "split";
         
        r5_0: r5@0 {
            #address-cells = <2>;
            #size-cells = <2>;
            ranges;
            memory-region = <&rproc_0_fw_reserved>, <&rproc_0_dma_reserved>;
            pnode-id = <0x7>;
            mboxes = <&ipi_mailbox_rpu0 0>, <&ipi_mailbox_rpu0 1>;
            mbox-names = "tx", "rx";
             
            tcm_0_a: tcm_0@0 {
                reg = <0x0 0xFFE00000 0x0 0x10000>;
                pnode-id = <0xf>;
            };
            tcm_0_b: tcm_0@1 {
                reg = <0x0 0xFFE20000 0x0 0x10000>;
                pnode-id = <0x10>;
            };
        };
         
        r5_1: r5@1 {
            #address-cells = <2>;
            #size-cells = <2>;
            ranges;
            memory-region = <&rproc_1_fw_reserved>, <&rproc_1_dma_reserved>;
            pnode-id = <0x8>;
            mboxes = <&ipi_mailbox_rpu1 0>, <&ipi_mailbox_rpu1 1>;
            mbox-names = "tx", "rx";
            r5_1_tcm_a: tcm@ffe90000 {
                reg = <0x0 0xFFE90000 0x0 0x10000>;
                pnode-id = <0x11>;
            };
            r5_1_tcm_b: tcm@ffeb0000 {
                reg = <0x0 0xFFEB0000 0x0 0x10000>;
                pnode-id = <0x12>;
            };
        };
 
    };
 
    zynqmp_ipi1 {
        compatible = "xlnx,zynqmp-ipi-mailbox";
        interrupt-parent = <&gic>;
        interrupts = <0 29 4>;
        xlnx,ipi-id = <7>;
        #address-cells = <1>;
        #size-cells = <1>;
        ranges;
 
        /* APU<->RPU0 IPI mailbox controller */
        ipi_mailbox_rpu0: mailbox@ff90600 {
            reg = <0xff990600 0x20>,
                  <0xff990620 0x20>,
                  <0xff9900c0 0x20>,
                  <0xff9900e0 0x20>;
            reg-names = "local_request_region",
                    "local_response_region",
                    "remote_request_region",
                    "remote_response_region";
            #mbox-cells = <1>;
            xlnx,ipi-id = <1>;
        };
    };
 
    zynqmp_ipi2 {
        compatible = "xlnx,zynqmp-ipi-mailbox";
        interrupt-parent = <&gic>;
        interrupts = <0 30 4>;
        xlnx,ipi-id = <8>;
        #address-cells = <1>;
        #size-cells = <1>;
        ranges;
        /* APU<->RPU1 IPI mailbox controller */
        ipi_mailbox_rpu1: mailbox@ff3f0b00 {
            reg = <0xff3f0b00 0x20>,
                  <0xff3f0b20 0x20>,
                  <0xff3f0940 0x20>,
                  <0xff3f0960 0x20>;
            reg-names = "local_request_region",
                    "local_response_region",
                    "remote_request_region",
                    "remote_response_region";
            #mbox-cells = <1>;
            xlnx,ipi-id = <2>;
        };
    };
     
};
 
*/
&i2c1 {
 
    /* FIXME PL i2c via PCA9306 - u45 */
    /* FIXME MSP430 - u41 - not detected */
    i2c-mux@74 { /* u34 */
        i2c@0 { /* i2c mw 74 0 1 */
            /*
             * IIC_EEPROM 1kB memory which uses 256B blocks
             * where every block has different address.
             *    0 - 256B address 0x54
             * 256B - 512B address 0x55
             * 512B - 768B address 0x56
             * 768B - 1024B address 0x57
             */
            eeprom: eeprom@54 { /* u23 */
                compatible = "atmel,24c08";
                reg = <0x54>;
            };
        };
    };
};
 
 
  • rebuild the device tree

    Code Block
    themeMidnight
    petalinux-build -c device-tree


Building remote processor demo applications with Xilinx SDK:
For RPU 0 (cortex_r5_0)
Proceed as documented in UG1186 to generate remote processor openamp applications with Xilinx SDK.
RPU 0 is also used by default for the pre-built applications provided with Petalinux BSPs.

...

Note: The order in which you start the RPU determines which /dev/rpmsgX device is being used with that RPU.
In the above case /dev/rpmsg0 is used for RPU-0.
If however RPU-1 was started first, it would have been associated with /dev/rpmsg0 and RPU-0 would have been using /dev/rpmsg1.

ZynqMP Linux Master running on APU with RPMsg in userspace and 2 RPU slaves.

  1. Add following device tree content to <petalinux project>/project-spec/meta-user/recipes-bsp/device-tree/file/system-user.dtsi

...

2. Enable the OpenAMP and libmetal packages with "petalinux-config -c rootfs":

Code Block
themeMidnight
Filesystem Packages --->
   libs --->
       libmetal   --->
         [*] libmetal
       open-amp   --->
         [*] open-amp
 
 

...

Code Block
themeMidnight
root@xilinx-zcu102-2019_2:~# linux_proxy_userspace_to_r5_1.elf
metal: info: metal_uio_dev_open: No IRQ for device 3ef00000.vring.
metal: iInitializating I/Os redirection...
nfo: metal_uio_dev_open: No IRQ for device 3ef00000.vring.
metal: info: metal_uio_dev_open: No IRQ for device 3ef40000.shm.
Master> Remote proc resource initialized.
Master> RPMSG channel has created.
Remote>Baremetal Remote Procedure Call (RPC) Demonstration


ZynqMP Linux Master running on APU with RPMsg in kernel space and one RPU slave.

When running with RPU in split mode and only one RPU is an OpenAMP slave, the second RPU can still run another non-openamp application.

  • RPU-0 slave:
    • Petalinux BSPs provide a default template to generate a DTB with support for OpenAMP running on RPU-0, see:
      • <petalinux project>/project-spec/meta-usr/recipes-bsp/device-tree/files/openamp-overlay.dtsi >
    • Add its content to file <petalinux project>/project-spec/meta-user/recipes-bsp/device-tree/file/system-user.dtsi
  • RPU-1 slave:
    • Proceed as for the two RPU configuration above and edit your device tree to remove the unused 'zynmp_r5_rproc' entry and associated nodes (tcm, pd,...) that may not be needed any more.


ZynqMP Linux Master running on APU Linux loads OpenAMP RPU Firmware

Overview

The information below is intended to provide guidance to users who wish to set up a Linux on APU + Bare-metal/RTOS on RPU. This configuration relies on the FSBL to start the software running on the APU, and then APU Linux using remoteproc will load the RPU.

...

  1. copy firmware (.elf file) into project-spec/meta-user/recipes-apps/<app_name>/files/ directory
  2. Modify the project-spec/meta-user/recipes-apps/<app_name>/<app_name>.bb to install the remote processor firmware in the RootFS as follows:


Code Block
themeMidnight
SUMMARY = "Simple test application"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM ="file:${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file:<myfirmware>"
S = "${WORKDIR}"
INSANE_SKIP_${PN} = "arch"
do_install() {
  install -d ${D}/lib/firmware
  install -m 0644 ${S}/<myfirmware> ${D}/lib/firmware/<myfirmware>
}
FILES_${PN} = "/lib/firmware/<myfirmware>
 
 

...

  • Run Linux application
  • Stop firmware

ZynqMP Linux loads RPU, Linux OpenAMP Application talks to RPU OpenAMP Application


Overview

Setting up Remote Firmware

...

Code Block
themeMidnight
echo stop > /sys/class/remoteproc/remoteproc0/state


ZynqMP on APU Linux communicate with RPU via Shared Memory without OpenAMP

Overview

The information below is intended to provide guidance to users who wish to set up a Linux + Bare-metal,RTOS, etc. We make the assumption that the Linux and RPU will communicate via Shared Memory. IPI can be used to further coordinate communication between processors. The use of IPI is documented in the section titled

...