Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
</table>
<a <p><b>Command Syntax:</b></p>
<ul><pre>
ls [-lRs] <dir-path>
</pre></ul>
<p>
<b>Synopsis</b>.
Show the contents of the directory at <code><dir-path></code>. NOTE:
<code><dir-path></code> must refer to a directory and no other filesystem
object.
</p>
<p><b>Options:</b></p>
<ul><table>
<tr>
<td><b><code>-R</code></b></td>
<td>Show the constents of specified directory and all of its
sub-directories.</td>
</tr>
<tr>
<td><b><code>-s</code></b></td>
<td>Show the size of the files along with the filenames in the
listing</td>
</tr>
<tr>
<td><b><code>-l</code></b></td>
<td>Show size and mode information along with the filenames
in the listing.</td>
</tr>
</table></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdmbhw"><h2>2.14 Access Memory (mb, mh, and mw)</h2></a>
1036
1037
1038
1039
1040
1041
1042
1043
1044
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
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
</td>
</tr>
</table>
<p><b>Command Syntax:</b></p>
<ul><pre>
mb <hex-address>[=<hex-value>][ <hex-byte-count>]
mh <hex-address>[=<hex-value>][ <hex-byte-count>]
mw <hex-address>[=<hex-value>][ <hex-byte-count>]
</pre></ul>
<p>
<b>Synopsis</b>.
Access memory using byte size access (mb), 16-bit accesses (mh),
or 32-bit access (mw). In each case,
</p>
<ul><table>
<tr>
<td><code><hex-address></code>.</td>
<td>Specifies the address to be accessed. The current
value at that address will always be read and displayed.
</tr>
<tr>
<td><code><hex-address>=<hex-value></code>.</td>
<td>Read the value, then write <code><hex-value></code>
to the location.
</tr>
<tr>
<td><code><hex-byte-count></code>.</td>
<td>Perform the mb, mh, or mw operation on a total
of <code><hex-byte-count></code> bytes, increment the <code><hex-address></code> appropriately
after each access
</tr>
</table></ul>
<p><b>Example:</b><p>
<ul><pre>
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>
</pre></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdmem"><h2>2.15 Show Memory Manager Status (mem)</h2></a>
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
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
1130
1131
1132
1133
1134
1135
1136
1137
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<ul><pre>
mem
</pre></ul>
<p>
<b>Synopsis</b>.
Show the current state of the memory allocator. For example,
</p>
<ul><pre>
nsh> mem
arena: fe2560
ordblks: 1
mxordblk: fdc3e0
uordblks: 6180
fordblks: fdc3e0
nsh>
</pre></ul>
<p><b>Where:</b></p>
<ul><table>
<tr>
<td><b><code>arena</code></b></td>
<td>This is the total size of memory allocated for use by malloc in bytes.</td>
</tr>
<tr>
<td><b><code>ordblks</code></b></td>
<td>This is the number of free (not in use) chunks.</td>
</tr>
<tr>
<td><b><code>mxordblk</code></b></td>
<td>Size of the largest free (not in use) chunk.</td>
</tr>
<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.16 Show Current Tasks and Threads (ps)</h2></a>
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
</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.17 Create a Directory (mkdir)</h2></a>
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
<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.18 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.19 Create a FIFO (mkfifo)</h2></a>
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
<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>
<a name="cmdmkrd"><h2>2.20 Create a RAMDISK (mkrd)</h2></a>
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
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
</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.21 Mount a File System (mount)</h2></a>
1313
1314
1315
1316
1317
1318
1319
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
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
<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.22 Check Network Peer (ping)</h2></a>
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
</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.23 Send File Via TFTP (put)</h2></a>
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
</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.24 Show Current Working Directory (pwd)</h2></a>
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
</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>
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
<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.26 Remove a Directory (rmdir)</h2></a>
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
<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.27 Set an Environment Variable (set)</h2></a>
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
</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.28 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.29 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.30 Unmount a File System (umount)</h2></a>
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
<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.31 Unset an Environment Variable (unset)</h2></a>
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
</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.32 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>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
</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>
<td><b><code>dd</code></b></td>
<td><code>CONFIG_NFILE_DESCRIPTORS</code> > 0</td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_DD</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>
<td><b><code>losetup</code></b></td>
<td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> && <code>CONFIG_NFILE_DESCRIPTORS</code> > 0</td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_LOSETUP</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