Skip to content

Commit e15c6f8

Browse files
nordic-baminordicjm
authored andcommitted
tests: benchmarks: Verify HPU feature temperature wakeups
SCFW HPU feature measures temperature periodically Verify the presence and period of the measurements Signed-off-by: Bartosz Miller <[email protected]>
1 parent 5c5c153 commit e15c6f8

File tree

9 files changed

+199
-0
lines changed

9 files changed

+199
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Copyright (c) 2022 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+
11+
if(NOT SYSBUILD)
12+
message(FATAL_ERROR
13+
" This is a multi-image application that should be built using sysbuild.\n"
14+
" Add --sysbuild argument to west build command to prepare all the images.")
15+
endif()
16+
17+
project(idle_hpu_temp_meas)
18+
19+
target_sources(app PRIVATE src/main.c)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# Copyright (c) 2023 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"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
CONFIG_PM=y
2+
CONFIG_PM_S2RAM=y
3+
CONFIG_PM_S2RAM_CUSTOM_MARKING=y
4+
CONFIG_PM_DEVICE=y
5+
CONFIG_PM_DEVICE_RUNTIME=y
6+
CONFIG_POWEROFF=y
7+
8+
CONFIG_GPIO=n
9+
CONFIG_BOOT_BANNER=n
10+
CONFIG_NRFS_MRAM_SERVICE_ENABLED=n
11+
12+
CONFIG_ASSERT=y
13+
CONFIG_NRFS=y
14+
15+
# Enable for debugging purposes only
16+
CONFIG_PRINTK=n
17+
CONFIG_LOG=n
18+
CONFIG_CONSOLE=n
19+
CONFIG_UART_CONSOLE=n
20+
CONFIG_SERIAL=n
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#
2+
# Copyright (c) 2022 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)
11+
12+
target_sources(app PRIVATE ../src/main.c)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
CONFIG_PM=y
2+
CONFIG_PM_S2RAM=y
3+
CONFIG_PM_S2RAM_CUSTOM_MARKING=y
4+
CONFIG_PM_DEVICE=y
5+
CONFIG_PM_DEVICE_RUNTIME=y
6+
CONFIG_POWEROFF=y
7+
8+
CONFIG_GPIO=n
9+
CONFIG_BOOT_BANNER=n
10+
CONFIG_NRFS_MRAM_SERVICE_ENABLED=n
11+
12+
CONFIG_ASSERT=y
13+
14+
CONFIG_NRFS=y
15+
16+
# Enable for debugging purposes only
17+
CONFIG_PRINTK=n
18+
CONFIG_LOG=n
19+
CONFIG_CONSOLE=n
20+
CONFIG_UART_CONSOLE=n
21+
CONFIG_SERIAL=n
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
#include <zephyr/kernel.h>
8+
#include <zephyr/sys/printk.h>
9+
#include <zephyr/logging/log.h>
10+
#include <nrfs_backend_ipc_service.h>
11+
#include <nrfs_gdpwr.h>
12+
13+
LOG_MODULE_REGISTER(idle_hpu_temp_meas);
14+
15+
/* Required to power off the GD2 and GD3 domains
16+
* Will be removed when GD handling
17+
* is implemented in sdk-zephyr
18+
*/
19+
static void gdpwr_handler(nrfs_gdpwr_evt_t const *p_evt, void *context)
20+
{
21+
switch (p_evt->type) {
22+
case NRFS_GDPWR_REQ_APPLIED:
23+
LOG_INF("GDPWR handler - response received: 0x%x, CTX=%d", p_evt->type,
24+
(uint32_t)context);
25+
break;
26+
case NRFS_GDPWR_REQ_REJECTED:
27+
LOG_ERR("GDPWR handler - request rejected: 0x%x, CTX=%d", p_evt->type,
28+
(uint32_t)context);
29+
break;
30+
default:
31+
LOG_ERR("GDPWR handler - unexpected event: 0x%x, CTX=%d", p_evt->type,
32+
(uint32_t)context);
33+
break;
34+
}
35+
}
36+
37+
/* Required to power off the GD2 and GD3 domains
38+
* Will be removed when GD handling
39+
* is implemented in sdk-zephyr
40+
*/
41+
static void clear_global_power_domains_requests(void)
42+
{
43+
int service_status;
44+
int tst_ctx = 1;
45+
46+
service_status = nrfs_gdpwr_init(gdpwr_handler);
47+
LOG_INF("Response: %d", service_status);
48+
LOG_INF("Sending GDPWR DISABLE request for: GDPWR_POWER_DOMAIN_ACTIVE_SLOW");
49+
service_status = nrfs_gdpwr_power_request(GDPWR_POWER_DOMAIN_ACTIVE_SLOW,
50+
GDPWR_POWER_REQUEST_CLEAR, (void *)tst_ctx++);
51+
LOG_INF("Response: %d", service_status);
52+
LOG_INF("Sending GDPWR DISABLE request for: GDPWR_POWER_DOMAIN_ACTIVE_FAST");
53+
service_status = nrfs_gdpwr_power_request(GDPWR_POWER_DOMAIN_ACTIVE_FAST,
54+
GDPWR_POWER_REQUEST_CLEAR, (void *)tst_ctx++);
55+
LOG_INF("Response: %d", service_status);
56+
LOG_INF("Sending GDPWR DISABLE request for: GDPWR_POWER_DOMAIN_MAIN_SLOW");
57+
service_status = nrfs_gdpwr_power_request(GDPWR_POWER_DOMAIN_MAIN_SLOW,
58+
GDPWR_POWER_REQUEST_CLEAR, (void *)tst_ctx);
59+
LOG_INF("Response: %d", service_status);
60+
}
61+
62+
int main(void)
63+
{
64+
LOG_INF("SCFW HPU temperature measurement feature test, %s", CONFIG_BOARD_TARGET);
65+
nrfs_backend_wait_for_connection(K_FOREVER);
66+
clear_global_power_domains_requests();
67+
while (1) {
68+
LOG_INF("Going to sleep forever");
69+
k_sleep(K_FOREVER);
70+
}
71+
72+
return 0;
73+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#
2+
# Copyright (c) 2023 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
if("${SB_CONFIG_REMOTE_BOARD}" STREQUAL "")
8+
message(FATAL_ERROR "REMOTE_BOARD must be set to a valid board name")
9+
endif()
10+
11+
# Add remote project
12+
ExternalZephyrProject_Add(
13+
APPLICATION remote
14+
SOURCE_DIR ${APP_DIR}/remote
15+
BOARD ${SB_CONFIG_REMOTE_BOARD}
16+
BOARD_REVISION ${BOARD_REVISION}
17+
)
18+
set_property(GLOBAL APPEND PROPERTY PM_DOMAINS CPUNET)
19+
set_property(GLOBAL APPEND PROPERTY PM_CPUNET_IMAGES remote)
20+
set_property(GLOBAL PROPERTY DOMAIN_APP_CPUNET remote)
21+
set(CPUNET_PM_DOMAIN_DYNAMIC_PARTITION remote CACHE INTERNAL "")
22+
23+
# Add a dependency so that the remote image will be built and flashed first
24+
add_dependencies(idle_hpu_temp_meas remote)
25+
# Add dependency so that the remote image is flashed first.
26+
sysbuild_add_dependencies(FLASH idle_hpu_temp_meas remote)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SB_CONFIG_REMOTE_BOARD="nrf54h20dk/nrf54h20/cpurad"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
common:
2+
sysbuild: true
3+
tags: ci_build ci_tests_benchmarks_multicore hpu ppk_power_measure
4+
5+
tests:
6+
benchmarks.multicore.idle_hpu_temp_meas:
7+
harness: pytest
8+
platform_allow:
9+
- nrf54h20dk/nrf54h20/cpuapp
10+
integration_platforms:
11+
- nrf54h20dk/nrf54h20/cpuapp
12+
extra_args:
13+
- SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad.conf
14+
harness_config:
15+
fixture: ppk_power_measure
16+
pytest_root:
17+
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_power_consumption_hpu_feature"

0 commit comments

Comments
 (0)