Newer
Older
<tr>
<td><b><code>uordblks</code></b></td>
<td>This is the total size of memory occupied by chunks handed out by malloc.</td>
</tr>
<tr>
<td><b><code>fordblks</code></b></td>
<td>This is the total size of memory occupied by free (not in use) chunks.</td>
</tr>
</table></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdps"><h2>2.14 Show Current Tasks and Threads (ps)</h2></a>
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<ul><pre>
ps
</pre></ul>
<p>
<b>Synopsis</b>.
Show the currently active threads and tasks. For example,
</p>
<ul><pre>
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>
</pre></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdmkdir"><h2>2.15 Create a Directory (mkdir)</h2></a>
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
<p><b>Command Syntax:</b></p>
<ul><pre>
mkdir <path>
</pre></ul>
<p>
<b>Synopsis</b>.
Create the directory at <code><path></code>.
All components of of <code><path></code> except the final directory name must exist on a mounted file
system; the final directory must not.
</p>
<p>
<b>Limited to Mounted File Systems</b>.
Recall that NuttX uses a <a href="NuttxUserGuide.html#FileSystemOverview"><i>pseudo</i> filesystem</a> for its root file
system.
The <code>mkdir</code> command can only be used to create directories in volumes set up with the
<a href="#cmdmount"><code>mount</code></a> command; it cannot be used to create directories in the <i>pseudo</i> filesystem.
</p>
<p><b>Example:</b></p>
<ul><pre>
nsh> mkdir /mnt/fs/tmp
nsh> ls -l /mnt/fs
/mnt/fs:
drw-rw-rw- 0 TESTDIR/
drw-rw-rw- 0 TMP/
nsh>
</pre></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdmkfatfs"><h2>2.16 Create a FAT Filesystem (mkfatfs)</h2></a>
<p><b>Command Syntax:</b></p>
<ul><pre>
mkfatfs <path>
</pre></ul>
<p>
<b>Synopsis</b>.
Format a fat file system on the block device specified by <code><path></code>.
NSH provides this command to access the <a href="mkfatfs"><code>mkfatfs()</code></a> NuttX API.
This block device must reside in the NuttX <a href="NuttxUserGuide.html#FileSystemOverview"><i>pseudo</i> filesystem</a> and
must have been created by some call to <code>register_blockdriver()</code> (see <code>include/nuttx/fs.h</code>).
</p>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdmkfifo"><h2>2.17 Create a FIFO (mkfifo)</h2></a>
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
<p><b>Command Syntax:</b></p>
<ul><pre>
mkfifo <path>
</pre></ul>
<p>
<b>Synopsis</b>.
Creates a FIFO character device anywhere in the pseudo file system, creating
whatever psuedo directories that may be needed to complete the <code><path></code>.
By convention, however, device drivers are place in the standard <code>/dev</code> directory.
After it is created, the FIFO device may be used as any other device driver.
NSH provides this command to access the <a href="NuttxUserGuide.html#mkfifo"><code>mkfifo()</code></a> NuttX API.
</p>
<p><b>Example</b></p>
<ul><pre>
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>
</pre></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
<a name="cmdmkrd"><h2>2.18 Create a RAMDISK (mkrd)</h2></a>
</td>
</tr>
</table>
<p><b>Command Syntax:</b></p>
<ul><pre>
mkrd [-m <minor>] [-s <sector-size>] <nsectors>
</pre></ul>
<p>
<b>Synopsis</b>.
Create a ramdisk consisting of <code><nsectors></code>, each of size
<code><sector-size></code> (or 512 bytes if <code><sector-size></code> is not specified.
The ramdisk will be registered as <code>/dev/ram<n></code> (if <code><n></code> is not
specified, mkrd will attempt to register the ramdisk as <code>/dev/ram0</code>.
</p>
<p><b>Example</b></p>
<ul><pre>
nsh> ls /dev
/dev:
console
null
ttyS0
ttyS1
nsh> mkrd 1024
nsh> ls /dev
/dev:
console
null
ram0
ttyS0
ttyS1
nsh>
</pre></ul>
<p>
Once the ramdisk has been created, it may be formatted using
the <code>mkfatfs</code> command and mounted using the <code>mount</code> command.
</p>
<p><b>Example</b></p>
<ul><pre>
nsh> mkrd 1024
nsh> mkfatfs /dev/ram0
nsh> mount -t vfat /dev/ram0 /tmp
nsh> ls /tmp
/tmp:
nsh>
</pre></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdmount"><h2>2.19 Mount a File System (mount)</h2></a>
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
<p><b>Command Syntax:</b></p>
<ul><pre>
mount -t <fstype> <block-device> <code><dir-path></code>
</pre></ul>
<p>
<b>Synopsis</b>.
The 'm ount' command mounts a file system in the NuttX psuedo
filesystem. 'mount' performs a three way associating, binding:
</p>
<ol>
<li><b>File system.</b>
The '-t <code><fstype></code>' option identifies the type of
file system that has been formatted on the <code><block-device></code>.
As of this writing, <code>vfat</code> is the only supported value for <code><fstype></code>
</li>
<li><b>Block Device.</b>
The <code><block-device></code> argument is the full or relative
path to a block driver inode in the <a href="NuttxUserGuide.html#FileSystemOverview"><i>pseudo</i> filesystem</a>.
By convention, this is a name under the <code>/dev</code> sub-directory.
This <code><block-device></code> must have been previously formatted with the same file system
type as specified by <code><fstype></code>
</li>
<li><b>Mount Point.</b>
The mount point, <code><dir-path></code>, is the location in the
<a href="NuttxUserGuide.html#FileSystemOverview"><i>pseudo</i> filesystem</a> where the mounted volume will appear.
This mount point can only reside in the NuttX <a href="NuttxUserGuide.html#FileSystemOverview"><i>pseudo</i> filesystem</a>.
By convention, this mount point is a subdirectory under <code>/mnt</code>.
The mount command will create whatever psuedo directories that may be needed to complete the
full path but the full path must not already exist.
</li>
</ol>
<p>
After the the volume has been mounted in the NuttX
<a href="NuttxUserGuide.html#FileSystemOverview"><i>pseudo</i> filesystem</a>,
it may be access in the same way as other objects in thefile system.
</p>
<p><b>Example</b></p>
<ul><pre>
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>
</pre></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdping"><h2>2.20 Check Network Peer (ping)</h2></a>
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<ul><pre>
ping [-c <count>] [-i <interval>] <ip-address>
</pre></ul>
<p>
<b>Synopsis</b>.
Test the network communication with a remote peer. Example,
</p>
<ul><pre>
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>
</pre></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdput"><h2>2.21 Send File Via TFTP (put)</h2></a>
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<ul><pre>
put [-b|-n] [-f <remote-path>] -h <ip-address> <local-path>
</pre></ul>
<p>
<b>Synopsis</b>.
Copy the file at <code><local-address></code> to the host whose IP address is
identified by <code><ip-address></code>.
</p>
<p><b>Other options:</b></p>
<ul><table>
<tr>
<td><b><code>-f <remote-path></code></b></td>
<td>
The file will be saved relative with the same name on the host
unless <code><remote-path></code> is provided.
</td>
</tr>
<tr>
<td><b><code>-b|-n</code></b></td>
<td>
Selects either binary ("octect") or test ("netascii") transfer
mode. Default: text.
</td>
</tr>
</table></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdpwd"><h2>2.22 Show Current Working Directory (pwd)</h2></a>
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<ul><pre>
pwd
</pre></ul>
<p>
<b>Synopsis</b>.
Show the current working directory.
</p>
<ul><pre>
nsh> cd /dev
nsh> pwd
/dev
nsh>
</pre></ul>
<p>Same as <code><a href="#cmdecho">echo</a> <a href="#environvars">$PWD</a></code>.</p>
<ul><pre>
nsh> echo $PWD
/dev
nsh>
</pre></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdrm"><h2>2.23 Remove a File (rm)</h2></a>
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
<a <p><b>Command Syntax:</b></p>
<ul><pre>
rm <file-path>
</pre></ul>
<p>
<b>Synopsis</b>.
Remove the specified <code><file-path></code> name from the mounted file system.
Recall that NuttX uses a <a href="NuttxUserGuide.html#FileSystemOverview"><i>pseudo</i> filesystem</a> for its root file
system.
The <code>rm</code> command can only be used to remove (unlink) files in volumes set up with the
<a href="#cmdmount"><code>mount</code></a> command;
it cannot be used to remove names in the <i>pseudo</i> filesystem.
</p>
<p><b>Example:</b></p>
<ul><pre>
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>
</pre></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdrmdir"><h2>2.24 Remove a Directory (rmdir)</h2></a>
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
<a <p><b>Command Syntax:</b></p>
<ul><pre>
rmdir <dir-path>
</pre></ul>
<p>
<b>Synopsis</b>.
Remove the specified <code><dir-path></code> directory from the mounted file system.
Recall that NuttX uses a <a href="NuttxUserGuide.html#FileSystemOverview"><i>pseudo</i> filesystem</a> for its root file
system.
The <code>rmdir</code> command can only be used to remove directories from volumes set up with the
<a href="#cmdmount"><code>mount</code></a> command;
it cannot be used to remove directories from the <i>pseudo</i> filesystem.
</p>
<p><b>Example:</b></p>
<ul><pre>
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
/mnt/fs:
drw-rw-rw- 0 TESTDIR/
nsh>
</pre></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdset"><h2>2.25 Set an Environment Variable (set)</h2></a>
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<ul><pre>
set <name> <value>
</pre></ul>
<p>
<b>Synopsis</b>.
Set the environment variable <code><name></code> to the string <code><value></code>.
For example,
</p>
<ul><pre>
nsh> echo $foobar
nsh> set foobar foovalue
nsh> echo $foobar
foovalue
nsh>
</pre></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdsh"><h2>2.26 Execute an NSH Script (sh)</h2></a>
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<ul><pre>
sh <script-path>
</pre></ul>
<p>
<b>Synopsis</b>.
Execute the sequence of NSH commands in the file referred
to by <code><script-path>.
</p>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdsleep"><h2>2.27 Wait for Seconds (sleep)</h2></a>
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<ul><pre>
sleep <sec>
</pre></ul>
<p>
<b>Synopsis</b>.
Pause execution (sleep) for <code><sec></code> seconds.
</p>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdunmount"><h2>2.28 Unmount a File System (umount)</h2></a>
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
<a <p><b>Command Syntax:</b></p>
<ul><pre>
umount <dir-path>
</pre></ul>
<p>
<b>Synopsis</b>.
Un-mount the file system at mount point <code><dir-path></code>.
The <code>umount</code> command can only be used to un-mount volumes previously mounted using
<a href="#cmdmount"><code>mount</code></a> command.
</p>
<p><b>Example:</b></p>
<ul><pre>
nsh> ls /mnt/fs
/mnt/fs:
TESTDIR/
nsh> umount /mnt/fs
nsh> ls /mnt/fs
/mnt/fs:
nsh: ls: no such directory: /mnt/fs
nsh>
</pre></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdunset"><h2>2.29 Unset an Environment Variable (unset)</h2></a>
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<ul><pre>
unset <name>
</pre></ul>
<p>
<b>Synopsis</b>.
Remove the value associated with the environment variable
<code><name>. Example:
</p>
<ul><pre>
nsh> echo $foobar
foovalue
nsh> unset foobar
nsh> echo $foobar
nsh>
</pre></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdusleep"><h2>2.30 Wait for Microseconds (usleep)</h2></a>
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<ul><pre>
usleep <usec>
</pre></ul>
<p>
<b>Synopsis</b>.
Pause execution (sleep) of <code><usec></code> microseconds.
</p>
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdxd"><h2>2.31 Hexadecimal dump (xd)</h2></a>
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<ul><pre>
xd <hex-address> <byte-count>
</pre></ul>
<p>
<b>Synopsis</b>.
Dump <code><byte-count></code> bytes of data from address <code><hex-address></code>.
</p>
<p><b>Example:</b></p>
<ul><pre>
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>
</pre></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="configuration"><h1>3.0 Configuration Settings</h1></a>
</td>
</tr>
</table>
<p>
The availability of the above commands depends upon features that
may or may not be enabled in the NuttX configuration file. The
following <a href="#cmddependencies">table</a> indicates the dependency of each command on NuttX
configuration settings. General configuration settings are discussed
in the <a href="NuttxPortingGuide.html">NuttX Porting Guide.</a>
Configuration settings specific to NSH as discussed at the <a href="#nshconfiguration">bottom</a> of this document.
</p>
<p>
Note that in addition to general NuttX configuation 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.
</p>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmddependencies"><h2>3.1 Command Dependencies on Configuration Settings</h2></a>
</td>
</tr>
</table>
<center><p>Table. Command Dependencies on Configuration Settings</p>
<table width="100%">
<tr bgcolor="#e4e4e4">
<th align="left" width="25%">Command</th>
<th align="left">Depends on Configuration</th>
<th align="left">Can Be Disabled with</th>
</tr>
<tr>
<td><b><code>[</code></b></td>
<td>!<code>CONFIG_EXAMPLES_NSH_DISABLESCRIPT</code></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_TEST</code></td>
</tr>
<tr>
<td><b><code>cat</code></b></td>
<td><code>CONFIG_NFILE_DESCRIPTORS</code> > 0</td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_CAT</code></td>
<td>!<code>CONFIG_DISABLE_ENVIRON</code> && <code>CONFIG_NFILE_DESCRIPTORS</code> > 0</td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_CD</code></td>
</tr>
<tr>
<td><b><code>cp</code></b></td>
<td><code>CONFIG_NFILE_DESCRIPTORS</code> > 0</td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_CP</code></td>
</tr>
<tr>
<td><b><code>echo</code></b></td>
<td><br></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_ECHO</code></td>
</tr>
<tr>
<td><b><code>exec</code></b></td>
<td><br></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_EXEC</code></td>
</tr>
<tr>
<td><b><code>exit</code></b></td>
<td><br></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_EXIT</code></td>
<td><code>CONFIG_NET</code> && <code>CONFIG_NET_UDP</code> &&
<code>CONFIG_NFILE_DESCRIPTORS</code> > 0 && <code>CONFIG_NET_BUFSIZE</code> >= 558<sup>1</sup></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_GET</code></td>
<tr>
<td><b><code>help</code></b></td>
<td><br></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_HELP</code></td>
</tr>
<tr>
<td><b><code>ifconfig</code></b></td>
<td><code>CONFIG_NET</code></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_IFCONFIG</code></td>
</tr>
<tr>
<td><b><code>ls</code></b></td>
<td><code>CONFIG_NFILE_DESCRIPTORS</code> > 0</td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_LS</code></td>
</tr>
<tr>
<td><b><code>mb,mh,mw</code></b></td>
<td><br></td>
<td>
<code>CONFIG_EXAMPLES_NSH_DISABLE_MB</code>,<br>
<code>CONFIG_EXAMPLES_NSH_DISABLE_MH</code>,<br>
<code>CONFIG_EXAMPLES_NSH_DISABLE_MW</code>
</td>
</tr>
<tr>
<td><b><code>mem</code></b></td>
<td><br></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_MEM</code></td>
<td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> && <code>CONFIG_NFILE_DESCRIPTORS</code> > 0 && <code>CONFIG_FS_WRITABLE</code><sup>4</sup></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_MKDIR</code></td>
</tr>
<tr>
<td><b><code>mkfatfs</code></b></td>
<td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> && <code>CONFIG_NFILE_DESCRIPTORS</code> > 0 && <code>CONFIG_FS_FAT</code></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_MKFATFS</code></td>
<td><code>CONFIG_NFILE_DESCRIPTORS</code> > 0</td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_MKFIFO</code></td>
</tr>
<tr>
<td><b><code>mkrd</code></b></td>
<td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> && <code>CONFIG_NFILE_DESCRIPTORS</code> > 0 && <code>CONFIG_FS_WRITABLE</code><sup>4</sup></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_MKRD</code></td>
<td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> && <code>CONFIG_NFILE_DESCRIPTORS</code> > 0 && <code>CONFIG_FS_READABLE</code><sup>3</sup></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_MOUNT</code></td>
<td><code>CONFIG_NET</code> && <code>CONFIG_NET_ICMP</code> &&
<code>CONFIG_NET_ICMP_PING</code> && !<code>CONFIG_DISABLE_CLOCK</code> &&
!<code>CONFIG_DISABLE_SIGNALS</code></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_PING</code></td>
</tr>
<tr>
<td><b><code>ps</code></b></td>
<td><br></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_PS</code></td>
<td><code>CONFIG_NET</code> && <code>CONFIG_NET_UDP</code> &&
<code>CONFIG_NFILE_DESCRIPTORS</code> > 0 && <code>CONFIG_NET_BUFSIZE</code> >= 558<sup>1,2</sup></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_PUT</code></td>
<tr>
<td><b><code>pwd</code></b></td>
<td>!<code>CONFIG_DISABLE_ENVIRON</code> && <code>CONFIG_NFILE_DESCRIPTORS</code> > 0</td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_PWD</code></td>
<td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> && <code>CONFIG_NFILE_DESCRIPTORS</code> > 0 && <code>CONFIG_FS_WRITABLE</code><sup>4</sup></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_RM</code></td>
<td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> && <code>CONFIG_NFILE_DESCRIPTORS</code> > 0 && <code>CONFIG_FS_WRITABLE</code><sup>4</sup></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_RMDIR</code></td>
</tr>
<tr>
<td><b><code>set</code></b></td>
<td>!<code>CONFIG_DISABLE_ENVIRON</code></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_SET</code></td>
</tr>
<tr>
<td><b><code>sh</code></b></td>
<td><code>CONFIG_NFILE_DESCRIPTORS > 0 && <code>CONFIG_NFILE_STREAMS > 0 && !<code>CONFIG_EXAMPLES_NSH_DISABLESCRIPT</code></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_SH</code></td>
</tr>
<tr>
<td><b><code>sleep</code></b></td>
<td>!<code>CONFIG_DISABLE_SIGNALS</code></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_SLEEP</code></td>
</tr>
<tr>
<td><b><code>test</code></b></td>
<td>!<code>CONFIG_EXAMPLES_NSH_DISABLESCRIPT</code></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_TEST</code></td>
<td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> && <code>CONFIG_NFILE_DESCRIPTORS</code> > 0 && <code>CONFIG_FS_READABLE</code><sup>3</sup></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_UMOUNT</code></td>
</tr>
<tr>
<td><b><code>unset</code></b></td>
<td>!<code>CONFIG_DISABLE_ENVIRON</code></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_UNSET</code></td>
</tr>
<tr>
<td><b><code>usleep</code></b></td>
<td>!<code>CONFIG_DISABLE_SIGNALS</code></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_USLEEP</code></td>
</tr>
<tr>
<td><b><code>xd</code></b></td>
<td><br></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_XD</code></td>
Because of hardware padding, the actual required packet size may be larger</small><br>
<sup>2</sup><small>
Special TFTP server start-up optionss will probably be required to permit
creation of files for the correct operation of the <code>put</code> command.</small><br>
<sup>3</sup><small>
<code>CONFIG_FS_READABLE</code> is not a user configuration but is set automatically
if any readable filesystem is selected. At present, this is either <code>CONFIG_FS_FAT</code>
or <code>CONFIG_FS_ROMFS</code>.</small><br>
<sup>4</sup><small>
<code>CONFIG_FS_WRITABLE</code> is not a user configuration but is set automatically
if any writable filesystem is selected. At present, this is only <code>CONFIG_FS_FAT</code>.</small><br>
</p>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="nshconfiguration"><h2>3.2 NSH-Specific Configuration Settings</h2></a>
</td>
</tr>
</table>
<p>
The behavior of NSH can be modified with the following settings in
the <code>configs/<board-name>/defconfig</code> file:
</p>
<center><table width="100%">
<tr bgcolor="#e4e4e4">
<th align="left" width="25%">Configuration</th>
<th align="left">Description</th>
</tr>
<tr>
<td valign="top"><b><code>CONFIG_EXAMPLES_NSH_FILEIOSIZE</code></b></td>
<td>
Size of a static I/O buffer used for file access (ignored if
there is no filesystem). Default is 1024.
<td valign="top"><b><code>CONFIG_EXAMPLES_NSH_STRERROR</code></b></td>
<td>
strerror(errno) makes more readable output but strerror() is
very large and will not be used unless this setting is <i>y</i>
</td>
</tr>
<tr>
<td valign="top"><b><code>CONFIG_EXAMPLES_NSH_LINELEN</code></b></td>
<td>
The maximum length of one command line and of one output line.
Default: 80
</td>
</tr>
<tr>
<td valign="top"><b><code>CONFIG_EXAMPLES_NSH_STACKSIZE</code></b></td>
<td>
The stack size to use when spawning new threads or tasks. Such
new threads are generated when a command is executed in background
or as new TELNET connections are established.
</td>
</tr>
<tr>
<td valign="top"><b><code>CONFIG_EXAMPLES_NSH_NESTDEPTH</code></b></td>
<td>
The maximum number of nested <a href="#conditional"><code>if-then[-else]-fi</code></a> sequences that
are permissable. Default: 3
</td>
</tr>
<tr>
<td valign="top"><b><code>CONFIG_EXAMPLES_NSH_DISABLESCRIPT</code></b></td>
<td>
This can be set to <i>y</i> to suppress support for scripting. This
setting disables the <a href="#cmdsh"><code>sh</code></a>, <a href="#cmdtest"><code>test</code></a>, and <a href="#cmtest"><code>[</code></a> commands and the
<a href="#conditional"><code>if-then[-else]-fi</code></a> construct. This would only be set on systems
where a minimal footprint is a necessity and scripting is not.
</td>
</tr>
<tr>
<td valign="top"><b><code>CONFIG_EXAMPLES_NSH_DISABLEBG</code></b></td>
<td>
This can be set to <i>y</i> to suppress support for background
commands. This setting disables the <a href="#cmdoverview"><code>nice</code></a> command prefix and
the <a href="#cmdoverview"><code>&</code></a> command suffix. This would only be set on systems
where a minimal footprint is a necessity and background command execution is not.
</td>
</tr>
<tr>
<td valign="top"><b><code>CONFIG_EXAMPLES_NSH_MMCSDMINOR</code></b></td>
<td>
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 <code>/dev/mmcsd</code><i>N</i> where <i>N</i> is the minor number.
Default is zero.
</td>
</tr>
<tr>
<td valign="top"><b><code>CONFIG_EXAMPLES_NSH_ROMFSETC</code></b></td>
<td>
Mount a ROMFS filesystem at <code>/etc</code> and provide a startup script
at <code>/etc/init.d/rcS</code>. The default startup script will mount
a FAT FS RAMDISK at <code>/tmp</code> but the logic is
<a href="#startupscript">easily extensible</a>.
</td>
</tr>
<td valign="top"><b><code>CONFIG_EXAMPLES_NSH_CONSOLE</code></b></td>
<td>
If <code>CONFIG_EXAMPLES_NSH_CONSOLE</code>is set to <i>y</i>, then a serial
console front-end is selected.
</td>
</tr>
<tr>
<td valign="top"><b><code>CONFIG_EXAMPLES_NSH_TELNET</code></b></td>
<td>
If <code>CONFIG_EXAMPLES_NSH_TELNET</code> is set to <i>y</i>, then a TELENET
server front-end is selected. When this option is provided,
you may log into NuttX remotely using telnet in order to
access NSH.
</td>
</tr>
<p>
One or both of <code>CONFIG_EXAMPLES_NSH_CONSOLE</code> and <code>CONFIG_EXAMPLES_NSH_TELNET</code>
must be defined. If <code>CONFIG_EXAMPLES_NSH_TELNET</code> is selected, then there some
other configuration settings that apply:
</p>
<center><table width="100%">
<tr bgcolor="#e4e4e4">
<th align="left" width="25%">Configuration</th>
<th align="left">Description</th>
</tr>
<td valign="top"><b><code>CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE</code></b></td>
<td>
Determines the size of the I/O buffer to use for sending/
receiving TELNET commands/reponses
</td>
</tr>
<tr>
<td valign="top"><b><code>CONFIG_EXAMPLES_NSH_DHCPC</code></b></td>
<td>
Obtain the the IP address via DHCP.
</td>
</tr>
<tr>
<td valign="top"><b><code>CONFIG_EXAMPLES_NSH_IPADDR</code></b></td>
<td>
If <code>CONFIG_EXAMPLES_NSH_DHCPC</code> is NOT set, then the static IP
address must be provided.
</td>
</tr>
<tr>
<td valign="top"><b><code>CONFIG_EXAMPLES_NSH_DRIPADDR</code></b></td>
<td>
Default router IP address
</td>
</tr>
<tr>
<td valign="top"><b><code>CONFIG_EXAMPLES_NSH_NETMASK</code></b></td>
<td valign="top"><b><code>CONFIG_EXAMPLES_NSH_NOMAC</code></b></td>
<td>
Set if your ethernet hardware has no built-in MAC address.
If set, a bogus MAC will be assigned.
</td>
</tr>
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
<p>
If <code>CONFIG_EXAMPLES_NSH_ROMFSETC</code> is selected, then the following additional
configuration setting apply:
</p>
<center><table width="100%">
<tr bgcolor="#e4e4e4">
<th align="left" width="25%">Configuration</th>
<th align="left">Description</th>
</tr>
<tr>
<td valign="top"><b><code>CONFIG_EXAMPLES_NSH_ROMFSMOUNTPT</code></b></td>
<td>
The default mountpoint for the ROMFS volume is <code>"/etc"</code>, but that
can be changed with this setting. This must be a absolute path
beginning with '<code>/</code>' and enclosed in quotes.
</td>
</tr>
<tr>
<td valign="top"><b><code>CONFIG_EXAMPLES_NSH_INITSCRIPT</code></b></td>
<td>
This is the relative path to the startup script within the mountpoint.
The default is <code>"init.d/rcS"</code>. This is a relative path and must not
start with '<code>/</code>' but must be enclosed in quotes.
</td>
</tr>
<tr>
<td valign="top"><b><code>CONFIG_EXAMPLES_NSH_ROMFSDEVNO</code></b></td>
<td>
This is the minor number of the ROMFS block device. The default is
'<code>0</code>' corresponding to <code>/dev/ram0</code>.
</td>
</tr>
<tr>
<td valign="top"><b><code>CONFIG_EXAMPLES_NSH_ROMFSSECTSIZE</code></b></td>
<td>
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.
</td>