Skip to content

Commit 6908622

Browse files
doki-nordicrakons
authored andcommitted
tests: ipc_service: Test restarting session in different scenarios
This commit adds a test that checks if disconnecting and restarting the IPC session works correctly. The test is also focused on the "unbound" callback. Signed-off-by: Dominik Kilian <[email protected]> Co-authored-by: Radoslaw Koppel <[email protected]>
1 parent 7cbe361 commit 6908622

33 files changed

+2735
-6
lines changed

scripts/ci/check_compliance.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,9 @@ def check_no_undef_outside_kconfig(self, kconf):
990990
"FOO_SETTING_1",
991991
"FOO_SETTING_2",
992992
"HEAP_MEM_POOL_ADD_SIZE_", # Used as an option matching prefix
993-
"LSM6DSO_INT_PIN",
993+
"HUGETLBFS", # Linux, in boards/xtensa/intel_adsp_cavs25/doc
994+
"IPC_SERVICE_ICMSG_BOND_NOTIFY_REPEAT_TO_MS", # Used in ICMsg tests for intercompatibility
995+
# with older versions of the ICMsg.
994996
"LIBGCC_RTLIB",
995997
"LLVM_USE_LD", # Both LLVM_USE_* are in cmake/toolchain/llvm/Kconfig
996998
"LLVM_USE_LLD", # which are only included if LLVM is selected but
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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})
13+
14+
zephyr_sources_ifdef(CONFIG_IPC_SERVICE_ICMSG_V1 interoperability/icmsg_v1.c)
15+
zephyr_sources_ifdef(CONFIG_PBUF_V1 interoperability/pbuf_v1.c)
16+
zephyr_sources_ifdef(CONFIG_IPC_SERVICE_BACKEND_ICMSG_V1 interoperability/ipc_icmsg_v1.c)

tests/subsys/ipc/ipc_sessions/Kconfig

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#
2+
# Copyright (c) 2024 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
rsource "interoperability/Kconfig"
8+
9+
menu "Zephyr"
10+
source "Kconfig.zephyr"
11+
endmenu
12+
13+
config IPC_TEST_MSG_HEAP_SIZE
14+
int "The heap to copy processed messages"
15+
default 512
16+
help
17+
Internal heap where all the message data would be copied to be processed
18+
linearry in tests.
19+
20+
config IPC_TEST_SKIP_CORE_RESET
21+
bool "Skip the tests that includes core resetting"
22+
help
23+
Some of the cores cannot be safely restarted.
24+
Skip the tests that require it in such a cases.
25+
26+
config IPC_TEST_BLOCK_SIZE
27+
int "Block size for multiple transfers test"
28+
default 32
29+
30+
config IPC_TEST_BLOCK_CNT
31+
int "Number of blocks for multiple transfers test"
32+
default 8000
33+
34+
config IPC_TEST_SKIP_UNBOUND
35+
bool "Skip unbound tests"
36+
help
37+
Whether to skip tests that requires unbound callback functionality.
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: Apache-2.0
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/cpurad" 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: Apache-2.0
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: Apache-2.0
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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor ASA
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/* Replace default ipc0 instance */
7+
&ipc0 {
8+
compatible = "zephyr,ipc-icmsg";
9+
/delete-property/ tx-blocks;
10+
/delete-property/ rx-blocks;
11+
unbound = "enable";
12+
};
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: Apache-2.0
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: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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+
/* Commands used for data transfer test */
21+
IPC_TEST_CMD_RXSTART, /**< Start receiving data */
22+
IPC_TEST_CMD_TXSTART, /**< Start sending data */
23+
IPC_TEST_CMD_RXGET, /**< Get rx status */
24+
IPC_TEST_CMD_TXGET, /**< Get tx status */
25+
IPC_TEST_CMD_XSTAT, /**< rx/tx status response */
26+
IPC_TEST_CMD_XDATA, /**< Transfer data block */
27+
/* End of commands used for data transfer test */
28+
};
29+
30+
/**
31+
* @brief Base command structure
32+
*/
33+
struct ipc_test_cmd {
34+
uint32_t cmd; /**< The command of @ref ipc_test_command type */
35+
uint8_t data[]; /**< Command data depending on the command itself */
36+
};
37+
38+
/**
39+
* @brief Rebond command structure
40+
*/
41+
struct ipc_test_cmd_rebond {
42+
struct ipc_test_cmd base;
43+
uint32_t timeout_ms;
44+
};
45+
46+
/**
47+
* @brief Reboot command structure
48+
*/
49+
struct ipc_test_cmd_reboot {
50+
struct ipc_test_cmd base;
51+
uint32_t timeout_ms;
52+
};
53+
54+
/**
55+
* @brief Start the rx or tx transfer
56+
*/
57+
struct ipc_test_cmd_xstart {
58+
struct ipc_test_cmd base;
59+
uint32_t blk_size;
60+
uint32_t blk_cnt;
61+
uint32_t seed;
62+
};
63+
64+
/**
65+
* @brief Get the status of rx or tx transfer
66+
*/
67+
struct ipc_test_cmd_xstat {
68+
struct ipc_test_cmd base;
69+
uint32_t blk_cnt; /**< Transfers left */
70+
int32_t result; /**< Current result */
71+
};
72+
73+
/**
74+
* @brief The result of rx or tx transfer
75+
*/
76+
struct ipc_test_cmd_xrsp {
77+
struct ipc_test_cmd base;
78+
int32_t result;
79+
};
80+
81+
#endif /* TEST_COMMANDS_H */
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#
2+
# Copyright (c) 2024 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
config IPC_SERVICE_BACKEND_ICMSG
8+
default n if IPC_SERVICE_BACKEND_ICMSG_V1
9+
10+
config IPC_SERVICE_ICMSG
11+
default n if IPC_SERVICE_ICMSG_V1
12+
13+
config IPC_SERVICE_BACKEND_ICMSG_V1
14+
bool "ICMSG backend with SPSC packet buffer (old implementation)"
15+
depends on MBOX
16+
select IPC_SERVICE_ICMSG_V1
17+
help
18+
Chosing this backend results in single endpoint implementation based
19+
on circular packet buffer.
20+
21+
menuconfig IPC_SERVICE_ICMSG_V1
22+
bool "icmsg IPC library (old implementation)"
23+
select PBUF_V1
24+
help
25+
Icmsg library
26+
27+
if IPC_SERVICE_ICMSG_V1
28+
rsource "Kconfig.icmsg_v1"
29+
endif

0 commit comments

Comments
 (0)