-
Notifications
You must be signed in to change notification settings - Fork 2k
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
doc: document how to handle multiple cpu_models in a directory #12407
base: master
Are you sure you want to change the base?
doc: document how to handle multiple cpu_models in a directory #12407
Conversation
@fjmolinas @aabadie @leandrolanzieri you may be interested. |
@vincent-d you may also be interested as I complained about |
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.
General comments, that IMO makes the different proposals easier to understand.
Also, as currently dependencies are not declarative, it is with the previous | ||
solution one of the only alternative as the following declarative only would | ||
not work. |
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.
As currently dependencies are not declarative. Only solutions 1 and 2 would not be able to declare specific CPU_MODEL
dependencies (as solutions 3 and 4 are declarative only.)
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.
Also move this before the solutions descriptions.
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.
With the solutions numbering it is way better.
I fixed "only solutions 1 and 2 would not be able".
I rephrased and moved to the first paragraph. I had to change the other description already talking about the different solutions.
It is in its own squash commit so you can see in details what I changed.
files. | ||
|
||
|
||
### `ifneq` based handling ### |
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 add numbers to reference all solutions in a easy way.
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.
Sure I will, I did not found how to have all automatically numbered but will compensate manually for now.
Also add them to the TOC for easier access.
In the case of only declarative values of specific variables, handling different | ||
`CPU_MODEL` is simply defining one per `CPU_MODEL`. | ||
When not relying on an `if` evaluation as before, one could define dictionaries | ||
which are implemented in `make` when using only one file with "namespaced" | ||
variables names including the `key` and so the `CPU_MODEL` value in the name. |
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.
Rewording suggestion:
Here every value is declared for each CPU_MODEL
, handling different
CPU_MODEL
is simply defining one per CPU_MODEL
...
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.
Same as the section 4, this changes the meaning, as it does not explain when it applies anymore which was my goal.
The "in the case of only declarative values of specific variables" is indeed hard to understand.
Maybe a "In the case of only declaring variables" ?
variables that have a list as value as the following solution does not apply. | ||
This is true for example for `FEATURES_PROVIDED`. |
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.
or for variables whose value is a list of values (this is case where solution 4 does not apply). This is true ...
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.
Yep better
Again in the case only delcarative values of specific variables, it can happen | ||
that many variables are somehow highly correlated. |
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.
In this case variables that are somehow correlated are declared for each CPU_MODEL
.
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 changes the style as I wanted to say "in THE case of declarative values that are correlated". In the same way as the section 3 introduction. The again
was refering to the section 3.
I may not consistent with the style in all solutions now that I re-read them :/
I have your version in a similar way as the last sentence of the paragraph.
"somehow highly" is weird indeed :D and I used to much "somehow"
I will fix the typo in delcarative
as the same time as the rest to not discard your review for nothing.
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 reworded this, please @fjmolinas take a look
@jia200x @leandrolanzieri I think it would be good to have your input on this since you will be working on configurations. |
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 find that having these approaches documented clarifies things a LOT, including the fact of distinguishing when they take a declarative syntax (which is the way we should aim to). It's really good to have this type of documentation.
I created the EFM32-based solution as a readable alternative to how the STM32 did it. I'll be honest that I don't have a strong opinion on this topic, nor the knowledge what's the best for the build system. That's why I removed myself from the reviewers. |
IMO we should go with solution 1 when dependencies need to be declared and 4 otherwise. Unless configuraiton wise solution 1 would be better for configuration guys @leandrolanzieri @jia200x? I think not all the options should be used, 2 should be avoided and and choose one between 3 and 4 as a less file cluttered alternative. Keeping one or two options at the end. |
The number 2 with It is currently in place and cannot be ignored. So should be tried to be migrated to the other alternatives before saying version 2 must not be used. https://github.com/RIOT-OS/RIOT/blob/e806d4bcbda2bd0735d2f60ba871b68db28ba118/cpu/kinetis/Makefile.features |
ping @leandrolanzieri @jia200x |
Of course, but is different to say should not and must not, we can start with the first-most and migrate later. I would say agreeing on how to do it is the right first step. We can add an issue for the conflicts and eventually a static check. |
@leandrolanzieri how about re-phrasing "#2" as something that is being used and that we are trying to move away from towards "#1". Regarding "#3" and "#4" do you have a preference? I would like to start moving towards implementing these. Maybe 3 is better although more verbose. |
Also maybe for the kinetis case #1 works largely better for you regarding kconfig ore devicetree? I seem to remember you a folder for each in some of your demos. |
Yes! We are opting for that folder structure. It defines a clear interface with every cpu model, and in case we want to add external cpus (e.g privatives) then we can add them withouth touching RIOT files (only specifying the right RIOTCPU env). |
@fjmolinas Sorry for the delay! IMHO we should definitely go with Approach 1. Although I can see that it might seem a bit of an overhead to add a folder per model, it gives us flexibility and order. This, as @jia200x pointed out, provides us with a clear interface to CPU models.
I agree. We should still mention it as a 'legacy' approach, that is migrating towards # 1.
I find Approach 3 to be clearer and more scalable, as it could include model-specific lists.
True, we took an approach similar to # 1 with the Devicetree folder structure, to place the bindings and the model-specific |
$(RIOTCPU)/$(CPU)/models/$(CPU_MODEL)/doc.txt | ||
~~~~~~~~~~~~~~~~~~~ | ||
|
||
And then each main `$(CPU)` file will include the `$(CPU_MODEL)` specific one. |
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 believe I misunderstood this part when I first read it. I think this should be the other way around. A board should specify which CPU_MODEL
it's using, then the model is in charge of including (or not) any common files like the CPU
(which may then include other common, and thus more generic, files).
Files should be included from more specific to less specific. CPU_MODEL
depends on BOARD
, and CPU
depends on CPU_MODEL
, not the other way around.
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.
yes I agree.
Ok if we don't mind folder cluter, I say we move on with only solution number 1 as accepted, although we list 2 as something that exists and that we wan't to get rid off. We can the open an issue with all the cases that do not respect that. Some will need some work to get into shape. |
ac8b1d2
to
2f7ff20
Compare
@fjmolinas I addressed some pending comments.
So we should only keep those alternatives in the document? |
@aabadie @fjmolinas care to review? |
This introduces ways of handling multiple cpu models defined in a directory without relying on `shell sed` magic and algorithms.
Add numbering for the different solutions.
Co-Authored-By: Francisco <femolina@uc.cl>
Move the description that solution 3 and 4 cannot declare dependencies to the introduction. I also reworded the "if only one should be used" to use the numbering, explain 1 over 2 and match more the style with the other one.
Co-Authored-By: Francisco <femolina@uc.cl>
Co-Authored-By: Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
Co-Authored-By: Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
Co-Authored-By: Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
Co-Authored-By: Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
Co-Authored-By: Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
Co-Authored-By: Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
2f7ff20
to
ae04db7
Compare
Let me give my opinion on the different approaches (with a big STM32 bias):
Looking at the current situation in RIOT, I think option 4 is the best option. Regarding what should be in this documentation page, I think we should drop options 1 and 2 from this doc, even if they are still used by existing CPUs supported by RIOT. Just adding a sentence at the beginning of the document saying that the approach is in progress and give good examples (efm32 is one of them). Finally, I don't think this documentation should appear at the top level in the documentation outline. We should group build system related pages under a global build system entry. This page could be added there. In general, the top level documentation needs a bit of reorganization IMHO. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
Contribution description
This introduces ways of handling multiple cpu models defined in a
directory without relying on
shell sed
magic and algorithms.This documentation, introduces different alternative ways to handle multiple cpu models in a cpu. Currently these handling are done through transforming the
CPU_MODEL
withshell | sed
handling and then performing extractions and magic algorithms conversion to declare the specificCPU_MODEL
variables.This is currently the case for example in:
I am currently not capable in a few seconds to tell you how much memory a kinetis board has, and I would guess you would have a hard time knowing if an
efm32
board provides theperiph_hwrng
feature without executing the build system.On top of not being clear, these also require calling a
$(shell)
with some sed parsing to allow doing there matching and then perform other operations.Which is way slower that pure make resolution.
So execute a slow algorithmic resolution at every
make
invocation (even clean) for something that is a fixed mapping.It has been bothering me for some time, and now, that we are trying to move the required definitions to
Makefile.features
, these resolutions should be split and refactored anyway so found it would be the good time to also implement it in a developer friendly way. For reading and execution time.This is currently written toward
CPU
andCPU_MODEL
but also apply to some boards.It was started this way and prefer getting feedback now than searching again for a name that will not be perfect anyway.
Testing procedure
Read the document and evaluate the content.
Also if you have feedback on the format, it is not a documentation anymore but maybe guidelines/ideas for maintainers.
The handling that would be replaced would be these ones (if I do not miss any):
Issues/PRs references
This is part of #11477
slwstk600b-*
export
in make and immediate evaluation Tracking: remove harmful use ofexport
in make and immediate evaluation #10850 for the call to the shell even when not required