Skip to content

Commit 23254f2

Browse files
doki-nordiccarlescufi
authored andcommitted
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]>
1 parent 28df449 commit 23254f2

17 files changed

+208
-12
lines changed

samples/subsys/ipc/ipc_service/icmsg_me/sample.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.

samples/subsys/ipc/ipc_service/icmsg_me/CMakeLists.txt renamed to samples/subsys/ipc/ipc_service/multi_endpoint/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,3 @@ endif()
1515
project(ipc_service)
1616

1717
target_sources(app PRIVATE src/main.c)
18-
19-
include(ExternalProject)
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
.. _ipc_multi_endpoint_sample:
2+
3+
IPC Service - Multi-endpoint Sample Application
4+
###############################################
5+
6+
This application demonstrates how to use IPC Service with multiple endpoints.
7+
By default, it uses the ``icmsg_me`` backend.
8+
You can also configure it to use the ``icbmsg`` backend.
9+
10+
Building the application for nrf5340dk_nrf5340_cpuapp
11+
*****************************************************
12+
13+
.. zephyr-app-commands::
14+
:zephyr-app: samples/subsys/ipc/ipc_service/multi_endpoint
15+
:board: nrf5340dk_nrf5340_cpuapp
16+
:goals: debug
17+
18+
Open a serial terminal (for example Minicom or PuTTY) and connect the board with the following settings:
19+
20+
* Speed: 115200
21+
* Data: 8 bits
22+
* Parity: None
23+
* Stop bits: 1
24+
25+
After resetting the board, the following message will appear on the corresponding
26+
serial port:
27+
28+
.. code-block:: console
29+
30+
*** Booting Zephyr OS build v3.4.0-rc1-108-gccfbac8b0721 ***
31+
IPC-service HOST [INST 0 - ENDP A] demo started
32+
IPC-service HOST [INST 0 - ENDP B] demo started
33+
IPC-service HOST [INST 1] demo started
34+
HOST [0A]: 1
35+
HOST [0A]: 3
36+
HOST [0B]: 1
37+
HOST [1]: 1
38+
...
39+
HOST [0A]: 99
40+
IPC-service HOST [INST 0 - ENDP A] demo ended.
41+
HOST [0B]: 99
42+
IPC-service HOST [INST 0 - ENDP B] demo ended.
43+
HOST [1]: 99
44+
IPC-service HOST [INST 1] demo ended.
45+
46+
.. code-block:: console
47+
48+
*** Booting Zephyr OS build v3.4.0-rc1-108-gccfbac8b0721 ***
49+
IPC-service REMOTE [INST 0 - ENDP A] demo started
50+
IPC-service REMOTE [INST 0 - ENDP B] demo started
51+
IPC-service REMOTE [INST 1] demo started
52+
REMOTE [0A]: 0
53+
REMOTE [0A]: 2
54+
...
55+
REMOTE [0A]: 98
56+
IPC-service REMOTE [INST 0 - ENDP A] demo ended.
57+
REMOTE [0B]: 98
58+
IPC-service REMOTE [INST 0 - ENDP B] demo ended.
59+
REMOTE [1]: 98
60+
IPC-service REMOTE [INST 1] demo ended.
61+
62+
63+
Changing the backend
64+
********************
65+
66+
To change the backend to ``icbmsg``, switch the devicetree
67+
overlay files as follows:
68+
69+
.. code-block:: console
70+
71+
west build -b nrf5340dk_nrf5340_cpuapp --sysbuild -- \
72+
-DDTC_OVERLAY_FILE=boards/nrf5340dk_nrf5340_cpuapp_icbmsg.overlay \
73+
-Dremote_DTC_OVERLAY_FILE=boards/nrf5340dk_nrf5340_cpunet_icbmsg.overlay
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright (c) 2023 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
chosen {
9+
/delete-property/ zephyr,ipc_shm;
10+
};
11+
12+
reserved-memory {
13+
/delete-node/ memory@20070000;
14+
15+
sram_ipc0_tx: memory@20070000 {
16+
reg = <0x20070000 0x4000>;
17+
};
18+
19+
sram_ipc0_rx: memory@20074000 {
20+
reg = <0x20074000 0x4000>;
21+
};
22+
23+
sram_ipc1_tx: memory@20078000 {
24+
reg = <0x20078000 0x4000>;
25+
};
26+
27+
sram_ipc1_rx: memory@2007C000 {
28+
reg = <0x2007C000 0x4000>;
29+
};
30+
};
31+
32+
ipc {
33+
/delete-node/ ipc0;
34+
35+
ipc0: ipc0 {
36+
compatible = "zephyr,ipc-icbmsg";
37+
tx-region = <&sram_ipc0_tx>;
38+
rx-region = <&sram_ipc0_rx>;
39+
tx-blocks = <16>;
40+
rx-blocks = <24>;
41+
mboxes = <&mbox 0>, <&mbox 1>;
42+
mbox-names = "tx", "rx";
43+
status = "okay";
44+
};
45+
46+
ipc1: ipc1 {
47+
compatible = "zephyr,ipc-icbmsg";
48+
tx-region = <&sram_ipc1_tx>;
49+
rx-region = <&sram_ipc1_rx>;
50+
tx-blocks = <32>;
51+
rx-blocks = <48>;
52+
mboxes = <&mbox 2>, <&mbox 3>;
53+
mbox-names = "tx", "rx";
54+
status = "okay";
55+
};
56+
};
57+
};

samples/subsys/ipc/ipc_service/icmsg_me/prj.conf renamed to samples/subsys/ipc/ipc_service/multi_endpoint/prj.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
CONFIG_PRINTK=y
2+
CONFIG_LOG_PRINTK=n
23

34
CONFIG_IPC_SERVICE=y
45
CONFIG_MBOX=y

0 commit comments

Comments
 (0)