From 746b4653295f5ef35b8b9f23c8e746d1eb018fe0 Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Thu, 12 Sep 2024 15:18:34 +0200 Subject: [PATCH] sysbuild: Add SDP FLPR image to automatic sysbuilds Add SDP FLPR application image to the build depending on the enabled configuration. Signed-off-by: Jakub Zymelka --- cmake/sysbuild/sdp.cmake | 41 +++++++++++++++++++++++++++++++++++++++ sysbuild/CMakeLists.txt | 9 +++++++++ sysbuild/Kconfig.sdp | 21 ++++++++++++++++++++ sysbuild/Kconfig.sysbuild | 1 + sysbuild/sdp.cmake | 22 +++++++++++++++++++++ 5 files changed, 94 insertions(+) create mode 100644 cmake/sysbuild/sdp.cmake create mode 100644 sysbuild/Kconfig.sdp create mode 100644 sysbuild/sdp.cmake diff --git a/cmake/sysbuild/sdp.cmake b/cmake/sysbuild/sdp.cmake new file mode 100644 index 000000000000..cd13f6da4075 --- /dev/null +++ b/cmake/sysbuild/sdp.cmake @@ -0,0 +1,41 @@ +# Copyright (c) 2024 Nordic Semiconductor +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +# Update FLPR image KConfig based on main app configuration. +# +# Usage: +# flpr_egpio_update_kconfig() +# +function(flpr_egpio_update_kconfig) + + sysbuild_get(CONFIG_MBOX_BACKEND IMAGE ${DEFAULT_IMAGE} VAR CONFIG_GPIO_NRFE_EGPIO_BACKEND_MBOX KCONFIG) + sysbuild_get(CONFIG_ICMSG_BACKEND IMAGE ${DEFAULT_IMAGE} VAR CONFIG_GPIO_NRFE_EGPIO_BACKEND_ICMSG KCONFIG) + sysbuild_get(CONFIG_PLATFORM IMAGE ${DEFAULT_IMAGE} VAR CONFIG_SOC KCONFIG) + + message(STATUS "eGPIO: Using ${CONFIG_PLATFORM} SoC") + + if(CONFIG_MBOX_BACKEND) + sysbuild_cache_set(VAR egpio_CONFIG_GPIO_NRFE_EGPIO_BACKEND_MBOX APPEND REMOVE_DUPLICATES "y") + if(CONFIG_PLATFORM STREQUAL "nrf54l15") + sysbuild_cache_set(VAR egpio_EXTRA_DTC_OVERLAY_FILE APPEND REMOVE_DUPLICATES "./boards/nrf54l15dk_nrf54l15_cpuflpr_mbox.overlay") + endif() + message(STATUS "eGPIO: Using MBOX backend") + elseif(CONFIG_ICMSG_BACKEND) + sysbuild_cache_set(VAR egpio_CONFIG_GPIO_NRFE_EGPIO_BACKEND_ICMSG APPEND REMOVE_DUPLICATES "y") + if(CONFIG_PLATFORM STREQUAL "nrf54l15") + sysbuild_cache_set(VAR egpio_EXTRA_DTC_OVERLAY_FILE APPEND REMOVE_DUPLICATES "./boards/nrf54l15dk_nrf54l15_cpuflpr_icmsg.overlay") + endif() + sysbuild_cache_set(VAR egpio_CONFIG_IPC_SERVICE APPEND REMOVE_DUPLICATES "y") + sysbuild_cache_set(VAR egpio_CONFIG_IPC_SERVICE_BACKEND_ICMSG APPEND REMOVE_DUPLICATES "y") + message(STATUS "eGPIO: Using ICMSG backend") + endif() + + sysbuild_cache(CREATE APPLICATION egpio CMAKE_RERUN) + +endfunction() + +# If eGPIO FLPR application is enabled, update Kconfigs +if(SB_CONFIG_EGPIO_FLPR_APPLICATION) + flpr_egpio_update_kconfig() +endif() diff --git a/sysbuild/CMakeLists.txt b/sysbuild/CMakeLists.txt index dcbf74ca446f..67b4d5725c89 100644 --- a/sysbuild/CMakeLists.txt +++ b/sysbuild/CMakeLists.txt @@ -64,6 +64,10 @@ function(include_packaging) include(${ZEPHYR_NRF_MODULE_DIR}/subsys/bootloader/cmake/packaging.cmake) endfunction() +function(include_sdp) + include(${ZEPHYR_NRF_MODULE_DIR}/cmake/sysbuild/sdp.cmake) +endfunction() + function(${SYSBUILD_CURRENT_MODULE_NAME}_pre_cmake) cmake_parse_arguments(PRE_CMAKE "" "" "IMAGES" ${ARGN}) restore_ncs_vars() @@ -594,6 +598,10 @@ function(${SYSBUILD_CURRENT_MODULE_NAME}_post_cmake) set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${BINARY_DIR}/zephyr/.config) endif() endif() + + if(SB_CONFIG_SDP) + include_sdp() + endif() endfunction(${SYSBUILD_CURRENT_MODULE_NAME}_post_cmake) # Enable use of partition manager with sysbuild. @@ -608,5 +616,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/netcore.cmake) include(${CMAKE_CURRENT_LIST_DIR}/secureboot.cmake) include(${CMAKE_CURRENT_LIST_DIR}/mcuboot.cmake) include(${CMAKE_CURRENT_LIST_DIR}/suit.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/sdp.cmake) store_ncs_vars() diff --git a/sysbuild/Kconfig.sdp b/sysbuild/Kconfig.sdp new file mode 100644 index 000000000000..c987721ee71d --- /dev/null +++ b/sysbuild/Kconfig.sdp @@ -0,0 +1,21 @@ +# Copyright (c) 2024 Nordic Semiconductor +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +menu "SW defined peripherals" + +menuconfig SDP + bool "Software defined peripherals" + +if SDP + +config EGPIO_FLPR_APPLICATION + bool "Nordic eGPIO FLPR application" + help + Include FLPR side eGPIO application in build. + FLPR eGPIO application is an eGPIO driver built for an FLPR core that receives commands + from the app core and controls the pin states based on them. + +endif # SDP + +endmenu diff --git a/sysbuild/Kconfig.sysbuild b/sysbuild/Kconfig.sysbuild index 36465544e775..b37b90a49956 100644 --- a/sysbuild/Kconfig.sysbuild +++ b/sysbuild/Kconfig.sysbuild @@ -79,3 +79,4 @@ rsource "Kconfig.zip" rsource "Kconfig.matter" rsource "Kconfig.wifi" rsource "Kconfig.suit" +rsource "Kconfig.sdp" diff --git a/sysbuild/sdp.cmake b/sysbuild/sdp.cmake new file mode 100644 index 000000000000..211de3c3b72e --- /dev/null +++ b/sysbuild/sdp.cmake @@ -0,0 +1,22 @@ +# Copyright (c) 2024 Nordic Semiconductor +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +# If it is enabled, include the eGPIO FLPR application in the build +if(SB_CONFIG_EGPIO_FLPR_APPLICATION) + # Extract soc name from related variables + string(REPLACE "/" ";" split_board_qualifiers "${BOARD_QUALIFIERS}") # Replace all "/" with ";" + list(GET split_board_qualifiers 1 target_soc) # Get the second element of the list, which is the soc name + if((DEFINED ${BOARD_REVISION}) AND NOT ${BOARD_REVISION} STREQUAL "") + string(CONCAT board_target_flpr ${BOARD} "@" ${BOARD_REVISION} "/" ${target_soc} "/cpuflpr") + else() + string(CONCAT board_target_flpr ${BOARD} "/" ${target_soc} "/cpuflpr") + endif() + set(target_soc) # Clear the variable that is no longer needed + + ExternalZephyrProject_Add( + APPLICATION egpio # Add ExternalZephyrProject for the sdp_gpio application + SOURCE_DIR ${ZEPHYR_NRF_MODULE_DIR}/applications/sdp/gpio # Specify the path to the application directory + BOARD ${board_target_flpr} # Specify the board for the application + ) +endif()