-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: benchmars: multicore: add comp tests.
Add tests for assesing s2ram with (lp)comp power consumption. Signed-off-by: Bartlomiej Buczek <[email protected]>
- Loading branch information
1 parent
0d1aab5
commit bab53b6
Showing
13 changed files
with
229 additions
and
0 deletions.
There are no files selected for viewing
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 @@ | ||
# | ||
# Copyright (c) 2024 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_comp) | ||
|
||
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,10 @@ | ||
# | ||
# Copyright (c) 2024 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" |
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,16 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
|
||
&comp { | ||
main-mode = "SE"; | ||
psel = "AIN2"; /* P1.02 */ | ||
refsel = "INT_1V2"; | ||
sp-mode = "HIGH"; | ||
th-up = <63>; | ||
th-down = <59>; | ||
isource = "DISABLED"; | ||
status = "okay"; | ||
}; |
12 changes: 12 additions & 0 deletions
12
tests/benchmarks/multicore/idle_comp/boards/lpcomp.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,12 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
|
||
&comp { | ||
compatible = "nordic,nrf-lpcomp"; | ||
psel = "AIN2"; /* P1.02 */ | ||
refsel = "VDD_4_8"; | ||
status = "okay"; | ||
}; |
19 changes: 19 additions & 0 deletions
19
tests/benchmarks/multicore/idle_comp/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,19 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
|
||
/ { | ||
aliases { | ||
test-comp = ∁ | ||
}; | ||
|
||
zephyr,user { | ||
test-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; | ||
}; | ||
}; | ||
|
||
&gpio1 { | ||
status = "okay"; | ||
}; |
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 @@ | ||
CONFIG_COMPARATOR=y | ||
CONFIG_GPIO=y | ||
|
||
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_BOOT_BANNER=n | ||
CONFIG_SOC_NRF54H20_NO_MRAM_LATENCY=n | ||
CONFIG_ASSERT=y | ||
|
||
# Enable for debugging purposes only | ||
CONFIG_PRINTK=n | ||
CONFIG_LOG=n | ||
CONFIG_CONSOLE=n | ||
CONFIG_UART_CONSOLE=n | ||
CONFIG_SERIAL=n |
12 changes: 12 additions & 0 deletions
12
tests/benchmarks/multicore/idle_comp/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,12 @@ | ||
# | ||
# Copyright (c) 2024 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) |
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_PM=y | ||
CONFIG_POWEROFF=y | ||
CONFIG_CONSOLE=n | ||
CONFIG_UART_CONSOLE=n | ||
CONFIG_SERIAL=n | ||
CONFIG_GPIO=n | ||
CONFIG_BOOT_BANNER=n | ||
CONFIG_SOC_NRF54H20_NO_MRAM_LATENCY=n |
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,14 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
|
||
#include <zephyr/kernel.h> | ||
|
||
int main(void) | ||
{ | ||
k_sleep(K_FOREVER); | ||
|
||
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,44 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
|
||
#include <zephyr/drivers/comparator.h> | ||
#include <zephyr/drivers/gpio.h> | ||
#include <zephyr/kernel.h> | ||
|
||
static const struct device *test_dev = DEVICE_DT_GET(DT_ALIAS(test_comp)); | ||
static const struct gpio_dt_spec test_pin = GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), test_gpios); | ||
|
||
volatile int counter; | ||
static void test_callback(const struct device *dev, void *user_data) | ||
{ | ||
counter++; | ||
} | ||
|
||
int main(void) | ||
{ | ||
|
||
int rc; | ||
|
||
gpio_pin_configure_dt(&test_pin, GPIO_OUTPUT_INACTIVE); | ||
|
||
rc = comparator_set_trigger_callback(test_dev, test_callback, NULL); | ||
__ASSERT_NO_MSG(rc == 0); | ||
|
||
rc = comparator_set_trigger(test_dev, COMPARATOR_TRIGGER_BOTH_EDGES); | ||
__ASSERT_NO_MSG(rc == 0); | ||
k_msleep(1000); | ||
|
||
while (1) { | ||
counter = 0; | ||
gpio_pin_set_dt(&test_pin, 1); | ||
k_msleep(1000); | ||
__ASSERT_NO_MSG(counter == 1); | ||
gpio_pin_set_dt(&test_pin, 0); | ||
k_msleep(1000); | ||
__ASSERT_NO_MSG(counter == 2); | ||
} | ||
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,22 @@ | ||
# | ||
# 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() | ||
|
||
# Add remote project | ||
ExternalZephyrProject_Add( | ||
APPLICATION remote | ||
SOURCE_DIR ${APP_DIR}/remote | ||
BOARD ${SB_CONFIG_REMOTE_BOARD} | ||
BOARD_REVISION ${BOARD_REVISION} | ||
) | ||
|
||
# Add a dependency so that the remote image will be built and flashed first | ||
add_dependencies(idle_comp remote) | ||
# Add dependency so that the remote image is flashed first. | ||
sysbuild_add_dependencies(FLASH idle_comp remote) |
1 change: 1 addition & 0 deletions
1
tests/benchmarks/multicore/idle_comp/sysbuild/nrf54h20dk_nrf54h20_cpurad.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 @@ | ||
SB_CONFIG_REMOTE_BOARD="nrf54h20dk/nrf54h20/cpurad" |
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,34 @@ | ||
common: | ||
sysbuild: true | ||
tags: ci_build ci_tests_benchmarks_multicore ppk_power_measure | ||
|
||
tests: | ||
benchmarks.multicore.idle_comp.nrf54h20dk_cpuapp_cpurad.s2ram: | ||
harness: pytest | ||
platform_allow: | ||
- nrf54h20dk/nrf54h20/cpuapp | ||
integration_platforms: | ||
- nrf54h20dk/nrf54h20/cpuapp | ||
extra_args: | ||
- FILE_SUFFIX=s2ram | ||
- SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad.conf | ||
- EXTRA_DTC_OVERLAY_FILE="boards/comp.overlay" | ||
harness_config: | ||
fixture: gpio_loopback | ||
pytest_root: | ||
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_power_consumption_comp" | ||
|
||
benchmarks.multicore.idle_lpcomp.nrf54h20dk_cpuapp_cpurad.s2ram: | ||
harness: pytest | ||
platform_allow: | ||
- nrf54h20dk/nrf54h20/cpuapp | ||
integration_platforms: | ||
- nrf54h20dk/nrf54h20/cpuapp | ||
extra_args: | ||
- FILE_SUFFIX=s2ram | ||
- SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad.conf | ||
- EXTRA_DTC_OVERLAY_FILE="boards/lpcomp.overlay" | ||
harness_config: | ||
fixture: gpio_loopback | ||
pytest_root: | ||
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_power_consumption_lpcomp" |