Skip to content

Commit

Permalink
samples: boards: nordic: coresight_stm: Add flpr and ppr support
Browse files Browse the repository at this point in the history
Add flpr and ppr core to the sample.

Since there are only 2 UARTs available on DK, local UART configuration
is using only cpuapp and cpurad.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
  • Loading branch information
nordic-krch authored and fabiobaltieri committed Sep 27, 2024
1 parent c61e92a commit d11997d
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 15 deletions.
8 changes: 5 additions & 3 deletions samples/boards/nordic/coresight_stm/Kconfig.sysbuild
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

source "share/sysbuild/Kconfig"

config RAD_CORE_BOARD
string
default "nrf54h20dk/nrf54h20/cpurad" if $(BOARD) = "nrf54h20dk"
config APP_CPUPPR_RUN
bool "Use PPR"

config APP_CPUFLPR_RUN
bool "Use FLPR"
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright (c) 2024 Nordic Semiconductor
* SPDX-License-Identifier: Apache-2.0
*/

&cpuppr_vpr {
status = "okay";
};

&cpuppr_ram3x_region {
status = "okay";
};

&cpuflpr_vpr {
status = "okay";
};
5 changes: 5 additions & 0 deletions samples/boards/nordic/coresight_stm/remote/prj.conf
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
CONFIG_LOG=y
CONFIG_CONSOLE=n
CONFIG_UART_CONSOLE=n
CONFIG_SERIAL=n
CONFIG_BOOT_BANNER=n
CONFIG_PRINTK=n
6 changes: 6 additions & 0 deletions samples/boards/nordic/coresight_stm/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ tests:
build_only: true
required_snippets:
- nordic-log-stm-dict
extra_args:
- SB_CONFIG_APP_CPUPPR_RUN=y
- SB_CONFIG_APP_CPUFLPR_RUN=y
sample.boards.nrf.coresight_stm:
platform_allow:
- nrf54h20dk/nrf54h20/cpuapp
Expand All @@ -26,6 +29,9 @@ tests:
- "Timing for log message with 2 arguments:"
- "Timing for log message with 3 arguments:"
- "Timing for log_message with string:"
extra_args:
- SB_CONFIG_APP_CPUPPR_RUN=y
- SB_CONFIG_APP_CPUFLPR_RUN=y
required_snippets:
- nordic-log-stm
sample.boards.nrf.coresight_stm.local_uart:
Expand Down
5 changes: 3 additions & 2 deletions samples/boards/nordic/coresight_stm/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

#include <zephyr/kernel.h>
#include <zephyr/sys/printk.h>
#include <zephyr/logging/log.h>

#ifdef CONFIG_LOG_FRONTEND_STMESP
Expand Down Expand Up @@ -37,6 +36,8 @@ static void get_core_name(void)
core_name = "rad";
} else if (strstr(CONFIG_BOARD_TARGET, "cpuppr")) {
core_name = "ppr";
} else if (strstr(CONFIG_BOARD_TARGET, "cpuflpr")) {
core_name = "flpr";
}
}

Expand All @@ -49,7 +50,7 @@ static void timing_report(uint32_t t, uint32_t rpt, const char *str)
{
uint32_t ns = t_to_ns(t, rpt, CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC);

printk("%s: Timing for %s: %d.%dus\n", core_name, str, ns / 1000, (ns % 1000) / 10);
LOG_RAW("%s: Timing for %s: %d.%dus\n", core_name, str, ns / 1000, (ns % 1000) / 10);
}

int main(void)
Expand Down
32 changes: 22 additions & 10 deletions samples/boards/nordic/coresight_stm/sysbuild.cmake
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

if("${SB_CONFIG_RAD_CORE_BOARD}" STREQUAL "")
message(FATAL_ERROR
"Target ${BOARD} not supported for this sample. "
"There is no remote board selected in Kconfig.sysbuild")
endif()

set(RAD_APP remote)
set(REMOTE_APP remote)

ExternalZephyrProject_Add(
APPLICATION ${RAD_APP}
SOURCE_DIR ${APP_DIR}/${RAD_APP}
BOARD ${SB_CONFIG_RAD_CORE_BOARD}
APPLICATION ${REMOTE_APP}_rad
SOURCE_DIR ${APP_DIR}/${REMOTE_APP}
BOARD ${SB_CONFIG_BOARD}/${SB_CONFIG_SOC}/cpurad
)

# There are sample configurations which do not use PPR.
if(SB_CONFIG_APP_CPUPPR_RUN)
ExternalZephyrProject_Add(
APPLICATION ${REMOTE_APP}_ppr
SOURCE_DIR ${APP_DIR}/${REMOTE_APP}
BOARD ${SB_CONFIG_BOARD}/${SB_CONFIG_SOC}/cpuppr
)
endif()

# There are sample configurations which do not use FLPR.
if(SB_CONFIG_APP_CPUFLPR_RUN)
ExternalZephyrProject_Add(
APPLICATION ${REMOTE_APP}_flpr
SOURCE_DIR ${APP_DIR}/${REMOTE_APP}
BOARD ${SB_CONFIG_BOARD}/${SB_CONFIG_SOC}/cpuflpr
)
endif()

0 comments on commit d11997d

Please sign in to comment.