Skip to content

Commit

Permalink
sysbuild: Add SDP FLPR image to automatic sysbuilds
Browse files Browse the repository at this point in the history
Add SDP FLPR application image to the build depending
on the enabled configuration.

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
  • Loading branch information
jaz1-nordic committed Sep 12, 2024
1 parent d5706de commit 746b465
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 0 deletions.
41 changes: 41 additions & 0 deletions cmake/sysbuild/sdp.cmake
Original file line number Diff line number Diff line change
@@ -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()
9 changes: 9 additions & 0 deletions sysbuild/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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.
Expand All @@ -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()
21 changes: 21 additions & 0 deletions sysbuild/Kconfig.sdp
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions sysbuild/Kconfig.sysbuild
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,4 @@ rsource "Kconfig.zip"
rsource "Kconfig.matter"
rsource "Kconfig.wifi"
rsource "Kconfig.suit"
rsource "Kconfig.sdp"
22 changes: 22 additions & 0 deletions sysbuild/sdp.cmake
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 746b465

Please sign in to comment.