Skip to content

Allow to add suffix overlays #2913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions share/sysbuild/cmake/modules/sysbuild_extensions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ function(ExternalZephyrProject_Add)
set(sysbuild_image_conf_dir ${APP_DIR}/sysbuild)
set(sysbuild_image_name_conf_dir ${APP_DIR}/sysbuild/${ZBUILD_APPLICATION})
# User defined `-D<image>_CONF_FILE=<file.conf>` takes precedence over anything else.
if (NOT ${ZBUILD_APPLICATION}_CONF_FILE)
if(NOT ${ZBUILD_APPLICATION}_CONF_FILE)
if(EXISTS ${sysbuild_image_name_conf_dir})
set(${ZBUILD_APPLICATION}_APPLICATION_CONFIG_DIR ${sysbuild_image_name_conf_dir}
CACHE INTERNAL "Application configuration dir controlled by sysbuild"
Expand All @@ -275,20 +275,31 @@ function(ExternalZephyrProject_Add)
NAMES ${ZBUILD_APPLICATION}.conf SUFFIX ${FILE_SUFFIX}
)

if (NOT (${ZBUILD_APPLICATION}_OVERLAY_CONFIG OR ${ZBUILD_APPLICATION}_EXTRA_CONF_FILE)
if(NOT (${ZBUILD_APPLICATION}_OVERLAY_CONFIG OR ${ZBUILD_APPLICATION}_EXTRA_CONF_FILE)
AND EXISTS ${sysbuild_image_conf_fragment}
)
set(${ZBUILD_APPLICATION}_EXTRA_CONF_FILE ${sysbuild_image_conf_fragment}
CACHE INTERNAL "Kconfig fragment defined by main application"
)
endif()

# Check for overlay named <ZBUILD_APPLICATION>.overlay.
set(sysbuild_image_dts_overlay ${sysbuild_image_conf_dir}/${ZBUILD_APPLICATION}.overlay)
if (NOT ${ZBUILD_APPLICATION}_DTC_OVERLAY_FILE AND EXISTS ${sysbuild_image_dts_overlay})
set(${ZBUILD_APPLICATION}_DTC_OVERLAY_FILE ${sysbuild_image_dts_overlay}
CACHE INTERNAL "devicetree overlay file defined by main application"
)
if(NOT ${ZBUILD_APPLICATION}_DTC_OVERLAY_FILE)
# Check for overlay named <ZBUILD_APPLICATION>.overlay.
set(sysbuild_image_dts_overlay_files ${sysbuild_image_conf_dir}/${ZBUILD_APPLICATION}.overlay)

# Check for overlay named <ZBUILD_APPLICATION>_<FILE_SUFFIX>.overlay.
if(FILE_SUFFIX)
list(PREPEND sysbuild_image_dts_overlay_files ${sysbuild_image_conf_dir}/${ZBUILD_APPLICATION}_${FILE_SUFFIX}.overlay)
endif()

foreach(sysbuild_image_dts_overlay_files overlay_file)
if(EXISTS ${overlay_file})
set(${ZBUILD_APPLICATION}_DTC_OVERLAY_FILE ${overlay_file}
CACHE INTERNAL "devicetree overlay file defined by main application"
)
break()
endif()
endforeach()
endif()
endif()

Expand Down