diff --git a/tests/benchmarks/multicore/common/remote_gdf_switching/CMakeLists.txt b/tests/benchmarks/multicore/common/remote_gdf_switching/CMakeLists.txt new file mode 100644 index 000000000000..d95d22a6a2ac --- /dev/null +++ b/tests/benchmarks/multicore/common/remote_gdf_switching/CMakeLists.txt @@ -0,0 +1,12 @@ +# +# Copyright (c) 2025 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_sleep_forever) + +target_sources(app PRIVATE src/main.c) diff --git a/tests/benchmarks/multicore/common/remote_gdf_switching/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/benchmarks/multicore/common/remote_gdf_switching/boards/nrf54h20dk_nrf54h20_cpurad.overlay new file mode 100644 index 000000000000..5a996c5dfeb5 --- /dev/null +++ b/tests/benchmarks/multicore/common/remote_gdf_switching/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +/ { + aliases { + led = &led1; + }; + + leds { + compatible = "gpio-leds"; + led1: led_1 { + gpios = <&gpio9 1 GPIO_ACTIVE_HIGH>; + label = "Green LED 1"; + }; + }; +}; + +&gpio9 { + status = "okay"; +}; + +&gpiote130 { + status = "okay"; +}; + +&uart135 { + status = "disabled"; + /delete-property/memory-regions; +}; diff --git a/tests/benchmarks/multicore/common/remote_gdf_switching/prj.conf b/tests/benchmarks/multicore/common/remote_gdf_switching/prj.conf new file mode 100644 index 000000000000..5d4f94e91810 --- /dev/null +++ b/tests/benchmarks/multicore/common/remote_gdf_switching/prj.conf @@ -0,0 +1,9 @@ +CONFIG_CLOCK_CONTROL=y + +CONFIG_PM=y +CONFIG_POWEROFF=y +CONFIG_CONSOLE=n +CONFIG_UART_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_GPIO=y +CONFIG_BOOT_BANNER=n diff --git a/tests/benchmarks/multicore/common/remote_gdf_switching/src/main.c b/tests/benchmarks/multicore/common/remote_gdf_switching/src/main.c new file mode 100644 index 000000000000..39df3ef9a1a3 --- /dev/null +++ b/tests/benchmarks/multicore/common/remote_gdf_switching/src/main.c @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +#include +#include +#include +#include + +static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(DT_ALIAS(led), gpios); + +const uint32_t freq[] = {320, 256, 128, 64}; + +/* + * Set Global Domain frequency (HSFLL120) + */ +void set_global_domain_frequency(uint32_t freq) +{ + int err; + int res; + struct onoff_client cli; + const struct device *hsfll_dev = DEVICE_DT_GET(DT_NODELABEL(hsfll120)); + const struct nrf_clock_spec clk_spec_global_hsfll = {.frequency = MHZ(freq)}; + + printk("Requested frequency [Hz]: %d\n", clk_spec_global_hsfll.frequency); + sys_notify_init_spinwait(&cli.notify); + err = nrf_clock_control_request(hsfll_dev, &clk_spec_global_hsfll, &cli); + __ASSERT((err >= 0 && err < 3), "Wrong nrf_clock_control_request return code"); + do { + err = sys_notify_fetch_result(&cli.notify, &res); + k_yield(); + } while (err == -EAGAIN); + __ASSERT(err == 0, "Wrong clock control request return code"); + __ASSERT(res == 0, "Wrong clock control request response"); +} + +int main(void) +{ + uint32_t counter = 0; + + gpio_pin_configure_dt(&led, GPIO_OUTPUT_INACTIVE); + k_msleep(300); + + while (1) { + gpio_pin_set_dt(&led, 1); + set_global_domain_frequency(freq[counter++ % ARRAY_SIZE(freq)]); + k_busy_wait(1000); + gpio_pin_set_dt(&led, 0); + k_msleep(2000); + } + + return 0; +} diff --git a/tests/benchmarks/multicore/idle_pwm_loopback/Kconfig.sysbuild b/tests/benchmarks/multicore/idle_pwm_loopback/Kconfig.sysbuild index a5a29117d87a..d0a17278f625 100644 --- a/tests/benchmarks/multicore/idle_pwm_loopback/Kconfig.sysbuild +++ b/tests/benchmarks/multicore/idle_pwm_loopback/Kconfig.sysbuild @@ -1,11 +1,10 @@ # -# Copyright (c) 2024 Nordic Semiconductor ASA +# Copyright (c) 2025 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" -config REMOTE_BOARD - string - default "$(BOARD)/nrf54h20/cpurad" if SOC_NRF54H20_CPUAPP +config REMOTE_GLOBAL_DOMAIN_CLOCK_FREQUENCY_SWITCHING + bool "Enable global domain frequency changing from remote" diff --git a/tests/benchmarks/multicore/idle_pwm_loopback/src/main.c b/tests/benchmarks/multicore/idle_pwm_loopback/src/main.c index 88c363616af2..337f69648ebd 100644 --- a/tests/benchmarks/multicore/idle_pwm_loopback/src/main.c +++ b/tests/benchmarks/multicore/idle_pwm_loopback/src/main.c @@ -206,8 +206,7 @@ int main(void) /* Keep PWM active for ~ 1 second */ while (!timer_expired) { /* GPIOTE shall count edges here */ - k_msleep(10); - k_yield(); + k_busy_wait(10000); } /* Disable PWM */ diff --git a/tests/benchmarks/multicore/idle_pwm_loopback/sysbuild.cmake b/tests/benchmarks/multicore/idle_pwm_loopback/sysbuild.cmake index 80f51bddea6d..928b66da689c 100644 --- a/tests/benchmarks/multicore/idle_pwm_loopback/sysbuild.cmake +++ b/tests/benchmarks/multicore/idle_pwm_loopback/sysbuild.cmake @@ -4,14 +4,18 @@ # 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() +if(SB_CONFIG_SOC_NRF54H20) + if(SB_CONFIG_REMOTE_GLOBAL_DOMAIN_CLOCK_FREQUENCY_SWITCHING) + set(REMOTE_SOURCE_DIR ${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/multicore/common/remote_gdf_switching) + else() + set(REMOTE_SOURCE_DIR ${APP_DIR}/remote) + endif() -# Add remote project -ExternalZephyrProject_Add( + # Add remote project + ExternalZephyrProject_Add( APPLICATION remote - SOURCE_DIR ${APP_DIR}/remote - BOARD ${SB_CONFIG_REMOTE_BOARD} + SOURCE_DIR ${REMOTE_SOURCE_DIR} + BOARD ${SB_CONFIG_BOARD}/${SB_CONFIG_SOC}/cpurad BOARD_REVISION ${BOARD_REVISION} -) + ) +endif() \ No newline at end of file diff --git a/tests/benchmarks/multicore/idle_pwm_loopback/testcase.yaml b/tests/benchmarks/multicore/idle_pwm_loopback/testcase.yaml index bc0e6e14eafb..69ac39b1f87e 100644 --- a/tests/benchmarks/multicore/idle_pwm_loopback/testcase.yaml +++ b/tests/benchmarks/multicore/idle_pwm_loopback/testcase.yaml @@ -90,6 +90,19 @@ tests: pytest_root: - "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_pwm_and_s2ram" + benchmarks.multicore.idle_pwm_loopback.nrf54h20dk_cpuapp_cpurad.s2ram_fast.remote_gd_freq_switching: + filter: not CONFIG_COVERAGE + tags: ppk_power_measure + extra_args: + - idle_pwm_loopback_CONF_FILE=prj_s2ram.conf + - idle_pwm_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_1.overlay" + - SB_CONFIG_REMOTE_GLOBAL_DOMAIN_CLOCK_FREQUENCY_SWITCHING=y + harness: pytest + harness_config: + fixture: spi_loopback + pytest_root: + - "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_pwm_and_s2ram" + benchmarks.multicore.idle_pwm_loopback.nrf54h20dk_cpuapp_cpurad.s2ram_fast.gd_freq_320MHz: filter: not CONFIG_COVERAGE tags: ppk_power_measure diff --git a/tests/benchmarks/multicore/idle_spim_loopback/Kconfig.sysbuild b/tests/benchmarks/multicore/idle_spim_loopback/Kconfig.sysbuild new file mode 100644 index 000000000000..d0a17278f625 --- /dev/null +++ b/tests/benchmarks/multicore/idle_spim_loopback/Kconfig.sysbuild @@ -0,0 +1,10 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" + +config REMOTE_GLOBAL_DOMAIN_CLOCK_FREQUENCY_SWITCHING + bool "Enable global domain frequency changing from remote" diff --git a/tests/benchmarks/multicore/idle_spim_loopback/sysbuild.cmake b/tests/benchmarks/multicore/idle_spim_loopback/sysbuild.cmake index bf4119b6a338..df379f30d974 100644 --- a/tests/benchmarks/multicore/idle_spim_loopback/sysbuild.cmake +++ b/tests/benchmarks/multicore/idle_spim_loopback/sysbuild.cmake @@ -5,10 +5,16 @@ # if(SB_CONFIG_SOC_NRF54H20) + if(SB_CONFIG_REMOTE_GLOBAL_DOMAIN_CLOCK_FREQUENCY_SWITCHING) + set(REMOTE_SOURCE_DIR ${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/multicore/common/remote_gdf_switching) + else() + set(REMOTE_SOURCE_DIR ${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/power_consumption/common/remote_sleep_forever) + endif() + # Add remote project ExternalZephyrProject_Add( APPLICATION remote - SOURCE_DIR ${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/power_consumption/common/remote_sleep_forever + SOURCE_DIR ${REMOTE_SOURCE_DIR} BOARD ${SB_CONFIG_BOARD}/${SB_CONFIG_SOC}/cpurad BOARD_REVISION ${BOARD_REVISION} ) diff --git a/tests/benchmarks/multicore/idle_spim_loopback/testcase.yaml b/tests/benchmarks/multicore/idle_spim_loopback/testcase.yaml index e2df3cea54ef..128782a86fa4 100644 --- a/tests/benchmarks/multicore/idle_spim_loopback/testcase.yaml +++ b/tests/benchmarks/multicore/idle_spim_loopback/testcase.yaml @@ -120,6 +120,20 @@ tests: pytest_root: - "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_spim_and_s2ram" + benchmarks.multicore.idle_spim_loopback.4_bytes.s2ram_fast.remote_gd_freq_switching: + filter: not CONFIG_COVERAGE + tags: ppk_power_measure + extra_args: + - idle_spim_loopback_CONF_FILE=prj_s2ram.conf + - idle_spim_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay" + - idle_spim_loopback_CONFIG_DATA_FIELD=4 + - SB_CONFIG_REMOTE_GLOBAL_DOMAIN_CLOCK_FREQUENCY_SWITCHING=y + harness: pytest + harness_config: + fixture: spi_loopback + pytest_root: + - "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_spim_and_s2ram" + benchmarks.multicore.idle_spim_loopback.4_bytes.gd_freq_64MHz.s2ram_fast: filter: not CONFIG_COVERAGE tags: ppk_power_measure @@ -222,6 +236,20 @@ tests: pytest_root: - "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_spim_and_s2ram" + benchmarks.multicore.idle_spim_loopback.16_bytes.s2ram_fast.remote_gd_freq_switching: + filter: not CONFIG_COVERAGE + tags: ppk_power_measure + extra_args: + - idle_spim_loopback_CONF_FILE=prj_s2ram.conf + - idle_spim_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay" + - idle_spim_loopback_CONFIG_DATA_FIELD=16 + - SB_CONFIG_REMOTE_GLOBAL_DOMAIN_CLOCK_FREQUENCY_SWITCHING=y + harness: pytest + harness_config: + fixture: spi_loopback + pytest_root: + - "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_spim_and_s2ram" + benchmarks.multicore.idle_spim_loopback.16_bytes.gd_freq_256MHz.s2ram_fast: filter: not CONFIG_COVERAGE tags: ppk_power_measure diff --git a/tests/benchmarks/multicore/idle_uarte/Kconfig.sysbuild b/tests/benchmarks/multicore/idle_uarte/Kconfig.sysbuild index a5a29117d87a..d0a17278f625 100644 --- a/tests/benchmarks/multicore/idle_uarte/Kconfig.sysbuild +++ b/tests/benchmarks/multicore/idle_uarte/Kconfig.sysbuild @@ -1,11 +1,10 @@ # -# Copyright (c) 2024 Nordic Semiconductor ASA +# Copyright (c) 2025 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" -config REMOTE_BOARD - string - default "$(BOARD)/nrf54h20/cpurad" if SOC_NRF54H20_CPUAPP +config REMOTE_GLOBAL_DOMAIN_CLOCK_FREQUENCY_SWITCHING + bool "Enable global domain frequency changing from remote" diff --git a/tests/benchmarks/multicore/idle_uarte/sysbuild.cmake b/tests/benchmarks/multicore/idle_uarte/sysbuild.cmake index 01a7f9b46ff7..df379f30d974 100644 --- a/tests/benchmarks/multicore/idle_uarte/sysbuild.cmake +++ b/tests/benchmarks/multicore/idle_uarte/sysbuild.cmake @@ -1,22 +1,21 @@ # -# Copyright (c) 2023 Nordic Semiconductor ASA +# Copyright (c) 2024 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() +if(SB_CONFIG_SOC_NRF54H20) + if(SB_CONFIG_REMOTE_GLOBAL_DOMAIN_CLOCK_FREQUENCY_SWITCHING) + set(REMOTE_SOURCE_DIR ${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/multicore/common/remote_gdf_switching) + else() + set(REMOTE_SOURCE_DIR ${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/power_consumption/common/remote_sleep_forever) + endif() -# Add remote project -ExternalZephyrProject_Add( + # Add remote project + ExternalZephyrProject_Add( APPLICATION remote - SOURCE_DIR ${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/power_consumption/common/remote_sleep_forever - BOARD ${SB_CONFIG_REMOTE_BOARD} + SOURCE_DIR ${REMOTE_SOURCE_DIR} + BOARD ${SB_CONFIG_BOARD}/${SB_CONFIG_SOC}/cpurad BOARD_REVISION ${BOARD_REVISION} ) - -# Add a dependency so that the remote image will be built and flashed first -add_dependencies(idle_uarte remote) -# Add dependency so that the remote image is flashed first. -sysbuild_add_dependencies(FLASH idle_uarte remote) +endif() diff --git a/tests/benchmarks/multicore/idle_uarte/testcase.yaml b/tests/benchmarks/multicore/idle_uarte/testcase.yaml index 63cd1014e235..f5d10e35257d 100644 --- a/tests/benchmarks/multicore/idle_uarte/testcase.yaml +++ b/tests/benchmarks/multicore/idle_uarte/testcase.yaml @@ -41,6 +41,27 @@ tests: pytest_root: - "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_power_consumption_gated_uarte" + benchmarks.multicore.idle_uarte.fast.nrf54h20dk_cpuapp_cpurad.s2ram.remote_gd_freq_switching: + tags: + - ci_build + - ci_tests_benchmarks_multicore + - uarte + - ppk_power_measure + filter: not CONFIG_COVERAGE + harness: pytest + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp + integration_platforms: + - nrf54h20dk/nrf54h20/cpuapp + extra_args: + - DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay" + - SB_CONFIG_REMOTE_GLOBAL_DOMAIN_CLOCK_FREQUENCY_SWITCHING=y + harness_config: + fixture: gpio_loopback + pytest_root: + - "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_power_consumption_gated_uarte" + + benchmarks.multicore.idle_uarte.fast.gd_freq_256MHz.nrf54h20dk_cpuapp_cpurad.s2ram: tags: - ci_build