Build Linux Userspace RPMsg Demo Applications Using PetaLinux Tools - 2023.2 English

Libmetal and OpenAMP User Guide (UG1186)

Document ID
UG1186
Release Date
2023-11-07
Version
2023.2 English

Before using PetaLinux tools, follow these preparatory steps:

  1. Create the PetaLinux master project in a suitable directory without any spaces. In this guide it is named <plnx_proj>:
    $ petalinux-create -t project -s <PATH_TO_PETALINUX_ZYNQMP_PROJECT_BSP>
  2. Navigate to the directory:
    $ cd <plnx_proj>
  3. Start the rootfs configuration utility:
    $ petalinux-config -c rootfs
  4. Enable the required rootfs packages for this demo:
    Filesystem Packages --->
    
    misc --->
    
    packagegroup-petalinux-openamp --->
    
    [*] packagegroup-petalinux-openamp
    Note: packagegroup-petalinux-openamp enables many openamp related sub-components. If you want to enable only the components needed here, do not set this packagegroup. Instead, enable the following individual components:
    open-amp, open-amp-demos, libmetal
  5. Setting Device Tree for the Linux Userspace RPMsg Application Demo:

The OpenAMP demo detailed below demo uses Userspace I/O (UIO) devices for IPI and shared memory.

Copy the following to <plnx-proj-root>/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi in the PetaLinux project and modify as needed.

DTS entry for zynqmp platform:

/ {
reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
rpu0vdev0vring0: rpu0vdev0vring0@3ed40000 {
no-map;
reg = <0x0 0x3ed40000 0x0 0x4000>;
};
rpu0vdev0vring1: rpu0vdev0vring1@3ed44000 {
no-map;
reg = <0x0 0x3ed44000 0x0 0x4000>;
};
rpu0vdev0buffer: rpu0vdev0buffer@3ed48000 {
no-map;
reg = <0x0 0x3ed48000 0x0 0x100000>;
};
rproc_0_reserved: rproc@3ed00000 {
no-map;
reg = <0x0 0x3ed00000 0x0 0x40000>;
};
};

tcm_0a: tcm_0a@ffe00000 {
no-map;
reg = <0x0 0xffe00000 0x0 0x10000>;
status = 'okay';
compatible = 'mmio-sram';
power-domain = <&zynqmp_firmware 15>;
};

tcm_0b: tcm_0b@ffe20000 {
no-map;
reg = <0x0 0xffe20000 0x0 0x10000>;
status = 'okay';
compatible = 'mmio-sram';
power-domain = <&zynqmp_firmware 16>;
};

rf5ss@ff9a0000 {
compatible = 'xlnx,zynqmp-r5-remoteproc';
xlnx,cluster-mode = <1>;
ranges;
reg = <0x0 0xFF9A0000 0x0 0x10000>;
#address-cells = <0x2>;
#size-cells = <0x2>;

r5f_0: r5f@0 {
compatible = 'xilinx,r5f';
#address-cells = <2>;
#size-cells = <2>;
ranges;
sram = <&tcm_0a>, <&tcm_0b>;
memory-region = <&rproc_0_reserved>, <&rpu0vdev0buffer>, <&rpu0vdev0vring0>, <&rpu0vdev0vring1>;
power-domain = <&zynqmp_firmware 7>;
};
};
};
/ {
axi {
shm@3ed20000 {
compatible = 'shm';

ipi@ff340000 {
compatible = 'ipi_uio';
reg = <0x0 0xff340000 0x0 0x1000>;
interrupt-parent = <0x5>;
interrupts = <0x0 0x1d 0x4>;
};
};
};

DTS entry for Versal platform:

/ {

reserved-memory {

#address-cells = <2>;

#size-cells = <2>;

ranges;

rproc_0_reserved: rproc@3ed000000 {

no-map;

reg = <0x0 0x3ed00000 0x0 0x1000000>;

};

};

};

&amba {

shm0: shm@0 {

compatible = "shm_uio";

reg = <0x0 0x3ed20000 0x0 0x0100000>;

};

ipi0: ipi@0 {

compatible = "ipi_uio";

reg = <0x0 0xff360000 0x0 0x1000>;

interrupt-parent = <&gic>;

interrupts = <0 33 4>;

};

};

};
Note: As the default APU IPI has been dedicated to PMU FW communication, OpenAMP picked another IP integrator (PL0 IPI) for communication notification.

You can find the source code of the Linux userspace RPMsg applications demos in the following locations: