-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Board-specific overlays defined in a module's shield directory are not found #71113
Comments
Hello! Let me jump in as I quickly glanced over this issue. As far as I see your problem is specific to the case when you are trying to add board-specific overlays for a shield that already exists somewhere else. It seems that the shields.cmake only allows adding overlays in the same place the board is defined (whether in-tree or in a Zephyr module).
The extension still correctly applies board-specific overlays for shields defined in a module (out-of-tree). The requirement is that's the same place that the shield is defined (contains So the question really is whether the script should be able to find ANY |
@MaroMetelski that's correct. In this specific case, I'm trying to apply a board-specific overlay to the
Thanks for the clarification on this. If this is working as intended, then this may be more of a feature request than a bug. I think it's valuable to be able to modify the built-in boards/shields via overlay/Kconfigs defined in other places (like modules). I'm not familiar enough with how the build system works to know if there are any downsides of doing this though. |
yes, this is more of a feature request, and a good one. In many ways it is similar in nature to the wish of extending a board in HWMv2: #69548 Now, with the requested behavior, then one thing we need to carefully consider is the behavior of shields. For example building This suddenly makes it harder to predict which overlays will be picked up, as well as where to look for such knowledge (should I examine all Zephyr modules myself to avoid surprises). Secondly, users cannot opt-out of those extra overlays, unless they disable the I will change this into a feature request for now, and create a more general shield enhancement meta issue, as there are a couple of more use-cases we would like to support, and where the transition to HWMv2 makes it possible. |
@tejlmand thanks for the insight on this.
FWIW, this is actually the result I'm looking to achieve with this feature request in this specific case, but I can see that there are cases where this would not be desired.
I realized from your comment that this concern applies more generally to including any overlays in a module for boards/shields that are not defined in that same module (not just the specific use case I described in the original issue). i.e. I had not realized that it was not currently possible to include a Here is what I'd like to be able to achieve at a high-level:
|
I'd like to add one little addition, I'm trying to use an ssd1306 shield with a board that doesn't have arduino_i2c nodes. I can add it easily enough in the zephyr provided board dts for the blackpill_f401ce but I'd rather not modify those. I have an overlay file in my workspace that I'm doing configuration with, so I thought I could add the arduino_i2c name or alias there. The problem is it seems the shield overlay is being processed before my board overlay, so it still complains about not finding that node. I'm not sure if your proposed change will help with this, but I'd like to: modify an existing "in-tree" board definition to fill in the gaps required by a shield definition. I want to store this change in my app repo. |
It is not currently possible to define a board-specific overlay for a shield in a module when that shield is defined elsewhere (e.g. in the Zephyr tree). See zephyrproject-rtos/zephyr#71113 for more details. If this ever becomes a feature that Zephyr provides, we can bring this overlay back into the module. Signed-off-by: Chris Wilson <chris@cgnd.dev>
@digiexchris take a look here: #72857 This PR will allow you to extend the
and then in your custom Then when building, instead of doing
or the short form:
|
and this is covered by #72857.
Yes, and with the new hardware model in place, then at some point we should consider if the new principle used by boards should be expanded to cover shields. But feel free to open an enhancement issue to have HWMv2 also covering shields.
and this is why a shield can define board overlays, so that the board devicetree is adjusted when using the given shield. |
does that solve the problem with the shield dts being processed before my project overlay resulting in the new nodes not being found? Sounds like it would since it would effectively act the same as a custom board |
@digiexchris it would, because your extended board variant will define the nodes before the shield overlay is applied. |
thanks! this solves a lot of problems (unrelated to this too)! |
…ield It is not currently possible to define a board-specific overlay for a shield in a module when that shield is defined elsewhere (e.g. in the Zephyr tree). See zephyrproject-rtos/zephyr#71113 for more details. If this ever becomes a feature that Zephyr provides, we can bring this overlay back into the module. Signed-off-by: Chris Wilson <chris@cgnd.dev>
@cdwilson getting back to this issue. I came to notice that you're actually creating overlay files for the nrf9160dk to allow that devkit to work with the uno click shield. So why are you not contributing your overlay files for the nRF9160dk to the Zephyr repository ? |
@carlescufi sorry for the delay in response, I'm still trying to digest #72857 and understand how I would accomplish this using extensions. I think what you are suggesting is that by using extensions, I can define a new board variant which extends
However, in this specific example, I'm building for It's not clear to me how I would specify both my
Could you explain a bit further what this might look like using board extensions?
@tejlmand I opened this PR about 2mo ago with this exact overlay, but it's still waiting for a review. Actually, the reason why I originally opened this issue is because I wanted the ability to distribute this overlay in one of our Zephyr modules as a stopgap. I assumed it will take a couple months to get this PR reviewed & merged into the official Zephyr repo, then wait for those changes to get picked up into a new NCS release, then wait for that NCS release to get picked up into a new golioth-firmware-sdk release before it actually becomes available for me to use in an app... 🫠 Btw, not trying to throw shade on anybody for the delay! I really appreciate all the work from maintainers to review PRs, I just know these things take some time to upstream. In general, I'd like to have a workflow where I can extend "in tree" boards/shields via a Zephyr module where I can make changes available immediately to my app(s), and then upstream those changes in parallel (if they are relevant to the broader Zephyr community). |
Sorry about that, this PR fell through the cracks. @erwango has reviewed it now, so please do address his review comments. |
No worries, thanks to you both for helping to get this merged! @carlescufi I also wanted to follow up on my previous question about how to extend |
…ield It is not currently possible to define a board-specific overlay for a shield in a module when that shield is defined elsewhere (e.g. in the Zephyr tree). See zephyrproject-rtos/zephyr#71113 for more details. If this ever becomes a feature that Zephyr provides, we can bring this overlay back into the module. Signed-off-by: Chris Wilson <chris@cgnd.dev>
Describe the bug
This issue is similar to #67227 but has to do with board-specific overlays defined within a shield directory in a Zephyr module.
Zephyr allows board-specific overlays & Kconfig to be defined for a particular shield by adding a
boards/
directory within the shield's directory, e.g.boards/shields/adafruit_neopixel_grid_bff/boards/
:However, if a
boards/shields/
directory is defined in a Zephyr module, the board-specific overlays within the shield'sboards/
directory are not found:To Reproduce
I have prepared two example branches in my Zephyr fork that can be used to reproduce this using a
mikroe_weather_click
shield installed on anarduino_uno_click
shield installed on thenRF9160dk
board.After checking out each branch below, the firmware can be built using the following command:
Example where overlays are correctly found
The first branch places the board-specific overlays for the
arduino_uno_click
shield in the Zephyr tree where they are correctly found by the build system:https://github.com/cgnd/zephyr/tree/cdwilson/github-issues/zephyr-in-tree-shield-board-overlays/boards/shields/arduino_uno_click/boards
In the build output, the following shield overlays are found:
Example where overlays are NOT correctly found
The second branch pulls in a 3rd-party Zephyr module in
west.yml
that contains the exact same board-specific overlays for thearduino_uno_click
shield, but located within the module'sboards/shields
directory:https://github.com/cgnd/zephyr/blob/cdwilson/github-issues/zephyr-module-shield-board-overlays/west.yml#L32-L35
In the build output, the following shield overlays are found:
In this 2nd example, the
boards/nrf9160dk_nrf9160*.overlay
files defined in the module are not found.Expected behavior
I expect that the
shields/
directory of a Zephyr module are searched exactly like theshields/
directory in the Zephyr tree when searching for overlay files. In the example above, I expect that overlays inboards/shields/<shield>/boards/*.overlay
are found during build.Impact
Current workaround is to add the overlay code in the app-specific board overlay instead of in the Zephyr module.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: