2.9.13. IPC Example

There are many different ways to implement Inter-Processor Communication (IPC) between Linux and remote cores. The Processor SDK for Linux includes an RPMsg IPC example in the default filesystem. RPMsg allows Linux to send and receive 512-Byte messages to and from remote cores.

For more information about the Linux side of RPMsg, reference the section IPC for AM64x in the Processor SDK Documentation.

For more information about the remote core side of RPMsg, reference the following sections in MCU+ SDK Documentation:

2.9.13.1. Load the Example IPC Binaries

Check to see if the remote core soft links point to the ipc_echo binaries.

On the below board, the M4F core loaded the ipc_echo firmware. That means the Linux RPMsg example will work out-of-the-box with the M4F core.

root@am62xx-evm:/opt/ltp# ls -l /lib/firmware
...
lrwxrwxrwx 1 root root      72 May 21  2022 am62-mcu-m4f0_0-fw -> /lib/firmware/pdk-ipc/ipc_echo_baremetal_test_mcu2_0_release_strip.xer5f

If needed, follow the steps at Booting Remote Cores from the Linux Console or User Space to update the remote core soft links to point to the ipc_echo binaries in /lib/firmware/pdk-ipc. Reboot the board in order to load new binaries onto the remote cores.

2.9.13.2. Run the IPC Echo Example

An RPMsg user space example is prebuilt and included in the default root filesystem (rootfs) under /usr/bin/rpmsg_char_simple. Steps for building the user space example, as well as building a kernel module example, are covered in a later section dev_remote_core_ipc.

Usage: rpmsg_char_simple [-r <rproc_id>] [-n <num_msgs>] [-d <rpmsg_dev_name] [-p <remote_endpt]
        Defaults: rproc_id: 0 num_msgs: 100 rpmsg_dev_name: NULL remote_endpt: 14

All remote processor IDs (rproc_id) are defined in rproc_id.h

The below table lists the device enumerations as defined in the rpmsg_char_library. The table also specifies whether an Enumeration ID is valid on AM62x.

rproc_id

Enumeration ID

Device Name

Valid

Description

9

M4F_MCU0_0

5000000.m4f

Yes

M4F core in MCU Domain

For example, to test IPC with M4F_MCU0_0 (5000000.m4f) after an ipc_echo binary was loaded into the remote core:

root@am62xx-evm:~# rpmsg_char_simple -r 9 -n 3
Created endpt device rpmsg-char-2-1027, fd = 3 port = 1025
Exchanging 3 messages with rpmsg device ti.ipc4.ping-pong on rproc id 9 ...

Sending message #0: hello there 0!
Receiving message #0: hello there 0!
Sending message #1: hello there 1!
Receiving message #1: hello there 1!
Sending message #2: hello there 2!
Receiving message #2: hello there 2!

Communicated 3 messages successfully on rpmsg-char-2-1027

TEST STATUS: PASSED