1.. zephyr:code-sample:: openamp-rsc-table 2 :name: OpenAMP using resource table 3 :relevant-api: ipm_interface 4 5 Send messages between two cores using OpenAMP and a resource table. 6 7Overview 8******** 9 10This application demonstrates how to use OpenAMP with Zephyr based on a resource 11table. It is designed to respond to the: 12 13* `Linux rpmsg client sample <https://elixir.bootlin.com/linux/latest/source/samples/rpmsg/rpmsg_client_sample.c>`_ 14* `Linux rpmsg tty driver <https://elixir.bootlin.com/linux/latest/source/drivers/tty/rpmsg_tty.c>`_ 15 16This sample implementation is compatible with platforms that embed 17a Linux kernel OS on the main processor and a Zephyr application on 18the co-processor. 19 20Building the application 21************************ 22 23Zephyr 24====== 25 26.. zephyr-app-commands:: 27 :zephyr-app: samples/subsys/ipc/openamp_rsc_table 28 :goals: test 29 30Running the client sample 31************************* 32 33Linux setup 34=========== 35 36Enable ``SAMPLE_RPMSG_CLIENT`` configuration to build the :file:`rpmsg_client_sample.ko` module. 37 38Zephyr setup 39============ 40 41Open a serial terminal (minicom, putty, etc.) and connect to the board using default serial port settings. 42 43Linux console 44============= 45 46Open a Linux shell (minicom, ssh, etc.) and insert the ``rpmsg_client_sample`` module into the Linux Kernel. 47Right after, logs should be displayed to notify channel creation/destruction and incoming message. 48 49.. code-block:: console 50 51 root@linuxshell: insmod rpmsg_client_sample.ko 52 [ 44.625407] rpmsg_client_sample virtio0.rpmsg-client-sample.-1.1024: new channel: 0x401 -> 0x400! 53 [ 44.631401] rpmsg_client_sample virtio0.rpmsg-client-sample.-1.1024: incoming msg 1 (src: 0x400) 54 [ 44.640614] rpmsg_client_sample virtio0.rpmsg-client-sample.-1.1024: incoming msg 2 (src: 0x400) 55 ... 56 [ 45.152269] rpmsg_client_sample virtio0.rpmsg-client-sample.-1.1024: incoming msg 99 (src: 0x400) 57 [ 45.157678] rpmsg_client_sample virtio0.rpmsg-client-sample.-1.1024: incoming msg 100 (src: 0x400) 58 [ 45.158822] rpmsg_client_sample virtio0.rpmsg-client-sample.-1.1024: goodbye! 59 [ 45.159741] virtio_rpmsg_bus virtio0: destroying channel rpmsg-client-sample addr 0x400 60 [ 45.160856] rpmsg_client_sample virtio0.rpmsg-client-sample.-1.1024: rpmsg sample client driver is removed 61 62 63Zephyr console 64============== 65 66For each message received, its content is displayed as shown down below then sent back to Linux. 67 68.. code-block:: console 69 70 *** Booting Zephyr OS build zephyr-v#.#.#-####-g########## *** 71 Starting application threads! 72 73 OpenAMP[remote] Linux responder demo started 74 75 OpenAMP[remote] Linux sample client responder started 76 77 OpenAMP[remote] Linux TTY responder started 78 [Linux sample client] incoming msg 1: hello world! 79 [Linux sample client] incoming msg 2: hello world! 80 ... 81 [Linux sample client] incoming msg 99: hello world! 82 [Linux sample client] incoming msg 100: hello world! 83 OpenAMP Linux sample client responder ended 84 85 86Running the rpmsg TTY demo 87************************** 88 89Linux setup 90=========== 91 92Enable ``RPMSG_TTY`` in the kernel configuration. 93 94Zephyr setup 95============ 96 97Open a serial terminal (minicom, putty, etc.) and connect to the board using default serial port settings. 98 99Linux console 100============= 101 102Open a Linux shell (minicom, ssh, etc.) and print the messages coming through the rpmsg-tty endpoint created during the sample initialization. 103On the Linux console, send a message to Zephyr which answers with the :samp:`TTY {<addr>}:` prefix. 104<addr> corresponds to the Zephyr rpmsg-tty endpoint address: 105 106.. code-block:: console 107 108 $> cat /dev/ttyRPMSG0 & 109 $> echo "Hello Zephyr" >/dev/ttyRPMSG0 110 TTY 0x0401: Hello Zephyr 111 112Zephyr console 113============== 114 115On the Zephyr console, the received message is displayed as shown below, then sent back to Linux. 116 117.. code-block:: console 118 119 *** Booting Zephyr OS build zephyr-v#.#.#-####-g########## *** 120 Starting application threads! 121 122 OpenAMP[remote] Linux responder demo started 123 124 OpenAMP[remote] Linux sample client responder started 125 126 OpenAMP[remote] Linux TTY responder started 127 [Linux TTY] incoming msg: Hello Zephyr 128