Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions tests/benchmarks/multicore/idle_hpu_temp_meas/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# Copyright (c) 2022 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_hpu_temp_meas)

target_sources(app PRIVATE src/main.c)
10 changes: 10 additions & 0 deletions tests/benchmarks/multicore/idle_hpu_temp_meas/Kconfig.sysbuild
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"
20 changes: 20 additions & 0 deletions tests/benchmarks/multicore/idle_hpu_temp_meas/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
CONFIG_PM=y
CONFIG_PM_S2RAM=y
CONFIG_PM_S2RAM_CUSTOM_MARKING=y
CONFIG_PM_DEVICE=y
CONFIG_PM_DEVICE_RUNTIME=y
CONFIG_POWEROFF=y

CONFIG_GPIO=n
CONFIG_BOOT_BANNER=n
CONFIG_NRFS_MRAM_SERVICE_ENABLED=n

CONFIG_ASSERT=y
CONFIG_NRFS=y

# Enable for debugging purposes only
CONFIG_PRINTK=n
CONFIG_LOG=n
CONFIG_CONSOLE=n
CONFIG_UART_CONSOLE=n
CONFIG_SERIAL=n
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Copyright (c) 2022 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)
21 changes: 21 additions & 0 deletions tests/benchmarks/multicore/idle_hpu_temp_meas/remote/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
CONFIG_PM=y
CONFIG_PM_S2RAM=y
CONFIG_PM_S2RAM_CUSTOM_MARKING=y
CONFIG_PM_DEVICE=y
CONFIG_PM_DEVICE_RUNTIME=y
CONFIG_POWEROFF=y

CONFIG_GPIO=n
CONFIG_BOOT_BANNER=n
CONFIG_NRFS_MRAM_SERVICE_ENABLED=n

CONFIG_ASSERT=y

CONFIG_NRFS=y

# Enable for debugging purposes only
CONFIG_PRINTK=n
CONFIG_LOG=n
CONFIG_CONSOLE=n
CONFIG_UART_CONSOLE=n
CONFIG_SERIAL=n
73 changes: 73 additions & 0 deletions tests/benchmarks/multicore/idle_hpu_temp_meas/src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

#include <zephyr/kernel.h>
#include <zephyr/sys/printk.h>
#include <zephyr/logging/log.h>
#include <nrfs_backend_ipc_service.h>
#include <nrfs_gdpwr.h>

LOG_MODULE_REGISTER(idle_hpu_temp_meas);

/* Required to power off the GD2 and GD3 domains
* Will be removed when GD handling
* is implemented in sdk-zephyr
*/
static void gdpwr_handler(nrfs_gdpwr_evt_t const *p_evt, void *context)
{
switch (p_evt->type) {
case NRFS_GDPWR_REQ_APPLIED:
LOG_INF("GDPWR handler - response received: 0x%x, CTX=%d", p_evt->type,
(uint32_t)context);
break;
case NRFS_GDPWR_REQ_REJECTED:
LOG_ERR("GDPWR handler - request rejected: 0x%x, CTX=%d", p_evt->type,
(uint32_t)context);
break;
default:
LOG_ERR("GDPWR handler - unexpected event: 0x%x, CTX=%d", p_evt->type,
(uint32_t)context);
break;
}
}

/* Required to power off the GD2 and GD3 domains
* Will be removed when GD handling
* is implemented in sdk-zephyr
*/
static void clear_global_power_domains_requests(void)
{
int service_status;
int tst_ctx = 1;

service_status = nrfs_gdpwr_init(gdpwr_handler);
LOG_INF("Response: %d", service_status);
LOG_INF("Sending GDPWR DISABLE request for: GDPWR_POWER_DOMAIN_ACTIVE_SLOW");
service_status = nrfs_gdpwr_power_request(GDPWR_POWER_DOMAIN_ACTIVE_SLOW,
GDPWR_POWER_REQUEST_CLEAR, (void *)tst_ctx++);
LOG_INF("Response: %d", service_status);
LOG_INF("Sending GDPWR DISABLE request for: GDPWR_POWER_DOMAIN_ACTIVE_FAST");
service_status = nrfs_gdpwr_power_request(GDPWR_POWER_DOMAIN_ACTIVE_FAST,
GDPWR_POWER_REQUEST_CLEAR, (void *)tst_ctx++);
LOG_INF("Response: %d", service_status);
LOG_INF("Sending GDPWR DISABLE request for: GDPWR_POWER_DOMAIN_MAIN_SLOW");
service_status = nrfs_gdpwr_power_request(GDPWR_POWER_DOMAIN_MAIN_SLOW,
GDPWR_POWER_REQUEST_CLEAR, (void *)tst_ctx);
LOG_INF("Response: %d", service_status);
}

int main(void)
{
LOG_INF("SCFW HPU temperature measurement feature test, %s", CONFIG_BOARD_TARGET);
nrfs_backend_wait_for_connection(K_FOREVER);
clear_global_power_domains_requests();
while (1) {
LOG_INF("Going to sleep forever");
k_sleep(K_FOREVER);
}

return 0;
}
26 changes: 26 additions & 0 deletions tests/benchmarks/multicore/idle_hpu_temp_meas/sysbuild.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# 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}
)
set_property(GLOBAL APPEND PROPERTY PM_DOMAINS CPUNET)
set_property(GLOBAL APPEND PROPERTY PM_CPUNET_IMAGES remote)
set_property(GLOBAL PROPERTY DOMAIN_APP_CPUNET remote)
set(CPUNET_PM_DOMAIN_DYNAMIC_PARTITION remote CACHE INTERNAL "")

# Add a dependency so that the remote image will be built and flashed first
add_dependencies(idle_hpu_temp_meas remote)
# Add dependency so that the remote image is flashed first.
sysbuild_add_dependencies(FLASH idle_hpu_temp_meas remote)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SB_CONFIG_REMOTE_BOARD="nrf54h20dk/nrf54h20/cpurad"
17 changes: 17 additions & 0 deletions tests/benchmarks/multicore/idle_hpu_temp_meas/testcase.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
common:
sysbuild: true
tags: ci_build ci_tests_benchmarks_multicore hpu ppk_power_measure

tests:
benchmarks.multicore.idle_hpu_temp_meas:
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_hpu_feature"
Loading