Removed Console dependencies from shell uart backend.
Generated define: CONFIG_UART_SHELL_ON_DEV_NAME for each board.
Fixes#10191
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
1. Created new shell module: shell_help.
2. Simplified command handlers with new shell print macros.
3. Removed help functions from command handlers.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Removed printing command help from help handler. It is now
realized by the shell engine. This change saves a lot of flash
but still allows to print help in command handler with function
shell_help_print.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Removing help "options" from shell API.
Currently SHELL_OPT macro is not used by users. What is more
commit: a89690d10f ignores possible options created in
command handler by the user. As a result they are not printed
in help message.
Second, currntly implemented "options" in command handlers options are
implemented without SHELL_OPT macro.
And last but not least this change will allow to implement
help handler in a way that user will not need to think about calling
functions printing help in a command handler.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Fix issue caused by 3fc497ac9a
This change removes `rtt` and `systemview` from header includes
as these are already placed in the path.
Also `SEGGER_SYSVIEW_ConfDefaults.h` header included from
`SEGGER_SYSVIEW_Int.h` is placed higher to make sure `INLINE`
definition is properly visible.
Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
Removed kconfig option for setting shell thread priority and fix
it to K_LOWEST_APPLICATION_THREAD_PRIO.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Improved reception in the backend and replaced thread
with periodic timer as thread was used only to
periodically poll RTT data availability and using timer
is more RAM-wise efficient.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Rephrase some help messages to decrease flash usage.
Deactivate shell history feature for test test_netusb_rndis
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Resize command requires shell to be working on UART interrupt
driven API. This will be now enabled by default when shell serial
backend is selected. Recently this feature was accidentally turned
off in PR #11556.
k_sleep(1) has been replaced with k_busy_wait(1000) to avoid
hanging in command handler.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Shell used to require adding commands and subcommands in alphabetical
order to ensure correct autocompletion and printing options with the
<Tab> key.
Commit: bd3a4e5fe5 implemented correct
options printing with the <Tab> key for not sorted commands.
This PR allows to partially autocomplete not sorted commands.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
In case terminal sends `\r\n` on the Enter button
shell will go to the new line twice and it will print
prompt twice. This patch fixes it.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Shell log backend was using k_fifo to enqueue log messages.
It was using field in log message that was used for same
purpose in log_core before passing message to backends.
However, this method supported only single shell as
other shell was corruption the fifo because field was
reused.
Modified shell log backend to use k_msgq for pending
messages.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Currently shell UART backend is interrupt driven if UART driver
is interrupt driven. That can be limitation if one instance
wants to use interrupts but shell UART should not.
Added option to shell uart to be able to control use of
interrupts. By default interrupts are enabled if driver
supports it.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
RTT backend was returning number of transfered data equal
to requested amount because it was not taking into
account value returned by SEGGER_RTT_Write. As the outcome
data could be lost.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Each shell thread will have unique name.
Previously thread name "shell" has been created for each shell
backend.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
RTT and uart shell backends were started with fixed
log limit set to INF. Configuration has been moved
to Kconfig allowing certain level or default LOG_MAX_LEVEL.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Scenario where RX ring buffer is full and cannot accept
more data was not handled. In that case byte should be
dropped. Such situation may occur when long command is
pasted (exceeding ring buffer size).
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
The code referenced CONFIG_SHELL_VT100_COLORS_ENABLED which does not
exist. Its mostly likely that CONFIG_SHELL_VT100_COLORS was meant
to be tested instead.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This allows the shell core to perform precheck before calling the
handler which then can assume the number of arguments is correct.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Improved RX path to use ring buffer for incoming data instead of single
byte buffer. Improved TX path to use ring buffer. Added support for
asynchronous UART API (interrupts).
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
k_poll_signal was being used by both, struct and function. Besides
this being extremely error prone it is also a MISRA-C violation.
Changing the function to contain a verb, since it performs an action
and the struct will be a noun. This pattern must be formalized and
followed and across the project.
MISRA-C rules 5.7 and 5.9
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Fixed the case when TXDONE signal was not cleared. Bug was unnoticed
because UART backend was synchronous.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Shell log backend was enabled too early, before shell thread was
up and running. That could lead to failure if log thread passes
log message to shell log backend.
Additionally, modified algorithm for multiplexing log output with
shell prompt. In case of logs flood prompt was unreadable because
it was deleted immediately after being printed. Added k_sleep
after printing prompt if any character was typed. This ensures that
shell prompt is readable if user uses it.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Added dummy backend which can be enabled with Kconfig. By default it is
disabled because it needs the same amount of memory as other phisical
backends. It shall be use only for commands testing purposes.
Improved shell_execute_cmd function, now it clears command context
before new command will be executed.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
When user was typing a new command and next pressed an up arrow
shell has displayed previously executed command. Next it was not
possible to display back currently edited command using a down arrow.
Fixes#10766.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
1. Changed return value of function: shell_cmd_precheck from bool to
int. Now it returns:
0 when argument count is correct and help print is not requested
1 when help was requested and printed
-EINVAL on wrong arguments count
This change simply shell_cmd_precheck usege in command handlers.
2. Unified all commands in shell_cmd.c file.
3. Fixed a bug where help was not printed on wrong argument count.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
If user will enable shell than for each backend shell instance
will be created automatically.
Update all shell examples according to the new initialization
procedure.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Some terminals literally interprets shell output data. Hence to print
a message in new line shell needs to send `\r\n` each time. To minimize
flash usage user can now send `\n` as a line delimiter and shell will
automatically add missing CR character.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Added functionality to enable active shell backends via Kconfig
file. When there will be more backends implemented user will
have an option to select only required ones.
It is no longer needed to select SERIAL in prj.conf.
Fixes#10190
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
This allows declaring the commands in any order which sometimes is
convenient when commands are conditional making it undesirable to
sort everything.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
1. Shell will accept CR or LF as line delimiter.
2. Macro SHELL_DEFINE simplified - it no longer requires
new line character.
3. Fixes: #10207.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
1. Command handler can return command exectution status as int.
2. Existing command handlers rework.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
This PR fixes: #10195.
Function _vprintk when used cannot parse '*' what
a as result causes dereferencing bad pointer.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Under GNU C, sizeof(void) = 1. This commit merely makes it explicit u8.
Pointer arithmetics over void types is:
* A GNU C extension
* Not supported by Clang
* Illegal across all ISO C standards
See also: https://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html
Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
The shell subsystem, as it is today, depends on having a UART,
therefore let's add the dependency explicitly in its Kconfig
Fixes#10190
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>