-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,9 @@ you use native host tools for compiling, debugging, and analyzing your | |
| Zephyr application, eliminating the need for architecture-specific | ||
| target hardware in the early phases of development. | ||
|
|
||
| This board provides a few peripherals such as an Ethernet driver and UART. | ||
| See `Peripherals`_ for more information. | ||
|
|
||
| Host system dependencies | ||
| ======================== | ||
|
|
||
|
|
@@ -458,8 +461,8 @@ The following peripherals are currently provided with this board: | |
| ``stdout``. | ||
|
|
||
| - Feed any input from the native application ``stdin`` to a possible | ||
| running :ref:`Shell`. For more information refer to the section | ||
| `Shell support`_. | ||
| running legacy shell. For more information refer to the section | ||
| `Legacy shell support`_. | ||
|
|
||
| **Clock, timer and system tick model** | ||
| This model provides the system tick timer. By default | ||
|
|
@@ -538,11 +541,40 @@ The following peripherals are currently provided with this board: | |
| must be powered down and support Bluetooth Low Energy (i.e. support the | ||
| Bluetooth specification version 4.0 or greater). | ||
|
|
||
| Shell support | ||
| ************* | ||
| **UART** | ||
| An optional UART driver can be compiled with native_posix. | ||
| For more information refer to the section `UART`_. | ||
|
|
||
|
|
||
| UART | ||
| ***** | ||
|
|
||
| This driver can be configured to either create and link the UART to a new | ||
| pseudoterminal (i.e. ``/dev/pts<nbr>``), or to map the UART input and | ||
| output to the executable's ``stdin`` and ``stdout``. | ||
| This is chosen by selecting either | ||
| :option:`CONFIG_NATIVE_UART_0_ON_OWN_PTY` or | ||
| :option:`CONFIG_NATIVE_UART_0_ON_STDINOUT` | ||
| Note that for interactive use, the first option should be chosen. The | ||
| second option is only intended for automated testing or feeding/piping other | ||
| processes output to the UART. | ||
|
|
||
| When :option:`CONFIG_NATIVE_UART_0_ON_OWN_PTY` is chosen, the name of the | ||
| newly created UART pseudo-terminal will be displayed in the console. | ||
| You may also chose to automatically attach a terminal emulator to it by | ||
| passing the command line option ``-attach_uart`` to the executable. | ||
| The command used for attaching to the new shell can be set with the command line | ||
| option ``-attach_uart_cmd=<"cmd">``. Where the default command is given by | ||
| :option:`CONFIG_NATIVE_UART_AUTOATTACH_DEFAULT_CMD`. | ||
| Note that the default command assumes both ``xterm`` and ``screen`` are | ||
| installed in the system. | ||
|
|
||
|
|
||
| Legacy shell support | ||
| ******************** | ||
|
|
||
| When the :ref:`Shell` subsystem is compiled with your application, the native | ||
| standard input (``stdin``) will be redirected to the shell. | ||
| When the legacy :ref:`Shell` subsystem is compiled with your application, | ||
|
||
| the native standard input (``stdin``) will be redirected to the shell. | ||
| You may use the shell interactively through the console, | ||
| by piping another process output to it, or by feeding it a file. | ||
|
|
||
|
|
@@ -580,16 +612,8 @@ These directives are: | |
| Use example | ||
| =========== | ||
|
|
||
| For example, you can build the shell sample app: | ||
|
|
||
| .. zephyr-app-commands:: | ||
| :zephyr-app: samples/subsys/shell/shell_module | ||
| :host-os: unix | ||
| :board: native_posix | ||
| :goals: build | ||
| :compact: | ||
|
|
||
| And feed it the following set of commands through a pipe: | ||
| For example, after you have built an application with the legacy shell, you | ||
| can feed it the following set of commands through a pipe: | ||
|
|
||
| .. code-block:: console | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| config UART_NATIVE_POSIX | ||
| bool "UART driver for native_posix" | ||
| select SERIAL_HAS_DRIVER | ||
| depends on ARCH_POSIX | ||
| help | ||
| This enables a UART driver for the POSIX ARCH. The driver can be configured | ||
| to either connect to the terminal from which native_posix was run, or into | ||
| one decicated pseudoterminal for this UART. | ||
|
|
||
| if UART_NATIVE_POSIX | ||
|
|
||
| config UART_NATIVE_POSIX_PORT_0_NAME | ||
| string "Port 0 Device Name" | ||
| default "UART_0" | ||
| depends on UART_NATIVE_POSIX | ||
| help | ||
| This is the device name for UART, and is included in the device | ||
| struct. | ||
|
|
||
| choice | ||
| prompt "Native UART Port 0 connection" | ||
| default NATIVE_UART_0_ON_OWN_PTY | ||
|
|
||
| config NATIVE_UART_0_ON_OWN_PTY | ||
| bool "Connect the UART to its own pseudo terminal" | ||
| help | ||
| Connect the UART to its own pseudoterminal. This is the preferred option | ||
| for users who want to use Zephyr's shell. | ||
| Moreover this option does not conflict with any other native_posix backend | ||
| which may use the calling shell standard input/output. | ||
|
|
||
| config NATIVE_UART_0_ON_STDINOUT | ||
| bool "Connect the UART to the invoking shell stdin/stdout" | ||
| help | ||
| Connect the UART to the stdin & stdout of the calling shell/terminal which | ||
| invoked the native_posix executable. This is good enough for automated | ||
| testing, or when feeding from a file/pipe. | ||
| Note that other, non UART messages, will also be printed to the terminal. | ||
| This option should NOT be used in conjunction with the legacy shell | ||
| native_posix backend (NATIVE_POSIX_STDIN_CONSOLE) | ||
| It is strongly discouraged to try to use this option with the new shell | ||
| interactively, as the default terminal configuration is NOT appropriate | ||
| for interactive use. | ||
|
|
||
| endchoice | ||
|
|
||
| config NATIVE_UART_AUTOATTACH_DEFAULT_CMD | ||
| string "Default command to attach the UART to a new terminal" | ||
| default "xterm -e screen %s &" | ||
| help | ||
| If the native_posix executable is called with the --attach_uart command line | ||
| option, this will be the default command which will be run to attach a new | ||
| terminal to it. | ||
| Note that this command must have one, and only one, '%s' as placeholder for | ||
| the pseudoterminal device name (e.g. /dev/pts/35) | ||
| This is only applicable if a UART is configured to use its own PTY with | ||
| NATIVE_UART_x_ON_OWN_PTY. | ||
|
|
||
| endif #UART_NATIVE_POSIX |
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?
Uh oh!
There was an error while loading. Please reload this page.
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 with that console driver. The new shell is not using
CONSOLE, but hooks directly into the UART driver. So theCONSOLE/old shell backends we had are of no use with the new shell.I guess the question should be for the new shell developers. But my understanding is that, today:
Uh oh!
There was an error while loading. Please reload this page.
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