Skip to content

Commit dd08471

Browse files
nordic-pikrnordic-piks
authored andcommitted
tests: benchmarks: multicore: idle_gpio: add cpuppr
Add cpuapp+cpuppr configuration for idle_gpio benchmark test. Signed-off-by: Piotr Krzyzanowski <[email protected]>
1 parent 36f509f commit dd08471

File tree

7 files changed

+168
-18
lines changed

7 files changed

+168
-18
lines changed

tests/benchmarks/multicore/idle_gpio/Kconfig.sysbuild

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,39 @@
66

77
source "share/sysbuild/Kconfig"
88

9+
config RUN_PPRCORE
10+
bool "Run test on Peripheral Processor Core (PPR)"
11+
12+
choice PPRCORE
13+
default PPRCORE_REMOTE if RUN_PPRCORE
14+
15+
config PPRCORE_REMOTE
16+
bool "Remote image"
17+
18+
endchoice
19+
20+
config PPRCORE_IMAGE_NAME
21+
default "remote" if PPRCORE_REMOTE
22+
23+
config PPRCORE_IMAGE_PATH
24+
default "${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/multicore/idle_gpio/remote" if PPRCORE_REMOTE
25+
926
choice NETCORE
10-
default NETCORE_REMOTE
27+
default NETCORE_REMOTE if PPRCORE_NONE
28+
default NETCORE_REMOTE_SLEEP_FOREVER if !PPRCORE_NONE
1129

1230
config NETCORE_REMOTE
1331
bool "Remote image"
1432

33+
config NETCORE_REMOTE_SLEEP_FOREVER
34+
bool "Remote sleep forever image"
35+
1536
endchoice
1637

1738
config NETCORE_IMAGE_NAME
1839
default "remote" if NETCORE_REMOTE
40+
default "remote_sleep_forever" if NETCORE_REMOTE_SLEEP_FOREVER
1941

2042
config NETCORE_IMAGE_PATH
2143
default "${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/multicore/idle_gpio/remote" if NETCORE_REMOTE
44+
default "${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/power_consumption/common/remote_sleep_forever" if NETCORE_REMOTE_SLEEP_FOREVER
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
&cpuppr_vpr {
8+
status = "okay";
9+
};

tests/benchmarks/multicore/idle_gpio/remote/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
1010
project(remote)
1111

1212
target_sources(app PRIVATE ../src/main.c)
13+
14+
if(CONFIG_SOC_NRF54H20_CPUPPR)
15+
message(DEBUG "Power Mode handler for RISC V is included.")
16+
target_sources(app PRIVATE ../../common/power_off.c)
17+
endif()
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
config APP_PROVIDE_PM_HOOKS
8+
bool "Application provides PM hooks"
9+
default y if SOC_NRF54H20_CPUPPR
10+
select HAS_PM
11+
select HAS_POWEROFF
12+
13+
source "Kconfig.zephyr"
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
/ {
8+
aliases {
9+
led3 = &led3;
10+
sw1 = &button1;
11+
};
12+
13+
leds {
14+
compatible = "gpio-leds";
15+
16+
led3: led_3 {
17+
gpios = <&gpio9 3 GPIO_ACTIVE_HIGH>;
18+
label = "Green LED 3";
19+
};
20+
};
21+
22+
buttons {
23+
compatible = "gpio-keys";
24+
25+
button1: button_1 {
26+
gpios = <&gpio0 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
27+
label = "Push button 1";
28+
zephyr,code = <INPUT_KEY_1>;
29+
};
30+
};
31+
32+
cpus {
33+
power-states {
34+
wait: wait {
35+
compatible = "zephyr,power-state";
36+
power-state-name = "standby";
37+
substate-id = <0>;
38+
min-residency-us = <20000>;
39+
};
40+
41+
hibernate: hibernate {
42+
compatible = "zephyr,power-state";
43+
power-state-name = "suspend-to-ram";
44+
substate-id = <0>;
45+
min-residency-us = <400000>;
46+
};
47+
};
48+
};
49+
};
50+
51+
&cpu {
52+
cpu-power-states = <&wait &hibernate>;
53+
};
54+
55+
&gpio0 {
56+
status = "okay";
57+
};
58+
59+
&gpio9 {
60+
status = "okay";
61+
};
62+
63+
&gpiote130 {
64+
status = "okay";
65+
owned-channels = <0>;
66+
};

