AM62x MCU+ SDK  09.02.00
IPC RP Message Linux Echo

Introduction

This example shows usage of RP Message APIs to exchange messages between RTOS/NORTOS CPUs as well as exchange message with Linux on Cortex-A CPU.

In this example,

  • We create two RP Message end points
    • One end point to exchange messages with Linux kernel
    • One end point to exchange messages with Linux user space and other RTOS/NORTOS CPUs
  • All cores on startup after driver initialization first wait for Linux to be ready
  • Then they announce the end points on which they are waiting for messages to Linux.
  • This is needed to be done else Linux cannot initiate message exchange with RTOS/NORTOS CPUs.
  • Two tasks are then created which listen for incoming messages and echo it back to the sender. The sender can be Linux CPU or other RTOS/NORTOS CPUs.
  • Meanwhile Linux kernel and user space test applications initiate message exchange with RTOS/NORTOS CPUs and wait for the echoed message.
  • The example also shows a "main" RTOS/NORTOS CPU exchanging message with other RTOS/NORTOS CPUs by sending messages to the same end point as that where LInux sends messages.
  • This shows that all CPUs can exchange messages with each other, no matter which OS or RTOS or NORTOS is running on the sender or receiver CPUs.
  • This example provides support for gracceful shutdown of the remote core (MCU M4F). Refer Graceful shutdown of remote cores from Linux
  • This example provides support for MCU only low power mode support on the MCU core (MCU M4F)

Supported Combinations

Parameter Value
CPU + OS m4fss0-0 freertos
r5fss0-0 freertos
Toolchain ti-arm-clang
Board am62x-sk, am62x-sk-lp, am62x-sip-sk
Example folder examples/drivers/ipc/ipc_rpmsg_echo_linux

Steps to Run the Example

  • When using CCS projects to build, import the system CCS project and build it using the CCS project menu (see Using SDK with CCS Projects). This will build all the dependant CPU projects as well
  • When using makefiles to build, build the system makefile using make command (see Using SDK with Makefiles). This will build all the dependant CPU makefiles as well.
  • To run this demo, Linux needs to run on the Cortex A-core. Refer to Processor SDK Linux user guide to load and run this example.
Attention
As the wake-up R5 is the device manager, it needs to be started by the SBL. So it can not be loaded through CCS. It should be flashed and booted through SBL.

MCU only LPM

Attention
Low power mode is supported only on the Linux SPL boot flow. SBL bootflow does not support low power mode (LPM)

The following steps shows how to run MCU-only low power mode.

  • Set the MCU-M4 as the wake-up source on the linux kernel by running the following command. When the MCU core is set as the wake-up source, suspending the kernel will go to MCU only sleep mode.
$ echo enabled > /sys/bus/platform/devices/5000000.m4fss/power/wakeup
  • Go to MCU only low power mode by running the following command on the linux.
$ echo mem > /sys/power/state
  • After this the following message will appear on the MCU UART.
[IPC RPMSG ECHO] Suspend request to MCU-only mode received
[IPC RPMSG ECHO] Press a sinlge key on this terminal to resume the kernel from MCU only mode
  • Then type any key on the MCU UART to resume the kernel from LPM.
[IPC RPMSG ECHO] Key pressed. Notifying DM to wakeup main domain.
[IPC RPMSG ECHO] Main domain resumed.

See Also

IPC RPMessage

Sample Output

There is no direct output from the RTOS/NORTOS CPUs on the UART or CCS console. The output is seen on the Linux console on Cortex-A CPU.