Skip to content

Commit 19a3df8

Browse files
nordic-pikrbjarki-andreasen
authored andcommitted
tests: benchmarks: multicore: Add leds
Add leds indicating particular core activity to simplify the analysis of measurements Signed-off-by: Piotr Krzyzanowski <piotr.krzyzanowski@nordicsemi.no> (cherry picked from commit 750ddf4)
1 parent c183191 commit 19a3df8

File tree

78 files changed

+489
-112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+489
-112
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/ {
2+
aliases {
3+
/delete-property/ led1;
4+
};
5+
};
6+
7+
/delete-node/ &led1;

tests/benchmarks/current_consumption/nfc_idle/sysbuild.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if(SB_CONFIG_SOC_NRF54H20)
88
# Add remote project
99
ExternalZephyrProject_Add(
1010
APPLICATION remote
11-
SOURCE_DIR ${SYSBUILD_NRF_MODULE_DIR}/tests/benchmarks/power_consumption/common/remote_sleep_forever
11+
SOURCE_DIR ${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/power_consumption/common/remote_sleep_forever
1212
BOARD ${SB_CONFIG_REMOTE_BOARD}
1313
BOARD_REVISION ${BOARD_REVISION}
1414
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
#include <zephyr/dt-bindings/gpio/nordic-nrf-gpio.h>
8+
9+
/ {
10+
11+
aliases {
12+
led = &led0;
13+
/delete-property/ led1;
14+
};
15+
16+
};
17+
18+
/delete-node/ &led1;

tests/benchmarks/multicore/idle_hpu_temp_meas/prj.conf

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ CONFIG_PM_DEVICE=y
55
CONFIG_PM_DEVICE_RUNTIME=y
66
CONFIG_POWEROFF=y
77

8-
CONFIG_GPIO=n
98
CONFIG_BOOT_BANNER=n
109

1110
CONFIG_ASSERT=y

tests/benchmarks/multicore/idle_hpu_temp_meas/sysbuild.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ endif()
1111
# Add remote project
1212
ExternalZephyrProject_Add(
1313
APPLICATION remote
14-
SOURCE_DIR ${SYSBUILD_NRF_MODULE_DIR}/tests/benchmarks/power_consumption/common/remote_sleep_forever
14+
SOURCE_DIR ${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/power_consumption/common/remote_sleep_forever
1515
BOARD ${SB_CONFIG_REMOTE_BOARD}
1616
BOARD_REVISION ${BOARD_REVISION}
1717
)

tests/benchmarks/multicore/idle_outside_of_main/remote/src/main.c tests/benchmarks/multicore/idle_outside_of_main/boards/nrf54h20dk_nrf54h20_cpuapp.overlay

+8-9
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55
*/
66

7-
#include <zephyr/kernel.h>
8-
9-
int main(void)
10-
{
11-
12-
k_msleep(2000);
13-
14-
return 0;
15-
}
7+
/ {
8+
aliases {
9+
led = &led0;
10+
/delete-property/ led1;
11+
};
12+
};
13+
14+
/delete-node/ &led1;

tests/benchmarks/multicore/idle_outside_of_main/prj.conf

-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@ CONFIG_PRINTK=n
1212
CONFIG_LOG=n
1313
CONFIG_CONSOLE=n
1414
CONFIG_UART_CONSOLE=n
15-
CONFIG_GPIO=n

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ cmake_minimum_required(VERSION 3.20.0)
99
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
1010
project(remote)
1111

12-
target_sources(app PRIVATE src/main.c)
12+
target_sources(app PRIVATE ../src/main.c)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
/ {
8+
aliases {
9+
led = &led1;
10+
};
11+
12+
leds {
13+
compatible = "gpio-leds";
14+
led1: led_1 {
15+
gpios = <&gpio9 1 GPIO_ACTIVE_HIGH>;
16+
label = "Green LED 1";
17+
};
18+
};
19+
};
20+
21+
&gpio9 {
22+
status = "okay";
23+
};
24+
25+
&gpiote130 {
26+
status = "okay";
27+
};

tests/benchmarks/multicore/idle_outside_of_main/remote/prj.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ CONFIG_POWEROFF=y
33
CONFIG_CONSOLE=n
44
CONFIG_UART_CONSOLE=n
55
CONFIG_SERIAL=n
6-
CONFIG_GPIO=n
6+
CONFIG_GPIO=y
77
CONFIG_NCS_BOOT_BANNER=n
88
CONFIG_BOOT_BANNER=n

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

+14-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,24 @@
55
*/
66

77
#include <zephyr/kernel.h>
8+
#include <zephyr/logging/log.h>
9+
#include <zephyr/drivers/gpio.h>
10+
#include <zephyr/pm/pm.h>
11+
12+
LOG_MODULE_REGISTER(idle_outside_of_main);
13+
14+
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(DT_ALIAS(led), gpios);
15+
816

917
int main(void)
1018
{
19+
int ret;
20+
21+
ret = gpio_is_ready_dt(&led);
22+
__ASSERT(ret, "Error: GPIO Device not ready");
1123

12-
k_msleep(2000);
24+
ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
25+
__ASSERT(ret == 0, "Could not configure led GPIO");
1326

1427
return 0;
1528
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
#include <zephyr/dt-bindings/pwm/pwm.h>
8+
9+
/ {
10+
aliases {
11+
led = &led0;
12+
/delete-property/ led1;
13+
};
14+
};
15+
16+
/delete-node/ &led1;

tests/benchmarks/multicore/idle_pwm_led/boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_0.overlay

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
/ {
1010
aliases {
11+
led = &led0;
12+
/delete-property/ led1;
1113
pwm-led0 = &pwm120_gpio;
1214
};
1315

@@ -19,6 +21,8 @@
1921
};
2022
};
2123

24+
/delete-node/ &led1;
25+
2226
&pinctrl {
2327
/omit-if-no-ref/ pwm120_default: pwm120_default {
2428
group1 {

tests/benchmarks/multicore/idle_pwm_led/remote/boards/nrf54h20dk_nrf54h20_cpurad.overlay

+17
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,18 @@
66

77
/ {
88
aliases {
9+
led = &led1;
910
pwm-led0 = &pwm_gpio;
1011
};
1112

13+
leds {
14+
compatible = "gpio-leds";
15+
led1: led_1 {
16+
gpios = <&gpio9 1 GPIO_ACTIVE_HIGH>;
17+
label = "Green LED 1";
18+
};
19+
};
20+
1221
pwmleds {
1322
compatible = "pwm-leds";
1423
pwm_gpio: pwm_gpio {
@@ -32,6 +41,14 @@
3241
};
3342
};
3443

44+
&gpio9 {
45+
status = "okay";
46+
};
47+
48+
&gpiote130 {
49+
status = "okay";
50+
};
51+
3552
&pwm131 {
3653
status = "okay";
3754
pinctrl-0 = <&pwm131_default>;
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
CONFIG_PRINTK=y
22
CONFIG_LOG=y
33
CONFIG_PWM=y
4+
CONFIG_GPIO=y

tests/benchmarks/multicore/idle_pwm_led/remote/prj_s2ram.conf

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ CONFIG_SERIAL=n
77
CONFIG_BOOT_BANNER=n
88

99
CONFIG_PWM=y
10+
CONFIG_GPIO=y

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

+15-8
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,13 @@ LOG_MODULE_REGISTER(idle_pwm_led, LOG_LEVEL_INF);
99

1010
#include <zephyr/kernel.h>
1111
#include <zephyr/drivers/pwm.h>
12+
#include <zephyr/drivers/gpio.h>
1213
#include <zephyr/pm/device_runtime.h>
1314

1415

15-
#if IS_ENABLED(CONFIG_SOC_NRF54H20_CPUAPP_COMMON)
16-
/* Alias pwm-led0 = &pwm_led2 */
16+
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(DT_ALIAS(led), gpios);
1717
static const struct pwm_dt_spec pwm_led = PWM_DT_SPEC_GET(DT_ALIAS(pwm_led0));
18-
#elif IS_ENABLED(CONFIG_SOC_NRF54H20_CPURAD_COMMON)
19-
/* Alias pwm-led0 = &pwm_led3 */
20-
static const struct pwm_dt_spec pwm_led = PWM_DT_SPEC_GET(DT_ALIAS(pwm_led0));
21-
#else
22-
#error "Invalid core selected."
23-
#endif
18+
2419

2520
#define PWM_STEPS_PER_SEC (50)
2621

@@ -35,6 +30,16 @@ int main(void)
3530
int32_t pulse_step;
3631
uint32_t current_pulse_width;
3732

33+
if (!gpio_is_ready_dt(&led)) {
34+
LOG_ERR("GPIO Device not ready");
35+
return 0;
36+
}
37+
38+
if (gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE) != 0) {
39+
LOG_ERR("Could not configure led GPIO");
40+
return 0;
41+
}
42+
3843
if (!pwm_is_ready_dt(&pwm_led)) {
3944
LOG_ERR("Device %s is not ready.", pwm_led.dev->name);
4045
return -ENODEV;
@@ -110,7 +115,9 @@ int main(void)
110115
#endif
111116

112117
/* Sleep / enter low power state */
118+
gpio_pin_set_dt(&led, 0);
113119
k_msleep(CONFIG_TEST_SLEEP_DURATION_MS);
120+
gpio_pin_set_dt(&led, 1);
114121
}
115122

116123
return 0;

tests/benchmarks/multicore/idle_pwm_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay

+8
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,21 @@
1313
*/
1414

1515
/ {
16+
17+
aliases {
18+
led = &led0;
19+
/delete-property/ led1;
20+
};
21+
1622
pwm_to_gpio_loopback: pwm_to_gpio_loopback {
1723
compatible = "test-pwm-to-gpio-loopback";
1824
pwms = <&pwm130 0 PWM_USEC(200) PWM_POLARITY_NORMAL>;
1925
gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
2026
};
2127
};
2228

29+
/delete-node/ &led1;
30+
2331
&pinctrl {
2432
/omit-if-no-ref/ pwm130_default: pwm130_default {
2533
group1 {

tests/benchmarks/multicore/idle_pwm_loopback/boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_1.overlay

+7
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,20 @@
1313
*/
1414

1515
/ {
16+
aliases {
17+
led = &led0;
18+
/delete-property/ led1;
19+
};
20+
1621
pwm_to_gpio_loopback: pwm_to_gpio_loopback {
1722
compatible = "test-pwm-to-gpio-loopback";
1823
pwms = <&pwm120 1 PWM_USEC(200) PWM_POLARITY_NORMAL>;
1924
gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>;
2025
};
2126
};
2227

28+
/delete-node/ &led1;
29+
2330
&pinctrl {
2431
/omit-if-no-ref/ pwm120_default: pwm120_default {
2532
group1 {

tests/benchmarks/multicore/idle_pwm_loopback/remote/boards/nrf54h20dk_nrf54h20_cpurad.overlay

+16
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,29 @@
1313
*/
1414

1515
/ {
16+
aliases {
17+
led = &led1;
18+
};
19+
20+
leds {
21+
compatible = "gpio-leds";
22+
led1: led_1 {
23+
gpios = <&gpio9 1 GPIO_ACTIVE_HIGH>;
24+
label = "Green LED 1";
25+
};
26+
};
27+
1628
pwm_to_gpio_loopback: pwm_to_gpio_loopback {
1729
compatible = "test-pwm-to-gpio-loopback";
1830
pwms = <&pwm131 0 PWM_USEC(200) PWM_POLARITY_NORMAL>;
1931
gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>;
2032
};
2133
};
2234

35+
&gpio9 {
36+
status = "okay";
37+
};
38+
2339
&pinctrl {
2440
/omit-if-no-ref/ pwm131_default: pwm131_default {
2541
group1 {

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

+13
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ LOG_MODULE_REGISTER(idle_pwm_loop, LOG_LEVEL_INF);
2121
#error "Unsupported board: pwm_to_gpio_loopback node is not defined"
2222
#endif
2323

24+
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(DT_ALIAS(led), gpios);
25+
2426
static const struct gpio_dt_spec pin_in = GPIO_DT_SPEC_GET_BY_IDX(
2527
DT_NODELABEL(pwm_to_gpio_loopback), gpios, 0);
2628

@@ -97,9 +99,18 @@ int main(void)
9799
uint32_t tolerance;
98100
int ret;
99101

102+
ret = gpio_is_ready_dt(&led);
103+
__ASSERT(ret, "Error: GPIO Device not ready");
104+
100105
#if defined(CONFIG_CLOCK_CONTROL)
106+
ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_INACTIVE);
107+
__ASSERT(ret == 0, "Could not configure led GPIO");
101108
k_msleep(1000);
109+
gpio_pin_set_dt(&led, 1);
102110
set_global_domain_frequency();
111+
#else
112+
ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
113+
__ASSERT(ret == 0, "Could not configure led GPIO");
103114
#endif
104115

105116
/* Set PWM fill ratio to 50% */
@@ -226,7 +237,9 @@ int main(void)
226237
__ASSERT_NO_MSG(low >= edges - tolerance);
227238

228239
/* Sleep / enter low power state */
240+
gpio_pin_set_dt(&led, 0);
229241
k_msleep(CONFIG_TEST_SLEEP_DURATION_MS);
242+
gpio_pin_set_dt(&led, 1);
230243
}
231244

232245
return 0;

tests/benchmarks/multicore/idle_spim/Kconfig.sysbuild

-10
This file was deleted.

0 commit comments

Comments
 (0)