-
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
make: improve handling of the stdio_rtt module, improve dependency management at application level #12724
Conversation
This logic seems reverse to me... shouldn't Lines 432 to 436 in d755d50
|
3fb3c84
to
b3f4c7d
Compare
And where would you provide the stdio_uart features ? In the boards!
I prefer having to blacklist the feature provided by the 3 boards that are using Segger RTT for stdio instead of requiring a feature that will have to be provided by all the other ones. |
I fixed the failures on Murdock: on thingy52 and ruuvitag, there was an |
Currently Lines 406 to 408 in 61c6b07
Does anything speak against replacing
I prefer it if you don't have to think about it and it happens all automatically in the background (which was what I proposed). This is how the FEATURE system was supposed to work. To me |
I'm aware of how stdio_% dependencies work. An I have some ideas of how all this should be improved. But I think this is out of the scope of this PR.
It seems there's a confusion on your side between FEATURES_PROVIDED and FEATURES_REQUIRED. While the former is set by cpus or boards (and soon by drivers I hope ;) ), e.g. in Makefile.features files, the latter is set when managing dependencies, e.g. in Makefile.dep files. So your question should rather be "why not use FEATURES_REQUIRED instead of USEMODULE ?" Even if I also thought of it, I haven't tested because I thought it might not work. I give this is a try (only tomorrow) anyway, just to be sure. Note that stdio_rtt is a real module, see here. stdio_uart as well. So I don't know how the build system will behaves if this is changed this way. |
This is exactly what this PR is trying to do. Using FEATURES_BLACKLIST is simpler and less intrusive than having to deal with a provided stdio_uart feature, like you suggested. |
I've reworked the management of dependencies with the introduced To convince @miri64, I'll try to better answer to your questions:
stdio_uart is used by almost all boards in RIOT, except the 3 ones modified by this PR. If we introduce a feature for this, we would have to add it to the
Even if there's a confusion between Lines 987 to 989 in cd0b975
This is basically what's done now between the new stdio_rtt feature and the corresponding module (which already exists). |
I do not think this needs a Not sure if this works straight out of the box for those boards, might need some refactoring. |
Just tested this locally and it works like a charm. I like your proposition @fjmolinas. Thanks! |
Adapted this PR following @fjmolinas's suggestion. By default the stdio_rtt module is used, except when Since hamilton doesn't provide periph_uart, it's automatically excluded from the build of applications using ethos. For thingy52 and ruuvitag, stdio_uart is built but that means an USB to UART adapter must be connected to run the test applications on these platforms in this case. |
|
c9b6c7e
to
5ef1228
Compare
Also, rebased to fix conflicts. |
I made an alternative proposal in #12739. No boards touched, no default |
That is exactly what I'm saying. Out of the 3 boards that use If a test needs
|
It should be noted, that this has also influence on automatic testing. If the board is attached just by the interface the user usually expects (Segger-RTT), if will output nothing via that interface if the test is executed. A separate UART adapter needs to be connected in that case.
I know. That is why I think it is reverse logic to say "Don't build this application if Lines 406 to 408 in 5f4b8ef
but apparently not central enough. /cc From #12739 (review)
Then |
(just noticed that the new approach doesn't use |
I agree, the issue is that the implementation of |
I agree it should be a reverse logic but that it should be built if
Many boards need a external device for On an automatic set-up I might rather hook-it up to an FTDI an always use |
I think the main issue I have with this approach is that we are replacing one dirty hack with a different dirty hack. I appreciate your work on this, but if the new dirty hack means I have to change my workflow, I rather stick to the old dirty hack. |
5ef1228
to
a5a7c48
Compare
84392b3
to
16195df
Compare
Rebased now that #12755 is merged. |
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 is an issue with the current status because of #9913.
boards/hamilton/Makefile.include
Outdated
TERMFLAGS = term-rtt | ||
|
||
USEMODULE += stdio_rtt | ||
# Configure Segger's RTT when stdio_rtt is loaded |
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.
This is not possible right now since Makefile.dep
is included after Makefile.include
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.
You are right, that doesn't work. I came with an another approach which is to set RIOT_TERMINAL to jlink by default with these boards. This way there's no check on the USEMODULE here.
The drawback is that is decouples the automatic use of jlink segger rtt from the fact that stdio_rtt is actually used.
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 think this is a none issue, if the user deactivates stdio_rtt
by using another stdio_
then they should now they won't get a terminal.
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 there are other build system related of detecting USEMODULE variables are not changing compared to master ? some of these do support usart
, so my comment is not valid.
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.
just a minor optimization, otherwise looks good to me.
boards/ruuvitag/Makefile.include
Outdated
TERMFLAGS = term-rtt | ||
# Configure Segger's RTT when stdio_rtt is loaded | ||
ifneq (,$(filter stdio_rtt,$(USEMODULE))) | ||
TERMPROG = $(RIOTTOOLS)/jlink/jlink.sh |
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.
Seems to me this block is duplicated, as its also defined identical for the thingy52
. I guess it would make sense to move it to make/tools/serial.inc.mk
?!
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.
You are right. I moved the the common code in serial.inc.mk
with a slightly different approach.
16195df
to
8f32159
Compare
else ifeq ($(RIOT_TERMINAL),jlink) | ||
TERMPROG = $(RIOTTOOLS)/jlink/jlink.sh | ||
TERMFLAGS = term-rtt |
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.
Nice! this should have been here a while ago :)
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.
One suggestion.
boards/thingy52/Makefile.include
Outdated
TERMPROG = $(RIOTTOOLS)/jlink/jlink.sh | ||
TERMFLAGS = term-rtt | ||
# use JLink Segger RTT by default | ||
RIOT_TERMINAL ?= jlink |
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 think this would make sense, it would replicate what is done in Makefile.dep
in a way it would work if stdio_ethos
, stdio_uart
is included.
RIOT_TERMINAL ?= jlink | |
# HACK: replicate dependency resolution in Makefile.dep | |
ifeq (,$(filter stdio_%,$(DISABLE_MODULE)$(USEMODULE))) | |
RIOT_TERMINAL ?= jlink | |
endif |
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 don't think so. 'stdio-%' modules used/disabled are known only after makefile.dep has been parsed. So at this stage both variables are probably empty, since makefile.include is parsed before (for the moment). Maybe I'm missing something though.
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.
Unless:
a) passed my the comand line
b) disabled in the application makefile
c) required in the application makefile
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.
And for any of this cases it is required for stdio_something
to be included as a module. In our code base it will not work for cases where USEMODULE += stdio_ethos
is in an application Makefile.dep
. So it is a HACK, and that is why I would have that comment, maybe extend it"
# HACK: replicate dependency resolution in Makefile.dep, only works of `USEMDOULE` or `DEFAULT_MODULE` is set by the command line or in the application Makefile.
It will still make the usage more transparent for most cases. Or maybe include Makefile.dep
here and tag is as HACK, for me this would be OK, since we are moving towards including Makefile.include
after Makefile.dep
in which case this hack could be removed. What do you think?
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 applied you proposal for thingy52 and ruuvitag because they can use stdio over UART so that makes sense in this case. For hamilton, since there's no UART configured, I think we can keep the base RIOT_TERMINAL ?= jlink
(maybe even without the ?
).
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 applied you proposal for thingy52 and ruuvitag because they can use stdio over UART so that makes sense in this case. For hamilton, since there's no UART configured, I think we can keep the base RIOT_TERMINAL ?= jlink (maybe even without the ?).
I would keep the ?
, but otherwise OK!
Still a bit hacky (IMHO stdio_%
should either be a DEFAULT_MODULE
for all boards or none... + I believe the stdio_null
case is completely ignored here). But my original concerns were addressed.
8f32159
to
f27c7d5
Compare
I have no more concern's, it is indeed hacky, but OK. please squash @aabadie |
Can you give a little more context, are you in general against |
For the moment, hamilton, ruuvitag and thingy52 use stdio_rtt by default.
chronos is indirectly blacklisted because of missing periph_uart feature. hamilton doesn't provide periph_uart when stdio_rtt is disabled (because of ethos dependency to stdio_uart) and ruuvitag/thingy52 provide the periph_uart feature so stdio_uart can work on these boards.
pic32 boards now provide an UART, and this the periph_uart feature ruuvitag/thingy52 provide the periph_uart feature so stdio_uart can work on these boards.
ruuvitag/thingy52 provide the periph_uart feature so stdio_uart can work on these boards even if stdio_rtt is disabled because of ethos.
f27c7d5
to
024d4ab
Compare
squashed! |
@haukepetersen, are you concerns addressed ? |
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 really don't like the use of DISABLE_MODULE
in the dependency tree regarding the STDIO selection. But I see the problem that it is not too easy to model this in a cleaner way without remodeling large part of the STDIO system.
So even that I don't like it, I am ok with merging this for now. But we should revisit this topic ASAP to model this coherently. Some thoughts that need to be addressed:
- STDIO -> tuple of RIOT backend (
stdio_uart
,stdio_rtt
, ...) vs. host tool (pyterm
,minicom
,jlink.sh
) - separation of RIOT backend and multiplexing, e.g.
stdio_uart
vsethos
- clean definition of default backend and default host tool, with possibility of overriding these
- [opt] using multiple STDIO backends in RIOT concurrently? E.g. STDIO over UART (
stdio_uart
) + STDIO over BLE/CoAP/UDP?!
@@ -468,6 +468,9 @@ endif | |||
|
|||
ifneq (,$(filter stdio_uart,$(USEMODULE))) | |||
FEATURES_REQUIRED += periph_uart | |||
|
|||
# stdio_rtt cannot be used when stdio_uart is loaded | |||
DISABLE_MODULE += stdio_rtt |
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.
This seems unclean to me: the dependencies should be defined so that only a single stdio_x
is used in the first place... Using DISABLE_MODULE
like this smells like trouble in the future...
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 we should open an Issue to discuss this (something I can do after the release).
As we seem to agree and all checks have passed, I take the freedom to merge this PR. But as said, lets address the STDIO selection thing not too far in the future to make it more intuitive for all boards... |
Contribution description
This PR introduces the stdio_rtt feature for boards for which stdio is accessed via RTT (there is a strong dependency on this for these boards): hamilton, thingy52 and ruuvitag.
The (new)
stdio_rtt
feature is required when the (already existing)stdio_rtt
module is used.This then allows to blacklist this feature when stdio_ethos is used in the build: indeed stdio_ethos has a strong dependency to stdio_uart, which is not compatible.
Thanks to this, the PR also removes all
BOARD_BLACKLIST
variables that were added because of this incompatibility.There is a small trick for
gnrc_*
tests application that was taken from #12304 (commit 6f43ab7 is cherry-picked from this PR in fact).Some details (pic32 chronos boards removed) are explained in related commit details comments.
Testing procedure
Issues/PRs references
None