Skip to content

Commit 670f345

Browse files
committed
tests: ipc: ipc_sessions: Implementation
Implementation of the test that focuses on session management in IPC. Mainly restoring connections after disconnection. Signed-off-by: Radoslaw Koppel <[email protected]>
1 parent 313531d commit 670f345

20 files changed

+987
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright 2021 Google LLC
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
cmake_minimum_required(VERSION 3.20.0)
5+
6+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
7+
project(ipc_service)
8+
9+
zephyr_include_directories(./common)
10+
11+
FILE(GLOB app_sources src/*.c)
12+
target_sources(app PRIVATE ${app_sources})
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#
2+
# Copyright (c) 2024 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
menu "Zephyr"
8+
source "Kconfig.zephyr"
9+
endmenu
10+
11+
config IPC_TEST_MSG_HEAP_SIZE
12+
int "The heap to copy processed messages"
13+
default 512
14+
help
15+
Internal heap where all the message data would be copied to be processed
16+
linearry in tests.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#
2+
# Copyright (c) 2024 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
source "${ZEPHYR_BASE}/share/sysbuild/Kconfig"
8+
9+
config REMOTE_BOARD
10+
string "The board used for remote target"
11+
default "nrf5340dk/nrf5340/cpunet" if BOARD_NRF5340DK_NRF5340_CPUAPP
12+
default "nrf5340dk/nrf5340/cpunet" if BOARD_NRF5340DK_NRF5340_CPUAPP_NS
13+
default "nrf54h20dk/nrf54h20/cpuppr" if BOARD_NRF54H20DK_NRF54H20_CPUAPP
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#
2+
# Copyright (c) 2024 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
CONFIG_SOC_NRF53_CPUNET_ENABLE=y
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (c) 2022 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
/delete-node/ &ipc0;
8+
9+
/ {
10+
chosen {
11+
/delete-property/ zephyr,ipc_shm;
12+
/delete-property/ zephyr,bt-hci;
13+
};
14+
15+
reserved-memory {
16+
/delete-node/ memory@20070000;
17+
18+
sram_tx: memory@20070000 {
19+
reg = <0x20070000 0x8000>;
20+
};
21+
22+
sram_rx: memory@20078000 {
23+
reg = <0x20078000 0x8000>;
24+
};
25+
};
26+
27+
ipc0: ipc0 {
28+
compatible = "zephyr,ipc-icmsg";
29+
tx-region = <&sram_tx>;
30+
rx-region = <&sram_rx>;
31+
mboxes = <&mbox 0>, <&mbox 1>;
32+
mbox-names = "tx", "rx";
33+
dcache-alignment = <8>;
34+
unbound = "detect";
35+
status = "okay";
36+
};
37+
};
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor ASA
3+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
4+
*/
5+
6+
/* Replace default ipc0 instance */
7+
/delete-node/ &ipc0;
8+
9+
ipc0: &cpuapp_cpuppr_ipc {
10+
status = "okay";
11+
unbound = "detect";
12+
};
13+
14+
&cpuppr_vevif {
15+
status = "okay";
16+
};
17+
18+
&cpuapp_bellboard {
19+
status = "okay";
20+
};
21+
22+
/ {
23+
chosen {
24+
/delete-property/ zephyr,bt-hci;
25+
};
26+
};
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
#ifndef TEST_COMMANDS_H
7+
#include <stdint.h>
8+
9+
/**
10+
* @brief Test commands executable by remote
11+
*/
12+
enum ipc_test_commands {
13+
IPC_TEST_CMD_NONE, /**< Command to be ingored */
14+
IPC_TEST_CMD_PING, /**< Respond with the @ref IPC_TEST_CMD_PONG message */
15+
IPC_TEST_CMD_PONG, /**< Expected response to IPC_TEST_CMD_PING */
16+
IPC_TEST_CMD_ECHO, /**< Respond with the same data */
17+
IPC_TEST_CMD_ECHO_RSP, /**< Echo respond */
18+
IPC_TEST_CMD_REBOND, /**< Unbond and rebond back whole interface */
19+
IPC_TEST_CMD_REBOOT, /**< Restart remote CPU after a given delay */
20+
};
21+
22+
/**
23+
* @brief Base command structure
24+
*/
25+
struct ipc_test_cmd {
26+
uint32_t cmd; /**< The command of @ref ipc_test_command type */
27+
uint8_t data[]; /**< Command data depending on the command itself */
28+
};
29+
30+
/**
31+
* @brief Rebond command structure
32+
*/
33+
struct ipc_test_cmd_rebond {
34+
struct ipc_test_cmd base;
35+
uint32_t timeout_ms;
36+
};
37+
38+
/**
39+
* @brief Reboot command structure
40+
*/
41+
struct ipc_test_cmd_reboot {
42+
struct ipc_test_cmd base;
43+
uint32_t timeout_ms;
44+
};
45+
46+
#endif /* TEST_COMMANDS_H */
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright 2021 Carlo Caione <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
CONFIG_ZTEST=y
5+
CONFIG_MMU=y
6+
CONFIG_IPC_SERVICE=y
7+
CONFIG_MBOX=y
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#
2+
# Copyright (c) 2024 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
cmake_minimum_required(VERSION 3.20.0)
8+
9+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
10+
project(remote_icmsg)
11+
12+
zephyr_include_directories(../common)
13+
14+
FILE(GLOB remote_sources src/*.c)
15+
target_sources(app PRIVATE ${remote_sources})
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#
2+
# Copyright (c) 2024 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
source "Kconfig.zephyr"

0 commit comments

Comments
 (0)