-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests: benchmarks: multicore: Add PM tests with FLPR core #19870
Merged
nordic-piks
merged 1 commit into
nrfconnect:main
from
nordic-segl:NRFX-6752_Add-idle-flpr
Jan 15, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# | ||
# 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}) | ||
|
||
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_flpr) | ||
|
||
target_sources(app PRIVATE src/main.c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# | ||
# Copyright (c) 2025 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
|
||
config TEST_SLEEP_DURATION_MS | ||
int "Core sleep duration (miliseconds)" | ||
default 1000 | ||
help | ||
Set sleep duration to TEST_SLEEP_DURATION_MS miliseconds. | ||
Based on the value of 'min-residency-us' specified for each power state defined in the DTS, | ||
core enters the lowest possible power state. | ||
|
||
source "Kconfig.zephyr" |
27 changes: 27 additions & 0 deletions
27
tests/benchmarks/multicore/idle_flpr/boards/nrf54h20dk_nrf54h20_cpuapp.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (c) 2025 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
|
||
&cpuflpr_vpr { | ||
status = "okay"; | ||
}; | ||
|
||
&uart120 { | ||
status = "reserved"; | ||
interrupt-parent = <&cpuflpr_clic>; | ||
}; | ||
|
||
/ { | ||
aliases { | ||
/delete-property/ led1; | ||
}; | ||
}; | ||
|
||
/delete-node/ &led1; | ||
|
||
&gpiote130 { | ||
status = "okay"; | ||
owned-channels = <0>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CONFIG_BOOT_BANNER=n | ||
CONFIG_NCS_BOOT_BANNER=n | ||
|
||
CONFIG_LOG=y | ||
CONFIG_ASSERT=y | ||
CONFIG_GPIO=y | ||
|
||
CONFIG_NRF_REGTOOL_VERBOSITY=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
CONFIG_PM=y | ||
CONFIG_PM_S2RAM=y | ||
CONFIG_PM_S2RAM_CUSTOM_MARKING=y | ||
CONFIG_POWEROFF=y | ||
|
||
CONFIG_PM_DEVICE=y | ||
CONFIG_PM_DEVICE_RUNTIME=y | ||
|
||
CONFIG_BOOT_BANNER=n | ||
CONFIG_NCS_BOOT_BANNER=n | ||
CONFIG_PRINTK=n | ||
CONFIG_LOG=n | ||
CONFIG_CONSOLE=n | ||
CONFIG_UART_CONSOLE=n | ||
CONFIG_SERIAL=n | ||
|
||
CONFIG_ASSERT=y | ||
CONFIG_GPIO=y |
17 changes: 17 additions & 0 deletions
17
tests/benchmarks/multicore/idle_flpr/remote/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# | ||
# 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) | ||
|
||
target_sources(app PRIVATE src/main.c) | ||
|
||
if((DEFINED CONFIG_SOC_NRF54H20_CPUFLPR) OR (DEFINED CONFIG_SOC_NRF54H20_ENGB_CPUFLPR)) | ||
message(STATUS "Power Mode handler for RISC V is included.") | ||
target_sources(app PRIVATE ../../common/power_off.c) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# | ||
# Copyright (c) 2025 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
|
||
config TEST_SLEEP_DURATION_MS | ||
int "Core sleep duration (miliseconds)" | ||
default 1000 | ||
help | ||
Set sleep duration to TEST_SLEEP_DURATION_MS miliseconds. | ||
Based on the value of 'min-residency-us' specified for each power state defined in the DTS, | ||
core enters the lowest possible power state. | ||
|
||
config APP_PROVIDE_PM_HOOKS | ||
bool "Application provides PM hooks" | ||
default y | ||
select HAS_PM | ||
select HAS_POWEROFF | ||
|
||
source "Kconfig.zephyr" |
29 changes: 29 additions & 0 deletions
29
tests/benchmarks/multicore/idle_flpr/remote/boards/nrf54h20dk_nrf54h20_cpuflpr.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) 2025 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
|
||
/ { | ||
cpus { | ||
power-states { | ||
wait: wait { | ||
compatible = "zephyr,power-state"; | ||
power-state-name = "standby"; | ||
substate-id = <0>; | ||
min-residency-us = <20000>; | ||
}; | ||
|
||
hibernate: hibernate { | ||
compatible = "zephyr,power-state"; | ||
power-state-name = "suspend-to-ram"; | ||
substate-id = <0>; | ||
min-residency-us = <400000>; | ||
}; | ||
}; | ||
}; | ||
}; | ||
|
||
&cpu { | ||
cpu-power-states = <&wait &hibernate>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CONFIG_LOG=y | ||
CONFIG_CONSOLE=n | ||
CONFIG_UART_CONSOLE=n | ||
CONFIG_SERIAL=n | ||
CONFIG_BOOT_BANNER=n | ||
CONFIG_NCS_BOOT_BANNER=n | ||
CONFIG_PRINTK=n | ||
|
||
CONFIG_ASSERT=y | ||
|
||
CONFIG_NRF_REGTOOL_VERBOSITY=1 |
13 changes: 13 additions & 0 deletions
13
tests/benchmarks/multicore/idle_flpr/remote/prj_s2ram.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
CONFIG_PM=y | ||
CONFIG_POWEROFF=y | ||
|
||
CONFIG_PM_DEVICE=y | ||
CONFIG_PM_DEVICE_RUNTIME=y | ||
|
||
CONFIG_CONSOLE=n | ||
CONFIG_UART_CONSOLE=n | ||
CONFIG_SERIAL=n | ||
CONFIG_BOOT_BANNER=n | ||
CONFIG_NCS_BOOT_BANNER=n | ||
|
||
CONFIG_ASSERT=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright (c) 2025 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
#include <zephyr/kernel.h> | ||
|
||
#include <zephyr/logging/log.h> | ||
LOG_MODULE_REGISTER(idle_flpr, LOG_LEVEL_INF); | ||
|
||
int main(void) | ||
{ | ||
LOG_INF("Multicore idle_flpr test on %s", CONFIG_BOARD_TARGET); | ||
LOG_INF("Main sleeps for %d ms", CONFIG_TEST_SLEEP_DURATION_MS); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright (c) 2025 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
#include <zephyr/kernel.h> | ||
#include <zephyr/drivers/gpio.h> | ||
|
||
#include <zephyr/logging/log.h> | ||
LOG_MODULE_REGISTER(idle_flpr, LOG_LEVEL_INF); | ||
|
||
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios); | ||
|
||
/* Variables used to make CPU active for ~1 second */ | ||
static struct k_timer my_timer; | ||
static bool timer_expired; | ||
|
||
void my_timer_handler(struct k_timer *dummy) | ||
{ | ||
timer_expired = true; | ||
} | ||
|
||
int main(void) | ||
{ | ||
int counter = 0; | ||
int ret; | ||
|
||
LOG_INF("Multicore idle_flpr test on %s", CONFIG_BOARD_TARGET); | ||
LOG_INF("Main sleeps for %d ms", CONFIG_TEST_SLEEP_DURATION_MS); | ||
|
||
ret = gpio_is_ready_dt(&led); | ||
if (!ret) { | ||
LOG_ERR("LED is not ready"); | ||
} | ||
__ASSERT(ret, "LED is not ready\n"); | ||
|
||
ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE); | ||
if (ret < 0) { | ||
LOG_ERR("Unable to configure GPIO as output"); | ||
} | ||
__ASSERT(ret == 0, "Unable to configure GPIO as output\n"); | ||
|
||
k_timer_init(&my_timer, my_timer_handler, NULL); | ||
|
||
/* Run test forever */ | ||
while (1) { | ||
timer_expired = false; | ||
|
||
/* start a one-shot timer that expires after 1 second */ | ||
k_timer_start(&my_timer, K_MSEC(1000), K_NO_WAIT); | ||
|
||
/* Turn ON LED */ | ||
ret = gpio_pin_set_dt(&led, 1); | ||
if (ret < 0) { | ||
LOG_ERR("Unable to turn on LED"); | ||
} | ||
__ASSERT(ret == 0, "Unable to turn on LED\n"); | ||
|
||
/* Keep CPU active for ~ 1 second */ | ||
while (!timer_expired) { | ||
k_busy_wait(10000); | ||
k_yield(); | ||
} | ||
|
||
/* Turn OFF LED */ | ||
ret = gpio_pin_set_dt(&led, 0); | ||
if (ret < 0) { | ||
LOG_ERR("Unable to turn off LED"); | ||
} | ||
__ASSERT(ret == 0, "Unable to turn off LED\n"); | ||
|
||
LOG_INF("Run %d", counter); | ||
counter++; | ||
|
||
/* Sleep / enter low power state */ | ||
k_msleep(CONFIG_TEST_SLEEP_DURATION_MS); | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# | ||
# Copyright (c) 2025 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
|
||
# Add remote project | ||
ExternalZephyrProject_Add( | ||
APPLICATION remote_rad | ||
SOURCE_DIR ${SYSBUILD_NRF_MODULE_DIR}/tests/benchmarks/power_consumption/common/remote_sleep_forever | ||
BOARD ${SB_CONFIG_BOARD}/${SB_CONFIG_SOC}/cpurad | ||
BOARD_REVISION ${BOARD_REVISION} | ||
) | ||
|
||
ExternalZephyrProject_Add( | ||
APPLICATION remote_flpr | ||
SOURCE_DIR ${APP_DIR}/remote | ||
BOARD ${SB_CONFIG_BOARD}/${SB_CONFIG_SOC}/cpuflpr | ||
BOARD_REVISION ${BOARD_REVISION} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
common: | ||
sysbuild: true | ||
tags: | ||
- ci_build | ||
- ci_tests_benchmarks_multicore | ||
platform_allow: | ||
- nrf54h20dk/nrf54h20/cpuapp | ||
integration_platforms: | ||
- nrf54h20dk/nrf54h20/cpuapp | ||
|
||
tests: | ||
benchmarks.multicore.idle_flpr.no_sleep: | ||
required_snippets: | ||
- nordic-log-stm | ||
harness: console | ||
harness_config: | ||
type: multi_line | ||
ordered: true | ||
regex: | ||
- "app/idle_flpr: Multicore idle_flpr test on" | ||
- "flpr/idle_flpr: Multicore idle_flpr test on" | ||
- "idle_flpr: Run 0" | ||
- "idle_flpr: Run 1" | ||
|
||
benchmarks.multicore.idle_flpr.idle: | ||
tags: ppk_power_measure | ||
extra_args: | ||
- idle_flpr_CONF_FILE=prj_s2ram.conf | ||
- remote_flpr_CONF_FILE=prj_s2ram.conf | ||
- idle_flpr_CONFIG_TEST_SLEEP_DURATION_MS=500 | ||
- remote_flpr_CONFIG_TEST_SLEEP_DURATION_MS=500 | ||
harness: pytest | ||
harness_config: | ||
fixture: ppk_power_measure | ||
pytest_root: | ||
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_ppr_and_idle" | ||
|
||
benchmarks.multicore.idle_flpr.s2ram: | ||
tags: ppk_power_measure | ||
extra_args: | ||
- idle_flpr_CONF_FILE=prj_s2ram.conf | ||
- remote_flpr_CONF_FILE=prj_s2ram.conf | ||
harness: pytest | ||
harness_config: | ||
fixture: ppk_power_measure | ||
pytest_root: | ||
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_ppr_and_s2ram" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, this should go to some
soc
files?(not requesting to add it there in this PR, maybe you can just add some comment with this information)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No 😄