tests/benchmarks/multicore/idle_gpio/src/main.c

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios);
1818
#elif IS_ENABLED(CONFIG_SOC_NRF54H20_CPURAD)
1919
static const struct gpio_dt_spec sw = GPIO_DT_SPEC_GET(DT_ALIAS(sw1), gpios);
2020
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(DT_ALIAS(led1), gpios);
21+
#elif IS_ENABLED(CONFIG_SOC_NRF54H20_CPUPPR)
22+
static const struct gpio_dt_spec sw = GPIO_DT_SPEC_GET(DT_ALIAS(sw1), gpios);
23+
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(DT_ALIAS(led3), gpios);
24+
2125
#else
2226
#error "Invalid core selected. "
2327
#endif
@@ -31,7 +35,7 @@ static K_SEM_DEFINE(my_gpio_sem, 0, 1);
3135
void my_gpio_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins)
3236
{
3337
gpio_pin_set_dt(&led, 1);
34-
LOG_INF("User callback for %s\n", CONFIG_BOARD_TARGET);
38+
LOG_INF("User callback for %s", CONFIG_BOARD_TARGET);
3539
k_sem_give(&my_gpio_sem);
3640
}
3741

@@ -44,55 +48,55 @@ int main(void)
4448

4549
rc = gpio_is_ready_dt(&led);
4650
if (rc < 0) {
47-
LOG_ERR("GPIO Device not ready (%d)\n", rc);
51+
LOG_ERR("GPIO Device not ready (%d)", rc);
4852
return 0;
4953
}
5054

5155
rc = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
5256
if (rc < 0) {
53-
LOG_ERR("Could not configure led GPIO (%d)\n", rc);
57+
LOG_ERR("Could not configure led GPIO (%d)", rc);
5458
return 0;
5559
}
5660

5761
#if DT_NODE_EXISTS(DT_PATH(zephyr_user))
5862
rc = gpio_is_ready_dt(&fake_rts);
5963
if (rc < 0) {
60-
LOG_ERR("GPIO Device not ready (%d)\n", rc);
64+
LOG_ERR("GPIO Device not ready (%d)", rc);
6165
return 0;
6266
}
6367

6468
rc = gpio_pin_configure_dt(&fake_rts, GPIO_OUTPUT_ACTIVE);
6569
if (rc < 0) {
66-
LOG_ERR("Could not configure fake_rst GPIO (%d)\n", rc);
70+
LOG_ERR("Could not configure fake_rst GPIO (%d)", rc);
6771
return 0;
6872
}
6973
#endif
7074

7175
rc = gpio_is_ready_dt(&sw);
7276
if (rc < 0) {
73-
LOG_ERR("GPIO Device not ready (%d)\n", rc);
77+
LOG_ERR("GPIO Device not ready (%d)", rc);
7478
return 0;
7579
}
7680

7781
rc = gpio_pin_configure_dt(&sw, GPIO_INPUT);
7882
if (rc < 0) {
79-
LOG_ERR("Could not configure sw GPIO (%d)\n", rc);
83+
LOG_ERR("Could not configure sw GPIO (%d)", rc);
8084
return 0;
8185
}
8286

