From d11997dbcf2f3d0c38503a18fef72ef71c55940e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 25 Sep 2024 14:30:41 +0200 Subject: [PATCH] samples: boards: nordic: coresight_stm: Add flpr and ppr support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../nordic/coresight_stm/Kconfig.sysbuild | 8 +++-- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 16 ++++++++++ .../nordic/coresight_stm/remote/prj.conf | 5 +++ .../boards/nordic/coresight_stm/sample.yaml | 6 ++++ .../boards/nordic/coresight_stm/src/main.c | 5 +-- .../nordic/coresight_stm/sysbuild.cmake | 32 +++++++++++++------ 6 files changed, 57 insertions(+), 15 deletions(-) create mode 100644 samples/boards/nordic/coresight_stm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/samples/boards/nordic/coresight_stm/Kconfig.sysbuild b/samples/boards/nordic/coresight_stm/Kconfig.sysbuild index ae4c80486151c0..3e4ddeaa515f14 100644 --- a/samples/boards/nordic/coresight_stm/Kconfig.sysbuild +++ b/samples/boards/nordic/coresight_stm/Kconfig.sysbuild @@ -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" diff --git a/samples/boards/nordic/coresight_stm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/boards/nordic/coresight_stm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000000..bf5ba18d204425 --- /dev/null +++ b/samples/boards/nordic/coresight_stm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -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"; +}; diff --git a/samples/boards/nordic/coresight_stm/remote/prj.conf b/samples/boards/nordic/coresight_stm/remote/prj.conf index 1e935e973c761b..5bea9f4760e827 100644 --- a/samples/boards/nordic/coresight_stm/remote/prj.conf +++ b/samples/boards/nordic/coresight_stm/remote/prj.conf @@ -1 +1,6 @@ CONFIG_LOG=y +CONFIG_CONSOLE=n +CONFIG_UART_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_BOOT_BANNER=n +CONFIG_PRINTK=n diff --git a/samples/boards/nordic/coresight_stm/sample.yaml b/samples/boards/nordic/coresight_stm/sample.yaml index 2bf3f0695e8328..eb3971a2f4eb20 100644 --- a/samples/boards/nordic/coresight_stm/sample.yaml +++ b/samples/boards/nordic/coresight_stm/sample.yaml @@ -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 @@ -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: diff --git a/samples/boards/nordic/coresight_stm/src/main.c b/samples/boards/nordic/coresight_stm/src/main.c index 01d3d14035cdd0..221633d8638c42 100644 --- a/samples/boards/nordic/coresight_stm/src/main.c +++ b/samples/boards/nordic/coresight_stm/src/main.c @@ -5,7 +5,6 @@ */ #include -#include #include #ifdef CONFIG_LOG_FRONTEND_STMESP @@ -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"; } } @@ -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) diff --git a/samples/boards/nordic/coresight_stm/sysbuild.cmake b/samples/boards/nordic/coresight_stm/sysbuild.cmake index c2eaeeaa20f269..89ccbcf1343eef 100644 --- a/samples/boards/nordic/coresight_stm/sysbuild.cmake +++ b/samples/boards/nordic/coresight_stm/sysbuild.cmake @@ -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()