-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
samples: add openamp sample relying on resource table
This sample is designed to respond to the Linux rpmsg sample client. It should be platform independent and based on the the integration of a resource table in the elf file. Signed-off-by: Arnaud Pouliquen <[email protected]>
- Loading branch information
Showing
7 changed files
with
443 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
cmake_minimum_required(VERSION 3.13.1) | ||
# Copyright (c) 2020 STMicroelectronics | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) | ||
|
||
project(openamp_rsc_table_remote) | ||
|
||
# METAL_MAX_DEVICE_REGIONS is used to give the number of memory regions shared | ||
# between processors. By default only one region is defined for the vrings | ||
# and rpmsg buffers. The METAL_MAX_DEVICE_REGIONS has to be redifined to add a | ||
# second region for the resource table. | ||
zephyr_compile_definitions(METAL_MAX_DEVICE_REGIONS=2) | ||
|
||
target_include_directories(app PRIVATE ${LIBMETAL_INCLUDE_DIR} ${OPENAMP_INCLUDE_DIR} ${PLATFORM_DIR}) | ||
|
||
target_sources(app PRIVATE src/main_remote.c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Private config options for openamp sample app | ||
|
||
# Copyright (c) 2020 STMicroelectronics | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Workaround for not being able to have commas in macro arguments | ||
DT_CHOSEN_Z_IPC := zephyr,ipc | ||
|
||
config OPENAMP_IPC_DEV_NAME | ||
string | ||
default "$(dt_chosen_label,$(DT_CHOSEN_Z_IPC))" | ||
help | ||
This option specifies the device name for the IPC device to be used | ||
|
||
source "Kconfig.zephyr" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
.. _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>`_. | ||
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 | ||
------------------------- | ||
|
||
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. |
24 changes: 24 additions & 0 deletions
24
samples/subsys/ipc/openamp_rsc_table/boards/stm32mp157c_dk2.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright (c) 2020, STMICROLECTRONICS | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/ { | ||
chosen { | ||
/* | ||
* shared memory reserved for the inter-processor communication | ||
*/ | ||
zephyr,ipc_shm = &mcusram3; | ||
zephyr,ipc = &mailbox; | ||
}; | ||
|
||
mcusram3: memory1@10040000 { | ||
compatible = "mmio-sram"; | ||
reg = <0x10040000 DT_SIZE_K(64)>; | ||
}; | ||
}; | ||
|
||
&mcusram { | ||
reg = <0x10000000 DT_SIZE_K(256)>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CONFIG_KERNEL_BIN_NAME="zephyr_openamp_rsc_table" | ||
CONFIG_PRINTK=n | ||
CONFIG_IPM=y | ||
CONFIG_IPM_MCUX=y | ||
CONFIG_PLATFORM_SPECIFIC_INIT=n | ||
CONFIG_MAIN_STACK_SIZE=1024 | ||
CONFIG_HEAP_MEM_POOL_SIZE=1024 | ||
CONFIG_OPENAMP=y | ||
CONFIG_OPENAMP_RSC_TABLE_NUM_RPMSG_BUFF=8 | ||
CONFIG_OPENAMP_RSC_TABLE=y | ||
CONFIG_OPENAMP_MASTER=n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
sample: | ||
description: This app provides an example of how to integrate OpenAMP | ||
with Zephyr in cluding a esource table. | ||
name: OpenAMP with resource table example integration | ||
tests: | ||
sample.subsys.ipc.openamp_rs_table: | ||
build_only: true | ||
platform_whitelist: stm32mp157c_dk2 | ||
tags: ipm |
Oops, something went wrong.