From 4b6dd2bc228cc0fc90a136707490bd7110ae7321 Mon Sep 17 00:00:00 2001 From: Iuliana Prodan Date: Thu, 12 Sep 2024 19:20:30 +0300 Subject: [PATCH 1/5] examples: zephyr: move sample.yaml out of src/ folder Move sample.yaml file outside of source folder. While here, fix some typos. Signed-off-by: Iuliana Prodan --- examples/zephyr/rpmsg_multi_services/{src => }/sample.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename examples/zephyr/rpmsg_multi_services/{src => }/sample.yaml (87%) diff --git a/examples/zephyr/rpmsg_multi_services/src/sample.yaml b/examples/zephyr/rpmsg_multi_services/sample.yaml similarity index 87% rename from examples/zephyr/rpmsg_multi_services/src/sample.yaml rename to examples/zephyr/rpmsg_multi_services/sample.yaml index aabbcbd..50a21b1 100644 --- a/examples/zephyr/rpmsg_multi_services/src/sample.yaml +++ b/examples/zephyr/rpmsg_multi_services/sample.yaml @@ -1,6 +1,6 @@ sample: description: This app provides an example of how to integrate OpenAMP - with Zephyr in cluding a esource table. + with Zephyr including a resource table. name: OpenAMP with resource table example integration tests: sample.subsys.ipc.openamp_rs_table: From 3e09f05b2831bc2ae3d33ecbea49bf810bf8ec6c Mon Sep 17 00:00:00 2001 From: Iuliana Prodan Date: Thu, 12 Sep 2024 19:31:55 +0300 Subject: [PATCH 2/5] examples: zephyr: remove unneeded files from src/ folder In src/ folder should only be source files, therefore remove the others. Actually all these files (README, CMakeLists and prj.conf) are already in sample's folder, where they belong. Signed-off-by: Iuliana Prodan --- .../rpmsg_multi_services/src/CMakeLists.txt | 19 ---- .../rpmsg_multi_services/src/README.rst | 89 ------------------- .../zephyr/rpmsg_multi_services/src/prj.conf | 10 --- 3 files changed, 118 deletions(-) delete mode 100644 examples/zephyr/rpmsg_multi_services/src/CMakeLists.txt delete mode 100644 examples/zephyr/rpmsg_multi_services/src/README.rst delete mode 100644 examples/zephyr/rpmsg_multi_services/src/prj.conf diff --git a/examples/zephyr/rpmsg_multi_services/src/CMakeLists.txt b/examples/zephyr/rpmsg_multi_services/src/CMakeLists.txt deleted file mode 100644 index 57640da..0000000 --- a/examples/zephyr/rpmsg_multi_services/src/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 3.20.0) -# Copyright (c) 2020 STMicroelectronics -# -# SPDX-License-Identifier: Apache-2.0 -# - -find_package(Zephyr REQUIRED 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 redefined 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) diff --git a/examples/zephyr/rpmsg_multi_services/src/README.rst b/examples/zephyr/rpmsg_multi_services/src/README.rst deleted file mode 100644 index 313ebb1..0000000 --- a/examples/zephyr/rpmsg_multi_services/src/README.rst +++ /dev/null @@ -1,89 +0,0 @@ -.. _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 `_ -* `Linux rpmsg tty driver `_ - -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 " prefix. - corresponds to the Zephyr rpmsg-tty endpoint address: - -.. code-block:: console - - $> cat /dev/ttyRPMSG0 & - $> echo "Hello Zephyr" >/dev/ttyRPMSG0 - TTY 0x0401: Hello Zephyr diff --git a/examples/zephyr/rpmsg_multi_services/src/prj.conf b/examples/zephyr/rpmsg_multi_services/src/prj.conf deleted file mode 100644 index 77a3794..0000000 --- a/examples/zephyr/rpmsg_multi_services/src/prj.conf +++ /dev/null @@ -1,10 +0,0 @@ -CONFIG_KERNEL_BIN_NAME="zephyr_openamp_rsc_table" -CONFIG_PRINTK=n -CONFIG_IPM=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 From 1d1029ae5c881f9c4e3f9a96934c634a7f43d7fd Mon Sep 17 00:00:00 2001 From: Iuliana Prodan Date: Fri, 13 Sep 2024 01:04:31 +0300 Subject: [PATCH 3/5] examples: zephyr: remove arch specific config from project The CONFIG_PLATFORM_SPECIFIC_INIT is bool, so the default value is implicitly n. Therefore, is redundant to set it again. Also, this is arch specific, and it should be no restriction to run the sample on other, non-arm, platforms. Signed-off-by: Iuliana Prodan --- examples/zephyr/rpmsg_multi_services/prj.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/zephyr/rpmsg_multi_services/prj.conf b/examples/zephyr/rpmsg_multi_services/prj.conf index 3bca152..c7bc963 100644 --- a/examples/zephyr/rpmsg_multi_services/prj.conf +++ b/examples/zephyr/rpmsg_multi_services/prj.conf @@ -1,7 +1,6 @@ CONFIG_KERNEL_BIN_NAME="rpmsg_multi_services" CONFIG_PRINTK=n CONFIG_IPM=y -CONFIG_PLATFORM_SPECIFIC_INIT=n CONFIG_MAIN_STACK_SIZE=1024 CONFIG_HEAP_MEM_POOL_SIZE=1024 CONFIG_OPENAMP=y From c3782b302818865135ef1cee048ad06183cbd87b Mon Sep 17 00:00:00 2001 From: Iuliana Prodan Date: Fri, 13 Sep 2024 19:04:01 +0300 Subject: [PATCH 4/5] examples: zephyr: increase stack size While testing rpmsg_multi_services example on HiFi4 DSP from i.MX8M Plus, realized the stack is not enough. Increase the size based on Thread Analyzer measurements: ... openamp_rsc_table: mailbox_notify: mailbox_notify: msg received OpenAMP Linux sample client responder ended Thread analyze: 0x9240d5b0 : STACK: unused 688 usage 1360 / 2048 (66 %); CPU: 0 % : Total CPU cycles used: 25065 0x9240d638 : STACK: unused 704 usage 1344 / 2048 (65 %); CPU: 0 % : Total CPU cycles used: 19662 0x9240d748 : STACK: unused 328 usage 696 / 1024 (67 %); CPU: 0 % : Total CPU cycles used: 1234863 0x9240d7d0 : STACK: unused 272 usage 752 / 1024 (73 %); CPU: 0 % : Total CPU cycles used: 53216 0x9240d858 : STACK: unused 168 usage 856 / 1024 (83 %); CPU: 98 % : Total CPU cycles used: 136995186 0x9240d920 : STACK: unused 936 usage 88 / 1024 (8 %); CPU: 0 % : Total CPU cycles used: 0 ISR0 : STACK: unused 1584 usage 464 / 2048 (22 %) Signed-off-by: Iuliana Prodan --- examples/zephyr/rpmsg_multi_services/src/main_remote.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/zephyr/rpmsg_multi_services/src/main_remote.c b/examples/zephyr/rpmsg_multi_services/src/main_remote.c index c93dc81..3a5052a 100644 --- a/examples/zephyr/rpmsg_multi_services/src/main_remote.c +++ b/examples/zephyr/rpmsg_multi_services/src/main_remote.c @@ -31,14 +31,13 @@ LOG_MODULE_REGISTER(openamp_rsc_table, LOG_LEVEL_DBG); #define SHM_START_ADDR DT_REG_ADDR(SHM_NODE) #define SHM_SIZE DT_REG_SIZE(SHM_NODE) -#define APP_TASK_STACK_SIZE (512) +#define APP_TASK_STACK_SIZE (1024) #define MAX_TTY_EPT 2 #define MAX_RAW_EPT 2 -/* Add 512 extra bytes for the TTY task stack for the "tx_buff" buffer. */ -#define APP_TTY_TASK_STACK_SIZE (1024) -#define APP_RAW_TASK_STACK_SIZE (1024) +#define APP_TTY_TASK_STACK_SIZE (2048) +#define APP_RAW_TASK_STACK_SIZE (2048) K_THREAD_STACK_DEFINE(thread_mng_stack, APP_TASK_STACK_SIZE); K_THREAD_STACK_DEFINE(thread_rp__client_stack, APP_TASK_STACK_SIZE); From bf04d9d61f65f307e71bacc8be457c66dbe68b33 Mon Sep 17 00:00:00 2001 From: Iuliana Prodan Date: Fri, 13 Sep 2024 19:05:40 +0300 Subject: [PATCH 5/5] examples: add support for nxp_adsp_imx8m in rpmsg_multi_services Add the dts and config overlay for nxp_adsp_imx8m board in order to have the rpmsg_multi_services sample working on HiFi4 DSP from i.MX 8M Plus. Signed-off-by: Iuliana Prodan --- .../boards/nxp_adsp_imx8m.conf | 4 ++++ .../boards/nxp_adsp_imx8m.overlay | 24 +++++++++++++++++++ .../zephyr/rpmsg_multi_services/sample.yaml | 1 + 3 files changed, 29 insertions(+) create mode 100644 examples/zephyr/rpmsg_multi_services/boards/nxp_adsp_imx8m.conf create mode 100644 examples/zephyr/rpmsg_multi_services/boards/nxp_adsp_imx8m.overlay diff --git a/examples/zephyr/rpmsg_multi_services/boards/nxp_adsp_imx8m.conf b/examples/zephyr/rpmsg_multi_services/boards/nxp_adsp_imx8m.conf new file mode 100644 index 0000000..1647bfa --- /dev/null +++ b/examples/zephyr/rpmsg_multi_services/boards/nxp_adsp_imx8m.conf @@ -0,0 +1,4 @@ +CONFIG_IPM_IMX_MAX_DATA_SIZE_16=n +CONFIG_IPM_IMX_MAX_DATA_SIZE_4=y +CONFIG_OPENAMP_WITH_DCACHE=y +CONFIG_IPM_IMX_FW_READY_REPLY=y diff --git a/examples/zephyr/rpmsg_multi_services/boards/nxp_adsp_imx8m.overlay b/examples/zephyr/rpmsg_multi_services/boards/nxp_adsp_imx8m.overlay new file mode 100644 index 0000000..56843c4 --- /dev/null +++ b/examples/zephyr/rpmsg_multi_services/boards/nxp_adsp_imx8m.overlay @@ -0,0 +1,24 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + /* + * shared memory reserved for the inter-processor communication + */ + zephyr,ipc_shm = &dspsram3; + zephyr,ipc = &mailbox0; + }; + + dspsram3: memory@942f0000 { + compatible = "mmio-sram"; + reg = <0x942f0000 0x110000>; + }; +}; + +&mailbox0 { + status = "okay"; +}; diff --git a/examples/zephyr/rpmsg_multi_services/sample.yaml b/examples/zephyr/rpmsg_multi_services/sample.yaml index 50a21b1..fa1efa1 100644 --- a/examples/zephyr/rpmsg_multi_services/sample.yaml +++ b/examples/zephyr/rpmsg_multi_services/sample.yaml @@ -8,4 +8,5 @@ tests: platform_allow: stm32mp157c_dk2 platform_allow: qemu_cortex_r5 platform_allow: kv260_r5 + platform_allow: nxp_adsp_imx8m tags: ipm