2.10.10. 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.10.10.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 with the M4F core. However, the Linux RPMsg example will not work with the R5F cores, because the R5F cores loaded the benchmark demo firmware instead of the ipc_echo firmware:
root@am64xx-evm:~# ls -l /lib/firmware
...
lrwxrwxrwx 1 root root 55 Jan 9 2022 am64-main-r5f0_0-fw -> /lib/firmware/mcusdk-benchmark_demo/am64-main-r5f0_0-fw
lrwxrwxrwx 1 root root 55 Jan 9 2022 am64-main-r5f0_1-fw -> /lib/firmware/mcusdk-benchmark_demo/am64-main-r5f0_1-fw
lrwxrwxrwx 1 root root 55 Jan 9 2022 am64-main-r5f1_0-fw -> /lib/firmware/mcusdk-benchmark_demo/am64-main-r5f1_0-fw
lrwxrwxrwx 1 root root 55 Jan 9 2022 am64-main-r5f1_1-fw -> /lib/firmware/mcusdk-benchmark_demo/am64-main-r5f1_1-fw
lrwxrwxrwx 1 root root 72 Jan 9 2022 am64-mcu-m4f0_0-fw -> /lib/firmware/pdk-ipc/ipc_echo_baremetal_test_mcu3_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.10.10.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 AM64x.
rproc_id |
Enumeration ID |
Device Name |
Valid |
Description |
---|---|---|---|---|
0 |
R5F_MCU0_0 |
N/A |
No |
R5F SS in MCU domain |
1 |
R5F_MCU0_1 |
N/A |
No |
R5F SS in MCU domain |
2 |
R5F_MAIN0_0 |
78000000.r5f |
Yes |
R5F Cluster0 Core0 in Main Domain |
3 |
R5F_MAIN0_1 |
78200000.r5f |
Yes |
R5F Cluster0 Core1 in Main Domain |
4 |
R5F_MAIN1_0 |
78400000.r5f |
Yes |
R5F Cluster1 Core0 in Main Domain |
5 |
R5F_MAIN1_1 |
78600000.r5f |
Yes |
R5F Cluster1 Core1 in Main Domain |
6 |
DSP_C66_0 |
N/A |
No |
C66 DSP |
7 |
DSP_C66_1 |
N/A |
No |
C66 DSP |
8 |
DSP_C71_0 |
N/A |
No |
C71 DSP |
9 |
M4F_MCU0_0 |
5000000.m4f |
Yes |
M4F core in MCU Domain |
10 |
DSP_C71_1 |
N/A |
No |
C71 DSP |
Note
The R5F clusters on AM64x can be in either single core or dual core mode. In single core mode enumerations ‘R5F_MAIN0_1 and R5F_MAIN1_1’ are not valid.
For example, to test IPC with R5F_MAIN0_0 (78000000.r5f) after an ipc_echo binary was loaded into the remote core:
root@am64xx-evm:~# rpmsg_char_simple -r 2 -n 3
Created endpt device rpmsg-char-2-1977, fd = 3 port = 1024
Exchanging 3 messages with rpmsg device ti.ipc4.ping-pong on rproc id 2 ...
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-1977
TEST STATUS: PASSED