cmake: add handling for shield config and shield/board overlays

Shields can often be very complex to setup in a generic way for several
boards to support.  Let's allow shields to have their own .conf files
as well as specialized overlays per board (when needed).

Signed-off-by: Michael Scott <mike@foundries.io>
This commit is contained in:
Michael Scott 2019-05-17 10:08:00 -07:00 committed by Anas Nashif
commit 421b426281
2 changed files with 28 additions and 0 deletions

View file

@ -316,6 +316,33 @@ foreach(root ${BOARD_ROOT})
else()
list(APPEND NOT_FOUND_SHIELD_LIST ${s})
endif()
# search for shield/boards/board.overlay file
if(EXISTS ${shield_dir}/${s}/boards/${BOARD}.overlay)
# add shield/board overlay to the shield overlays list
list(APPEND
shield_dts_files
${shield_dir}/${s}/boards/${BOARD}.overlay
)
endif()
# search for shield/shield.conf file
if(EXISTS ${shield_dir}/${s}/${s}.conf)
# add shield.conf to the shield config list
list(APPEND
shield_conf_files
${shield_dir}/${s}/${s}.conf
)
endif()
# search for shield/boards/board.conf file
if(EXISTS ${shield_dir}/${s}/boards/${BOARD}.conf)
# add HW specific board.conf to the shield config list
list(APPEND
shield_conf_files
${shield_dir}/${s}/boards/${BOARD}.conf
)
endif()
endforeach()
endif()
endforeach()

View file

@ -112,6 +112,7 @@ set(
merge_config_files
${BOARD_DEFCONFIG}
${CONF_FILE_AS_LIST}
${shield_conf_files}
${OVERLAY_CONFIG_AS_LIST}
${EXTRA_KCONFIG_OPTIONS_FILE}
${config_files}