The shell is a command line interface where the user can execute various commands to control, debug and monitor its application.
> make -s console $ kernel/sys/info app: shell-master built 2017-03-05 21:26 CET by erik. board: Arduino Due mcu: Atmel SAM3X8E Cortex-M3 @ 84MHz, 96k sram, 512k flash OK $ kernel/thrd/list NAME STATE PRIO CPU SCHEDULED MAX-STACK-USAGE LOGMASK monitor suspended -80 0% 22 176/ 518 0x0f idle ready 127 99% 594 276/ 390 0x0f main current 0 0% 305 540/ 88898 0x00 OK $ kernel/thrd/set_log_mask foo 0 ERROR(-3) $ <Ctrl-D> >
The shell module has a few configuration variables that can be used to
tailor the shell to the application requirements. Most noticeably is
the configuration variable
CONFIG_SHELL_MINIMAL. If set to
all the shell functionality is built; including tab completion, cursor
movement, line editing and command history. If set to
1 only the
minimal functionality is built; only including tab completion and line
editing at the end of the line.
See Configuration for a list of all configuration variables.
Test code: tst/oam/shell/main.c
Test coverage: src/oam/shell.c
Example code: examples/shell/main.c
Initialize the shell module. This function must be called before calling any other function in this module.
The module will only be initialized once even if this function is called multiple times.
- zero(0) or negative error code.
shell_init(struct shell_t *self_p, void *chin_p, void *chout_p, void *arg_p, const char *name_p, const char *username_p, const char *password_p)¶
Initialize a shell with given parameters.
chin_p: The shell input channel. The shell waits for commands on this channel.
chout_p: The shell output channel. The shell writes responses on this channel.
arg_p: User supplied argument passed to all commands.
name_p: The shell thread name.
username_p: Shell login username, or NULL if no username is required to use the shell.
password_p: Shell login password. This field is unused if
The shell main function that listens for commands on the input channel and send response on the output channel. All received commands are passed to the debug file system function
- Never returns.
arg_p: Pointer to the shell arguemnt struct
struct shell_t. See the struct definition for a description of it’s content.
struct shell_t::@119::@120 shell_t::heap
struct shell_t::@119 shell_t::history