Configuration Settings
The availability of the above commands depends upon features that may or may not be enabled in the NuttX configuration file. The following cmdtable <cmddependencies>
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 cmdbottom <nshconfiguration>
of this document.
Note that in addition to general NuttX configuration settings, each NSH command can be individually disabled via the settings in the rightmost column. All of these settings make the configuration of NSH potentially complex but also allow it to squeeze into very small memory footprints.
Command Dependencies on Configuration Settings
Command | Depends on Configuration | Can Be Disabled with |
---|---|---|
[ | ! CONFIG_NSH_DISABLESCRIPT | CONFIG_NSH_DISABLE_TEST |
cmdaddroute | CONFIG_NET && CONFIG_NET_ROUTE | CONFIG_NSH_DISABLE_ADDROUTE |
cmdarp | CONFIG_NET && CONFIG_NET_ARP | CONFIG_NSH_DISABLE_ARP |
|
|
|
|
|
|
cmdbasename | . | CONFIG_NSH_DISABLE_BASENAME |
| ! | . |
cmdcat | CONFIG_NSH_DISABLE_CAT | . |
cmdcd | ! CONFIG_DISABLE_ENVIRON | CONFIG_NSH_DISABLE_CD |
cmdcmp | CONFIG_NSH_DISABLE_CMP | . |
cmdcp | CONFIG_NSH_DISABLE_CP | . |
cmddate | CONFIG_NSH_DISABLE_DATE | . |
cmddelroute | CONFIG_NET && CONFIG_NET_ROUTE | CONFIG_NSH_DISABLE_DELROUTE |
cmddf | ! CONFIG_DISABLE_MOUNTPOINT | CONFIG_NSH_DISABLE_DF |
cmddirname | CONFIG_NSH_DISABLE_DIRNAME | . |
cmddmesg | CONFIG_RAMLOG_SYSLOG | CONFIG_NSH_DISABLE_DMESG |
cmdecho | CONFIG_NSH_DISABLE_ECHO | . |
|
|
|
cmdexec | CONFIG_NSH_DISABLE_EXEC | . |
|
| .
|
cmdfree | CONFIG_NSH_DISABLE_FREE | . |
|
|
|
cmdhelp [2] | CONFIG_NSH_DISABLE_HELP | . |
cmdhexdump | CONFIG_NSH_DISABLE_HEXDUMP | . |
|
|
|
|
|
|
cmdinsmod | CONFIG_MODULE | CONFIG_NSH_DISABLE_MODCMDS |
| ! | . |
cmdkill | CONFIG_NSH_DISABLE_KILL | . |
| ! |
|
cmdln | CONFIG_PSEUDOFS_SOFTLINKS | CONFIG_NSH_DISABLE_LN |
cmdls | CONFIG_NSH_DISABLE_LS | . |
|
|
|
|
|
|
| . |
|
| (! |
|
| ! |
|
|
|
|
cmdmkrd | ! CONFIG_DISABLE_MOUNTPOINT | CONFIG_NSH_DISABLE_MKRD |
cmdmount | ! CONFIG_DISABLE_MOUNTPOINT | CONFIG_NSH_DISABLE_MOUNT |
| ! |
|
| ! |
|
|
|
|
| ! |
|
cmdpmconfig | CONFIG_PM | CONFIG_NSH_DISABLE_PMCONFIG |
cmdpoweroff | CONFIG_BOARDCTL_POWEROFF | CONFIG_NSH_DISABLE_POWEROFF |
|
|
|
|
|
|
cmdpwd | ! CONFIG_DISABLE_ENVIRON | CONFIG_NSH_DISABLE_PWD |
cmdreadlink | CONFIG_PSEUDOFS_SOFTLINKS | CONFIG_NSH_DISABLE_READLINK |
cmdreboot | CONFIG_BOARD_RESET | CONFIG_NSH_DISABLE_REBOOT |
| ! |
|
cmdrmmod | CONFIG_MODULE | CONFIG_NSH_DISABLE_MODCMDS |
|
|
|
cmdrptun | CONFIG_RPTUN | CONFIG_NSH_DISABLE_RPTUN |
|
|
|
|
|
|
cmdsleep | . | CONFIG_NSH_DISABLE_SLEEP |
|
|
|
cmdtest | ! CONFIG_NSH_DISABLESCRIPT | CONFIG_NSH_DISABLE_TEST |
cmdtime | . | CONFIG_NSH_DISABLE_TIME |
cmdtruncate | ! CONFIG_DISABLE_MOUNTPOINT | CONFIG_NSH_DISABLE_TRUNCATE |
cmdumount | ! CONFIG_DISABLE_MOUNTPOINT | CONFIG_NSH_DISABLE_UMOUNT |
cmduname | . | CONFIG_NSH_DISABLE_UNAME |
|
|
|
| ! |
|
| ! |
|
| ! |
|
| ! |
|
cmdusleep | . | CONFIG_NSH_DISABLE_USLEEP |
cmdwget | CONFIG_NET && CONFIG_NET_TCP | CONFIG_NSH_DISABLE_WGET |
cmdxd | . | CONFIG_NSH_DISABLE_XD |
Built-In Command Dependencies on Configuration Settings
All built-in applications require that support for NSH built-in applications has been enabled. This support is enabled with CONFIG_BUILTIN=y
and CONFIG_NSH_BUILTIN_APPS=y
.
Command | Depends on Configuration |
---|---|
ping | CONFIG_NET && CONFIG_NET_ICMP && CONFIG_NET_ICMP_SOCKET && CONFIG_SYSTEM_PING |
ping6 | CONFIG_NET && CONFIG_NET_ICMPv6 && CONFIG_NET_ICMPv6_SOCKET && CONFIG_SYSTEM_PING6 |
NSH-Specific Configuration Settings
The behavior of NSH can be modified with the following settings in the boards/<arch>/<chip>/<board>/defconfig
file:
Configuration | Description |
---|---|
| Selects the minimal implementation of |
| 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 supports extensive VT100 editing commands. Selecting this option will add probably 1.5-2KB to the FLASH footprint. |
| Support external registered, "builtin" applications that can be executed from the NSH command line (see apps/README.txt for more information). This required |
| Size of a static I/O buffer used for file access (ignored if there is no file system). Default is 1024. |
|
|
| 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 |
| 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:
will execute the program named |
| The maximum number of NSH command arguments. Default: 6 |
| Support concatenation of strings with environment variables or command output. For example:
would set the environment variable |
| By default, there are no internal NSH variables. NSH will use OS environment variables for all variable storage. If this option, NSH will also support local NSH variables. These variables are, for the most part, transparent and work just like the OS environment variables. The difference is that when you create new tasks, all of environment variables are inherited by the created tasks. NSH local variables are not. If this option is enabled (and |
| Enables back-slash quoting of certain characters within the command. This option is useful for the case where an NSH script is used to dynamically generate a new NSH script. In that case, commands must be treated as simple text strings without interpretation of any special characters. Special characters such as |
| The maximum number of nested |
| This can be set to y to suppress support for scripting. This setting disables the |
| If scripting is enabled, then then this option can be selected to suppress support for |
| If scripting is enabled, then then this option can be selected suppress support |
| This can be set to y to suppress support for background commands. This setting disables the |
| 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 |
| If Normally, the serial console device is a UART and RS-232 interface. However, if
If there are more than one USB slots, then a USB device minor number may also need to be provided:
If USB tracing is enabled (
|
| If
|
| If |
| Set |
CMD | w/o CONFIG_NSH_VARS | w/CONFIG_NSH_VARS |
---|---|---|
set <a> <b> | Set environment variable <a> to <b> | Set NSH variable <a> to <b> (Unless the NSH variable has been promoted via export , in which case the env ironment variable of the same name is set to <b>). |
set | Causes an error. | Lists all NSH variables. |
unset <a> | Unsets environment variable <a> | Unsets both environment variable and NSH variable with and name <a> |
export <a> <b> | Causes an error, | Unsets NSH variable <a>. Sets environment variable <a> to <b>. |
export <a> | Causes an error. | Sets environment variable <a> to the value of NSH variable <a> (or "" if the NSH variable has not been set). Unsets NSH local variable <a>. |
env | Lists all environment variables | Lists all environment variables (only) |
If Telnet is selected for the NSH console, then we must configure the resources used by the Telnet daemon and by the Telnet clients.
Configuration | Description |
---|---|
CONFIG_SYSTEM_TELNETD_PORT | The telnet daemon will listen on this TCP port number for connections. Default: 23 |
CONFIG_SYSTEM_TELNETD_PRIORITY | Priority of the Telnet daemon. Default: SCHED_PRIORITY_DEFAULT |
CONFIG_SYSTEM_TELNETD_STACKSIZE | Stack size allocated for the Telnet daemon. Default: 2048 |
CONFIG_SYSTEM_TELNETD_SESSION_PRIORITY | Priority of the Telnet client. Default: SCHED_PRIORITY_DEFAULT |
CONFIG_SYSTEM_TELNETD_SESSION_STACKSIZE | Stack size allocated for the Telnet client. Default: 2048 |
One or both of CONFIG_NSH_CONSOLE
and CONFIG_NSH_TELNET
must be defined. If CONFIG_NSH_TELNET
is selected, then there some other configuration settings that apply:
Configuration | Description |
---|---|
CONFIG_NET=y | Of course, networking must be enabled. |
CONFIG_NET_TCP=y | TCP/IP support is required for telnet (as well as various other TCP-related configuration settings). |
CONFIG_NSH_DHCPC | Obtain the IP address via DHCP. |
CONFIG_NSH_IPADDR | If CONFIG_NSH_DHCPC is NOT set, then the static IP address must be provided. |
CONFIG_NSH_DRIPADDR | Default router IP address |
CONFIG_NSH_NETMASK | Network mask |
CONFIG_NSH_NOMAC | Set if your Ethernet hardware has no built-in MAC address. If set, a bogus MAC will be assigned. |
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). |
If you use DHCPC, then some special configuration network options are required. These include:
Configuration | Description |
---|---|
CONFIG_NET=y | Of course, networking must be enabled. |
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. |
CONFIG_NET_ETH_PKTSIZE=650 (or larger) | 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). NOTE: Note that the actual MTU setting will depend upon the specific link protocol. Here Ethernet is indicated. |
If CONFIG_ETC_ROMFS
is selected, then the following additional configuration setting apply:
Configuration | Description |
---|---|
CONFIG_NSH_SYSINITSCRIPT | This is the relative path to the system init script within the mountpoint. The default is "init.d/rc.sysinit" . This is a relative path and must not start with '/ ' but must be enclosed in quotes. |
CONFIG_NSH_INITSCRIPT | 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 '/ ' but must be enclosed in quotes. |
Common Problems
Problem:
The function 'readline' is undefined.
Usual Cause:
The following is missing from your defconfig file:
CONFIG_SYSTEM_READLINE=y
Because of hardware padding, the actual required packet size may be larger
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.Because of hardware padding, the actual required packet size may be larger
Special TFTP server start-up options will probably be required to permit creation of files for the correct operation of the
put
command.