diff --git a/tests/benchmarks/multicore/idle_hpu_temp_meas/CMakeLists.txt b/tests/benchmarks/multicore/idle_hpu_temp_meas/CMakeLists.txt new file mode 100644 index 000000000000..240ad874c0ac --- /dev/null +++ b/tests/benchmarks/multicore/idle_hpu_temp_meas/CMakeLists.txt @@ -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) diff --git a/tests/benchmarks/multicore/idle_hpu_temp_meas/Kconfig.sysbuild b/tests/benchmarks/multicore/idle_hpu_temp_meas/Kconfig.sysbuild new file mode 100644 index 000000000000..da26dbe3dc09 --- /dev/null +++ b/tests/benchmarks/multicore/idle_hpu_temp_meas/Kconfig.sysbuild @@ -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" diff --git a/tests/benchmarks/multicore/idle_hpu_temp_meas/prj.conf b/tests/benchmarks/multicore/idle_hpu_temp_meas/prj.conf new file mode 100644 index 000000000000..701788a14643 --- /dev/null +++ b/tests/benchmarks/multicore/idle_hpu_temp_meas/prj.conf @@ -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 diff --git a/tests/benchmarks/multicore/idle_hpu_temp_meas/remote/CMakeLists.txt b/tests/benchmarks/multicore/idle_hpu_temp_meas/remote/CMakeLists.txt new file mode 100644 index 000000000000..031fd28d29a7 --- /dev/null +++ b/tests/benchmarks/multicore/idle_hpu_temp_meas/remote/CMakeLists.txt @@ -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) diff --git a/tests/benchmarks/multicore/idle_hpu_temp_meas/remote/prj.conf b/tests/benchmarks/multicore/idle_hpu_temp_meas/remote/prj.conf new file mode 100644 index 000000000000..f13627baa970 --- /dev/null +++ b/tests/benchmarks/multicore/idle_hpu_temp_meas/remote/prj.conf @@ -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 diff --git a/tests/benchmarks/multicore/idle_hpu_temp_meas/src/main.c b/tests/benchmarks/multicore/idle_hpu_temp_meas/src/main.c new file mode 100644 index 000000000000..cb51b7cc2708 --- /dev/null +++ b/tests/benchmarks/multicore/idle_hpu_temp_meas/src/main.c @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include +#include +#include +#include +#include + +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; +} diff --git a/tests/benchmarks/multicore/idle_hpu_temp_meas/sysbuild.cmake b/tests/benchmarks/multicore/idle_hpu_temp_meas/sysbuild.cmake new file mode 100644 index 000000000000..e7a94bd31e2a --- /dev/null +++ b/tests/benchmarks/multicore/idle_hpu_temp_meas/sysbuild.cmake @@ -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) diff --git a/tests/benchmarks/multicore/idle_hpu_temp_meas/sysbuild/nrf54h20dk_nrf54h20_cpurad.conf b/tests/benchmarks/multicore/idle_hpu_temp_meas/sysbuild/nrf54h20dk_nrf54h20_cpurad.conf new file mode 100644 index 000000000000..dd863e78d993 --- /dev/null +++ b/tests/benchmarks/multicore/idle_hpu_temp_meas/sysbuild/nrf54h20dk_nrf54h20_cpurad.conf @@ -0,0 +1 @@ +SB_CONFIG_REMOTE_BOARD="nrf54h20dk/nrf54h20/cpurad" diff --git a/tests/benchmarks/multicore/idle_hpu_temp_meas/testcase.yaml b/tests/benchmarks/multicore/idle_hpu_temp_meas/testcase.yaml new file mode 100644 index 000000000000..b10e5848be5c --- /dev/null +++ b/tests/benchmarks/multicore/idle_hpu_temp_meas/testcase.yaml @@ -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"