-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Improve out-of-tree driver experience #27048
Comments
Is the existing macro https://github.com/zephyrproject-rtos/zephyr/blob/master/cmake/extensions.cmake#L394-L405 |
An example on how this is used for an out-of-tree entropy driver. |
@tejlmand
when used in a structure such as the one listed above. |
right. That is because there are some code related to processing order that will not work as expected for Zephyr modules defined after Before removing this safeguard in Until then, you may define you
and then remove Else you may add |
Closing this issue, I think |
@gmarull Thank you for the discussion, but the thread seems unconcluded to me. As of today I still can't use the zephyr_library_amend with my driver. Any help is appreciated. |
@saacifuentesmu-titoma the Zephyr build system got very complicated over time. It tries to make everything "just work™" in every situation. To achieve this, a lot of "boilerplate"-code (meaning repetitive, common, standard stuff needed everywhere) has been abstracted away. This convenience however has now became a barrier to people new to the project, as one must first understand this "boilerplate" code, to understand what it is you really get by calling it. Which to a degree defeats its purpose: It is no longer that convenient. (It is to the people that developed it, but not to people that were not around whilst it was made.) One such example is What's not immediately obvious is the fact that So, if you copy an in-tree directory as a guide to go by whilst developing your driver, it will not work outside of the Zephyr tree. If you run it in your own tree (outside of the Zephyr tree) the The solution: Not much is required for that. Instead of doing
And that's all there's to it. By dropping |
I'm afraid you're wrong: https://github.com/zephyrproject-rtos/example-application/blob/main/lib/custom_lib/CMakeLists.txt#L4 |
Then I don't know why it not worked for me. Neither do I know why what I describe above does work for me. And above all I not know where to read up on it other than "self-documenting" examples. In summary: I know nothing. The above is best I could make of it, with help from Discord user thetruebell. |
+1 on this, would be nice to have some documentation explaining all this, the existing examples don't explain how things work to the extent that this thread at least attempted to explain. |
@merethan Thank you for your helpful explanation of how to add external out of tree modules! For others wanting to get more info I am going to link the discussion #43650 and the example repo dedicated to out of tree module support for both zephyr and non-zephyr targets. Updates
|
Is your enhancement proposal related to a problem? Please describe.
It is not always possible to add an out-of-tree driver for an existing subsystem using the same CMake macros used upstream. The reason for that is that the library created with
zephyr_library()
macro gets no sources if no upstream driver is enabled (e.g. forkscan
). In fact, this is not always true as some subsystems like sensors usezephyr_library()
on each driver subdirectory.Describe the solution you'd like
I'd like to be able to add a new out-of-tree driver for an existing subsystem using equal or similar CMake macros used upstream. That is, assuming the following layout:
with the following content in
$APP_DIR/drivers/kscan/CMakeLists.txt
:I think that there should be clear and concise documentation on how to write out-of-tree drivers.
Describe alternatives you've considered
I have tried the following to solve this problem:
zephyr_ext_library()
with:Then you have the following content in
$APP_DIR/drivers/kscan/CMakeLists.txt
:zephyr_library()
(knowing that library name is built using its path with underscores). You end up with the following content in$APP_DIR/drivers/kscan/CMakeLists.txt
:Additional context
N/A
The text was updated successfully, but these errors were encountered: