diff --git a/cmake/modules/configuration_files.cmake b/cmake/modules/configuration_files.cmake index 78e7bf2a494..dda142441ed 100644 --- a/cmake/modules/configuration_files.cmake +++ b/cmake/modules/configuration_files.cmake @@ -45,6 +45,7 @@ endif() zephyr_get(CONF_FILE SYSBUILD LOCAL) if(NOT DEFINED CONF_FILE) zephyr_file(CONF_FILES ${APPLICATION_CONFIG_DIR} KCONF CONF_FILE NAMES "prj.conf" SUFFIX ${FILE_SUFFIX} REQUIRED) + zephyr_file(CONF_FILES ${APPLICATION_CONFIG_DIR}/socs KCONF CONF_FILE QUALIFIERS SUFFIX ${FILE_SUFFIX}) zephyr_file(CONF_FILES ${APPLICATION_CONFIG_DIR}/boards KCONF CONF_FILE SUFFIX ${FILE_SUFFIX}) else() string(CONFIGURE "${CONF_FILE}" CONF_FILE_EXPANDED) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index 6833d5de9c8..35ab0e246b2 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -1538,6 +1538,11 @@ endfunction() # [BUILD ] # [MERGE [REVERSE]] # ) +# zephyr_build_string( +# BOARD_QUALIFIERS +# [BUILD ] +# [MERGE [REVERSE]] +# ) # # : Output variable where the build string will be returned. # SHORT : Output variable where the shortened build string will be returned. @@ -1571,6 +1576,10 @@ endfunction() # `alpha_soc_bar_1_0_0;alpha_soc_bar` in `build_string` parameter. # `alpha_bar_1_0_0;alpha_bar` in `short_build_string` parameter. # +# calling +# zephyr_build_string(build_string BOARD_QUALIFIERS /soc/bar/foo) +# will return the string `soc_bar_foo` in `build_string` parameter. +# function(zephyr_build_string outvar) set(options MERGE REVERSE) set(single_args BOARD BOARD_QUALIFIERS BOARD_REVISION BUILD SHORT) @@ -1590,10 +1599,17 @@ function(zephyr_build_string outvar) ) endif() - if(DEFINED BUILD_STR_BOARD_QUALIFIERS AND NOT BUILD_STR_BOARD) + if(DEFINED BUILD_STR_BOARD_REVISION AND NOT DEFINED BUILD_STR_BOARD) message(FATAL_ERROR - "zephyr_build_string(${ARGV0} BOARD_QUALIFIERS ${BUILD_STR_BOARD_QUALIFIERS} ...)" - " given without BOARD argument, please specify BOARD" + "zephyr_build_string(${ARGV0} BOARD_REVISION ${BUILD_STR_BOARD_REVISION} ...)" + " given without BOARD argument, these must be used together" + ) + endif() + + if(DEFINED BUILD_STR_SHORT AND NOT DEFINED BUILD_STR_BOARD) + message(FATAL_ERROR + "zephyr_build_string(${ARGV0} SHORT ${BUILD_STR_SHORT} ...)" + " given without BOARD argument, these must be used together" ) endif() @@ -2572,7 +2588,7 @@ Please provide one of following: APPLICATION_ROOT, CONF_FILES") if(${ARGV0} STREQUAL APPLICATION_ROOT) set(single_args APPLICATION_ROOT) elseif(${ARGV0} STREQUAL CONF_FILES) - set(options REQUIRED) + set(options QUALIFIERS REQUIRED) set(single_args BOARD BOARD_REVISION BOARD_QUALIFIERS DTS KCONF DEFCONFIG BUILD SUFFIX) set(multi_args CONF_FILES NAMES) endif() @@ -2641,14 +2657,22 @@ Relative paths are only allowed with `-D${ARGV1}=`") set(dts_filename_list ${ZFILE_NAMES}) set(kconf_filename_list ${ZFILE_NAMES}) else() - zephyr_build_string(filename_list - SHORT shortened_filename_list - BOARD ${ZFILE_BOARD} - BOARD_REVISION ${ZFILE_BOARD_REVISION} - BOARD_QUALIFIERS ${ZFILE_BOARD_QUALIFIERS} - BUILD ${ZFILE_BUILD} - MERGE REVERSE - ) + if(NOT ZFILE_QUALIFIERS) + zephyr_build_string(filename_list + SHORT shortened_filename_list + BOARD ${ZFILE_BOARD} + BOARD_REVISION ${ZFILE_BOARD_REVISION} + BOARD_QUALIFIERS ${ZFILE_BOARD_QUALIFIERS} + BUILD ${ZFILE_BUILD} + MERGE REVERSE + ) + else() + zephyr_build_string(filename_list + BOARD_QUALIFIERS ${ZFILE_BOARD_QUALIFIERS} + BUILD ${ZFILE_BUILD} + MERGE REVERSE + ) + endif() set(dts_filename_list ${filename_list}) set(dts_shortened_filename_list ${shortened_filename_list})