OpenAMP using resource table

Browse source code on GitHub

Overview

This application demonstrates how to use OpenAMP with Zephyr based on a resource table. It is designed to respond to the:

This sample implementation is compatible with platforms that embed a Linux kernel OS on the main processor and a Zephyr application on the co-processor.

Building the application

Zephyr

# From the root of the zephyr repository
west build -b None samples/subsys/ipc/openamp_rsc_table
west build -t test

Running the client sample

Linux setup

Enable SAMPLE_RPMSG_CLIENT configuration to build the rpmsg_client_sample.ko module.

Zephyr setup

Open a serial terminal (minicom, putty, etc.) and connect to the board using default serial port settings.

Linux console

Open a Linux shell (minicom, ssh, etc.) and insert the rpmsg_client_sample module into the Linux Kernel. Right after, logs should be displayed to notify channel creation/destruction and incoming message.

root@linuxshell: insmod rpmsg_client_sample.ko
[   44.625407] rpmsg_client_sample virtio0.rpmsg-client-sample.-1.1024: new channel: 0x401 -> 0x400!
[   44.631401] rpmsg_client_sample virtio0.rpmsg-client-sample.-1.1024: incoming msg 1 (src: 0x400)
[   44.640614] rpmsg_client_sample virtio0.rpmsg-client-sample.-1.1024: incoming msg 2 (src: 0x400)
...
[   45.152269] rpmsg_client_sample virtio0.rpmsg-client-sample.-1.1024: incoming msg 99 (src: 0x400)
[   45.157678] rpmsg_client_sample virtio0.rpmsg-client-sample.-1.1024: incoming msg 100 (src: 0x400)
[   45.158822] rpmsg_client_sample virtio0.rpmsg-client-sample.-1.1024: goodbye!
[   45.159741] virtio_rpmsg_bus virtio0: destroying channel rpmsg-client-sample addr 0x400
[   45.160856] rpmsg_client_sample virtio0.rpmsg-client-sample.-1.1024: rpmsg sample client driver is removed

Zephyr console

For each message received, its content is displayed as shown down below then sent back to Linux.

*** Booting Zephyr OS build zephyr-v#.#.#-####-g########## ***
Starting application threads!

OpenAMP[remote] Linux responder demo started

OpenAMP[remote] Linux sample client responder started

OpenAMP[remote] Linux TTY responder started
[Linux sample client] incoming msg 1: hello world!
[Linux sample client] incoming msg 2: hello world!
...
[Linux sample client] incoming msg 99: hello world!
[Linux sample client] incoming msg 100: hello world!
OpenAMP Linux sample client responder ended

Running the rpmsg TTY demo

Linux setup

Enable RPMSG_TTY in the kernel configuration.

Zephyr setup

Open a serial terminal (minicom, putty, etc.) and connect to the board using default serial port settings.

Linux console

Open a Linux shell (minicom, ssh, etc.) and print the messages coming through the rpmsg-tty endpoint created during the sample initialization. On the Linux console, send a message to Zephyr which answers with the TTY <addr>: prefix. <addr> corresponds to the Zephyr rpmsg-tty endpoint address:

$> cat /dev/ttyRPMSG0 &
$> echo "Hello Zephyr" >/dev/ttyRPMSG0
TTY 0x0401: Hello Zephyr

Zephyr console

On the Zephyr console, the received message is displayed as shown below, then sent back to Linux.

*** Booting Zephyr OS build zephyr-v#.#.#-####-g########## ***
Starting application threads!

OpenAMP[remote] Linux responder demo started

OpenAMP[remote] Linux sample client responder started

OpenAMP[remote] Linux TTY responder started
[Linux TTY] incoming msg: Hello Zephyr

See also

IPM Interface