zephyr/samples/subsys/ipc/openamp_rsc_table
Gerard Marull-Paretas 79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
..
boards
src includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h> 2022-09-05 16:31:47 +02:00
CMakeLists.txt
README.rst
prj.conf
sample.yaml

README.rst

.. _openAMP_rsc_table_sample:

OpenAMP Sample Application using resource table
###############################################

Overview
********

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

* `Linux rpmsg client sample <https://elixir.bootlin.com/linux/latest/source/samples/rpmsg/rpmsg_client_sample.c>`_
* `Linux rpmsg tty driver <https://elixir.bootlin.com/linux/latest/source/drivers/tty/rpmsg_tty.c>`_

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
-------

.. zephyr-app-commands::
   :zephyr-app: samples/subsys/ipc/openamp_rsc_table
   :goals: test

Linux
------

Enable SAMPLE_RPMSG_CLIENT configuration to build and install
the rpmsg_client_sample.ko module on the target.

Running the sample
*******************

Zephyr console
---------------

Open a serial terminal (minicom, putty, etc.) and connect the board with the
following settings:

- Speed: 115200
- Data: 8 bits
- Parity: None
- Stop bits: 1

Reset the board.

Linux console
---------------

Open a Linux shell (minicom, ssh, etc.) and insert a module into the Linux Kernel

.. code-block:: console

   root@linuxshell: insmod rpmsg_client_sample.ko

Result on Zephyr console on boot
--------------------------------

The following message will appear on the corresponding Zephyr console:

.. code-block:: console

   ***** Booting Zephyr OS v#.##.#-####-g########## *****
   Starting application thread!

   OpenAMP demo started
   Remote core received message 1: hello world!
   Remote core received message 2: hello world!
   Remote core received message 3: hello world!
   ...
   Remote core received message 100: hello world!
   OpenAMP demo ended.


rpmsg TTY demo on Linux console
-------------------------------

On the Linux console send a message to Zephyr which answers with the "TTY <add>" prefix.
<addr> corresponds to the Zephyr rpmsg-tty endpoint address:

.. code-block:: console

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