8387
rc = gpio_pin_interrupt_configure(sw.port, sw.pin, GPIO_INT_LEVEL_ACTIVE);
8488
if (rc < 0) {
85-
LOG_ERR("Could not configure sw GPIO interrupt (%d)\n", rc);
89+
LOG_ERR("Could not configure sw GPIO interrupt (%d)", rc);
8690
return 0;
8791
}
8892
gpio_init_callback(&gpio_cb, my_gpio_callback, 0xFFFF);
8993
gpio_add_callback(sw.port, &gpio_cb);
90-
LOG_INF("Multicore idle_gpio test on %s\n", CONFIG_BOARD_TARGET);
94+
LOG_INF("Multicore idle_gpio test on %s", CONFIG_BOARD_TARGET);
9195
while (1) {
92-
LOG_INF("Multicore idle_gpio test iteration %u\n", cnt++);
96+
LOG_INF("Multicore idle_gpio test iteration %u", cnt++);
9397
gpio_pin_set_dt(&led, 0);
9498
if (k_sem_take(&my_gpio_sem, K_FOREVER) != 0) {
95-
LOG_ERR("Failed to take a semaphore\n");
99+
LOG_ERR("Failed to take a semaphore");
96100
return 0;
97101
}
98102
k_busy_wait(1000000);

tests/benchmarks/multicore/idle_gpio/testcase.yaml

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,22 @@ tests:
2020
- nrf54h20dk/nrf54h20/cpuapp
2121
extra_args:
2222
- FILE_SUFFIX=s2ram
23-
- DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_s2ram.overlay"
24-
- remote_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpurad_s2ram.overlay"
23+
harness: pytest
24+
harness_config:
25+
fixture: ppk_power_measure
26+
pytest_root:
27+
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_power_consumption_simple"
28+
tags: ppk_power_measure
29+
30+
benchmarks.multicore.idle_gpio.nrf54h20dk_cpuapp_cpuppr.s2ram:
31+
platform_allow:
32+
- nrf54h20dk/nrf54h20/cpuapp
33+
integration_platforms:
34+
- nrf54h20dk/nrf54h20/cpuapp
35+
extra_args:
36+
- FILE_SUFFIX=s2ram
37+
- SB_CONFIG_RUN_PPRCORE=y
38+
- EXTRA_DTC_OVERLAY_FILE="enable_ppr.overlay"
2539
harness: pytest
2640
harness_config:
2741
fixture: ppk_power_measure
@@ -37,8 +51,6 @@ tests:
3751
extra_args:
3852
- SB_CONFIG_BOOTLOADER_MCUBOOT=y
3953
- FILE_SUFFIX=s2ram
40-
- DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_s2ram.overlay"
41-
- remote_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpurad_s2ram.overlay"
4254
- mcuboot_EXTRA_DTC_OVERLAY_FILE="${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/multicore/idle_gpio/boards/nrf54h20dk_nrf54h20_cpuapp_s2ram.overlay"
4355
harness: pytest
4456
harness_config:
@@ -54,8 +66,26 @@ tests:
5466
- nrf54h20dk/nrf54h20/cpuapp
5567
extra_args:
5668
- FILE_SUFFIX=s2ram
57-
- DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_s2ram.overlay;boards/wakeup_from_uart_pins.overlay"
58-
- remote_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpurad_s2ram.overlay;boards/wakeup_from_uart_pins.overlay"
69+
- EXTRA_DTC_OVERLAY_FILE="boards/wakeup_from_uart_pins.overlay"
70+
- remote_EXTRA_DTC_OVERLAY_FILE="boards/wakeup_from_uart_pins.overlay"
71+
harness: pytest
72+
harness_config:
73+
fixture: gpio_loopback
74+
pytest_root:
75+
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_power_consumption_with_wakeups_two_cores"
76+
timeout: 120
77+
tags: ppk_power_measure
78+
79+
benchmarks.multicore.idle_gpio.nrf54h20dk_cpuapp_cpuppr.s2ram.wakeup_from_uart_pins:
80+
platform_allow:
81+
- nrf54h20dk/nrf54h20/cpuapp
82+
integration_platforms:
83+
- nrf54h20dk/nrf54h20/cpuapp
84+
extra_args:
85+
- FILE_SUFFIX=s2ram
86+
- SB_CONFIG_RUN_PPRCORE=y
87+
- EXTRA_DTC_OVERLAY_FILE="enable_ppr.overlay;boards/wakeup_from_uart_pins.overlay"
88+
- remote_EXTRA_DTC_OVERLAY_FILE="boards/wakeup_from_uart_pins.overlay"
5989
harness: pytest
6090
harness_config:
6191
fixture: gpio_loopback

0 commit comments

Comments
 (0)