2011-03-18 20:46:25 +01:00
|
|
|
apps/nshlib
|
|
|
|
^^^^^^^^^^^
|
|
|
|
|
|
|
|
This directory contains the NuttShell (NSH) library. This library can be
|
|
|
|
linked with other logic to provide a simple shell application for NuttX.
|
|
|
|
|
|
|
|
- Console/NSH Front End
|
|
|
|
- Command Overview
|
|
|
|
- Conditional Command Execution
|
2014-01-18 16:39:16 +01:00
|
|
|
- Looping
|
2011-03-18 20:46:25 +01:00
|
|
|
- Built-In Variables
|
|
|
|
- Current Working Directory
|
|
|
|
Environment Variables
|
|
|
|
- NSH Start-Up Script
|
|
|
|
- Simple Commands
|
|
|
|
- NSH Configuration Settings
|
|
|
|
Command Dependencies on Configuration Settings
|
|
|
|
NSH-Specific Configuration Settings
|
|
|
|
- Common Problems
|
|
|
|
|
|
|
|
Console/NSH Front End
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Using settings in the configuration file, NSH may be configured to
|
|
|
|
use either the serial stdin/out or a telnet connection as the console
|
|
|
|
or BOTH. When NSH is started, you will see the following welcome on
|
|
|
|
either console:
|
|
|
|
|
|
|
|
NuttShell (NSH)
|
|
|
|
nsh>
|
|
|
|
|
|
|
|
'nsh>' is the NSH prompt and indicates that you may enter a command
|
|
|
|
from the console.
|
|
|
|
|
|
|
|
Command Overview
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
This directory contains the NuttShell (NSH). This is a simple
|
|
|
|
shell-like application. At present, NSH supports the following commands
|
|
|
|
forms:
|
|
|
|
|
|
|
|
Simple command: <cmd>
|
|
|
|
Command with re-directed output: <cmd> > <file>
|
|
|
|
<cmd> >> <file>
|
|
|
|
Background command: <cmd> &
|
|
|
|
Re-directed background command: <cmd> > <file> &
|
|
|
|
<cmd> >> <file> &
|
|
|
|
|
|
|
|
Where:
|
|
|
|
|
|
|
|
<cmd> is any one of the simple commands listed later.
|
2013-12-29 22:02:51 +01:00
|
|
|
<file> is the full or relative path to any writeable object
|
|
|
|
in the file system name space (file or character driver).
|
2011-03-18 20:46:25 +01:00
|
|
|
Such objects will be referred to simply as files throughout
|
|
|
|
this README.
|
|
|
|
|
|
|
|
NSH executes at the mid-priority (128). Backgrounded commands can
|
|
|
|
be made to execute at higher or lower priorities using nice:
|
|
|
|
|
|
|
|
[nice [-d <niceness>>]] <cmd> [> <file>|>> <file>] [&]
|
|
|
|
|
|
|
|
Where <niceness> is any value between -20 and 19 where lower
|
|
|
|
(more negative values) correspond to higher priorities. The
|
|
|
|
default niceness is 10.
|
|
|
|
|
2014-01-10 22:23:26 +01:00
|
|
|
Multiple commands per line. NSH will accept multiple commands per
|
|
|
|
command line with each command separated with the semi-colon character (;).
|
|
|
|
|
2014-01-11 16:50:54 +01:00
|
|
|
If CONFIG_NSH_CMDPARMS is selected, then the output from commands, from
|
|
|
|
file applications, and from NSH built-in commands can be used as arguments
|
|
|
|
to other commands. The entity to be executed is identified by enclosing
|
|
|
|
the command line in back quotes. For example,
|
|
|
|
|
|
|
|
set FOO `myprogram $BAR`
|
|
|
|
|
|
|
|
Will execute the program named myprogram passing it the value of the
|
|
|
|
environment variable BAR. The value of the environment variable FOO
|
|
|
|
is then set output of myprogram on stdout. Because this feature commits
|
|
|
|
significant resources, it is disabled by default.
|
|
|
|
|
|
|
|
If CONFIG_NSH_ARGCAT is selected, the support concatenation of strings
|
|
|
|
with environment variables or command output. For example:
|
|
|
|
|
|
|
|
set FOO XYZ
|
|
|
|
set BAR 123
|
|
|
|
set FOOBAR ABC_${FOO}_${BAR}
|
|
|
|
|
|
|
|
would set the environment variable FOO to XYZ, BAR to 123 and FOOBAR
|
|
|
|
to ABC_XYZ_123. If NSH_ARGCAT is not selected, then a slightly small
|
|
|
|
FLASH footprint results but then also only simple environment
|
|
|
|
variables like $FOO can be used on the command line.
|
|
|
|
|
2011-03-18 20:46:25 +01:00
|
|
|
Conditional Command Execution
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
An if-then[-else]-fi construct is also supported in order to
|
|
|
|
support conditional execution of commands. This works from the
|
|
|
|
command line but is primarily intended for use within NSH scripts
|
2013-12-29 22:02:51 +01:00
|
|
|
(see the sh command). The syntax is as follows:
|
2011-03-18 20:46:25 +01:00
|
|
|
|
|
|
|
if <cmd>
|
|
|
|
then
|
|
|
|
[sequence of <cmd>]
|
|
|
|
else
|
|
|
|
[sequence of <cmd>]
|
|
|
|
fi
|
|
|
|
|
2014-01-17 22:56:32 +01:00
|
|
|
Looping
|
|
|
|
^^^^^^^
|
|
|
|
|
|
|
|
while-do-done and until-do-done looping constructs are also supported.
|
|
|
|
These works from the command line but are primarily intended for use
|
|
|
|
within NSH scripts (see the sh command). The syntax is as follows:
|
|
|
|
|
|
|
|
while <test-cmd>; do <cmd-sequence>; done
|
|
|
|
|
|
|
|
Execute <cmd-sequence> as long as <test-cmd> has an exit status of
|
|
|
|
zero.
|
|
|
|
|
2014-01-18 17:20:22 +01:00
|
|
|
until <test-cmd>; do <cmd-sequence>; done
|
2014-01-17 22:56:32 +01:00
|
|
|
|
|
|
|
Execute <cmd-sequence> as long as <test-cmd> has a non-zero exit
|
|
|
|
status.
|
|
|
|
|
2014-01-18 17:20:22 +01:00
|
|
|
A break command is also supported. The break command is only meaningful
|
2014-01-18 16:39:16 +01:00
|
|
|
within the body of the a while or until loop, between the do and done
|
|
|
|
tokens. If the break command is executed within the body of a loop, the
|
|
|
|
loop will immediately terminate and execution will continue with the
|
|
|
|
next command immediately following the done token.
|
|
|
|
|
2011-03-18 20:46:25 +01:00
|
|
|
Built-In Variables
|
|
|
|
^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
$? - The result of the last simple command execution
|
|
|
|
|
|
|
|
Current Working Directory
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
All path arguments to commands may be either an absolute path or a
|
|
|
|
path relative to the current working directory. The current working
|
|
|
|
directory is set using the 'cd' command and can be queried either
|
|
|
|
by using the 'pwd' command or by using the 'echo $PWD' command.
|
|
|
|
|
|
|
|
Environment Variables:
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
PWD - The current working directory
|
|
|
|
OLDPWD - The previous working directory
|
|
|
|
|
|
|
|
NSH Start-Up Script
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
NSH supports options to provide a start up script for NSH. In general
|
2011-03-18 21:35:31 +01:00
|
|
|
this capability is enabled with CONFIG_NSH_ROMFSETC, but has
|
2011-03-18 20:46:25 +01:00
|
|
|
several other related configuration options as described in the final
|
|
|
|
section of this README. This capability also depends on:
|
|
|
|
|
|
|
|
- CONFIG_DISABLE_MOUNTPOINT not set
|
2012-08-04 00:04:14 +02:00
|
|
|
- CONFIG_NFILE_DESCRIPTORS > 4
|
2011-03-18 20:46:25 +01:00
|
|
|
- CONFIG_FS_ROMFS
|
|
|
|
|
|
|
|
Default Start-Up Behavior
|
|
|
|
-------------------------
|
|
|
|
|
|
|
|
The implementation that is provided is intended to provide great flexibility
|
|
|
|
for the use of Start-Up files. This paragraph will discuss the general
|
|
|
|
behavior when all of the configuration options are set to the default
|
|
|
|
values.
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
In this default case, enabling CONFIG_NSH_ROMFSETC will cause
|
2011-03-18 20:46:25 +01:00
|
|
|
NSH to behave as follows at NSH startup time:
|
|
|
|
|
|
|
|
- NSH will create a read-only RAM disk (a ROM disk), containing a tiny
|
2013-12-29 22:02:51 +01:00
|
|
|
ROMFS file system containing the following:
|
2011-03-18 20:46:25 +01:00
|
|
|
|
|
|
|
|--init.d/
|
|
|
|
`-- rcS
|
|
|
|
|
|
|
|
Where rcS is the NSH start-up script
|
|
|
|
|
2013-12-29 22:02:51 +01:00
|
|
|
- NSH will then mount the ROMFS file system at /etc, resulting in:
|
2011-03-18 20:46:25 +01:00
|
|
|
|
|
|
|
|--dev/
|
|
|
|
| `-- ram0
|
|
|
|
`--etc/
|
|
|
|
`--init.d/
|
|
|
|
`-- rcS
|
|
|
|
|
|
|
|
- By default, the contents of rcS script are:
|
|
|
|
|
2014-12-01 13:41:30 +01:00
|
|
|
# Create a RAMDISK and mount it at XXXRDMOUNTPOINTXXX
|
2011-03-18 20:46:25 +01:00
|
|
|
|
|
|
|
mkrd -m 1 -s 512 1024
|
|
|
|
mkfatfs /dev/ram1
|
|
|
|
mount -t vfat /dev/ram1 /tmp
|
|
|
|
|
|
|
|
- NSH will execute the script at /etc/init.d/rcS at start-up (before the
|
|
|
|
first NSH prompt. After execution of the script, the root FS will look
|
|
|
|
like:
|
|
|
|
|
|
|
|
|--dev/
|
|
|
|
| |-- ram0
|
|
|
|
| `-- ram1
|
|
|
|
|--etc/
|
|
|
|
| `--init.d/
|
|
|
|
| `-- rcS
|
|
|
|
`--tmp/
|
|
|
|
|
|
|
|
Modifying the ROMFS Image
|
|
|
|
-------------------------
|
|
|
|
|
|
|
|
The contents of the /etc directory are retained in the file
|
2011-03-18 21:35:31 +01:00
|
|
|
apps/nshlib/nsh_romfsimg.h (OR, if CONFIG_NSH_ARCHROMFS
|
2014-06-29 00:11:41 +02:00
|
|
|
is defined, include/arch/board/rcS.template). In order to modify
|
2011-03-18 20:46:25 +01:00
|
|
|
the start-up behavior, there are three things to study:
|
|
|
|
|
|
|
|
1. Configuration Options.
|
2011-03-18 21:35:31 +01:00
|
|
|
The additional CONFIG_NSH_ROMFSETC configuration options
|
2011-03-18 20:46:25 +01:00
|
|
|
discussed in the final section of this README.
|
|
|
|
|
|
|
|
2. tools/mkromfsimg.sh Script.
|
|
|
|
The script tools/mkromfsimg.sh creates nsh_romfsimg.h.
|
|
|
|
It is not automatically executed. If you want to change the
|
|
|
|
configuration settings associated with creating and mounting
|
|
|
|
the /tmp directory, then it will be necessary to re-generate
|
|
|
|
this header file using the mkromfsimg.sh script.
|
|
|
|
|
|
|
|
The behavior of this script depends upon three things:
|
|
|
|
|
|
|
|
- The configuration settings of the installed NuttX configuration.
|
|
|
|
- The genromfs tool (available from http://romfs.sourceforge.net).
|
|
|
|
- The file apps/nshlib/rcS.template (OR, if
|
2011-03-18 21:35:31 +01:00
|
|
|
CONFIG_NSH_ARCHROMFS is defined, include/arch/board/rcs.template)
|
2011-03-18 20:46:25 +01:00
|
|
|
|
|
|
|
3. rcS.template.
|
|
|
|
The file apps/nshlib/rcS.template contains the general form
|
|
|
|
of the rcS file; configured values are plugged into this
|
|
|
|
template file to produce the final rcS file.
|
|
|
|
|
|
|
|
NOTE:
|
|
|
|
|
|
|
|
apps/nshlib/rcS.template generates the standard, default
|
2011-03-18 21:35:31 +01:00
|
|
|
nsh_romfsimg.h file. If CONFIG_NSH_ARCHROMFS is defined
|
2011-03-18 20:46:25 +01:00
|
|
|
in the NuttX configuration file, then a custom, board-specific
|
|
|
|
nsh_romfsimg.h file residing in configs/<board>/include will be
|
|
|
|
used. NOTE when the OS is configured, include/arch/board will
|
|
|
|
be linked to configs/<board>/include.
|
|
|
|
|
|
|
|
All of the startup-behavior is contained in rcS.template. The
|
|
|
|
role of mkromfsimg.sh is to (1) apply the specific configuration
|
|
|
|
settings to rcS.template to create the final rcS, and (2) to
|
2013-12-29 22:02:51 +01:00
|
|
|
generate the header file nsh_romfsimg.h containing the ROMFS
|
2011-03-18 20:46:25 +01:00
|
|
|
file system image.
|
|
|
|
|
|
|
|
Simple Commands
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
o [ <expression> ]
|
|
|
|
o test <expression>
|
|
|
|
|
|
|
|
These are two alternative forms of the same command. They support
|
|
|
|
evaluation of a boolean expression which sets $?. This command
|
|
|
|
is used most frequently as the conditional command following the
|
|
|
|
'if' in the if-then[-else]-fi construct.
|
|
|
|
|
|
|
|
Expression Syntax:
|
|
|
|
------------------
|
|
|
|
|
|
|
|
expression = simple-expression | !expression |
|
|
|
|
expression -o expression | expression -a expression
|
|
|
|
|
|
|
|
simple-expression = unary-expression | binary-expression
|
|
|
|
|
|
|
|
unary-expression = string-unary | file-unary
|
|
|
|
|
|
|
|
string-unary = -n string | -z string
|
|
|
|
|
|
|
|
file-unary = -b file | -c file | -d file | -e file | -f file |
|
|
|
|
-r file | -s file | -w file
|
|
|
|
|
|
|
|
binary-expression = string-binary | numeric-binary
|
|
|
|
|
|
|
|
string-binary = string = string | string == string | string != string
|
|
|
|
|
|
|
|
numeric-binary = integer -eq integer | integer -ge integer |
|
|
|
|
integer -gt integer | integer -le integer |
|
|
|
|
integer -lt integer | integer -ne integer
|
|
|
|
|
2013-10-05 23:42:20 +02:00
|
|
|
o addroute <target> <netmask> <router>
|
|
|
|
|
|
|
|
This command adds an entry in the routing table. The new entry
|
|
|
|
will map the IP address of a router on a local network(<router>)
|
|
|
|
to an external network characterized by the <target> IP address and
|
|
|
|
a network mask <netmask>
|
|
|
|
|
2013-10-06 03:08:57 +02:00
|
|
|
Example:
|
|
|
|
|
|
|
|
nsh> addroute 1.1.1.1 2.2.2.2 3.3.3.3
|
|
|
|
|
2012-10-31 18:53:28 +01:00
|
|
|
o base64dec [-w] [-f] <string or filepath>
|
|
|
|
|
|
|
|
o base64dec [-w] [-f] <string or filepath>
|
|
|
|
|
2014-01-18 17:20:22 +01:00
|
|
|
o break
|
|
|
|
|
|
|
|
The break command is only meaningful within the body of the a while or
|
|
|
|
until loop, between the do and done tokens. Outside of a loop, break
|
|
|
|
command does nothing. If the break command is executed within the body
|
|
|
|
of a loop, the loop will immediately terminate and execution will
|
2014-02-21 01:14:02 +01:00
|
|
|
continue with the next command immediately following the done token.
|
2014-01-18 17:20:22 +01:00
|
|
|
|
2011-03-18 20:46:25 +01:00
|
|
|
o cat <path> [<path> [<path> ...]]
|
|
|
|
|
2013-12-29 22:02:51 +01:00
|
|
|
This command copies and concatenates all of the files at <path>
|
2011-03-18 20:46:25 +01:00
|
|
|
to the console (or to another file if the output is redirected).
|
|
|
|
|
|
|
|
o cd [<dir-path>|-|~|..]
|
|
|
|
|
|
|
|
Changes the current working directory (PWD). Also sets the
|
|
|
|
previous working directory environment variable (OLDPWD).
|
|
|
|
|
|
|
|
FORMS:
|
|
|
|
------
|
|
|
|
|
|
|
|
'cd <dir-path>' sets the current working directory to <dir-path>.
|
|
|
|
'cd -' sets the current working directory to the previous
|
|
|
|
working directory ($OLDPWD). Equivalent to 'cd $OLDPWD'.
|
|
|
|
'cd' or 'cd ~' set the current working directory to the 'home'
|
|
|
|
directory. The 'home' directory can be configured by setting
|
|
|
|
CONFIG_LIB_HOMEDIR in the configuration file. The default
|
|
|
|
'home' directory is '/'.
|
|
|
|
'cd ..' sets the current working directory to the parent directory.
|
|
|
|
|
2013-07-18 16:24:29 +02:00
|
|
|
o cmp <path1> <path2>
|
|
|
|
|
|
|
|
Compare of the contents of the file at <file1> with the contents of
|
|
|
|
the file at <path2>. Returns an indication only if the files differ.
|
|
|
|
|
2011-03-18 20:46:25 +01:00
|
|
|
o cp <source-path> <dest-path>
|
|
|
|
|
|
|
|
Copy of the contents of the file at <source-path> to the location
|
2013-12-29 22:02:51 +01:00
|
|
|
in the file system indicated by <path-path>
|
2011-03-18 20:46:25 +01:00
|
|
|
|
2011-09-01 19:56:03 +02:00
|
|
|
o date [-s "MMM DD HH:MM:SS YYYY"]
|
|
|
|
|
|
|
|
Show or set the current date and time. This command is only supported
|
|
|
|
if the platform supported RTC hardware (CONFIG_RTC=y).
|
|
|
|
|
|
|
|
Only one format is used both on display and when setting the date/time:
|
|
|
|
MMM DD HH:MM:SS YYYY. For example,
|
2013-06-02 01:25:16 +02:00
|
|
|
|
2011-09-01 19:56:03 +02:00
|
|
|
data -s "Sep 1 11:30:00 2011"
|
|
|
|
|
|
|
|
24-hour time format is assumed.
|
|
|
|
|
2011-03-18 20:46:25 +01:00
|
|
|
o dd if=<infile> of=<outfile> [bs=<sectsize>] [count=<sectors>] [skip=<sectors>]
|
|
|
|
|
|
|
|
Copy blocks from <infile> to <outfile>. <nfile> or <outfile> may
|
|
|
|
be the path to a standard file, a character device, or a block device.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
|
|
1. Read from character device, write to regular file. This will
|
|
|
|
create a new file of the specified size filled with zero.
|
|
|
|
|
|
|
|
nsh> dd if=/dev/zero of=/tmp/zeros bs=64 count=16
|
|
|
|
nsh> ls -l /tmp
|
|
|
|
/tmp:
|
|
|
|
-rw-rw-rw- 1024 ZEROS
|
|
|
|
|
|
|
|
2. Read from character device, write to block device. This will
|
|
|
|
fill the entire block device with zeros.
|
|
|
|
|
|
|
|
nsh> ls -l /dev
|
|
|
|
/dev:
|
|
|
|
brw-rw-rw- 0 ram0
|
|
|
|
crw-rw-rw- 0 zero
|
|
|
|
nsh> dd if=/dev/zero of=/dev/ram0
|
|
|
|
|
|
|
|
3. Read from a block devic, write to a character device. This
|
|
|
|
will read the entire block device and dump the contents in
|
|
|
|
the bit bucket.
|
|
|
|
|
|
|
|
nsh> ls -l /dev
|
|
|
|
/dev:
|
|
|
|
crw-rw-rw- 0 null
|
|
|
|
brw-rw-rw- 0 ram0
|
|
|
|
nsh> dd if=/dev/ram0 of=/dev/null
|
|
|
|
|
2013-10-06 03:08:57 +02:00
|
|
|
o delroute <target> <netmask>
|
2013-10-05 23:42:20 +02:00
|
|
|
|
|
|
|
This command removes an entry from the routing table. The entry
|
|
|
|
removed will be the first entry in the routing table that matches
|
|
|
|
the external network characterized by the <target> IP address and
|
|
|
|
the network mask <netmask>
|
|
|
|
|
2013-10-06 03:08:57 +02:00
|
|
|
Example:
|
|
|
|
|
|
|
|
nsh> delroute 1.1.1.1 2.2.2.2
|
|
|
|
|
2012-08-04 02:37:25 +02:00
|
|
|
o df
|
|
|
|
|
2012-08-05 00:00:18 +02:00
|
|
|
Show the state of each mounted volume.
|
2012-08-04 02:37:25 +02:00
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
nsh> mount
|
|
|
|
/etc type romfs
|
|
|
|
/tmp type vfat
|
|
|
|
nsh> df
|
|
|
|
Block Number
|
|
|
|
Size Blocks Used Available Mounted on
|
|
|
|
64 6 6 0 /etc
|
|
|
|
512 985 2 983 /tmp
|
2013-06-02 01:25:16 +02:00
|
|
|
nsh>
|
2012-08-04 02:37:25 +02:00
|
|
|
|
2011-03-18 20:46:25 +01:00
|
|
|
o echo [<string|$name> [<string|$name>...]]
|
|
|
|
|
|
|
|
Copy the sequence of strings and expanded environment variables to
|
|
|
|
console out (or to a file if the output is re-directed).
|
|
|
|
|
|
|
|
o exec <hex-address>
|
|
|
|
|
|
|
|
Execute the user logic at address <hex-address>. NSH will pause
|
|
|
|
until the execution unless the user logic is executed in background
|
|
|
|
via 'exec <hex-address> &'
|
|
|
|
|
|
|
|
o exit
|
|
|
|
|
|
|
|
Exit NSH. Only useful if you have started some other tasks (perhaps
|
|
|
|
using the 'exec' command') and you would like to have NSH out of the
|
|
|
|
way.
|
|
|
|
|
|
|
|
o free
|
|
|
|
|
|
|
|
Show the current state of the memory allocator. For example,
|
|
|
|
|
|
|
|
nsh> free
|
|
|
|
free
|
|
|
|
total used free largest
|
|
|
|
Mem: 4194288 1591552 2602736 2601584
|
|
|
|
|
|
|
|
Where:
|
|
|
|
total - This is the total size of memory allocated for use
|
|
|
|
by malloc in bytes.
|
|
|
|
used - This is the total size of memory occupied by
|
|
|
|
chunks handed out by malloc.
|
|
|
|
free - This is the total size of memory occupied by
|
|
|
|
free (not in use) chunks.
|
|
|
|
largest - Size of the largest free (not in use) chunk
|
|
|
|
|
|
|
|
o get [-b|-n] [-f <local-path>] -h <ip-address> <remote-path>
|
|
|
|
|
|
|
|
Use TFTP to copy the file at <remote-address> from the host whose IP
|
|
|
|
address is identified by <ip-address>. Other options:
|
|
|
|
|
|
|
|
-f <local-path>
|
|
|
|
The file will be saved relative to the current working directory
|
|
|
|
unless <local-path> is provided.
|
|
|
|
-b|-n
|
2013-12-29 22:02:51 +01:00
|
|
|
Selects either binary ("octet") or test ("netascii") transfer
|
2011-03-18 20:46:25 +01:00
|
|
|
mode. Default: text.
|
|
|
|
|
2012-08-05 00:17:37 +02:00
|
|
|
o help [-v] [<cmd>]
|
2011-03-18 20:46:25 +01:00
|
|
|
|
2012-08-05 00:17:37 +02:00
|
|
|
Presents summary information about NSH commands to console. Options:
|
|
|
|
|
|
|
|
-v
|
|
|
|
Show verbose output will full command usage
|
|
|
|
|
|
|
|
<cmd>
|
|
|
|
Show full command usage only for this command
|
2011-03-18 20:46:25 +01:00
|
|
|
|
2012-11-09 15:54:29 +01:00
|
|
|
o hexdump <file or device>
|
|
|
|
|
|
|
|
Dump data in hexadecimal format from a file or character device.
|
|
|
|
|
2012-11-27 17:26:54 +01:00
|
|
|
o ifconfig [nic_name [<ip-address>|dhcp]] [dr|gw|gateway <dr-address>] [netmask <net-mask>] [dns <dns-address>] [hw <hw-mac>]
|
2011-03-18 20:46:25 +01:00
|
|
|
|
|
|
|
Show the current configuration of the network, for example:
|
|
|
|
|
|
|
|
nsh> ifconfig
|
|
|
|
eth0 HWaddr 00:18:11:80:10:06
|
|
|
|
IPaddr:10.0.0.2 DRaddr:10.0.0.1 Mask:255.255.255.0
|
|
|
|
|
2014-07-01 01:52:59 +02:00
|
|
|
if networking statistics are enabled (CONFIG_NET_STATISTICS), then
|
|
|
|
this command will also show the detailed state of transfers by protocol.
|
2011-03-18 20:46:25 +01:00
|
|
|
|
2012-11-04 19:54:04 +01:00
|
|
|
o ifdown <nic-name>
|
|
|
|
|
|
|
|
Take down the interface identified by the name <nic-name>.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
ifdown eth0
|
|
|
|
|
|
|
|
o ifup <nic-name>
|
|
|
|
|
|
|
|
Bring up down the interface identified by the name <nic-name>.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
ifup eth0
|
|
|
|
|
2011-03-18 20:46:25 +01:00
|
|
|
o kill -<signal> <pid>
|
|
|
|
|
|
|
|
Send the <signal> to the task identified by <pid>.
|
|
|
|
|
|
|
|
o losetup [-d <dev-path>] | [[-o <offset>] [-r] <ldev-path> <file-path>]
|
|
|
|
|
|
|
|
Setup or teardown the loop device:
|
|
|
|
|
|
|
|
1. Teardown the setup for the loop device at <dev-path>:
|
|
|
|
|
|
|
|
losetup d <dev-path>
|
|
|
|
|
|
|
|
2. Setup the loop device at <dev-path> to access the file at <file-path>
|
|
|
|
as a block device:
|
|
|
|
|
|
|
|
losetup [-o <offset>] [-r] <dev-path> <file-path>
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
nsh> dd if=/dev/zero of=/tmp/image bs=512 count=512
|
|
|
|
nsh> ls -l /tmp
|
|
|
|
/tmp:
|
|
|
|
-rw-rw-rw- 262144 IMAGE
|
|
|
|
nsh> losetup /dev/loop0 /tmp/image
|
|
|
|
nsh> ls -l /dev
|
|
|
|
/dev:
|
|
|
|
brw-rw-rw- 0 loop0
|
|
|
|
nsh> mkfatfs /dev/loop0
|
|
|
|
nsh> mount -t vfat /dev/loop0 /mnt/example
|
|
|
|
nsh> ls -l /mnt
|
|
|
|
ls -l /mnt
|
|
|
|
/mnt:
|
|
|
|
drw-rw-rw- 0 example/
|
|
|
|
nsh> echo "This is a test" >/mnt/example/atest.txt
|
|
|
|
nsh> ls -l /mnt/example
|
|
|
|
/mnt/example:
|
|
|
|
-rw-rw-rw- 16 ATEST.TXT
|
|
|
|
nsh> cat /mnt/example/atest.txt
|
|
|
|
This is a test
|
|
|
|
nsh>
|
|
|
|
|
|
|
|
o ls [-lRs] <dir-path>
|
|
|
|
|
|
|
|
Show the contents of the directory at <dir-path>. NOTE:
|
2013-12-29 22:02:51 +01:00
|
|
|
<dir-path> must refer to a directory and no other file system
|
2011-03-18 20:46:25 +01:00
|
|
|
object.
|
|
|
|
|
|
|
|
Options:
|
|
|
|
--------
|
|
|
|
|
|
|
|
-R Show the constents of specified directory and all of its
|
|
|
|
sub-directories.
|
|
|
|
-s Show the size of the files along with the filenames in the
|
|
|
|
listing
|
|
|
|
-l Show size and mode information along with the filenames
|
|
|
|
in the listing.
|
|
|
|
|
2012-10-31 15:36:00 +01:00
|
|
|
o md5 [-f] <string or filepath>
|
|
|
|
|
2011-03-18 20:46:25 +01:00
|
|
|
o mb <hex-address>[=<hex-value>][ <hex-byte-count>]
|
|
|
|
o mh <hex-address>[=<hex-value>][ <hex-byte-count>]
|
|
|
|
o mw <hex-address>[=<hex-value>][ <hex-byte-count>]
|
|
|
|
|
|
|
|
Access memory using byte size access (mb), 16-bit accesses (mh),
|
|
|
|
or 32-bit access (mw). In each case,
|
|
|
|
|
|
|
|
<hex-address>. Specifies the address to be accessed. The current
|
|
|
|
value at that address will always be read and displayed.
|
|
|
|
<hex-address>=<hex-value>. Read the value, then write <hex-value>
|
|
|
|
to the location.
|
|
|
|
<hex-byte-count>. Perform the mb, mh, or mw operation on a total
|
|
|
|
of <hex-byte-count> bytes, increment the <hex-address> appropriately
|
|
|
|
after each access
|
|
|
|
|
|
|
|
Example
|
|
|
|
|
|
|
|
nsh> mh 0 16
|
|
|
|
0 = 0x0c1e
|
|
|
|
2 = 0x0100
|
|
|
|
4 = 0x0c1e
|
|
|
|
6 = 0x0110
|
|
|
|
8 = 0x0c1e
|
|
|
|
a = 0x0120
|
|
|
|
c = 0x0c1e
|
|
|
|
e = 0x0130
|
|
|
|
10 = 0x0c1e
|
|
|
|
12 = 0x0140
|
|
|
|
14 = 0x0c1e
|
|
|
|
nsh>
|
|
|
|
|
|
|
|
o mkdir <path>
|
|
|
|
|
|
|
|
Create the directory at <path>. All components of of <path>
|
|
|
|
except the final directory name must exist on a mounted file
|
|
|
|
system; the final directory must not.
|
|
|
|
|
2013-12-29 22:02:51 +01:00
|
|
|
Recall that NuttX uses a pseudo file system for its root file system.
|
2011-03-18 20:46:25 +01:00
|
|
|
The mkdir command can only be used to create directories in volumes
|
|
|
|
set up with the mount command; it cannot be used to create directories
|
2013-12-29 22:02:51 +01:00
|
|
|
in the pseudo file system.
|
2011-03-18 20:46:25 +01:00
|
|
|
|
|
|
|
Example:
|
|
|
|
^^^^^^^^
|
|
|
|
|
|
|
|
nsh> mkdir /mnt/fs/tmp
|
|
|
|
nsh> ls -l /mnt/fs
|
|
|
|
/mnt/fs:
|
|
|
|
drw-rw-rw- 0 TESTDIR/
|
|
|
|
drw-rw-rw- 0 TMP/
|
|
|
|
nsh>
|
|
|
|
|
2013-12-06 01:12:11 +01:00
|
|
|
o mkfatfs [-F <fatsize>] <block-driver>
|
|
|
|
|
|
|
|
Format a fat file system on the block device specified by <block-driver>
|
|
|
|
path. The FAT size may be provided as an option. Without the <fatsize>
|
|
|
|
option, mkfatfs will select either the FAT12 or FAT16 format. For
|
|
|
|
historical reasons, if you want the FAT32 format, it must be explicitly
|
|
|
|
specified on the command line.
|
2011-03-18 20:46:25 +01:00
|
|
|
|
|
|
|
NSH provides this command to access the mkfatfs() NuttX API.
|
2013-12-29 22:02:51 +01:00
|
|
|
This block device must reside in the NuttX pseudo file system and
|
2011-03-18 20:46:25 +01:00
|
|
|
must have been created by some call to register_blockdriver() (see
|
2012-03-21 19:01:07 +01:00
|
|
|
include/nuttx/fs/fs.h).
|
2011-03-18 20:46:25 +01:00
|
|
|
|
|
|
|
o mkfifo <path>
|
|
|
|
|
|
|
|
Creates a FIFO character device anywhere in the pseudo file system,
|
2012-08-05 19:44:11 +02:00
|
|
|
creating whatever pseudo directories that may be needed to complete
|
2011-03-18 20:46:25 +01:00
|
|
|
the full path. By convention, however, device drivers are place in
|
|
|
|
the standard /dev directory. After it is created, the FIFO device
|
|
|
|
may be used as any other device driver. NSH provides this command
|
|
|
|
to access the mkfifo() NuttX API.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
^^^^^^^^
|
|
|
|
|
|
|
|
nsh> ls -l /dev
|
|
|
|
/dev:
|
|
|
|
crw-rw-rw- 0 console
|
|
|
|
crw-rw-rw- 0 null
|
|
|
|
brw-rw-rw- 0 ram0
|
|
|
|
nsh> mkfifo /dev/fifo
|
|
|
|
nsh> ls -l /dev
|
|
|
|
ls -l /dev
|
|
|
|
/dev:
|
|
|
|
crw-rw-rw- 0 console
|
|
|
|
crw-rw-rw- 0 fifo
|
|
|
|
crw-rw-rw- 0 null
|
|
|
|
brw-rw-rw- 0 ram0
|
|
|
|
nsh>
|
|
|
|
|
|
|
|
o mkrd [-m <minor>] [-s <sector-size>] <nsectors>
|
|
|
|
|
|
|
|
Create a ramdisk consisting of <nsectors>, each of size
|
|
|
|
<sector-size> (or 512 bytes if <sector-size> is not specified.
|
|
|
|
The ramdisk will be registered as /dev/ram<n> (if <n> is not
|
|
|
|
specified, mkrd will attempt to register the ramdisk as
|
|
|
|
/dev/ram0.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
^^^^^^^^
|
|
|
|
|
|
|
|
nsh> ls /dev
|
|
|
|
/dev:
|
|
|
|
console
|
|
|
|
null
|
|
|
|
ttyS0
|
|
|
|
ttyS1
|
|
|
|
nsh> mkrd 1024
|
|
|
|
nsh> ls /dev
|
|
|
|
/dev:
|
|
|
|
console
|
|
|
|
null
|
|
|
|
ram0
|
|
|
|
ttyS0
|
|
|
|
ttyS1
|
|
|
|
nsh>
|
|
|
|
|
|
|
|
Once the ramdisk has been created, it may be formatted using
|
|
|
|
the mkfatfs command and mounted using the mount command.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
^^^^^^^^
|
|
|
|
nsh> mkrd 1024
|
|
|
|
nsh> mkfatfs /dev/ram0
|
|
|
|
nsh> mount -t vfat /dev/ram0 /tmp
|
|
|
|
nsh> ls /tmp
|
|
|
|
/tmp:
|
|
|
|
nsh>
|
|
|
|
|
2012-08-04 01:47:32 +02:00
|
|
|
o mount [-t <fstype> <block-device> <dir-path>]
|
2011-03-18 20:46:25 +01:00
|
|
|
|
2012-08-04 01:47:32 +02:00
|
|
|
The mount command performs one of two different operations. If no
|
2014-07-07 23:54:37 +02:00
|
|
|
parameters are provided on the command line after the mount command,
|
2012-08-04 01:47:32 +02:00
|
|
|
then the 'mount' command will enumerate all of the current
|
|
|
|
mountpoints on the console.
|
|
|
|
|
|
|
|
If the mount parameters are provied on the command after the 'mount'
|
|
|
|
command, then the 'mount' command will mount a file system in the
|
2012-08-05 19:44:11 +02:00
|
|
|
NuttX pseudo-file system. 'mount' performs a three way association,
|
2012-08-04 01:47:32 +02:00
|
|
|
binding:
|
2011-03-18 20:46:25 +01:00
|
|
|
|
|
|
|
File system. The '-t <fstype>' option identifies the type of
|
|
|
|
file system that has been formatted on the <block-device>. As
|
|
|
|
of this writing, vfat is the only supported value for <fstype>
|
|
|
|
|
|
|
|
Block Device. The <block-device> argument is the full or relative
|
2013-12-29 22:02:51 +01:00
|
|
|
path to a block driver inode in the pseudo file system. By convention,
|
2011-03-18 20:46:25 +01:00
|
|
|
this is a name under the /dev sub-directory. This <block-device>
|
|
|
|
must have been previously formatted with the same file system
|
|
|
|
type as specified by <fstype>
|
|
|
|
|
2012-08-05 19:44:11 +02:00
|
|
|
Mount Point. The mount point is the location in the pseudo file
|
2011-03-18 20:46:25 +01:00
|
|
|
system where the mounted volume will appear. This mount point
|
2013-12-29 22:02:51 +01:00
|
|
|
can only reside in the NuttX pseudo file system. By convention, this
|
2011-03-18 20:46:25 +01:00
|
|
|
mount point is a subdirectory under /mnt. The mount command will
|
2012-08-05 19:44:11 +02:00
|
|
|
create whatever pseudo directories that may be needed to complete
|
2011-03-18 20:46:25 +01:00
|
|
|
the full path but the full path must not already exist.
|
|
|
|
|
2012-08-05 19:44:11 +02:00
|
|
|
After the volume has been mounted in the NuttX pseudo file
|
2011-03-18 20:46:25 +01:00
|
|
|
system, it may be access in the same way as other objects in the
|
|
|
|
file system.
|
|
|
|
|
2012-08-04 01:47:32 +02:00
|
|
|
Examples:
|
|
|
|
^^^^^^^^^
|
2011-03-18 20:46:25 +01:00
|
|
|
|
|
|
|
nsh> ls -l /dev
|
|
|
|
/dev:
|
|
|
|
crw-rw-rw- 0 console
|
|
|
|
crw-rw-rw- 0 null
|
|
|
|
brw-rw-rw- 0 ram0
|
|
|
|
nsh> ls /mnt
|
|
|
|
nsh: ls: no such directory: /mnt
|
|
|
|
nsh> mount -t vfat /dev/ram0 /mnt/fs
|
|
|
|
nsh> ls -l /mnt/fs/testdir
|
|
|
|
/mnt/fs/testdir:
|
|
|
|
-rw-rw-rw- 15 TESTFILE.TXT
|
|
|
|
nsh> echo "This is a test" >/mnt/fs/testdir/example.txt
|
|
|
|
nsh> ls -l /mnt/fs/testdir
|
|
|
|
/mnt/fs/testdir:
|
|
|
|
-rw-rw-rw- 15 TESTFILE.TXT
|
|
|
|
-rw-rw-rw- 16 EXAMPLE.TXT
|
|
|
|
nsh> cat /mnt/fs/testdir/example.txt
|
|
|
|
This is a test
|
|
|
|
nsh>
|
|
|
|
|
2012-08-04 01:47:32 +02:00
|
|
|
nsh> mount
|
|
|
|
/etc type romfs
|
|
|
|
/tmp type vfat
|
|
|
|
/mnt/fs type vfat
|
|
|
|
|
2012-06-12 01:47:31 +02:00
|
|
|
o mv <old-path> <new-path>
|
|
|
|
|
|
|
|
Rename the file object at <old-path> to <new-path>. Both paths must
|
2013-12-29 22:02:51 +01:00
|
|
|
reside in the same mounted file system.
|
2012-06-12 01:47:31 +02:00
|
|
|
|
2012-06-15 18:23:17 +02:00
|
|
|
o nfsmount <server-address> <mount-point> <remote-path>
|
|
|
|
|
|
|
|
Mount the remote NFS server directory <remote-path> at <mount-point> on the target machine.
|
|
|
|
<server-address> is the IP address of the remote server.
|
|
|
|
|
2011-03-18 20:46:25 +01:00
|
|
|
o ps
|
|
|
|
|
|
|
|
Show the currently active threads and tasks. For example,
|
|
|
|
|
|
|
|
nsh> ps
|
|
|
|
PID PRI SCHD TYPE NP STATE NAME
|
|
|
|
0 0 FIFO TASK READY Idle Task()
|
|
|
|
1 128 RR TASK RUNNING init()
|
|
|
|
2 128 FIFO TASK WAITSEM nsh_telnetmain()
|
|
|
|
3 100 RR PTHREAD WAITSEM <pthread>(21)
|
|
|
|
nsh>
|
|
|
|
|
|
|
|
o ping [-c <count>] [-i <interval>] <ip-address>
|
|
|
|
|
|
|
|
Test the network communication with a remote peer. Example,
|
|
|
|
|
|
|
|
nsh> 10.0.0.1
|
|
|
|
PING 10.0.0.1 56 bytes of data
|
|
|
|
56 bytes from 10.0.0.1: icmp_seq=1 time=0 ms
|
|
|
|
56 bytes from 10.0.0.1: icmp_seq=2 time=0 ms
|
|
|
|
56 bytes from 10.0.0.1: icmp_seq=3 time=0 ms
|
|
|
|
56 bytes from 10.0.0.1: icmp_seq=4 time=0 ms
|
|
|
|
56 bytes from 10.0.0.1: icmp_seq=5 time=0 ms
|
|
|
|
56 bytes from 10.0.0.1: icmp_seq=6 time=0 ms
|
|
|
|
56 bytes from 10.0.0.1: icmp_seq=7 time=0 ms
|
|
|
|
56 bytes from 10.0.0.1: icmp_seq=8 time=0 ms
|
|
|
|
56 bytes from 10.0.0.1: icmp_seq=9 time=0 ms
|
|
|
|
56 bytes from 10.0.0.1: icmp_seq=10 time=0 ms
|
|
|
|
10 packets transmitted, 10 received, 0% packet loss, time 10190 ms
|
|
|
|
nsh>
|
|
|
|
|
|
|
|
o put [-b|-n] [-f <remote-path>] -h <ip-address> <local-path>
|
|
|
|
|
|
|
|
Copy the file at <local-address> to the host whose IP address is
|
|
|
|
identified by <ip-address>. Other options:
|
|
|
|
|
|
|
|
-f <remote-path>
|
|
|
|
The file will be saved with the same name on the host unless
|
|
|
|
unless <local-path> is provided.
|
|
|
|
-b|-n
|
2013-12-29 22:02:51 +01:00
|
|
|
Selects either binary ("octet") or test ("netascii") transfer
|
2011-03-18 20:46:25 +01:00
|
|
|
mode. Default: text.
|
|
|
|
|
|
|
|
o pwd
|
|
|
|
|
|
|
|
Show the current working directory.
|
|
|
|
|
|
|
|
nsh> cd /dev
|
|
|
|
nsh> pwd
|
|
|
|
/dev
|
|
|
|
nsh>
|
|
|
|
|
|
|
|
Same as 'echo $PWD'
|
|
|
|
|
|
|
|
nsh> echo $PWD
|
|
|
|
/dev
|
|
|
|
nsh>
|
|
|
|
|
|
|
|
o rm <file-path>
|
|
|
|
|
|
|
|
Remove the specified <file-path> name from the mounted file system.
|
2013-12-29 22:02:51 +01:00
|
|
|
Recall that NuttX uses a pseudo file system for its root file system.
|
2011-03-18 20:46:25 +01:00
|
|
|
The rm command can only be used to remove (unlink) files in volumes
|
|
|
|
set up with the mount command; it cannot be used to remove names from
|
2013-12-29 22:02:51 +01:00
|
|
|
the pseudo file system.
|
2011-03-18 20:46:25 +01:00
|
|
|
|
|
|
|
Example:
|
|
|
|
^^^^^^^^
|
|
|
|
|
|
|
|
nsh> ls /mnt/fs/testdir
|
|
|
|
/mnt/fs/testdir:
|
|
|
|
TESTFILE.TXT
|
|
|
|
EXAMPLE.TXT
|
|
|
|
nsh> rm /mnt/fs/testdir/example.txt
|
|
|
|
nsh> ls /mnt/fs/testdir
|
|
|
|
/mnt/fs/testdir:
|
|
|
|
TESTFILE.TXT
|
|
|
|
nsh>
|
|
|
|
|
|
|
|
o rmdir <dir-path>
|
|
|
|
|
|
|
|
Remove the specified <dir-path> directory from the mounted file system.
|
2013-12-29 22:02:51 +01:00
|
|
|
Recall that NuttX uses a pseudo file system for its root file system. The
|
2011-03-18 20:46:25 +01:00
|
|
|
rmdir command can only be used to remove directories from volumes set up
|
|
|
|
with the mount command; it cannot be used to remove directories from the
|
2013-12-29 22:02:51 +01:00
|
|
|
pseudo file system.
|
2011-03-18 20:46:25 +01:00
|
|
|
|
|
|
|
Example:
|
|
|
|
^^^^^^^^
|
|
|
|
|
|
|
|
nsh> mkdir /mnt/fs/tmp
|
|
|
|
nsh> ls -l /mnt/fs
|
|
|
|
/mnt/fs:
|
|
|
|
drw-rw-rw- 0 TESTDIR/
|
|
|
|
drw-rw-rw- 0 TMP/
|
|
|
|
nsh> rmdir /mnt/fs/tmp
|
|
|
|
nsh> ls -l /mnt/fs
|
|
|
|
ls -l /mnt/fs
|
|
|
|
/mnt/fs:
|
|
|
|
drw-rw-rw- 0 TESTDIR/
|
|
|
|
nsh>
|
|
|
|
|
|
|
|
o set <name> <value>
|
|
|
|
|
|
|
|
Set the environment variable <name> to the sting <value>.
|
|
|
|
For example,
|
|
|
|
|
|
|
|
nsh> echo $foobar
|
|
|
|
|
|
|
|
nsh> set foobar foovalue
|
|
|
|
nsh> echo $foobar
|
|
|
|
foovalue
|
|
|
|
nsh>
|
|
|
|
|
|
|
|
o sh <script-path>
|
|
|
|
|
|
|
|
Execute the sequence of NSH commands in the file referred
|
|
|
|
to by <script-path>.
|
|
|
|
|
|
|
|
o sleep <sec>
|
|
|
|
|
|
|
|
Pause execution (sleep) of <sec> seconds.
|
|
|
|
|
|
|
|
o unset <name>
|
|
|
|
|
|
|
|
Remove the value associated with the environment variable
|
|
|
|
<name>. Example:
|
|
|
|
|
|
|
|
nsh> echo $foobar
|
|
|
|
foovalue
|
|
|
|
nsh> unset foobar
|
|
|
|
nsh> echo $foobar
|
|
|
|
|
|
|
|
nsh>
|
|
|
|
|
2012-10-31 15:36:00 +01:00
|
|
|
o urldecode [-f] <string or filepath>
|
2013-06-02 01:25:16 +02:00
|
|
|
|
2012-10-31 15:36:00 +01:00
|
|
|
o urlencode [-f] <string or filepath>
|
|
|
|
|
2011-03-18 20:46:25 +01:00
|
|
|
o usleep <usec>
|
|
|
|
|
|
|
|
Pause execution (sleep) of <usec> microseconds.
|
|
|
|
|
|
|
|
o wget [-o <local-path>] <url>
|
|
|
|
|
|
|
|
Use HTTP to copy the file at <url> to the current directory.
|
|
|
|
Options:
|
|
|
|
|
|
|
|
-o <local-path>
|
|
|
|
The file will be saved relative to the current working directory
|
|
|
|
and with the same name as on the HTTP server unless <local-path>
|
|
|
|
is provided.
|
|
|
|
|
|
|
|
o xd <hex-address> <byte-count>
|
|
|
|
|
|
|
|
Dump <byte-count> bytes of data from address <hex-address>
|
|
|
|
|
|
|
|
Example:
|
|
|
|
^^^^^^^^
|
|
|
|
|
|
|
|
nsh> xd 410e0 512
|
|
|
|
Hex dump:
|
|
|
|
0000: 00 00 00 00 9c 9d 03 00 00 00 00 01 11 01 10 06 ................
|
|
|
|
0010: 12 01 11 01 25 08 13 0b 03 08 1b 08 00 00 02 24 ....%..........$
|
|
|
|
...
|
|
|
|
01f0: 08 3a 0b 3b 0b 49 13 00 00 04 13 01 01 13 03 08 .:.;.I..........
|
|
|
|
nsh>
|
|
|
|
|
|
|
|
NSH Configuration Settings
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
The availability of the above commands depends upon features that
|
2013-06-02 01:25:16 +02:00
|
|
|
may or may not be enabled in the NuttX configuration file. The
|
2011-03-18 20:46:25 +01:00
|
|
|
following table indicates the dependency of each command on NuttX
|
|
|
|
configuration settings. General configuration settings are discussed
|
|
|
|
in the NuttX Porting Guide. Configuration settings specific to NSH
|
|
|
|
as discussed at the bottom of this README file.
|
|
|
|
|
|
|
|
Command Dependencies on Configuration Settings
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Command Depends on Configuration
|
|
|
|
---------- --------------------------
|
2011-03-18 21:35:31 +01:00
|
|
|
[ !CONFIG_NSH_DISABLESCRIPT
|
2013-10-05 23:42:20 +02:00
|
|
|
addroute CONFIG_NET && CONFIG_NET_ROUTE
|
2012-10-31 15:36:00 +01:00
|
|
|
base64dec CONFIG_NETUTILS_CODECS && CONFIG_CODECS_BASE64
|
|
|
|
base64enc CONFIG_NETUTILS_CODECS && CONFIG_CODECS_BASE64
|
2014-01-18 17:26:12 +01:00
|
|
|
break !CONFIG_NSH_DISABLESCRIPT && !CONFIG_NSH_DISABLE_LOOPS
|
2011-03-18 20:46:25 +01:00
|
|
|
cat CONFIG_NFILE_DESCRIPTORS > 0
|
|
|
|
cd !CONFIG_DISABLE_ENVIRON && CONFIG_NFILE_DESCRIPTORS > 0
|
|
|
|
cp CONFIG_NFILE_DESCRIPTORS > 0
|
|
|
|
dd CONFIG_NFILE_DESCRIPTORS > 0
|
2014-02-21 01:14:02 +01:00
|
|
|
delrout CONFIG_NET && CONFIG_NET_ROUTE
|
2012-08-04 02:37:25 +02:00
|
|
|
df !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_READABLE (see note 3)
|
2011-03-18 20:46:25 +01:00
|
|
|
echo --
|
|
|
|
exec --
|
|
|
|
exit --
|
|
|
|
free --
|
2014-11-16 15:50:36 +01:00
|
|
|
get CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 && MTU >= 558 (see note 1)
|
2011-03-18 20:46:25 +01:00
|
|
|
help --
|
2012-11-09 15:54:29 +01:00
|
|
|
hexdump CONFIG_NFILE_DESCRIPTORS > 0
|
2011-03-18 20:46:25 +01:00
|
|
|
ifconfig CONFIG_NET
|
2012-11-04 19:54:04 +01:00
|
|
|
ifdown CONFIG_NET
|
|
|
|
ifup CONFIG_NET
|
2011-03-18 20:46:25 +01:00
|
|
|
kill !CONFIG_DISABLE_SIGNALS
|
|
|
|
losetup !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0
|
|
|
|
ls CONFIG_NFILE_DESCRIPTORS > 0
|
2012-10-31 15:36:00 +01:00
|
|
|
md5 CONFIG_NETUTILS_CODECS && CONFIG_CODECS_HASH_MD5
|
2011-03-18 20:46:25 +01:00
|
|
|
mb,mh,mw ---
|
2014-02-21 01:14:02 +01:00
|
|
|
mkdir (((!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS) && CONFIG_NFILE_DESCRIPTORS > 0)
|
2011-03-18 20:46:25 +01:00
|
|
|
mkfatfs !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_FAT
|
|
|
|
mkfifo CONFIG_NFILE_DESCRIPTORS > 0
|
|
|
|
mkrd !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE (see note 4)
|
|
|
|
mount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_READABLE (see note 3)
|
2014-02-21 01:14:02 +01:00
|
|
|
mv (((!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS) && CONFIG_NFILE_DESCRIPTORS > 0) (see note 4)
|
2012-06-15 18:23:17 +02:00
|
|
|
nfsmount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NET && CONFIG_NFS
|
2014-08-07 20:35:24 +02:00
|
|
|
ping CONFIG_NET && CONFIG_NET_ICMP && CONFIG_NET_ICMP_PING && !CONFIG_DISABLE_SIGNALS
|
2011-03-18 20:46:25 +01:00
|
|
|
ps --
|
2014-11-16 15:50:36 +01:00
|
|
|
put CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 && MTU >= 558 (see note 1,2)
|
2011-03-18 20:46:25 +01:00
|
|
|
pwd !CONFIG_DISABLE_ENVIRON && CONFIG_NFILE_DESCRIPTORS > 0
|
2014-02-21 01:14:02 +01:00
|
|
|
rm (((!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS) && CONFIG_NFILE_DESCRIPTORS > 0)
|
|
|
|
rmdir (((!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS) && CONFIG_NFILE_DESCRIPTORS > 0)
|
2011-03-18 20:46:25 +01:00
|
|
|
set !CONFIG_DISABLE_ENVIRON
|
2011-03-18 21:35:31 +01:00
|
|
|
sh CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !CONFIG_NSH_DISABLESCRIPT
|
2011-03-18 20:46:25 +01:00
|
|
|
sleep !CONFIG_DISABLE_SIGNALS
|
2011-03-18 21:35:31 +01:00
|
|
|
test !CONFIG_NSH_DISABLESCRIPT
|
2011-03-18 20:46:25 +01:00
|
|
|
umount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_READABLE
|
|
|
|
unset !CONFIG_DISABLE_ENVIRON
|
2012-10-31 18:53:28 +01:00
|
|
|
urldecode CONFIG_NETUTILS_CODECS && CONFIG_CODECS_URLCODE
|
|
|
|
urlencode CONFIG_NETUTILS_CODECS && CONFIG_CODECS_URLCODE
|
2011-03-18 20:46:25 +01:00
|
|
|
usleep !CONFIG_DISABLE_SIGNALS
|
|
|
|
get CONFIG_NET && CONFIG_NET_TCP && CONFIG_NFILE_DESCRIPTORS > 0
|
|
|
|
xd ---
|
|
|
|
|
|
|
|
* NOTES:
|
2014-11-16 15:50:36 +01:00
|
|
|
1. Because of hardware padding, the actual MTU required for put and get
|
2011-03-18 20:46:25 +01:00
|
|
|
operations size may be larger.
|
2013-12-29 22:02:51 +01:00
|
|
|
2. Special TFTP server start-up options will probably be required to permit
|
2011-03-18 20:46:25 +01:00
|
|
|
creation of file for the correct operation of the put command.
|
|
|
|
3. CONFIG_FS_READABLE is not a user configuration but is set automatically
|
2013-12-29 22:02:51 +01:00
|
|
|
if any readable file system is selected. At present, this is either CONFIG_FS_FAT
|
2011-03-18 20:46:25 +01:00
|
|
|
and CONFIG_FS_ROMFS.
|
|
|
|
4. CONFIG_FS_WRITABLE is not a user configuration but is set automatically
|
2013-12-29 22:02:51 +01:00
|
|
|
if any writeable file system is selected. At present, this is only CONFIG_FS_FAT.
|
2011-03-18 20:46:25 +01:00
|
|
|
|
|
|
|
In addition, each NSH command can be individually disabled via one of the following
|
|
|
|
settings. All of these settings make the configuration of NSH potentially complex but
|
|
|
|
also allow it to squeeze into very small memory footprints.
|
|
|
|
|
2013-10-05 23:42:20 +02:00
|
|
|
CONFIG_NSH_DISABLE_ADDROUTE, CONFIG_NSH_DISABLE_BASE64DEC, CONFIG_NSH_DISABLE_BASE64ENC,
|
|
|
|
CONFIG_NSH_DISABLE_CAT, CONFIG_NSH_DISABLE_CD, CONFIG_NSH_DISABLE_CP,
|
|
|
|
CONFIG_NSH_DISABLE_DD, CONFIG_NSH_DISABLE_DELROUTE, CONFIG_NSH_DISABLE_DF,
|
|
|
|
CONFIG_NSH_DISABLE_ECHO, CONFIG_NSH_DISABLE_EXEC, CONFIG_NSH_DISABLE_EXIT,
|
|
|
|
CONFIG_NSH_DISABLE_FREE, CONFIG_NSH_DISABLE_GET, CONFIG_NSH_DISABLE_HELP,
|
|
|
|
CONFIG_NSH_DISABLE_HEXDUMP, CONFIG_NSH_DISABLE_IFCONFIG, CONFIG_NSH_DISABLE_IFUPDOWN,
|
|
|
|
CONFIG_NSH_DISABLE_KILL, CONFIG_NSH_DISABLE_LOSETUP, CONFIG_NSH_DISABLE_LS,
|
|
|
|
CONFIG_NSH_DISABLE_MD5 CONFIG_NSH_DISABLE_MB, CONFIG_NSH_DISABLE_MKDIR,
|
|
|
|
CONFIG_NSH_DISABLE_MKFATFS, CONFIG_NSH_DISABLE_MKFIFO, CONFIG_NSH_DISABLE_MKRD,
|
|
|
|
CONFIG_NSH_DISABLE_MH, CONFIG_NSH_DISABLE_MOUNT, CONFIG_NSH_DISABLE_MW,
|
|
|
|
CONFIG_NSH_DISABLE_MV, CONFIG_NSH_DISABLE_NFSMOUNT, CONFIG_NSH_DISABLE_PS,
|
|
|
|
CONFIG_NSH_DISABLE_PING, CONFIG_NSH_DISABLE_PUT, CONFIG_NSH_DISABLE_PWD,
|
|
|
|
CONFIG_NSH_DISABLE_RM, CONFIG_NSH_DISABLE_RMDIR, CONFIG_NSH_DISABLE_SET,
|
|
|
|
CONFIG_NSH_DISABLE_SH, CONFIG_NSH_DISABLE_SLEEP, CONFIG_NSH_DISABLE_TEST,
|
|
|
|
CONFIG_NSH_DISABLE_UMOUNT, CONFIG_NSH_DISABLE_UNSET, CONFIG_NSH_DISABLE_URLDECODE,
|
|
|
|
CONFIG_NSH_DISABLE_URLENCODE, CONFIG_NSH_DISABLE_USLEEP, CONFIG_NSH_DISABLE_WGET,
|
|
|
|
CONFIG_NSH_DISABLE_XD
|
2011-03-18 20:46:25 +01:00
|
|
|
|
2012-08-05 00:17:37 +02:00
|
|
|
Verbose help output can be suppressed by defining CONFIG_NSH_HELP_TERSE. In that
|
|
|
|
case, the help command is still available but will be slightly smaller.
|
|
|
|
|
2011-03-18 20:46:25 +01:00
|
|
|
NSH-Specific Configuration Settings
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
The behavior of NSH can be modified with the following settings in
|
|
|
|
the configs/<board-name>/defconfig file:
|
|
|
|
|
2014-02-03 17:56:52 +01:00
|
|
|
* CONFIG_NSH_READLINE
|
|
|
|
Selects the minimal implementation of readline(). This minimal
|
|
|
|
implementation provides on backspace for command line editing.
|
|
|
|
|
|
|
|
* CONFIG_NSH_CLE
|
|
|
|
Selects the more extensive, EMACS-like command line editor.
|
|
|
|
Select this option only if (1) you don't mind a modest increase
|
|
|
|
in the FLASH footprint, and (2) you work with a terminal that
|
|
|
|
support VT100 editing commands.
|
|
|
|
|
|
|
|
Selecting this option will add probably 1.5-2KB to the FLASH
|
|
|
|
footprint.
|
|
|
|
|
2011-07-16 17:52:15 +02:00
|
|
|
* CONFIG_NSH_BUILTIN_APPS
|
2012-12-23 21:22:41 +01:00
|
|
|
Support external registered, "builtin" applications that can be
|
2011-07-16 17:52:15 +02:00
|
|
|
executed from the NSH command line (see apps/README.txt for
|
|
|
|
more information).
|
2013-06-02 01:25:16 +02:00
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_FILEIOSIZE
|
2011-03-18 20:46:25 +01:00
|
|
|
Size of a static I/O buffer used for file access (ignored if
|
2013-12-29 22:02:51 +01:00
|
|
|
there is no file system). Default is 1024.
|
2011-03-18 20:46:25 +01:00
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_STRERROR
|
2011-03-18 20:46:25 +01:00
|
|
|
strerror(errno) makes more readable output but strerror() is
|
2012-08-28 21:01:14 +02:00
|
|
|
very large and will not be used unless this setting is 'y'.
|
|
|
|
This setting depends upon the strerror() having been enabled
|
|
|
|
with CONFIG_LIBC_STRERROR.
|
2011-03-18 20:46:25 +01:00
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_LINELEN
|
2011-03-18 20:46:25 +01:00
|
|
|
The maximum length of one command line and of one output line.
|
|
|
|
Default: 80
|
|
|
|
|
2014-01-10 22:23:26 +01:00
|
|
|
* CONFIG_NSH_DISABLE_SEMICOLON
|
|
|
|
By default, you can enter multiple NSH commands on a line with
|
|
|
|
each command separated by a semicolon. You can disable this
|
|
|
|
feature to save a little memory on FLASH challenged platforms.
|
|
|
|
Default: n
|
|
|
|
|
2014-01-11 16:50:54 +01:00
|
|
|
* CONFIG_NSH_CMDPARMS
|
|
|
|
If selected, then the output from commands, from file applications, and
|
|
|
|
from NSH built-in commands can be used as arguments to other
|
|
|
|
commands. The entity to be executed is identified by enclosing the
|
|
|
|
command line in back quotes. For example,
|
|
|
|
|
|
|
|
set FOO `myprogram $BAR`
|
|
|
|
|
|
|
|
Will execute the program named myprogram passing it the value of the
|
|
|
|
environment variable BAR. The value of the environment variable FOO
|
|
|
|
is then set output of myprogram on stdout. Because this feature commits
|
|
|
|
significant resources, it is disabled by default.
|
|
|
|
|
|
|
|
* CONFIG_NSH_TMPDIR
|
|
|
|
If CONFIG_NSH_CMDPARMS is selected, then function output will be retained
|
|
|
|
in a temporary file. In that case, this string must be provided to
|
|
|
|
specify the full path to a directory where temporary files can be
|
|
|
|
created. This would be a good application of RAM disk: To provide
|
|
|
|
temporary storage for function output.
|
|
|
|
|
|
|
|
* CONFIG_NSH_MAXARGUMENTS
|
|
|
|
The maximum number of NSH command arguments. Default: 6
|
|
|
|
|
|
|
|
* CONFIG_NSH_ARGCAT
|
|
|
|
Support concatenation of strings with environment variables or command
|
|
|
|
output. For example:
|
|
|
|
|
|
|
|
set FOO XYZ
|
|
|
|
set BAR 123
|
|
|
|
set FOOBAR ABC_${FOO}_${BAR}
|
|
|
|
|
|
|
|
would set the environment variable FOO to XYZ, BAR to 123 and FOOBAR
|
|
|
|
to ABC_XYZ_123. If NSH_ARGCAT is not selected, then a slightly small
|
|
|
|
FLASH footprint results but then also only simple environment
|
|
|
|
variables like $FOO can be used on the command line.
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_NESTDEPTH
|
2011-03-18 20:46:25 +01:00
|
|
|
The maximum number of nested if-then[-else]-fi sequences that
|
|
|
|
are permissable. Default: 3
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_DISABLESCRIPT
|
2011-03-18 20:46:25 +01:00
|
|
|
This can be set to 'y' to suppress support for scripting. This
|
|
|
|
setting disables the 'sh', 'test', and '[' commands and the
|
|
|
|
if-then[-else]-fi construct. This would only be set on systems
|
|
|
|
where a minimal footprint is a necessity and scripting is not.
|
|
|
|
|
2014-01-18 16:39:16 +01:00
|
|
|
* CONFIG_NSH_DISABLE_ITEF
|
|
|
|
|
|
|
|
If scripting is enabled, then then this option can be selected to
|
|
|
|
suppress support for if-then-else-fi sequences in scripts. This would
|
|
|
|
only be set on systems where some minimal scripting is required but
|
|
|
|
if-then-else-fi is not.
|
|
|
|
|
|
|
|
* CONFIG_NSH_DISABLE_LOOPS
|
|
|
|
|
|
|
|
If scripting is enabled, then then this option can be selected
|
|
|
|
suppress support for while-do-done and until-do-done sequences in
|
|
|
|
scripts. This would only be set on systems where some minimal
|
|
|
|
scripting is required but looping is not.
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_DISABLEBG
|
2011-03-18 20:46:25 +01:00
|
|
|
This can be set to 'y' to suppress support for background
|
|
|
|
commands. This setting disables the 'nice' command prefix and
|
|
|
|
the '&' command suffix. This would only be set on systems
|
|
|
|
where a minimal footprint is a necessity and background command
|
|
|
|
execution is not.
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_MMCSDMINOR
|
2011-03-18 20:46:25 +01:00
|
|
|
If the architecture supports an MMC/SD slot and if the NSH
|
|
|
|
architecture specific logic is present, this option will provide
|
|
|
|
the MMC/SD minor number, i.e., the MMC/SD block driver will
|
|
|
|
be registered as /dev/mmcsdN where N is the minor number.
|
|
|
|
Default is zero.
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_ROMFSETC
|
2013-12-29 22:02:51 +01:00
|
|
|
Mount a ROMFS file system at /etc and provide a startup script
|
2011-03-18 20:46:25 +01:00
|
|
|
at /etc/init.d/rcS. The default startup script will mount
|
|
|
|
a FAT FS RAMDISK at /tmp but the logic is easily extensible.
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_CONSOLE
|
|
|
|
If CONFIG_NSH_CONSOLE is set to 'y', then a serial
|
2011-03-18 20:46:25 +01:00
|
|
|
console front-end is selected.
|
|
|
|
|
2012-03-06 21:21:57 +01:00
|
|
|
Normally, the serial console device is a UART and RS-232
|
|
|
|
interface. However, if CONFIG_USBDEV is defined, then a USB
|
|
|
|
serial device may, instead, be used if the one of
|
|
|
|
the following are defined:
|
|
|
|
|
|
|
|
CONFIG_PL2303 and CONFIG_PL2303_CONSOLE - Sets up the
|
|
|
|
Prolifics PL2303 emulation as a console device
|
|
|
|
at /dev/console.
|
|
|
|
|
|
|
|
CONFIG_CDCACM and CONFIG_CDCACM_CONSOLE - Sets up the
|
|
|
|
CDC/ACM serial device as a console device at
|
|
|
|
dev/console.
|
|
|
|
|
2012-05-26 00:10:40 +02:00
|
|
|
CONFIG_NSH_USBCONSOLE
|
|
|
|
If defined, then the an arbitrary USB device may be used
|
|
|
|
to as the NSH console. In this case, CONFIG_NSH_USBCONDEV
|
|
|
|
must be defined to indicate which USB device to use as
|
|
|
|
the console.
|
|
|
|
|
|
|
|
CONFIG_NSH_USBCONDEV
|
|
|
|
If CONFIG_NSH_USBCONSOLE is set to 'y', then CONFIG_NSH_USBCONDEV
|
|
|
|
must also be set to select the USB device used to support
|
|
|
|
the NSH console. This should be set to the quoted name of a
|
2014-07-04 00:25:02 +02:00
|
|
|
read-/write-able USB driver. Default: "/dev/ttyACM0".
|
2012-05-26 00:10:40 +02:00
|
|
|
|
|
|
|
If there are more than one USB devices, then a USB device
|
|
|
|
minor number may also need to be provided:
|
|
|
|
|
2013-01-29 18:42:58 +01:00
|
|
|
CONFIG_NSH_USBDEV_MINOR
|
2012-05-26 00:10:40 +02:00
|
|
|
The minor device number of the USB device. Default: 0
|
|
|
|
|
2014-07-04 00:25:02 +02:00
|
|
|
CONFIG_NSH_USBKBD
|
|
|
|
Normally NSH uses the same device for stdin, stdout, and stderr. By
|
|
|
|
default, that device is /dev/console. If this option is selected,
|
|
|
|
then NSH will use a USB HID keyboard for stdin. In this case, the
|
|
|
|
keyboard is connected directly to the target (via a USB host
|
|
|
|
interface) and the data from the keyboard will drive NSH. NSH
|
|
|
|
output (stdout and stderr) will still go to /dev/console.
|
|
|
|
|
|
|
|
CONFIG_NSH_USBKBD_DEVNAME
|
|
|
|
If NSH_USBKBD is set to 'y', then NSH_USBKBD_DEVNAME must also be
|
|
|
|
set to select the USB keyboard device used to support the NSH
|
|
|
|
console input. This should be set to the quoted name of a read-
|
|
|
|
able keyboard driver. Default: "/dev/kbda".
|
|
|
|
|
2013-01-29 18:42:58 +01:00
|
|
|
CONFIG_NSH_USBDEV_TRACE
|
|
|
|
If USB tracing is enabled (CONFIG_USBDEV_TRACE), then NSH can
|
|
|
|
be configured to show the buffered USB trace data afer each
|
|
|
|
NSH command:
|
|
|
|
|
|
|
|
If CONFIG_NSH_USBDEV_TRACE is selected, then USB trace data
|
|
|
|
can be filtered as follows. Default: Only USB errors are traced.
|
2012-05-26 20:05:26 +02:00
|
|
|
|
|
|
|
CONFIG_NSH_USBDEV_TRACEINIT
|
|
|
|
Show initialization events
|
|
|
|
CONFIG_NSH_USBDEV_TRACECLASS
|
|
|
|
Show class driver events
|
|
|
|
CONFIG_NSH_USBDEV_TRACETRANSFERS
|
|
|
|
Show data transfer events
|
|
|
|
CONFIG_NSH_USBDEV_TRACECONTROLLER
|
|
|
|
Show controller events
|
|
|
|
CONFIG_NSH_USBDEV_TRACEINTERRUPTS
|
|
|
|
Show interrupt-related events.
|
2012-05-26 00:10:40 +02:00
|
|
|
|
2014-05-05 16:52:02 +02:00
|
|
|
* CONFIG_NSH_ALTCONDEV and CONFIG_NSH_CONDEV
|
|
|
|
If CONFIG_NSH_CONSOLE is set to 'y', then CONFIG_NSH_ALTCONDEV may also
|
|
|
|
be selected to enable use of an alternate character device to support
|
|
|
|
the NSH console. If CONFIG_NSH_ALTCONDEV is selected, then
|
|
|
|
CONFIG_NSH_CONDEV holds the quoted name of a readable/write-able
|
|
|
|
character driver such as: CONFIG_NSH_CONDEV="/dev/ttyS1". This is
|
|
|
|
useful, for example, to separate the NSH command line from the system
|
|
|
|
console when the system console is used to provide debug output.
|
|
|
|
Default: stdin and stdout (probably "/dev/console")
|
|
|
|
|
|
|
|
NOTE 1: When any other device other than /dev/console is used for a
|
|
|
|
user interface, (1) linefeeds (\n) will not be expanded to carriage
|
|
|
|
return / linefeeds (\r\n). You will need to configure your terminal
|
|
|
|
program to account for this. And (2) input is not automatically
|
|
|
|
echoed so you will have to turn local echo on.
|
|
|
|
|
|
|
|
NOTE 2: This option forces the console of all sessions to use
|
|
|
|
NSH_CONDEV. Hence, this option only makes sense for a system that
|
|
|
|
supports only a single session. This option is, in particular,
|
|
|
|
incompatible with Telnet sessions because each Telnet session must
|
|
|
|
use a different console device.
|
2011-07-05 00:38:45 +02:00
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_TELNET
|
|
|
|
If CONFIG_NSH_TELNET is set to 'y', then a TELENET
|
2011-03-18 20:46:25 +01:00
|
|
|
server front-end is selected. When this option is provided,
|
|
|
|
you may log into NuttX remotely using telnet in order to
|
|
|
|
access NSH.
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_ARCHINIT
|
2011-03-18 20:46:25 +01:00
|
|
|
Set if your board provides architecture specific initialization
|
|
|
|
via the board-specific function nsh_archinitialize(). This
|
|
|
|
function will be called early in NSH initialization to allow
|
|
|
|
board logic to do such things as configure MMC/SD slots.
|
|
|
|
|
2012-02-02 17:04:09 +01:00
|
|
|
If Telnet is selected for the NSH console, then we must configure
|
|
|
|
the resources used by the Telnet daemon and by the Telnet clients.
|
|
|
|
|
|
|
|
* CONFIG_NSH_TELNETD_PORT - The telnet daemon will listen on this
|
|
|
|
TCP port number for connections. Default: 23
|
|
|
|
|
|
|
|
* CONFIG_NSH_TELNETD_DAEMONPRIO - Priority of the Telnet daemon.
|
|
|
|
Default: SCHED_PRIORITY_DEFAULT
|
|
|
|
|
|
|
|
* CONFIG_NSH_TELNETD_DAEMONSTACKSIZE - Stack size allocated for the
|
|
|
|
Telnet daemon. Default: 2048
|
|
|
|
|
|
|
|
* CONFIG_NSH_TELNETD_CLIENTPRIO- Priority of the Telnet client.
|
|
|
|
Default: SCHED_PRIORITY_DEFAULT
|
|
|
|
|
|
|
|
* CONFIG_NSH_TELNETD_CLIENTSTACKSIZE - Stack size allocated for the
|
|
|
|
Telnet client. Default: 2048
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
One or both of CONFIG_NSH_CONSOLE and CONFIG_NSH_TELNET
|
|
|
|
must be defined. If CONFIG_NSH_TELNET is selected, then there some
|
2011-03-18 20:46:25 +01:00
|
|
|
other configuration settings that apply:
|
|
|
|
|
|
|
|
* CONFIG_NET=y
|
|
|
|
Of course, networking must be enabled
|
2013-06-02 01:25:16 +02:00
|
|
|
|
2011-03-18 20:46:25 +01:00
|
|
|
* CONFIG_NSOCKET_DESCRIPTORS
|
|
|
|
And, of course, you must allocate some socket descriptors.
|
|
|
|
|
|
|
|
* CONFIG_NET_TCP=y
|
|
|
|
TCP/IP support is required for telnet (as well as various other TCP-related
|
|
|
|
configuration settings).
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_IOBUFFER_SIZE
|
2011-03-18 20:46:25 +01:00
|
|
|
Determines the size of the I/O buffer to use for sending/
|
|
|
|
receiving TELNET commands/reponses
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_DHCPC
|
2011-03-18 20:46:25 +01:00
|
|
|
Obtain the IP address via DHCP.
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_IPADDR
|
|
|
|
If CONFIG_NSH_DHCPC is NOT set, then the static IP
|
2011-03-18 20:46:25 +01:00
|
|
|
address must be provided.
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_DRIPADDR
|
2011-03-18 20:46:25 +01:00
|
|
|
Default router IP address
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_NETMASK
|
2011-03-18 20:46:25 +01:00
|
|
|
Network mask
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_NOMAC
|
2011-03-18 20:46:25 +01:00
|
|
|
Set if your ethernet hardware has no built-in MAC address.
|
|
|
|
If set, a bogus MAC will be assigned.
|
|
|
|
|
2012-10-20 23:42:19 +02:00
|
|
|
* CONFIG_NSH_MAX_ROUNDTRIP
|
|
|
|
This is the maximum round trip for a response to a ICMP ECHO request.
|
|
|
|
It is in units of deciseconds. The default is 20 (2 seconds).
|
|
|
|
|
2011-03-18 20:46:25 +01:00
|
|
|
If you use DHCPC, then some special configuration network options are
|
|
|
|
required. These include:
|
|
|
|
|
|
|
|
* CONFIG_NET=y
|
|
|
|
Of course, networking must be enabled
|
2013-06-02 01:25:16 +02:00
|
|
|
|
2011-03-18 20:46:25 +01:00
|
|
|
* CONFIG_NSOCKET_DESCRIPTORS
|
|
|
|
And, of course, you must allocate some socket descriptors.
|
|
|
|
|
|
|
|
* CONFIG_NET_UDP=y
|
|
|
|
UDP support is required for DHCP (as well as various other UDP-related
|
|
|
|
configuration settings)
|
|
|
|
|
|
|
|
* CONFIG_NET_BROADCAST=y
|
|
|
|
UDP broadcast support is needed.
|
2013-06-02 01:25:16 +02:00
|
|
|
|
2014-11-16 15:50:36 +01:00
|
|
|
* CONFIG_NET_ETH_MTU=650 (or larger)
|
2011-03-18 20:46:25 +01:00
|
|
|
Per RFC2131 (p. 9), the DHCP client must be prepared to receive DHCP
|
|
|
|
messages of up to 576 bytes (excluding Ethernet, IP, or UDP headers and FCS).
|
2014-11-16 15:50:36 +01:00
|
|
|
NOTE: Note that the actual MTU setting will depend upon the specific
|
|
|
|
link protocol. Here Ethernet is indicated.
|
2011-03-18 20:46:25 +01:00
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
If CONFIG_NSH_ROMFSETC is selected, then the following additional
|
2011-03-18 20:46:25 +01:00
|
|
|
configuration setting apply:
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_ROMFSMOUNTPT
|
2011-03-18 20:46:25 +01:00
|
|
|
The default mountpoint for the ROMFS volume is /etc, but that
|
|
|
|
can be changed with this setting. This must be a absolute path
|
|
|
|
beginning with '/'.
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_INITSCRIPT
|
2011-03-18 20:46:25 +01:00
|
|
|
This is the relative path to the startup script within the mountpoint.
|
|
|
|
The default is init.d/rcS. This is a relative path and must not
|
|
|
|
start with '/'.
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_ROMFSDEVNO
|
2013-06-02 01:25:16 +02:00
|
|
|
This is the minor number of the ROMFS block device. The default is
|
2011-03-18 20:46:25 +01:00
|
|
|
'0' corresponding to /dev/ram0.
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_ROMFSSECTSIZE
|
2011-03-18 20:46:25 +01:00
|
|
|
This is the sector size to use with the ROMFS volume. Since the
|
|
|
|
default volume is very small, this defaults to 64 but should be
|
|
|
|
increased if the ROMFS volume were to be become large. Any value
|
|
|
|
selected must be a power of 2.
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
When the default rcS file used when CONFIG_NSH_ROMFSETC is
|
2011-03-18 20:46:25 +01:00
|
|
|
selected, it will mount a FAT FS under /tmp. The following selections
|
|
|
|
describe that FAT FS.
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_FATDEVNO
|
2013-06-02 01:25:16 +02:00
|
|
|
This is the minor number of the FAT FS block device. The default is
|
2011-03-18 20:46:25 +01:00
|
|
|
'1' corresponding to /dev/ram1.
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_FATSECTSIZE
|
2011-03-18 20:46:25 +01:00
|
|
|
This is the sector size use with the FAT FS. Default is 512.
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_FATNSECTORS
|
2011-03-18 20:46:25 +01:00
|
|
|
This is the number of sectors to use with the FAT FS. Defalt is
|
|
|
|
1024. The amount of memory used by the FAT FS will be
|
2011-03-18 21:35:31 +01:00
|
|
|
CONFIG_NSH_FATSECTSIZE * CONFIG_NSH_FATNSECTORS
|
2011-03-18 20:46:25 +01:00
|
|
|
bytes.
|
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
* CONFIG_NSH_FATMOUNTPT
|
2011-03-18 20:46:25 +01:00
|
|
|
This is the location where the FAT FS will be mounted. Default
|
|
|
|
is /tmp.
|
|
|
|
|
|
|
|
Common Problems
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Problem:
|
|
|
|
Using NSH over serial, the "nsh>" prompt repeats over and over again
|
|
|
|
with no serial input.
|
|
|
|
Usual Cause:
|
|
|
|
NSH over serial needs to use the interrupt driven serial driver
|
|
|
|
(drivers/serial/serial.c) not the polled serial driver (drivers/serial/lowconsole.c).
|
|
|
|
Make sure that the polled console is disabled in the OS configuration
|
|
|
|
file, .config. That file should have CONFIG_DEV_LOWCONSOLE=n for
|
|
|
|
NSH over serial.
|
2012-02-01 20:47:12 +01:00
|
|
|
|
|
|
|
Problem:
|
|
|
|
The function 'readline' is undefined.
|
|
|
|
Usual Cause:
|
2013-06-02 01:25:16 +02:00
|
|
|
The following is missing from your defconfig file:
|
2012-02-01 20:47:12 +01:00
|
|
|
|
2013-06-02 01:25:16 +02:00
|
|
|
CONFIG_SYSTEM_READLINE=y
|