Skip to content
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 comp tests. #18932

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions tests/benchmarks/multicore/idle_comp/CMakeLists.txt
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)
10 changes: 10 additions & 0 deletions tests/benchmarks/multicore/idle_comp/Kconfig.sysbuild
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"
16 changes: 16 additions & 0 deletions tests/benchmarks/multicore/idle_comp/boards/comp.overlay
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 tests/benchmarks/multicore/idle_comp/boards/lpcomp.overlay
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";
};
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 = &comp;
};

zephyr,user {
test-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;
};
};

&gpio1 {
status = "okay";
};
19 changes: 19 additions & 0 deletions tests/benchmarks/multicore/idle_comp/prj.conf
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 tests/benchmarks/multicore/idle_comp/remote/CMakeLists.txt
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)
8 changes: 8 additions & 0 deletions tests/benchmarks/multicore/idle_comp/remote/prj.conf
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
14 changes: 14 additions & 0 deletions tests/benchmarks/multicore/idle_comp/remote/src/main.c
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;
}
44 changes: 44 additions & 0 deletions tests/benchmarks/multicore/idle_comp/src/main.c
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;
}
22 changes: 22 additions & 0 deletions tests/benchmarks/multicore/idle_comp/sysbuild.cmake
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)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SB_CONFIG_REMOTE_BOARD="nrf54h20dk/nrf54h20/cpurad"
34 changes: 34 additions & 0 deletions tests/benchmarks/multicore/idle_comp/testcase.yaml
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"
Loading