-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Support SoC and board extensions #72857
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
Support SoC and board extensions #72857
Conversation
669ab34 to
a9fbefe
Compare
550d074 to
d0dbcc4
Compare
|
nice. would be great if this feature is presented in the arch wg to get more feedback and input. |
57300
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.
Tested this a bunch over the past few weeks and it works as expected. Thanks!
Just a couple of comments on the implementation.
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.
If board/SoC extensions will be allowed in-tree, will this have to be updated to include all folders?
| soc_folders = {soc.folder[0] for soc in v2_systems.get_socs()} | |
| soc_folders = {folder for soc in v2_systems.get_socs() for folder in soc.folder} |
Same with the occurrences of board.dir[0].
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.
that depends on how we want to organize the docs in such case.
Will we want docs describing the in-tree soc / board to be located in a single folder, or do we want to allow documentation for a given soc / board to be placed at multiple locations.
I would like to leave such decision to doc maintainers and not as part of this PR.
@kartben thoughts ?
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.
OK, I would agree that the docs can be handled later, same with compliance.
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.
Wouldn't it be better to include the original board DTS, instead of copying it into the test?
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.
a copy was chosen as we just need a device tree where we can verify that it's being correctly extended.
We have no intention of tracking the real board, and only reason to have the real board in this case is to ensure the extension mechanism works.
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.
We have no intention of tracking the real board
If that's the case, have you considered using something closer to blank/dummy files? I don't know if the dts contents here are essential to pass these tests.
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.
I did, but this is where I took the short route of a copy and instead focus on the board extend functionality itself.
Having the dts as close to the board it extends is probably more likely than an blank / dummy dts file.
Although you can say that for a real extend, a user would most likely try to include a dtsi file if possible, which is close to your first comment 😉
doc commit cherry-picked into this PR. |
|
@kartben regardless of when this gets merged, are you happy with the doc? |
kartben
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.
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.
repeated. I tend to like second paragraph's formulation better, fwiw
also would recommend skipping a line so that "Extending an existing board with [...]" is another paragraph
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.
of course you like the second paragraph best, cause you wrote it yourself 😉
I happened to just apply your suggestion in this comment #73409 (comment) using the commit suggestion feature of github.
Guess I should have noticed that you were actually not removing the old lines in that suggestion 😆
Repeated paragraph removed.
Extend the board porting guide with documentation on the new board extend feature. Signed-off-by: Torsten Rasmussen <[email protected]>
891b895 to
c145817
Compare
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.
I often use the existing board extension mechanism, but it is very limited. This will solve my current issues with that, and open up for much smoother (customised) hardware-in-the-loop testing here. Thanks.
kartben
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.
+1 for docs
| ├── Kconfig | ||
| ├── Kconfig.plank | ||
| ├── Kconfig.defconfig | ||
| └── plank_<new-qualifiers>.yaml |
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.
had to scratch my head a bit here trying to understand what the new_qualifier would end up like by looking at the tests. It will help alot if you provide an example here showing how you get to the new qualifier by extending a board.
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.
maybe:
As an example, when extending the native_sim board using the following:
board:
extend: native_sim
variants:
- name: one
qualifier: native
- name: two
qualifier: native/64
the new board targets will end up as native_sim/native/one and native_sim/native/64/two. The DTS files for the extended boards will be native_sim_native_64_two.dts and native_sim_native_one.dts.
| Board extensions | ||
| **************** | ||
|
|
||
| The board hardware model in Zephyr allows you to extend an existing board with |
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.
The PR also does add SoC extension out of tree, where is this documented?
nashif
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 submit followup PRs expanding the docs:
- add an example with real names o illustrate how a new board extension will look like when it comes to names
- add docs about SoC extensions
Upstream PR: zephyrproject-rtos/zephyr#72857 Cleanup the Kconfig generating code in hwm_v2.cmake by moving common logic inside the kconfig_gen() helper function. This prepares the code for board extension feature. Signed-off-by: Torsten Rasmussen <[email protected]> (cherry picked from commit d39cc46b56294b6eb297a67478334c23db8c8ca3) (cherry picked from commit a20616f) (cherry picked from commit 80f0145)
Upstream PR: zephyrproject-rtos/zephyr#72857 Fixes: #69548 Support extending an existing board with new board variants. This commit introduces the following changes to allow a board to be extended out-of-tree. The board yaml schema is extended to support an extend field which will be used to identify the board to be extended. A board 'plank' can be extended like this: > board: > extend: plank > variants: > - name: ext > qualifier: soc1 For the rest of the build system this means that there is no longer a single board directory. The existing CMake variable BOARD_DIR is kept and reference the directory which defines the board. A new CMake variable BOARD_DIRECTORIES provides a list of all directories which defines board targets for the board. This means the directory which defines the board as well as all directories that extends the board. Signed-off-by: Torsten Rasmussen <[email protected]> (cherry picked from commit ad16407aca8ccde1aaa57d4d1dcb15bb4d0bfc25) (cherry picked from commit a276e94) (cherry picked from commit ad3a56e)
Upstream PR: zephyrproject-rtos/zephyr#72857 Fixes: #72374 Support extending an existing SoC with new CPU clusters. This commit introduces the following changes to allow an SoC to be extended out-of-tree. The SoC yaml schema is extended to support an extend field which will be used to identify the SoC to be extended with extra CPU clusters. A SoC 'a_soc' can be extended like this: > socs: > extend: a_soc > cpuclusters: > - name: extra_core Signed-off-by: Torsten Rasmussen <[email protected]> (cherry picked from commit c602935faf814c161ea78d19e5a858f7022978c2) (cherry picked from commit e371648) (cherry picked from commit 5de335b)
…sion Upstream PR: zephyrproject-rtos/zephyr#72857 This commit adds new tests for verifying the functionality of the board and SoC extension feature. It does so by defining: - A new CPU cluster on an existing SoC - Two new board variants on top of an existing board The new board variants are defined on top of the existing `native_sim` board, so that the following native_sim board targets are available for the test. Existing board targets: - native_sim/native - native_sim/native/64 Extended board targets: - native_sim/native/one - native_sim/native/64/two The new CPU cluster is defined for the existing `an521` SoC. Existing CPU Clusters on an521: - cpu0 - cpu1 New CPU Cluster: - cputest For SoC tests the mps2 board is used. This means that for testing, the following board targets using the an521 SoC are: - mps2/an521/cpu0 - mps2/an521/cpu1 - mps2/an521/cputest Signed-off-by: Torsten Rasmussen <[email protected]> (cherry picked from commit 04dda379d7ea202712c68aba60b473cd4b5774ef) (cherry picked from commit e766f9f) (cherry picked from commit 0d8c22b)
…config Upstream PR: zephyrproject-rtos/zephyr#72857 Adds an optional priority parameter to the flash runner run once configuration which allows for deciding upon which file should ultimately be used Signed-off-by: Jamie McCrae <[email protected]> (cherry picked from commit 88a4c4ecf6906c7b66e6f42402f1f3e22456ff05) (cherry picked from commit c88231a) (cherry picked from commit 59371c3)
…n once config Upstream PR: zephyrproject-rtos/zephyr#72857 Removes validating the qualifiers for flash run once configuration as files may be present that contain information for qualifiers that are not present in a single repository but are spaced out in other repositories, or might be optional Signed-off-by: Jamie McCrae <[email protected]> (cherry picked from commit b72acf47e550090878fa87145c9766504c3deb13) (cherry picked from commit 973e62f) (cherry picked from commit 4f0db94)
Upstream PR: zephyrproject-rtos/zephyr#72857 In the `Board` class, the `dir` member was renamed to `directories`, both to indicate that it is now a list (in HWMv2 with board extensions) and to reflect the addition of the `BOARD_DIRECTORIES` CMake variable. Considering that the build system also keeps the `BOARD_DIR` variable, and for the sake of backwards compatibility and brevity, it should be useful to retain `Board.dir` in Python as well, symmetrically. Signed-off-by: Grzegorz Swiderski <[email protected]> (cherry picked from commit 25fd4b16e8c488792d0d8450e1b822292f94d3c3) (cherry picked from commit 423ed80) (cherry picked from commit 4175a49)
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]>
Fixes: #69548
Fixes: #72374
This PR introduces support for extending boards and SoC with new variants oot.
Scope reduction in this PR compared to #69548:
This feature part will be addressed as follow-up PR.