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>
Added k_thread_name_set() and enable thread name setting when declaring
static threads. This is enabled only when THREAD_MONITOR is used. System
threads get a name by default.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Added flag in log_output module to add timestamp when message is
formatted to a string. Updated existing backends.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Added flag in log_output module to add severity level when message is
formatted to a string. Updated existing backends.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
1. All macros assert have been replaced with __ASSERT_NO_MSG.
2. Macro _Static_assert has been replaced with BUILD_ASSERT.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Removing assert that was crashing shell in allowed scenario.
For example the Tab button is pressed when command buffer is empty.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
1. Added API to change shell prompt in runtime.
2. Added prompt buffer length configuration in Kconfig.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Fixed case when shell_log_backend.c was included even though
shell was disabled.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Extended shell to support wildcard characters: * and ? and expand
commands accordingly.
Increased default stack size.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
New shell support features like:
- multi-instance
- command tree
- static and dynamic commands
- multiline
- help print function
- smart tab (autocompletion)
- meta-keys
- history, wildcards etc.
- generic transport (initially, uart present)
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
New shell implementation is on the way. For now old one and all
references are kept to be gradually replaced by new shell.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This allows to define shells which are using different syntax for
commands parsing eg. foocmd=param1,param2.
This is usefull for providing compatibility with existing external
tools while allowing to use Zephyr's shell subsystem.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
When compiling with the native_posix console, the prototype
for posix_flush_stdout() was missing => added.
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Bool symbols implicitly default to 'n'.
A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though.
Remove some 'default ""' properties on string symbols too.
Also make definitions more consistent by converting some
config FOO
<type>
prompt "foo"
definitions to a shorter form:
config FOO
<type> "foo"
This shorthand works for int/hex/string symbols too, not just for bool
symbols.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Similar fix as in commit b26ca13672. Just later in the same
function. This is how the logic used to be before quite heavy redesign
that happened a while ago.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The original code (introduced by commit d5db35204a) looked like this
before the last rewrite/cleanup:
if (default_module != -1) {
return (str == NULL) ? dest : -1;
}
However with the cleanup the logic seems to have gotten reversed.
Fixes#8501
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Console subsystem is intended to be a layer between console drivers
and console clients, like e.g. shell. This change factors out code
from shell which dealed with individial console drivers and moves it
to console subsystem, under the name console_register_line_input().
To accommodate for this change, older console subsys Kconfig symbol
is changed from CONFIG_CONSOLE_PULL to CONFIG_CONSOLE_SUBSYS
(CONFIG_CONSOLE is already used by console drivers). This signifies
that console subsystem is intended to deal with all of console
aspects in Zephyr (existing and new), not just provide some "new"
functionality on top of raw console drivers, like it initially
started.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Add a reboot command for requesting a warm or cold system reboot
through the kernel shell.
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
Add console driver that allows console session to be transferred
over a websocket connection.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Added noprompt command to shell. It will disable printing
the prompt.
For the native port, when feeding commands from a file or
pipe the prompt reprinting after each command (without echoing)
just confuses the user.
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Now the native console driver also handles stdin
so we can drive the shell from the command line,
a pipe or a file
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Rename tasks -> threads, task was the common name for threads before the
unified kernel was introduced.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Instead of accessing the environment variable ZEPHYR_BASE every time we
require accessing the source code root, use an intermediate variable
that has OS path separators correctly set to '/' to avoid issues on
Windows.
Note: This removes the ZEPHYR_SOURCE_DIR CMake variable. External
applications using that will need to change to use the new ZEPHYR_BASE
variable.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
It's much more intuitive to read "if (module)" instead of
"if (module != -1)" when checking for a valid module. Update the code
to use struct shell_module pointers instead of integers for tracking
modules.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Make the internal commands (exit, select & help) as any other
commands, so that e.g. "help help" works as expected. Also redesign
the way commands are looked up to avoid duplicate lookups.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The print_cmd_unknown() is just a two-liner and only called from a
single place, so just do the printk calls inline.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The code was completely broken wrt command lookups when the command is
given in the format "<module> <cmd> <args...>". It would only work if
the default module is not set, which is almost never the case (as most
apps set it explicitly).
Refactor the command handling by moving more logic up to shell_exec(),
so that get_cb() does a lookup for a single module
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The way get_command_and_module() is used it's impossible for it to be
given an argv where argv[0] is NULL.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>