-
Notifications
You must be signed in to change notification settings - Fork 722
[nrf fromlist] cmake: zephyr_library_amend feature #219
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
[nrf fromlist] cmake: zephyr_library_amend feature #219
Conversation
c9bd240 to
d96ea43
Compare
|
@SebastianBoe Please review this. Please comment if you believe code should be changed to get it approved upstream later. |
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.
changelog needs to begin with [nrf toup], please see https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_dev_model.html#oss-repositories-downstream-project-history
d96ea43 to
7a04826
Compare
Thanks for notifying. |
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.
PR must be created upstream before this is merged, and @thomasstenersen should review.
|
Some background. As I originally did this, the
|
yes, I know, but wanted to make this PR first to allow others and especially @thomasstenersen to provide feedback before going upstream. |
Thanks for commenting, and the link. In our case with the cc310, an entropy driver will be provided internally in the fw-nrfconnect-nrf repo, similar to If this approach is generally accepted (or at least accepted in nrf repo), I will add the cc310 entropy driver in same way. |
|
You are correct that one should not use the library name when it can be avoided, but for this use-case we were unable to avoid it. |
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.
Why this patch cannot go upstream as is? Is there any controversial content?
I'm happy to use the library name directly, but it is possible to avoid using the library name with this PR. The principle in this PR will also allows a more generic approach for Zephyr community to provide alt implementation of entropy if they so wish. @SebastianBoe and @thomasstenersen Please let me know if you think it has value to go ahead with this PR upstream for a more generic approach and to avoid directly using the lib name |
Due to the fact that we already did this in slightly different way internally, I just wanted to give people opportunity to give feedback first. |
|
I'm sceptical, what if we want entropy_handlers.c and also a different implementation of the nrf driver? I think we should follow @thomasstenersen 's work. |
|
@tejlmand thanks for the context. It's not pretty and I myself would prefer your solution, really. But I don't think this will be accepted upstream until there are others than Nordic that needs this functionality (that was the argument last time). |
If that is the case, please use |
7a04826 to
95414db
Compare
Completely agree, if this is not going upstream. |
|
Thanks for all the comments and based on this, and especially this from @SebastianBoe
So I have now made a more generic way of doing this. I have reworked the PR, so read the updated description at the top. With the changes, it is now possible to create a @thomasstenersen for this to also work for |
cmake/extensions.cmake
Outdated
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.
Is this error missing an if-statement ?
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.
good spotted, thansk.
This was added at last minut, cause I wanted to safe guard accidential calls from Zephyr repo.
Guess it was done a little to fast.
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.
Fixed
|
The approach LGTM, we just need a PR posted upstream and then we can merge this. |
95414db to
4d822bb
Compare
|
4d822bb to
e9d0d8c
Compare
|
The tag should be fromlist according to Marti. |
e9d0d8c to
805e60b
Compare
805e60b to
f83f330
Compare
|
Thanks for bearing with me on the patch bookkeeping! These tags make it a lot easier to track patches by category, and help bring attention to patches which may have been merged upstream during mergeups. |
|
DNM until #220 is merged. It is policy to block PR's to fw-nrfconnect-zephyr when an upmerge PR is ongoing. |
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.
NACKing to block the merge
f83f330 to
b2325fc
Compare
the mergeup is in, please revisit @SebastianBoe |
This commit introduces the cmake extension zephyr_library_amend. This function allows for adding files in an out-of-tree Zephyr module to a zephyr library created in zephyr repo CMake files. As example: drivers/entropy/CMakeLists.txt creates an zephyr library as: zephyr_library() only available to zephyr itself. The amend function allows to amend to such a lib, by creating a CMakeLists.txt file following identical folder structure in a Zephyr Module: <zephyr_module_oot>/drivers/entropy/CMakeLists.txt zephyr_library_amend() zephyr_library_sources() # Sources are amended to the original library Signed-off-by: Torsten Rasmussen <[email protected]>
This commits adds ${IMAGE} in order to support multiimage in the amend
feature.
Signed-off-by: Torsten Rasmussen <[email protected]>
b2325fc to
0f79114
Compare
|
The CI is failing because of an intermittent bug with QEMU that is on master also. You can merge this without the CI pass. |
This PR allows amending to a Zephyr library created inside Zephyr repo in a generic way.
Currently, if no files are added to a library, as example the drivers/entropy zephyr library because no drivers (c-files) are selected using Kconfig, the following error when running cmake / menuconfig:
This PR allows to amend drivers files out-of-tree to an existing zephyr library.
As example:
drivers/entropy/CMakeLists.txtcreates a zephyr library as:but due to kconfig settings, no files are added to the lib in Zephyr.
The amend function allows to amend to such a lib, by creating a
CMakeLists.txt file following identical folder structure in a Zephyr Module:
which means that the library created in Zephyr is no longer empty.
Signed-off-by: Torsten Rasmussen [email protected]