-
Notifications
You must be signed in to change notification settings - Fork 8.2k
cmake: include pre_dt_board.cmake from all board directories #93393
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
base: main
Are you sure you want to change the base?
cmake: include pre_dt_board.cmake from all board directories #93393
Conversation
After zephyrproject-rtos#72857 the concept of board directory was expanded from a single path (BOARD_DIR) to a list of paths (BOARD_DIRECTORIES) which is taken into account in several places except when including `pre_dt_board.cmake` files. This patch moves the inclusion of `pre_dt_board.cmake` files into `dts.cmake` AFTER `boards.cmake` is included (so we can access `BOARD_DIRECTORIES`) but BEFORE `pre_dt.cmake`, which preserves the original inclusion order relative to pre DTC operations. The original motivation of this patch was to address the practicality of defining board extensions that can re-use base board definitions. In particular, one of the drawbacks of zephyrproject-rtos#72857 is that board extensions are not really extending board definitions just the qualifier. There is still the need to create a DTS for each new board extension which is often a copy-and-paste of the base board DTS eventually with a few alterations. The problem is that except for toy examples, board DTS files are rarely self-contained and instead are composed of multiple dtsi includes using relative paths which then forces board extension files to either use hard coded paths to the base board directory OR recursively copy all included dtsi files from the base board directory into the board extension directory. With this patch a board extension directory can define custom configuration steps like regular base boards can and then adjust CPP and DTC include search paths dynamically, for example with: ``` list(APPEND DTS_EXTRA_CPPFLAGS "-I${BOARD_DIR}") list(APPEND EXTRA_DTC_FLAGS "-i${BOARD_DIR}") ``` Signed-off-by: Nicolas Lebedenco <[email protected]>
|
|
Note that the same problem does not apply to Kconfig files because #72857 And then in the same directory it is enough to have a Kconfig.nrf9160dk with: |
tejlmand
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take a look at #87821
And ensure the comments in that PR are not applicable in this PR, as the two PRs are very similar, #87821 (review)
| foreach(dir IN LISTS BOARD_DIRECTORIES) | ||
| include("${dir}/pre_dt_board.cmake" OPTIONAL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this suffers the same issue as described here: #87821 (comment)
|
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |



After #72857 the concept of board directory was expanded from a single path (BOARD_DIR) to a list of paths (BOARD_DIRECTORIES) which is taken into account in several places except when including
pre_dt_board.cmakefiles. This patch moves the inclusion ofpre_dt_board.cmakefiles intodts.cmakeAFTERboards.cmakeis included (so we can accessBOARD_DIRECTORIES) but BEFOREpre_dt.cmake, which preserves the original inclusion order relative to pre DTC operations.The original motivation of this patch was to address the practicality of defining board extensions that can re-use base board definitions.
In particular, one of the drawbacks of
#72857 is that board extensions are not really extending board definitions just the qualifier. There is still the need to create a DTS for each new board extension which is often a copy-and-paste of the base board DTS eventually with a few alterations. The problem is that except for toy examples, board DTS files are rarely self-contained and instead are composed of multiple dtsi includes using relative paths which then forces board extension files to either use hard coded paths to the base board directory OR recursively copy all included dtsi files from the base board directory into the board extension directory.
With this patch a board extension directory can define custom configuration steps like regular base boards can and then adjust CPP and DTC include search paths dynamically, for example with: