Skip to content
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

cmake: Fix shield bug when BOARD_ROOT is a list #23609

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
111 changes: 56 additions & 55 deletions cmake/app/boilerplate.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -296,69 +296,70 @@ foreach(root ${BOARD_ROOT})

if(DEFINED SHIELD)
foreach(s ${SHIELD_AS_LIST})
list(REMOVE_ITEM SHIELD ${s})
list(FIND SHIELD_LIST ${s} _idx)
if (NOT _idx EQUAL -1)
list(GET shields_refs_list ${_idx} s_path)
get_filename_component(s_dir ${s_path} DIRECTORY)
if (_idx EQUAL -1)
continue()
endif()

# if shield config flag is on, add shield overlay to the shield overlays
# list and dts_fixup file to the shield fixup file
list(APPEND
shield_dts_files
${shield_dir}/${s_path}
list(REMOVE_ITEM SHIELD ${s})

list(GET shields_refs_list ${_idx} s_path)
get_filename_component(s_dir ${s_path} DIRECTORY)

# if shield config flag is on, add shield overlay to the shield overlays
# list and dts_fixup file to the shield fixup file
list(APPEND
shield_dts_files
${shield_dir}/${s_path}
)
list(APPEND
shield_dts_fixups
${shield_dir}/${s_dir}/dts_fixup.h
list(APPEND
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that still possible to have shields fixup?
This is not the case anymore in main tree at least, I'm not sure in case of out-of tree shields
Maybe this could be totally removed (in a dedicated change).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not been following the DT changes, so I'm not sure.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.
So, after a quick look, there is nothing that prevent it, but this mainly depends on drivers (sensors and components available on shields) implementations which should no use them.
Now, this is correctly done in in-tree drivers, but we don't know about potential out-of-tree support.
Anyway, support for fixup should be removed short term with on going changes in device tree support. Support removal in shields could be done at that time when supported is removed globally.

shield_dts_fixups
${shield_dir}/${s_dir}/dts_fixup.h
)

# search for shield/boards/board.overlay file
if(EXISTS ${shield_dir}/${s_dir}/boards/${BOARD}.overlay)
# add shield/board overlay to the shield overlays list
list(APPEND
shield_dts_files
${shield_dir}/${s_dir}/boards/${BOARD}.overlay
# search for shield/boards/board.overlay file
if(EXISTS ${shield_dir}/${s_dir}/boards/${BOARD}.overlay)
# add shield/board overlay to the shield overlays list
list(APPEND
shield_dts_files
${shield_dir}/${s_dir}/boards/${BOARD}.overlay
)
endif()

# search for shield/boards/shield/board.overlay file
if(EXISTS ${shield_dir}/${s_dir}/boards/${s}/${BOARD}.overlay)
# add shield/board overlay to the shield overlays list
list(APPEND
shield_dts_files
${shield_dir}/${s_dir}/boards/${s}/${BOARD}.overlay
endif()

# search for shield/boards/shield/board.overlay file
if(EXISTS ${shield_dir}/${s_dir}/boards/${s}/${BOARD}.overlay)
# add shield/board overlay to the shield overlays list
list(APPEND
shield_dts_files
${shield_dir}/${s_dir}/boards/${s}/${BOARD}.overlay
)
endif()

# search for shield/shield.conf file
if(EXISTS ${shield_dir}/${s_dir}/${s}.conf)
# add shield.conf to the shield config list
list(APPEND
shield_conf_files
${shield_dir}/${s_dir}/${s}.conf
endif()

# search for shield/shield.conf file
if(EXISTS ${shield_dir}/${s_dir}/${s}.conf)
# add shield.conf to the shield config list
list(APPEND
shield_conf_files
${shield_dir}/${s_dir}/${s}.conf
)
endif()

# search for shield/boards/board.conf file
if(EXISTS ${shield_dir}/${s_dir}/boards/${BOARD}.conf)
# add HW specific board.conf to the shield config list
list(APPEND
shield_conf_files
${shield_dir}/${s_dir}/boards/${BOARD}.conf
endif()

# search for shield/boards/board.conf file
if(EXISTS ${shield_dir}/${s_dir}/boards/${BOARD}.conf)
# add HW specific board.conf to the shield config list
list(APPEND
shield_conf_files
${shield_dir}/${s_dir}/boards/${BOARD}.conf
)
endif()

# search for shield/boards/shield/board.conf file
if(EXISTS ${shield_dir}/${s_dir}/boards/${s}/${BOARD}.conf)
# add HW specific board.conf to the shield config list
list(APPEND
shield_conf_files
${shield_dir}/${s_dir}/boards/${s}/${BOARD}.conf
endif()

# search for shield/boards/shield/board.conf file
if(EXISTS ${shield_dir}/${s_dir}/boards/${s}/${BOARD}.conf)
# add HW specific board.conf to the shield config list
list(APPEND
shield_conf_files
${shield_dir}/${s_dir}/boards/${s}/${BOARD}.conf
)
endif()
else()
list(APPEND NOT_FOUND_SHIELD_LIST ${s})
endif()
endforeach()
endif()
Expand All @@ -371,8 +372,8 @@ if(NOT BOARD_DIR)
message(FATAL_ERROR "Invalid usage")
endif()

if(DEFINED SHIELD AND DEFINED NOT_FOUND_SHIELD_LIST)
foreach (s ${NOT_FOUND_SHIELD_LIST})
if(DEFINED SHIELD AND NOT (SHIELD STREQUAL ""))
foreach (s ${SHIELD})
message("No shield named '${s}' found")
endforeach()
print_usage()
Expand Down