-
Notifications
You must be signed in to change notification settings - Fork 8.2k
UART for POSIX_ARCH #10212
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
UART for POSIX_ARCH #10212
Conversation
252b3fb to
7739892
Compare
Codecov Report
@@ Coverage Diff @@
## master #10212 +/- ##
=======================================
Coverage 53.06% 53.06%
=======================================
Files 214 214
Lines 26198 26198
Branches 5645 5645
=======================================
Hits 13901 13901
Misses 10025 10025
Partials 2272 2272Continue to review full report at Codecov.
|
|
One clarification to a question you will probably have: The reason for this is that the shell assumes it has access to a terminal thru a raw driver, without any of the standard terminal niceties. That means that if we wanted to provide some reasonable setup thru stdin/out for interactive use, we would need to reconfigure the terminal into a non-sane mode (no echo, no line input, no Ctrl+X raising signals, etc..).
|
7739892 to
eebd94c
Compare
|
You can for example try the shell sample app as: If you run any of the commands which require options without an option you will trigger #10195 |
|
recheck |
subsys/shell/Kconfig
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.
depends on might be better here. selecting symbols with prompts or dependencies often leads to two common issues:
-
selectignores dependencies. If someone adds (unsatisfied) dependencies toSERIAL, this will still force it on (but at least you get a warning). -
With
select, you can't immediately tell when looking atSERIALthat there's other ways for it to get enabled, or thatCONFIG_SHELL=yalso enablesSERIAL. That can lead to twisty and hard-to-follow Kconfig files if there's a lot ofselecting going on.People often overlook the selecting symbols when changing dependencies too, which is how you end up with the first issue.
Usually, it's best to limit select to simple invisible "helper" symbols (select CPU_SUPPORTS_FOO and the like). It's great for that.
I whitelisted the select-without-satisfied-dependencies warning when I was turning warnings into errors, because there was a lot of it going on, and a lot of it seemed to be from CONSOLE-related symbols. Should probably refactor a bunch of those to use depends on instead. :)
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 sentiment also appears in kconfig-language.txt btw:
select should be used with care. select will force a symbol to a value without
visiting the dependencies. By abusing select you are able to select a symbol
FOO even if FOO depends on BAR that is not set. In general use select only for
non-visible symbols (no prompts anywhere) and for symbols with no dependencies.
That will limit the usefulness but on the other hand avoid the illegal
configurations all over.
Common sense overrides it though, but in practice, select very often leads to those issues.
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.
Agreed.
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.
Some examples would be nice here:
This board provides a few peripherals such as an Ethernet driver and UART. See ...
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.
Not the new shell, eh? Will the new and legacy shells work together or are they mutually exclusive?
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.
Not the new shell, eh?
Not with that console driver. The new shell is not using CONSOLE , but hooks directly into the UART driver. So the CONSOLE/old shell backends we had are of no use with the new shell.
Will the new and legacy shells work together or are they mutually exclusive?
I guess the question should be for the new shell developers. But my understanding is that, today:
- The modules using the legacy shell are being ported to use the new shell. So the legacy shell will be purposeless quite soon (unless some old app uses it).
- The new shell does not know or care about the old shell, and does not intend to avoid any conflict with it. If the old shell was driven thru UART they will certainly conflict if compiled together.
- In case of native_posix, I think you may still be able to compile the old shell in parallel with the new one by using this native console driver for the old shell, and the new UART driver for the new shell.
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.
AFAIK legacy shell will be removed completely
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.
:ref:`shell` will be a reference to the new shell documentation and not to the legacy shell subsystem. The shell documentation is changing with PR #10216, so your PR's references may break when 10216 is merged (or not work until it is). This should probably change to:
When the :ref:`legacy shell` subsystem is compiled ...
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.. I saw that PR coming after I sent mine. So I guess my options are
a. to leave the old link which is correct today, and if that PR is merged before this, correct it. If this PR is merged before, the other PR author should correct the references to the old shell page around, OR, I can send a new PR after 10216 is merged.
b. remove all links to Shell all together, and add them back in a new PR after both are merged.
c. Point to the new shell doc and stall this PR.. => don't like this one.
0b42286 to
dd4364f
Compare
|
@jarz-nordic: are you ok with the fixes in the shell files? |
dd4364f to
918214a
Compare
|
@nashif , @jukkar , @jhedberg : Please take a quick look at the code, and tell if it there is something obviously horrible or not. This code is adding a new optional feature meant for testing, so I do not think we need an extremely thorough review. (I do not expect anybody to review the particular terminal driver flags combination...). If any of you can think of a better reviewer for this, just add him. |
jukkar
left a comment
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.
LGTM
2ad14ce to
5714624
Compare
|
@aescolar : sorry for late review, I had a busy day. |
|
Is this supposed to fix #5941 ? If no, why? If yes, doc clauses like:
Seem strange/limiting. I wanted to check myself, but hit another obstacle: #10243 |
Well, it doesn't. There's no irq mode support, only busy-polling. |
It just means that for interactive use, you have a dedicated TTY for the UART, instead of taking over the one from where you launch the zephyr app. |
In a typical embedded situation, there's just one UART for user to connect to and do everything (provide input and get output, see logging, etc.). I'd expect the same functionality to be available on an emulated Zephyr port (at least available, if not default). |
|
I think you missunderstood me. When you configure the native_poxis UART with CONFIG_NATIVE_UART_0_ON_OWN_PTY (default), you get a new linux /dev/pts mapped to the Zephyr UART. If you use the --atach_uart command, you even get a new window with a terminal emulator connected to it pop automagically. |
|
Right, and if CONFIG_NATIVE_UART_0_ON_STDINOUT is defined, your docs say that it "is only intended for automated testing or feeding/piping other |
If you try to use the shell interactively in that way, you will find yourself with a lot of annoyances, like both the Linux terminal driver and Zephyr shell echoing, the terminal capturing the Ctrl+x combinations (which the shell expects to get raw), the terminal replacing the \r with a \n, while the shell only reacts to \r as end of line, and so forth. That's why I warn people in advance that it is not going to be pleasant, and guide them to the other option which provides what I think most people will expect. |
Ack, I see. As I hinted above, I quickly tried this patch with samples/subsys/console/echo/, but that failed as it required interrupt-driven UART, and I didn't look further so far. Now the situation is clear, thanks. I'd be keen to do something about it, but will look into it later. |
ulfalizer
left a comment
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.
select nit fixed.
|
@dbkinder : Is your review stale? or do you want to hold merging this one until the shell doc PR is fixed and merged, and this one would point to the new pages? |
|
I would like to see this merged asap, the net-shell conversion at #9825 is currently blocked and needs this fix. |
5714624 to
705b5e7
Compare
The posix arch does not compile either of Zephyr's libc, so _prf() is not avaliable Signed-off-by: Alberto Escolar Piedras <[email protected]>
The shell subsystem, as it is today, depends on having a UART, therefore let's add the dependency explicitly in its Kconfig Fixes zephyrproject-rtos#10190 Signed-off-by: Alberto Escolar Piedras <[email protected]>
Added a new UART driver for posix arch boards. The driver can be configured to either attach to a new pseudo-terminal, or to connect to the invoking shell stdin-out. Signed-off-by: Alberto Escolar Piedras <[email protected]>
When running a UART test in CI, it is better to configure the nativeposix UART to be mapped to the process STDIN/OUT. Signed-off-by: Alberto Escolar Piedras <[email protected]>
|
This last push is just a commit message fix to address the neither->either typo. No other change. |
|
I hope we are getting this merging soon, it is also blocking #10239 |
dbkinder
left a comment
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'll get out of the way for this PR and we'll deal with the doc changes after the new shell code and docs are merged.
|
@nashif / @carlescufi : If either of you does not have anything against, feel free to press the button. |
Added a new UART driver for posix arch boards. The driver can be configured to either attach to a new
pseudo-terminal, or to connect to the process stdin-out (only meant for automatic testing, not for interactive use)
Fixes #10190
Fixes #10127 by working around #10191