-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: benchmarks: multicore: Start testing IPC with s2ram
Run IPC benchmark with s2ram Signed-off-by: Bartosz Miller <[email protected]>
- Loading branch information
1 parent
4239811
commit cb0c5da
Showing
16 changed files
with
341 additions
and
0 deletions.
There are no files selected for viewing
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 @@ | ||
# | ||
# Copyright (c) 2024 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
|
||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
|
||
if(NOT SYSBUILD) | ||
message(FATAL_ERROR | ||
" This is a multi-image application that should be built using sysbuild.\n" | ||
" Add --sysbuild argument to west build command to prepare all the images.") | ||
endif() | ||
|
||
project(idle_ipc) | ||
|
||
target_sources(app PRIVATE src/main.c) |
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,8 @@ | ||
# | ||
# Copyright (c) 2024 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
|
||
source "Kconfig.zephyr" | ||
rsource "Kconfig.common" |
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,18 @@ | ||
# | ||
# Copyright (c) 2024 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
|
||
config APP_IPC_SERVICE_SEND_INTERVAL | ||
int "Ipc service sending interval [us]" | ||
default 70 | ||
help | ||
Time in micro seconds between sending subsequent data packages over | ||
IPC service. Since kernel timeout has 1 ms resolution, the value is | ||
rounded down. If value of this option is lower than 1000 us, busy | ||
wait is used instead of sleep. | ||
|
||
config APP_IPC_SERVICE_MESSAGE_LEN | ||
int "Length of single IPC message in bytes" | ||
default 100 |
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,10 @@ | ||
# | ||
# Copyright (c) 2023 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
|
||
source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" | ||
|
||
config REMOTE_BOARD | ||
string "The board used for remote target" |
4 changes: 4 additions & 0 deletions
4
tests/benchmarks/multicore/idle_ipc/boards/nrf54h20dk_nrf54h20_cpuapp.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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright (c) 2024 Nordic Semiconductor ASA | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
|
||
CONFIG_APP_IPC_SERVICE_SEND_INTERVAL=900 |
25 changes: 25 additions & 0 deletions
25
tests/benchmarks/multicore/idle_ipc/boards/nrf54h20dk_nrf54h20_cpuapp_cpuppr.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,25 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
|
||
/* Replace default ipc0 instance */ | ||
/delete-node/ &ipc0; | ||
|
||
ipc0: &cpuapp_cpuppr_ipc { | ||
status = "okay"; | ||
}; | ||
|
||
&cpuppr_vevif { | ||
status = "okay"; | ||
}; | ||
|
||
&cpuapp_bellboard { | ||
status = "okay"; | ||
}; | ||
|
||
/ { | ||
chosen { | ||
/delete-property/ zephyr,bt-hci; | ||
}; | ||
}; |
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,25 @@ | ||
# Copyright (c) 2024 Nordic Semiconductor ASA | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
|
||
CONFIG_LOG_PROCESS_THREAD_PRIORITY=-15 | ||
CONFIG_LOG_PROCESS_THREAD_CUSTOM_PRIORITY=y | ||
|
||
CONFIG_HEAP_MEM_POOL_SIZE=4096 | ||
|
||
CONFIG_MBOX=y | ||
|
||
CONFIG_IPC_SERVICE=y | ||
CONFIG_IPC_SERVICE_LOG_LEVEL_INF=y | ||
|
||
CONFIG_PM=y | ||
CONFIG_PM_S2RAM=y | ||
CONFIG_PM_S2RAM_CUSTOM_MARKING=y | ||
CONFIG_PM_DEVICE=y | ||
CONFIG_POWEROFF=y | ||
CONFIG_PM_DEVICE_RUNTIME=y | ||
|
||
# Enable for debugging pruposes only | ||
CONFIG_PRINTK=y | ||
CONFIG_LOG=y | ||
CONFIG_CONSOLE=y | ||
CONFIG_UART_CONSOLE=y |
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,12 @@ | ||
# | ||
# Copyright (c) 2024 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
|
||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
project(remote) | ||
|
||
target_sources(app PRIVATE ../src/main.c) |
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,8 @@ | ||
# | ||
# Copyright (c) 2024 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
|
||
source "Kconfig.zephyr" | ||
rsource "../Kconfig.common" |
4 changes: 4 additions & 0 deletions
4
tests/benchmarks/multicore/idle_ipc/remote/boards/nrf54h20dk_nrf54h20_cpurad.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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright (c) 2024 Nordic Semiconductor ASA | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
|
||
CONFIG_APP_IPC_SERVICE_SEND_INTERVAL=900 |
8 changes: 8 additions & 0 deletions
8
tests/benchmarks/multicore/idle_ipc/remote/boards/nrf54h20dk_nrf54h20_cpurad.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,8 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
|
||
&uart135 { | ||
/delete-property/ hw-flow-control; | ||
}; |
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,24 @@ | ||
# Copyright (c) 2024 Nordic Semiconductor ASA | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
|
||
|
||
CONFIG_LOG_PROCESS_THREAD_PRIORITY=-15 | ||
CONFIG_LOG_PROCESS_THREAD_CUSTOM_PRIORITY=y | ||
|
||
CONFIG_HEAP_MEM_POOL_SIZE=2048 | ||
|
||
CONFIG_IPC_SERVICE=y | ||
CONFIG_IPC_SERVICE_LOG_LEVEL_INF=y | ||
|
||
CONFIG_MBOX=y | ||
|
||
CONFIG_PM=y | ||
CONFIG_PM_DEVICE=y | ||
CONFIG_POWEROFF=y | ||
CONFIG_PM_DEVICE_RUNTIME=y | ||
|
||
# Enable for debugging pruposes only | ||
CONFIG_PRINTK=y | ||
CONFIG_LOG=y | ||
CONFIG_CONSOLE=y | ||
CONFIG_UART_CONSOLE=y |
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,135 @@ | ||
/* | ||
* Copyright (c) 2022 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
|
||
#include <zephyr/kernel.h> | ||
#include <zephyr/device.h> | ||
#include <zephyr/pm/device.h> | ||
#include <zephyr/pm/device_runtime.h> | ||
#include <string.h> | ||
#include <zephyr/logging/log.h> | ||
#include <zephyr/ipc/ipc_service.h> | ||
|
||
#ifdef CONFIG_TEST_EXTRA_STACK_SIZE | ||
#define STACKSIZE (1024 + CONFIG_TEST_EXTRA_STACK_SIZE) | ||
#else | ||
#define STACKSIZE (1024) | ||
#endif | ||
|
||
K_THREAD_STACK_DEFINE(ipc0_stack, STACKSIZE); | ||
|
||
LOG_MODULE_REGISTER(host, LOG_LEVEL_INF); | ||
|
||
static const struct device *const console_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console)); | ||
|
||
struct payload { | ||
unsigned long cnt; | ||
unsigned long size; | ||
uint8_t data[]; | ||
}; | ||
|
||
struct payload *p_payload; | ||
|
||
static K_SEM_DEFINE(bound_sem, 0, 1); | ||
|
||
static void ep_bound(void *priv) | ||
{ | ||
k_sem_give(&bound_sem); | ||
} | ||
|
||
static void ep_recv(const void *data, size_t len, void *priv) | ||
{ | ||
uint8_t received_val = *((uint8_t *)data); | ||
static uint8_t expected_val; | ||
|
||
if ((received_val != expected_val) || (len != CONFIG_APP_IPC_SERVICE_MESSAGE_LEN)) { | ||
printk("Unexpected message received_val: %d , expected_val: %d\n", received_val, | ||
expected_val); | ||
} | ||
|
||
expected_val++; | ||
} | ||
|
||
static struct ipc_ept_cfg ep_cfg = { | ||
.name = "ep0", | ||
.cb = | ||
{ | ||
.bound = ep_bound, | ||
.received = ep_recv, | ||
}, | ||
}; | ||
|
||
int main(void) | ||
{ | ||
const struct device *ipc0_instance; | ||
struct ipc_ept ep; | ||
int ret; | ||
unsigned long last_cnt = 0; | ||
unsigned long delta = 0; | ||
|
||
p_payload = (struct payload *)k_malloc(CONFIG_APP_IPC_SERVICE_MESSAGE_LEN); | ||
if (!p_payload) { | ||
printk("k_malloc() failure\n"); | ||
return -ENOMEM; | ||
} | ||
|
||
memset(p_payload->data, 0xA5, CONFIG_APP_IPC_SERVICE_MESSAGE_LEN - sizeof(struct payload)); | ||
|
||
p_payload->size = CONFIG_APP_IPC_SERVICE_MESSAGE_LEN; | ||
p_payload->cnt = 0; | ||
|
||
printk("IPC-service %s demo started\n", CONFIG_BOARD_TARGET); | ||
|
||
ipc0_instance = DEVICE_DT_GET(DT_NODELABEL(ipc0)); | ||
|
||
ret = ipc_service_open_instance(ipc0_instance); | ||
if ((ret < 0) && (ret != -EALREADY)) { | ||
LOG_INF("ipc_service_open_instance() failure (%d)", ret); | ||
return ret; | ||
} | ||
|
||
ret = ipc_service_register_endpoint(ipc0_instance, &ep, &ep_cfg); | ||
if (ret < 0) { | ||
printf("ipc_service_register_endpoint() failure (%d)", ret); | ||
return ret; | ||
} | ||
|
||
if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { | ||
pm_device_runtime_enable(console_dev); | ||
pm_device_runtime_enable(ipc0_instance); | ||
} | ||
|
||
// k_sem_take(&bound_sem, K_FOREVER); | ||
|
||
while (true) { | ||
|
||
printk("Hello\n"); | ||
printk("Send data over IPC\n"); | ||
|
||
for (int counter = 0; counter < 10; counter++) { | ||
ret = ipc_service_send(&ep, p_payload, CONFIG_APP_IPC_SERVICE_MESSAGE_LEN); | ||
if (ret == -ENOMEM) { | ||
/* No space in the buffer. Retry. */ | ||
continue; | ||
} else if (ret < 0) { | ||
printk("send_message(%ld) failed with ret %d\n", p_payload->cnt, | ||
ret); | ||
break; | ||
} | ||
k_msleep(100); | ||
|
||
delta = p_payload->cnt - last_cnt; | ||
printk("Δpkt: %ld (%ld B/pkt) | throughput: %ld bit/s\n", delta, | ||
p_payload->size, delta * CONFIG_APP_IPC_SERVICE_MESSAGE_LEN * 8); | ||
last_cnt = p_payload->cnt; | ||
p_payload->cnt++; | ||
} | ||
|
||
printk("Go to sleep (s2ram)\n"); | ||
k_msleep(2000); | ||
} | ||
|
||
return 0; | ||
} |
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,22 @@ | ||
# | ||
# Copyright (c) 2023 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
|
||
if("${SB_CONFIG_REMOTE_BOARD}" STREQUAL "") | ||
message(FATAL_ERROR "REMOTE_BOARD must be set to a valid board name") | ||
endif() | ||
|
||
# Add remote project | ||
ExternalZephyrProject_Add( | ||
APPLICATION remote | ||
SOURCE_DIR ${APP_DIR}/remote | ||
BOARD ${SB_CONFIG_REMOTE_BOARD} | ||
BOARD_REVISION ${BOARD_REVISION} | ||
) | ||
|
||
# Add a dependency so that the remote image will be built and flashed first | ||
add_dependencies(idle_ipc remote) | ||
# Add dependency so that the remote image is flashed first. | ||
sysbuild_add_dependencies(FLASH idle_ipc remote) |
1 change: 1 addition & 0 deletions
1
tests/benchmarks/multicore/idle_ipc/sysbuild/nrf54h20dk_nrf54h20_cpurad.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
SB_CONFIG_REMOTE_BOARD="nrf54h20dk/nrf54h20/cpurad" |
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,18 @@ | ||
common: | ||
sysbuild: true | ||
tags: ci_build ci_tests_benchmarks_multicore ipc ppk_power_measure | ||
|
||
tests: | ||
benchmarks.multicore.idle_ipc.nrf54h20dk_cpuapp_cpurad.s2ram: | ||
# harness: pytest | ||
platform_allow: | ||
- nrf54h20dk/nrf54h20/cpuapp | ||
integration_platforms: | ||
- nrf54h20dk/nrf54h20/cpuapp | ||
extra_args: | ||
- SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad.conf | ||
# harness_config: | ||
# fixture: ppk_power_measure | ||
# pytest_root: | ||
# - "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_power_consumption_uarte" | ||
|
||