samples/subsys/ipc/openamp_rsc_table/README.html · samples/subsys/ipc/openamp_rsc_table/README.rst 공식 원문 ↗

Zephyr 3.7.0 · Linux · Zephyr · RPMsg

OpenAMP resource table

RPMsg channel 생성부터 client echo와 TTY endpoint 왕복까지 두 console에서 추적합니다.

Official pathsamples/subsys/ipc/openamp_rsc_table/README.html
Source filesamples/subsys/ipc/openamp_rsc_table/README.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

Linux module·Zephyr responder·rpmsg TTY의 5개 exact command/output block을 보존합니다.

Host

Linux main processor

Remote

Zephyr co-processor

Interfaces

rpmsg client · TTY

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 99978158BF37E6EABF1CEF1F21CE4E4EE1628AC8DA73DBA03E53192DEAC93DB4
.. zephyr:code-sample:: openamp-rsc-table
   :name: OpenAMP using resource table
   :relevant-api: ipm_interface

   Send messages between two cores using OpenAMP and a 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

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

Linux setup
===========

Enable ``SAMPLE_RPMSG_CLIENT`` configuration to build the :file:`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.

.. code-block:: console

   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.

.. code-block:: console

   *** 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 :samp:`TTY {<addr>}:` 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

Zephyr console
==============

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

.. code-block:: console

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

Part 3

한국어 전문 번역

개요

Resource table을 기반으로 Zephyr에서 OpenAMP를 사용하는 application입니다. Linux main processor와 Zephyr co-processor가 함께 있는 platform을 대상으로 하며, Linux rpmsg_client_sample과 rpmsg_tty driver에 응답합니다. Resource table은 Linux remoteproc/rpmsg 쪽이 필요한 shared-memory와 virtio resource 정보를 발견하도록 연결합니다.

Application 빌드

Zephyr

공식 문서의 board가 지정되지 않은 test command는 렌더링 결과의 -b None까지 그대로 보존합니다. 실제 사용 시에는 platform 통합에서 정한 board와 resource-table 배치를 사용해야 합니다.

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

Client sample 실행

Linux 설정

Kernel configuration에서 SAMPLE_RPMSG_CLIENT를 enable해 rpmsg_client_sample.ko module을 build합니다.

Zephyr 설정

Minicom이나 PuTTY 같은 serial terminal을 열고 board의 기본 serial-port 설정으로 연결합니다.

Linux console

Linux shell에서 rpmsg_client_sample module을 kernel에 삽입합니다. 즉시 channel 생성, 1부터 100까지의 incoming message, goodbye, channel 파괴와 driver 제거 log가 표시됩니다. Source address는 0x400이고 새 channel은 0x401 -> 0x400으로 보고됩니다.

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

Zephyr는 받은 message마다 내용을 출력한 뒤 Linux로 다시 보냅니다. Linux sample-client responder와 TTY responder가 함께 시작되며, client 흐름은 100번째 hello world! 뒤 종료됩니다.

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

rpmsg TTY demo 실행

Linux 설정

Linux kernel configuration에서 RPMSG_TTY를 enable합니다.

Zephyr 설정

Serial terminal을 board의 기본 serial-port 설정으로 연결합니다.

Linux console

Sample 초기화 때 생성된 rpmsg-tty endpoint의 /dev/ttyRPMSG0를 읽고 Hello Zephyr를 씁니다. Zephyr 응답에는 TTY <addr>: prefix가 붙으며, 여기서 address 0x0401은 Zephyr rpmsg-tty endpoint address입니다.

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

Zephyr console

Zephyr console은 받은 TTY message를 표시한 뒤 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

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.