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>
The way the command line parsing works, argv[0] is always guaranteed
to be non-NULL as well as a non-empty string, so doing checks for this
in get_cb() is redundant.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
All code paths in shell_exec() are guaranteed to set err before
returning it, so doing this (rather curious) initialization is
completely unnecessary.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The command name and a shortened form of valid parameters is not
necessarily enough to understand its usage. Add the option of
providing a more lengthy description of the command usage.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Most commands provide a short string to describe the parameters it
takes. Provide this help text as part of the list of supported
commands for each module.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.
Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.
This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.
For users that just want to continue their work with minimal
disruption the following should suffice:
Install CMake 3.8.2+
Port any out-of-tree Makefiles to CMake.
Learn the absolute minimum about the new command line interface:
$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..
$ cd build
$ make
PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
The command callback might not recognize commands if the input comes
with the module name as first parameter as both argc and argv will be
off by one.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
If the command cannot be execute code should return a proper since this
may not be a user input.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds shell_exec which can be used to execute commands directly
without the use of a console which is useful for both testing as well
as interfacing with applications/upper layer which would like to have
access to shell commands directly.
In addition to that this may be more trivial to interface with instead
of using fifos like uart_register_input and telnet_register_input do.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
In console shell, add explicit, 'exit' command to leave the current
module. Currently this is being achieved by overloading select command
(without an argument).
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
This enables modules to define its own prompt handler instead of always
using the default_module_prompt.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.
Jira: ZEP-2051
Change-Id: Icbf9e542b23208890a3a32358447d44cdc274ef1
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Let's use the generic console input type now. This will be useful for
other console input drivers such as telnet.
Change-Id: I787a1e9d86481d5f8c4803453726d9042a89dea4
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>