-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: benchmarks: multicore: Remote GDF switching
Add test cases for fast pwm, spim, uarte instances where global domain frequency is changed from remote application Signed-off-by: Piotr Krzyzanowski <[email protected]>
- Loading branch information
1 parent
ed34c4a
commit cd63074
Showing
14 changed files
with
217 additions
and
32 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
tests/benchmarks/multicore/common/remote_gdf_switching/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) 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_sleep_forever) | ||
|
||
target_sources(app PRIVATE src/main.c) |
32 changes: 32 additions & 0 deletions
32
...enchmarks/multicore/common/remote_gdf_switching/boards/nrf54h20dk_nrf54h20_cpurad.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,32 @@ | ||
/* | ||
* Copyright (c) 2025 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
|
||
/ { | ||
aliases { | ||
led = &led1; | ||
}; | ||
|
||
leds { | ||
compatible = "gpio-leds"; | ||
led1: led_1 { | ||
gpios = <&gpio9 1 GPIO_ACTIVE_HIGH>; | ||
label = "Green LED 1"; | ||
}; | ||
}; | ||
}; | ||
|
||
&gpio9 { | ||
status = "okay"; | ||
}; | ||
|
||
&gpiote130 { | ||
status = "okay"; | ||
}; | ||
|
||
&uart135 { | ||
status = "disabled"; | ||
/delete-property/memory-regions; | ||
}; |
9 changes: 9 additions & 0 deletions
9
tests/benchmarks/multicore/common/remote_gdf_switching/prj.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,9 @@ | ||
CONFIG_CLOCK_CONTROL=y | ||
|
||
CONFIG_PM=y | ||
CONFIG_POWEROFF=y | ||
CONFIG_CONSOLE=n | ||
CONFIG_UART_CONSOLE=n | ||
CONFIG_SERIAL=n | ||
CONFIG_GPIO=y | ||
CONFIG_BOOT_BANNER=n |
54 changes: 54 additions & 0 deletions
54
tests/benchmarks/multicore/common/remote_gdf_switching/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,54 @@ | ||
/* | ||
* Copyright (c) 2025 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
#include <zephyr/kernel.h> | ||
#include <zephyr/drivers/gpio.h> | ||
#include <zephyr/devicetree/clocks.h> | ||
#include <zephyr/drivers/clock_control/nrf_clock_control.h> | ||
|
||
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(DT_ALIAS(led), gpios); | ||
|
||
const uint32_t freq[] = {320, 256, 128, 64}; | ||
|
||
/* | ||
* Set Global Domain frequency (HSFLL120) | ||
*/ | ||
void set_global_domain_frequency(uint32_t freq) | ||
{ | ||
int err; | ||
int res; | ||
struct onoff_client cli; | ||
const struct device *hsfll_dev = DEVICE_DT_GET(DT_NODELABEL(hsfll120)); | ||
const struct nrf_clock_spec clk_spec_global_hsfll = {.frequency = MHZ(freq)}; | ||
|
||
printk("Requested frequency [Hz]: %d\n", clk_spec_global_hsfll.frequency); | ||
sys_notify_init_spinwait(&cli.notify); | ||
err = nrf_clock_control_request(hsfll_dev, &clk_spec_global_hsfll, &cli); | ||
__ASSERT((err >= 0 && err < 3), "Wrong nrf_clock_control_request return code"); | ||
do { | ||
err = sys_notify_fetch_result(&cli.notify, &res); | ||
k_yield(); | ||
} while (err == -EAGAIN); | ||
__ASSERT(err == 0, "Wrong clock control request return code"); | ||
__ASSERT(res == 0, "Wrong clock control request response"); | ||
} | ||
|
||
int main(void) | ||
{ | ||
uint32_t counter = 0; | ||
|
||
gpio_pin_configure_dt(&led, GPIO_OUTPUT_INACTIVE); | ||
k_msleep(300); | ||
|
||
while (1) { | ||
gpio_pin_set_dt(&led, 1); | ||
set_global_domain_frequency(freq[counter++ % ARRAY_SIZE(freq)]); | ||
k_busy_wait(1000); | ||
gpio_pin_set_dt(&led, 0); | ||
k_msleep(2000); | ||
} | ||
|
||
return 0; | ||
} |
7 changes: 3 additions & 4 deletions
7
tests/benchmarks/multicore/idle_pwm_loopback/Kconfig.sysbuild
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 |
---|---|---|
@@ -1,11 +1,10 @@ | ||
# | ||
# Copyright (c) 2024 Nordic Semiconductor ASA | ||
# Copyright (c) 2025 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
|
||
source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" | ||
|
||
config REMOTE_BOARD | ||
string | ||
default "$(BOARD)/nrf54h20/cpurad" if SOC_NRF54H20_CPUAPP | ||
config REMOTE_GLOBAL_DOMAIN_CLOCK_FREQUENCY_SWITCHING | ||
bool "Enable global domain frequency changing from remote" |
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
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
10 changes: 10 additions & 0 deletions
10
tests/benchmarks/multicore/idle_spim_loopback/Kconfig.sysbuild
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) 2025 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
|
||
source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" | ||
|
||
config REMOTE_GLOBAL_DOMAIN_CLOCK_FREQUENCY_SWITCHING | ||
bool "Enable global domain frequency changing from remote" |
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
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 |
---|---|---|
@@ -1,11 +1,10 @@ | ||
# | ||
# Copyright (c) 2024 Nordic Semiconductor ASA | ||
# Copyright (c) 2025 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
|
||
source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" | ||
|
||
config REMOTE_BOARD | ||
string | ||
default "$(BOARD)/nrf54h20/cpurad" if SOC_NRF54H20_CPUAPP | ||
config REMOTE_GLOBAL_DOMAIN_CLOCK_FREQUENCY_SWITCHING | ||
bool "Enable global domain frequency changing from remote" |
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 |
---|---|---|
@@ -1,22 +1,21 @@ | ||
# | ||
# Copyright (c) 2023 Nordic Semiconductor ASA | ||
# 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() | ||
if(SB_CONFIG_SOC_NRF54H20) | ||
if(SB_CONFIG_REMOTE_GLOBAL_DOMAIN_CLOCK_FREQUENCY_SWITCHING) | ||
set(REMOTE_SOURCE_DIR ${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/multicore/common/remote_gdf_switching) | ||
else() | ||
set(REMOTE_SOURCE_DIR ${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/power_consumption/common/remote_sleep_forever) | ||
endif() | ||
|
||
# Add remote project | ||
ExternalZephyrProject_Add( | ||
# Add remote project | ||
ExternalZephyrProject_Add( | ||
APPLICATION remote | ||
SOURCE_DIR ${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/power_consumption/common/remote_sleep_forever | ||
BOARD ${SB_CONFIG_REMOTE_BOARD} | ||
SOURCE_DIR ${REMOTE_SOURCE_DIR} | ||
BOARD ${SB_CONFIG_BOARD}/${SB_CONFIG_SOC}/cpurad | ||
BOARD_REVISION ${BOARD_REVISION} | ||
) | ||
|
||
# Add a dependency so that the remote image will be built and flashed first | ||
add_dependencies(idle_uarte remote) | ||
# Add dependency so that the remote image is flashed first. | ||
sysbuild_add_dependencies(FLASH idle_uarte remote) | ||
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