-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
samples: ipc: Modify icmsg_me sample allowing any multiendpoint backend
There are more ipc_service backends that supports multiple endpoint. This sample can be used for any of those backends, so this commits makes the sample more generic. The default backend it still icmsg_me, but now, the sample has files and instructions for icmsg_with_buf backend. Signed-off-by: Dominik Kilian <[email protected]>
- Loading branch information
1 parent
28df449
commit 23254f2
Showing
17 changed files
with
208 additions
and
12 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -15,5 +15,3 @@ endif() | |
project(ipc_service) | ||
|
||
target_sources(app PRIVATE src/main.c) | ||
|
||
include(ExternalProject) |
File renamed without changes.
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,73 @@ | ||
.. _ipc_multi_endpoint_sample: | ||
|
||
IPC Service - Multi-endpoint Sample Application | ||
############################################### | ||
|
||
This application demonstrates how to use IPC Service with multiple endpoints. | ||
By default, it uses the ``icmsg_me`` backend. | ||
You can also configure it to use the ``icbmsg`` backend. | ||
|
||
Building the application for nrf5340dk_nrf5340_cpuapp | ||
***************************************************** | ||
|
||
.. zephyr-app-commands:: | ||
:zephyr-app: samples/subsys/ipc/ipc_service/multi_endpoint | ||
:board: nrf5340dk_nrf5340_cpuapp | ||
:goals: debug | ||
|
||
Open a serial terminal (for example Minicom or PuTTY) and connect the board with the following settings: | ||
|
||
* Speed: 115200 | ||
* Data: 8 bits | ||
* Parity: None | ||
* Stop bits: 1 | ||
|
||
After resetting the board, the following message will appear on the corresponding | ||
serial port: | ||
|
||
.. code-block:: console | ||
*** Booting Zephyr OS build v3.4.0-rc1-108-gccfbac8b0721 *** | ||
IPC-service HOST [INST 0 - ENDP A] demo started | ||
IPC-service HOST [INST 0 - ENDP B] demo started | ||
IPC-service HOST [INST 1] demo started | ||
HOST [0A]: 1 | ||
HOST [0A]: 3 | ||
HOST [0B]: 1 | ||
HOST [1]: 1 | ||
... | ||
HOST [0A]: 99 | ||
IPC-service HOST [INST 0 - ENDP A] demo ended. | ||
HOST [0B]: 99 | ||
IPC-service HOST [INST 0 - ENDP B] demo ended. | ||
HOST [1]: 99 | ||
IPC-service HOST [INST 1] demo ended. | ||
.. code-block:: console | ||
*** Booting Zephyr OS build v3.4.0-rc1-108-gccfbac8b0721 *** | ||
IPC-service REMOTE [INST 0 - ENDP A] demo started | ||
IPC-service REMOTE [INST 0 - ENDP B] demo started | ||
IPC-service REMOTE [INST 1] demo started | ||
REMOTE [0A]: 0 | ||
REMOTE [0A]: 2 | ||
... | ||
REMOTE [0A]: 98 | ||
IPC-service REMOTE [INST 0 - ENDP A] demo ended. | ||
REMOTE [0B]: 98 | ||
IPC-service REMOTE [INST 0 - ENDP B] demo ended. | ||
REMOTE [1]: 98 | ||
IPC-service REMOTE [INST 1] demo ended. | ||
Changing the backend | ||
******************** | ||
|
||
To change the backend to ``icbmsg``, switch the devicetree | ||
overlay files as follows: | ||
|
||
.. code-block:: console | ||
west build -b nrf5340dk_nrf5340_cpuapp --sysbuild -- \ | ||
-DDTC_OVERLAY_FILE=boards/nrf5340dk_nrf5340_cpuapp_icbmsg.overlay \ | ||
-Dremote_DTC_OVERLAY_FILE=boards/nrf5340dk_nrf5340_cpunet_icbmsg.overlay |
File renamed without changes.
File renamed without changes.
57 changes: 57 additions & 0 deletions
57
samples/subsys/ipc/ipc_service/multi_endpoint/boards/nrf5340dk_nrf5340_cpuapp_icbmsg.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,57 @@ | ||
/* | ||
* Copyright (c) 2023 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/ { | ||
chosen { | ||
/delete-property/ zephyr,ipc_shm; | ||
}; | ||
|
||
reserved-memory { | ||
/delete-node/ memory@20070000; | ||
|
||
sram_ipc0_tx: memory@20070000 { | ||
reg = <0x20070000 0x4000>; | ||
}; | ||
|
||
sram_ipc0_rx: memory@20074000 { | ||
reg = <0x20074000 0x4000>; | ||
}; | ||
|
||
sram_ipc1_tx: memory@20078000 { | ||
reg = <0x20078000 0x4000>; | ||
}; | ||
|
||
sram_ipc1_rx: memory@2007C000 { | ||
reg = <0x2007C000 0x4000>; | ||
}; | ||
}; | ||
|
||
ipc { | ||
/delete-node/ ipc0; | ||
|
||
ipc0: ipc0 { | ||
compatible = "zephyr,ipc-icbmsg"; | ||
tx-region = <&sram_ipc0_tx>; | ||
rx-region = <&sram_ipc0_rx>; | ||
tx-blocks = <16>; | ||
rx-blocks = <24>; | ||
mboxes = <&mbox 0>, <&mbox 1>; | ||
mbox-names = "tx", "rx"; | ||
status = "okay"; | ||
}; | ||
|
||
ipc1: ipc1 { | ||
compatible = "zephyr,ipc-icbmsg"; | ||
tx-region = <&sram_ipc1_tx>; | ||
rx-region = <&sram_ipc1_rx>; | ||
tx-blocks = <32>; | ||
rx-blocks = <48>; | ||
mboxes = <&mbox 2>, <&mbox 3>; | ||
mbox-names = "tx", "rx"; | ||
status = "okay"; | ||
}; | ||
}; | ||
}; |
1 change: 1 addition & 0 deletions
1
.../subsys/ipc/ipc_service/icmsg_me/prj.conf → ...s/ipc/ipc_service/multi_endpoint/prj.conf
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
CONFIG_PRINTK=y | ||
CONFIG_LOG_PRINTK=n | ||
|
||
CONFIG_IPC_SERVICE=y | ||
CONFIG_MBOX=y | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
57 changes: 57 additions & 0 deletions
57
...bsys/ipc/ipc_service/multi_endpoint/remote/boards/nrf5340dk_nrf5340_cpunet_icbmsg.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,57 @@ | ||
/* | ||
* Copyright (c) 2023 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/ { | ||
chosen { | ||
/delete-property/ zephyr,ipc_shm; | ||
}; | ||
|
||
reserved-memory { | ||
/delete-node/ memory@20070000; | ||
|
||
sram_ipc0_rx: memory@20070000 { | ||
reg = <0x20070000 0x4000>; | ||
}; | ||
|
||
sram_ipc0_tx: memory@20074000 { | ||
reg = <0x20074000 0x4000>; | ||
}; | ||
|
||
sram_ipc1_rx: memory@20078000 { | ||
reg = <0x20078000 0x4000>; | ||
}; | ||
|
||
sram_ipc1_tx: memory@2007C000 { | ||
reg = <0x2007C000 0x4000>; | ||
}; | ||
}; | ||
|
||
ipc { | ||
/delete-node/ ipc0; | ||
|
||
ipc0: ipc0 { | ||
compatible = "zephyr,ipc-icbmsg"; | ||
tx-region = <&sram_ipc0_tx>; | ||
rx-region = <&sram_ipc0_rx>; | ||
tx-blocks = <24>; | ||
rx-blocks = <16>; | ||
mboxes = <&mbox 0>, <&mbox 1>; | ||
mbox-names = "rx", "tx"; | ||
status = "okay"; | ||
}; | ||
|
||
ipc1: ipc1 { | ||
compatible = "zephyr,ipc-icbmsg"; | ||
tx-region = <&sram_ipc1_tx>; | ||
rx-region = <&sram_ipc1_rx>; | ||
tx-blocks = <48>; | ||
rx-blocks = <32>; | ||
mboxes = <&mbox 2>, <&mbox 3>; | ||
mbox-names = "rx", "tx"; | ||
status = "okay"; | ||
}; | ||
}; | ||
}; |
1 change: 1 addition & 0 deletions
1
.../ipc/ipc_service/icmsg_me/remote/prj.conf → ...pc_service/multi_endpoint/remote/prj.conf
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
CONFIG_PRINTK=y | ||
CONFIG_LOG_PRINTK=n | ||
|
||
CONFIG_IPC_SERVICE=y | ||
CONFIG_MBOX=y | ||
|
File renamed without changes.
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 @@ | ||
sample: | ||
name: IPC Service example integration (icmsg multi endpoint backend) | ||
tests: | ||
sample.ipc.multi_endpoint: | ||
platform_allow: nrf5340dk_nrf5340_cpuapp | ||
integration_platforms: | ||
- nrf5340dk_nrf5340_cpuapp | ||
tags: ipc | ||
sysbuild: true | ||
harness: remote | ||
sample.ipc.multi_endpoint.icbmsg: | ||
platform_allow: nrf5340dk_nrf5340_cpuapp | ||
integration_platforms: | ||
- nrf5340dk_nrf5340_cpuapp | ||
tags: ipc | ||
sysbuild: true | ||
extra_args: | ||
DTC_OVERLAY_FILE=boards/nrf5340dk_nrf5340_cpuapp_icbmsg.overlay | ||
remote_DTC_OVERLAY_FILE=boards/nrf5340dk_nrf5340_cpunet_icbmsg.overlay |
File renamed without changes.
File renamed without changes.