From 8816f6bc4743c7fff597e69e06d462a970195d18 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. (cherry picked from commit d11997dbcf2f3d0c38503a18fef72ef71c55940e) Original-Signed-off-by: Krzysztof Chruściński GitOrigin-RevId: d11997dbcf2f3d0c38503a18fef72ef71c55940e Cr-Build-Id: 8735619482632649473 Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8735619482632649473 Copybot-Job-Name: zephyr-main-copybot-downstream Change-Id: Ica2080f87053beb989d7b8b7b8addee71808a9fc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5896231 Tested-by: ChromeOS Prod (Robot) Commit-Queue: Fabio Baltieri Tested-by: Fabio Baltieri Reviewed-by: Fabio Baltieri --- .../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 ae4c8048615..3e4ddeaa515 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 00000000000..bf5ba18d204 --- /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 1e935e973c7..5bea9f4760e 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 2bf3f0695e8..eb3971a2f4e 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 01d3d14035c..221633d8638 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 c2eaeeaa20f..89ccbcf1343 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()