diff options
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/ChangeLog | 5 | ||||
-rw-r--r-- | nuttx/Documentation/NuttShell.html | 175 | ||||
-rw-r--r-- | nuttx/Documentation/NuttX.html | 9 | ||||
-rw-r--r-- | nuttx/TODO | 23 | ||||
-rw-r--r-- | nuttx/examples/nsh/Makefile | 3 | ||||
-rw-r--r-- | nuttx/examples/nsh/README.txt | 64 | ||||
-rw-r--r-- | nuttx/examples/nsh/nsh.h | 4 | ||||
-rw-r--r-- | nuttx/examples/nsh/nsh_dbgcmds.c | 29 | ||||
-rw-r--r-- | nuttx/examples/nsh/nsh_main.c | 7 | ||||
-rw-r--r-- | nuttx/examples/nsh/nsh_mmcmds.c | 95 |
10 files changed, 252 insertions, 162 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 0eb84f229..cd2164dc9 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -1465,6 +1465,8 @@ Dean Camera. * examples/nsh -- Correct an usage of getopt(): If you stop calling getopt() before all parameters are parsed, you can leave getopt() in a strange state. + * include/nuttx/fb.h -- Restore missing RGB type that was accidentally removed + when Nokia 6100 support was added. * Rename arch/pjrc-8051 to arch/8051 * configs/ne64badge -- Add a configuration for the Future Electronics Group NE64 Badge development board (Freescale MC9S12NE64) @@ -1480,3 +1482,6 @@ running NuttX tasks. 5.19 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> + + * NSH: 'mem' command renamed to 'free'. Output is now more similar to the + Linux 'free' command. diff --git a/nuttx/Documentation/NuttShell.html b/nuttx/Documentation/NuttShell.html index 045117b08..754057917 100644 --- a/nuttx/Documentation/NuttShell.html +++ b/nuttx/Documentation/NuttShell.html @@ -8,7 +8,7 @@ <tr align="center" bgcolor="#e4e4e4"> <td> <h1><big><font color="#3c34ec"><i>NuttShell (NSH)</i></font></big></h1> - <p>Last Updated: February 27, 2011</p> + <p>Last Updated: February 28, 2011</p> </td> </tr> </table> @@ -125,55 +125,55 @@ <tr> <td><br></td> <td> - <a href="#cmdget">2.8 Get File Via TFTP (get)</a> + <a href="#cmdexit">2.8 Exit NSH (exit)</a> </td> </tr> <tr> <td><br></td> <td> - <a href="#cmdexit">2.9 Exit NSH (exit)</a> + <a href="#cmdfree">2.9 Show Memory Manager Status (free)</a> </td> </tr> <tr> <td><br></td> <td> - <a href="#cmdhelp">2.10 Show Usage Command Usage (help)</a> + <a href="#cmdget">2.10 Get File Via TFTP (get)</a> </td> </tr> <tr> <td><br></td> <td> - <a href="#cmdifconfig">2.11 Show Network Configuration (ifconfig)</a> + <a href="#cmdhelp">2.11 Show Usage Command Usage (help)</a> </td> </tr> <tr> <td><br></td> <td> - <a href="#cmdkill">2.12 Send a signal to a task (kill)</a> + <a href="#cmdifconfig">2.12 Show Network Configuration (ifconfig)</a> </td> </tr> <tr> <td><br></td> <td> - <a href="#cmdlosetup">2.13 Setup/teardown the Loop Device (losetup)</a> + <a href="#cmdkill">2.13 Send a signal to a task (kill)</a> </td> </tr> <tr> <td><br></td> <td> - <a href="#cmdls">2.14 List Directory Contents (ls)</a> + <a href="#cmdlosetup">2.14 Setup/teardown the Loop Device (losetup)</a> </td> </tr> <tr> <td><br></td> <td> - <a href="#cmdmbhw">2.15 Access Memory (mb, mh, and mw)</a> + <a href="#cmdls">2.15 List Directory Contents (ls)</a> </td> </tr> <tr> <td><br></td> <td> - <a href="#cmdmem">2.16 Show Memory Manager Status (mem)</a> + <a href="#cmdmbhw">2.16 Access Memory (mb, mh, and mw)</a> </td> </tr> <tr> @@ -857,61 +857,103 @@ exec <hex-address> <table width ="100%"> <tr bgcolor="#e4e4e4"> <td> - <a name="cmdget"><h2>2.8 Get File Via TFTP (get)</h2></a> + <a name="cmdexit"><h2>2.8 Exit NSH (exit)</h2></a> </td> </tr> </table> <p><b>Command Syntax:</b></p> <ul><pre> -get [-b|-n] [-f <local-path>] -h <ip-address> <remote-path> +exit </pre></ul> <p> <b>Synopsis</b>. - Copy the file at <code><remote-address></code> from the host whose IP address is - identified by <code><ip-address></code>. + Exit NSH. Only useful for the serial front end if you have started some other tasks (perhaps + using the <code><a href="#cmdexec">exec</a></code> command) and you would like to have NSH out of the + way. For the telnet front-end, <code>exit</code> terminates the telenet session. </p> -<p><b>Other options:</b></p> + +<table width ="100%"> + <tr bgcolor="#e4e4e4"> + <td> + <a name="cmdfree"><h2>2.9 Show Memory Manager Status (free)</h2></a> + </td> + </tr> +</table> + +<p><b>Command Syntax:</b></p> +<ul><pre> +free +</pre></ul> +<p> + <b>Synopsis</b>. + Show the current state of the memory allocator. For example, +</p> +<ul><pre> +nsh> free + total used free largest +Mem: 4194288 1591552 2602736 2601584 +nsh> +</pre></ul> +<p><b>Where:</b></p> <ul><table> <tr> - <td><b><code>-f <local-path></code></b></td> - <td> - The file will be saved relative to the current working directory - unless <code><local-path></code> is provided. - </td> + <td><b><code>total</code></b></td> + <td>This is the total size of memory allocated for use by malloc in bytes.</td> </tr> <tr> - <td><b><code>-b|-n</code></b></td> - <td> - Selects either binary ("octect") or test ("netascii") transfer - mode. Default: text. - </td> + <td><b><code>used</code></b></td> + <td>This is the total size of memory occupied by chunks handed out by malloc.</td> + </tr> + <tr> + <td><b><code>free</code></b></td> + <td>This is the total size of memory occupied by free (not in use) chunks.</td> + </tr> + <tr> + <td><b><code>largest</code></b></td> + <td>Size of the largest free (not in use) chunk.</td> </tr> </table></ul> <table width ="100%"> <tr bgcolor="#e4e4e4"> <td> - <a name="cmdexit"><h2>2.9 Exit NSH (exit)</h2></a> + <a name="cmdget"><h2>2.10 Get File Via TFTP (get)</h2></a> </td> </tr> </table> <p><b>Command Syntax:</b></p> <ul><pre> -exit +get [-b|-n] [-f <local-path>] -h <ip-address> <remote-path> </pre></ul> <p> <b>Synopsis</b>. - Exit NSH. Only useful for the serial front end if you have started some other tasks (perhaps - using the <code><a href="#cmdexec">exec</a></code> command) and you would like to have NSH out of the - way. For the telnet front-end, <code>exit</code> terminates the telenet session. + Copy the file at <code><remote-address></code> from 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 <local-path></code></b></td> + <td> + The file will be saved relative to the current working directory + unless <code><local-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="cmdhelp"><h2>2.10 Show Usage Command Usage (help)</h2></a> + <a name="cmdhelp"><h2>2.11 Show Usage Command Usage (help)</h2></a> </td> </tr> </table> @@ -928,7 +970,7 @@ help <table width ="100%"> <tr bgcolor="#e4e4e4"> <td> - <a name="cmdifconfig"><h2>2.11 Show Network Configuration (ifconfig)</h2></a> + <a name="cmdifconfig"><h2>2.12 Show Network Configuration (ifconfig)</h2></a> </td> </tr> </table> @@ -954,7 +996,7 @@ eth0 HWaddr 00:18:11:80:10:06 <table width ="100%"> <tr bgcolor="#e4e4e4"> <td> - <a name="cmdkill"><h2>2.12 Send a signal to a task (kill)</h2></a> + <a name="cmdkill"><h2>2.13 Send a signal to a task (kill)</h2></a> </td> </tr> </table> @@ -970,7 +1012,7 @@ kill -<signal> <pid> <table width ="100%"> <tr bgcolor="#e4e4e4"> <td> - <a name="cmdlosetup"><h2>2.13 Setup/teardown the Loop Device (losetup)</h2></a> + <a name="cmdlosetup"><h2>2.14 Setup/teardown the Loop Device (losetup)</h2></a> </td> </tr> </table> @@ -1023,7 +1065,7 @@ losetup d <dev-path> <table width ="100%"> <tr bgcolor="#e4e4e4"> <td> - <a name="cmdls"><h2>2.14 List Directory Contents (ls)</h2></a> + <a name="cmdls"><h2>2.15 List Directory Contents (ls)</h2></a> </td> </tr> </table> @@ -1060,7 +1102,7 @@ ls [-lRs] <dir-path> <table width ="100%"> <tr bgcolor="#e4e4e4"> <td> - <a name="cmdmbhw"><h2>2.15 Access Memory (mb, mh, and mw)</h2></a> + <a name="cmdmbhw"><h2>2.16 Access Memory (mb, mh, and mw)</h2></a> </td> </tr> </table> @@ -1114,55 +1156,6 @@ nsh> <table width ="100%"> <tr bgcolor="#e4e4e4"> <td> - <a name="cmdmem"><h2>2.16 Show Memory Manager Status (mem)</h2></a> - </td> - </tr> -</table> - -<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.17 Show Current Tasks and Threads (ps)</h2></a> </td> </tr> @@ -1832,6 +1825,11 @@ nsh> <td><code>CONFIG_EXAMPLES_NSH_DISABLE_EXIT</code></td> </tr> <tr> + <td><b><code>free</code></b></td> + <td><br></td> + <td><code>CONFIG_EXAMPLES_NSH_DISABLE_FREE</code></td> + </tr> + <tr> <td><b><code>get</code></b></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> @@ -1872,11 +1870,6 @@ nsh> </td> </tr> <tr> - <td><b><code>mem</code></b></td> - <td><br></td> - <td><code>CONFIG_EXAMPLES_NSH_DISABLE_MEM</code></td> - </tr> - <tr> <td><b><code>mkdir</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_MKDIR</code></td> @@ -2353,6 +2346,7 @@ nsh> <td></ul> <li><a href="#cmdexec"><code>exec</code></a></li> <li><a href="#cmdexit"><code>exit</code></a></li> + <li><a href="#cmdfree"><code>free</code></a></li> <li><a href="#cmdget"><code>get</code></a></li> <li><a href="#frontend">Greeting</a></li> <li><a href="#cmdhelp"><code>help</code></a></li> @@ -2364,7 +2358,6 @@ nsh> <li><a href="#cmdmbhw"><code>mb</code></a></li> <li><a href="#cmdmbhw"><code>mh</code></a></li> <li><a href="#cmdmbhw"><code>mw</code></a></li> - <li><a href="#cmdmem"><code>mem</code></a></li> <li><a href="#cmdmkdir"><code>mkdir</code></a></li> <li><a href="#cmdmkfatfs"><code>mkfatfs</code></a></li> <li><a href="#cmdmkfifo"><code>mkfifo</code></a></li> diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index 0c11fc704..52386107a 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -2038,6 +2038,8 @@ nuttx-5.18 2011-02-27 Gregory Nutt <spudmonkey@racsa.co.cr> Dean Camera. * examples/nsh -- Correct an usage of getopt(): If you stop calling getopt() before all parameters are parsed, you can leave getopt() in a strange state. + * include/nuttx/fb.h -- Restore missing RGB type that was accidentally removed + when Nokia 6100 support was added. * Rename arch/pjrc-8051 to arch/8051 * configs/ne64badge -- Add a configuration for the Future Electronics Group NE64 Badge development board (Freescale MC9S12NE64) @@ -2049,8 +2051,8 @@ nuttx-5.18 2011-02-27 Gregory Nutt <spudmonkey@racsa.co.cr> mc9s12ne64 on the Future Electronics Group NE64 /PoE Badge board. Howeve, this port remains untested until I figure out this BDM / Code Warrior and paged build thing - * Added a new 'kill' command to NSH that will support sending signals to - running NuttX tasks. + * Added a new 'kill' command to NSH that will support sending signals to + running NuttX tasks. pascal-2.0 2009-12-21 Gregory Nutt <spudmonkey@racsa.co.cr> @@ -2083,6 +2085,9 @@ buildroot-1.9 2011-02-10 <spudmonkey@racsa.co.cr> <ul><pre> nuttx-5.19 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> + * NSH: 'mem' command renamed to 'free'. Output is now more similar to the + Linux 'free' command. + pascal-2.1 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> buildroot-1.10 2011-xx-xx <spudmonkey@racsa.co.cr> diff --git a/nuttx/TODO b/nuttx/TODO index 438dc4603..9dcb56425 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -1,4 +1,4 @@ -NuttX TODO List (Last updated February 24, 2011) +NuttX TODO List (Last updated February 28, 2011) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (5) Task/Scheduler (sched/) @@ -19,7 +19,7 @@ NuttX TODO List (Last updated February 24, 2011) (5) Build system / Toolchains (4) NuttShell (NSH) (examples/nsh) (3) Other Applications & Tests (examples/) - (5) Linux/Cywgin simulation (arch/sim) + (7) Linux/Cywgin simulation (arch/sim) (3) ARM (arch/arm/) (1) ARM/C5471 (arch/arm/src/c5471/) (3) ARM/DM320 (arch/arm/src/dm320/) @@ -616,6 +616,25 @@ o Linux/Cywgin simulation (arch/sim) irqrestore() to block and (conditionally) unblock the signal. Status: Open Priority: Low + + Descripion: The NSH example has some odd behaviors. Mult-tasking -- for example, + execution of commands in background -- does not work normally. This + is due to the fact that NSH uses the system standard input for the + console. This means that the simulation is actually "frozen" all of + the time when NSH is waiting for input and background commands never + get the chance to run. + Status: Open + Priority: This will not be fixed. This is the normal behavior in the current + design of the simulator. "Real" platforms will behave correctly + because NSH will "sleep" when it waits for console inpu and other + tasks can run freely. + + Description: In the NSH example, the host HOST echoes each command so after you + you enter a command, the command is repeated on the next line. This + is an artifact of the simulator only. + Status: Open + Priority: This will not be fixed. This is the normal behavior in the current + design of the simulator. "Real" platforms will behave correctly. o ARM (arch/arm/) ^^^^^^^^^^^^^^^ diff --git a/nuttx/examples/nsh/Makefile b/nuttx/examples/nsh/Makefile index 961858666..66888599b 100644 --- a/nuttx/examples/nsh/Makefile +++ b/nuttx/examples/nsh/Makefile @@ -37,7 +37,8 @@ -include $(TOPDIR)/Make.defs ASRCS = -CSRCS = nsh_main.c nsh_fscmds.c nsh_ddcmd.c nsh_proccmds.c nsh_envcmds.c nsh_dbgcmds.c +CSRCS = nsh_main.c nsh_fscmds.c nsh_ddcmd.c nsh_proccmds.c nsh_mmcmds.c \ + nsh_envcmds.c nsh_dbgcmds.c ifeq ($(CONFIG_EXAMPLES_NSH_ROMFSETC),y) CSRCS += nsh_romfsetc.c diff --git a/nuttx/examples/nsh/README.txt b/nuttx/examples/nsh/README.txt index bbe1429d8..ee3a42de2 100644 --- a/nuttx/examples/nsh/README.txt +++ b/nuttx/examples/nsh/README.txt @@ -302,6 +302,24 @@ o exit 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 @@ -417,28 +435,6 @@ o mw <hex-address>[=<hex-value>][ <hex-byte-count>] 14 = 0x0c1e nsh> -o mem - - Show the current state of the memory allocator. For example, - - nsh> mem - arena: fe2560 - ordblks: 1 - mxordblk: fdc3e0 - uordblks: 6180 - fordblks: fdc3e0 - nsh> - - Where: - arena - This is the total size of memory allocated for use - by malloc in bytes. - ordblks - This is the number of free (not in use) chunks. - mxordblk - Size of the largest free (not in use) chunk - uordblks - This is the total size of memory occupied by - chunks handed out by malloc. - fordblks - This is the total size of memory occupied by - free (not in use) chunks. - o mkdir <path> Create the directory at <path>. All components of of <path> @@ -770,6 +766,7 @@ Command Dependencies on Configuration Settings echo -- exec -- exit -- + free -- get CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NET_BUFSIZE >= 558 (see note 1) help -- ifconfig CONFIG_NET @@ -777,7 +774,6 @@ Command Dependencies on Configuration Settings losetup !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 ls CONFIG_NFILE_DESCRIPTORS > 0 mb,mh,mw --- - mem --- mkdir !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE (see note 4) mkfatfs !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_FAT mkfifo CONFIG_NFILE_DESCRIPTORS > 0 @@ -814,17 +810,17 @@ In addition, each NSH command can be individually disabled via one of the follow settings. All of these settings make the configuration of NSH potentially complex but also allow it to squeeze into very small memory footprints. - CONFIG_EXAMPLES_NSH_DISABLE_CAT, CONFIG_EXAMPLES_NSH_DISABLE_CD, CONFIG_EXAMPLES_NSH_DISABLE_CP, - CONFIG_EXAMPLES_NSH_DISABLE_DD, CONFIG_EXAMPLES_NSH_DISABLE_ECHO, CONFIG_EXAMPLES_NSH_DISABLE_EXEC, - CONFIG_EXAMPLES_NSH_DISABLE_EXIT, CONFIG_EXAMPLES_NSH_DISABLE_GET, CONFIG_EXAMPLES_NSH_DISABLE_HELP, - CONFIG_EXAMPLES_NSH_DISABLE_IFCONFIG, CONFIG_EXAMPLES_NSH_DISABLE_KILL, CONFIG_EXAMPLES_NSH_DISABLE_LOSETUP, - CONFIG_EXAMPLES_NSH_DISABLE_LS, CONFIG_EXAMPLES_NSH_DISABLE_MB, CONFIG_EXAMPLES_NSH_DISABLE_MEM, - CONFIG_EXAMPLES_NSH_DISABLE_MKDIR, CONFIG_EXAMPLES_NSH_DISABLE_MKFATFS, CONFIG_EXAMPLES_NSH_DISABLE_MKFIFO, - CONFIG_EXAMPLES_NSH_DISABLE_MKRD, CONFIG_EXAMPLES_NSH_DISABLE_MH, CONFIG_EXAMPLES_NSH_DISABLE_MOUNT, - CONFIG_EXAMPLES_NSH_DISABLE_MW, CONFIG_EXAMPLES_NSH_DISABLE_PS, CONFIG_EXAMPLES_NSH_DISABLE_PING, - CONFIG_EXAMPLES_NSH_DISABLE_PUT, CONFIG_EXAMPLES_NSH_DISABLE_PWD, CONFIG_EXAMPLES_NSH_DISABLE_RM, - CONFIG_EXAMPLES_NSH_DISABLE_RMDIR, CONFIG_EXAMPLES_NSH_DISABLE_SET, CONFIG_EXAMPLES_NSH_DISABLE_SH, - CONFIG_EXAMPLES_NSH_DISABLE_SLEEP, CONFIG_EXAMPLES_NSH_DISABLE_TEST, CONFIG_EXAMPLES_NSH_DISABLE_UMOUNT, + CONFIG_EXAMPLES_NSH_DISABLE_CAT, CONFIG_EXAMPLES_NSH_DISABLE_CD, CONFIG_EXAMPLES_NSH_DISABLE_CP, + CONFIG_EXAMPLES_NSH_DISABLE_DD, CONFIG_EXAMPLES_NSH_DISABLE_ECHO, CONFIG_EXAMPLES_NSH_DISABLE_EXEC, + CONFIG_EXAMPLES_NSH_DISABLE_EXIT, CONFIG_EXAMPLES_NSH_DISABLE_FREE, CONFIG_EXAMPLES_NSH_DISABLE_GET, + CONFIG_EXAMPLES_NSH_DISABLE_HELP, CONFIG_EXAMPLES_NSH_DISABLE_IFCONFIG, CONFIG_EXAMPLES_NSH_DISABLE_KILL, + CONFIG_EXAMPLES_NSH_DISABLE_LOSETUP, CONFIG_EXAMPLES_NSH_DISABLE_LS, CONFIG_EXAMPLES_NSH_DISABLE_MB, + CONFIG_EXAMPLES_NSH_DISABLE_MKDIR, CONFIG_EXAMPLES_NSH_DISABLE_MKFATFS, CONFIG_EXAMPLES_NSH_DISABLE_MKFIFO, + CONFIG_EXAMPLES_NSH_DISABLE_MKRD, CONFIG_EXAMPLES_NSH_DISABLE_MH, CONFIG_EXAMPLES_NSH_DISABLE_MOUNT, + CONFIG_EXAMPLES_NSH_DISABLE_MW, CONFIG_EXAMPLES_NSH_DISABLE_PS, CONFIG_EXAMPLES_NSH_DISABLE_PING, + CONFIG_EXAMPLES_NSH_DISABLE_PUT, CONFIG_EXAMPLES_NSH_DISABLE_PWD, CONFIG_EXAMPLES_NSH_DISABLE_RM, + CONFIG_EXAMPLES_NSH_DISABLE_RMDIR, CONFIG_EXAMPLES_NSH_DISABLE_SET, CONFIG_EXAMPLES_NSH_DISABLE_SH, + CONFIG_EXAMPLES_NSH_DISABLE_SLEEP, CONFIG_EXAMPLES_NSH_DISABLE_TEST, CONFIG_EXAMPLES_NSH_DISABLE_UMOUNT, CONFIG_EXAMPLES_NSH_DISABLE_UNSET, CONFIG_EXAMPLES_NSH_DISABLE_USLEEP, CONFIG_EXAMPLES_NSH_DISABLE_WGET, CONFIG_EXAMPLES_NSH_DISABLE_XD diff --git a/nuttx/examples/nsh/nsh.h b/nuttx/examples/nsh/nsh.h index 1fd1b3e92..ef03ddc9d 100644 --- a/nuttx/examples/nsh/nsh.h +++ b/nuttx/examples/nsh/nsh.h @@ -364,8 +364,8 @@ extern void nsh_dumpbuffer(FAR struct nsh_vtbl_s *vtbl, const char *msg, #ifndef CONFIG_EXAMPLES_NSH_DISABLE_MW extern int cmd_mw(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); #endif -#ifndef CONFIG_EXAMPLES_NSH_DISABLE_MEM - extern int cmd_mem(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +#ifndef CONFIG_EXAMPLES_NSH_DISABLE_FREE + extern int cmd_free(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); #endif #ifndef CONFIG_EXAMPLES_NSH_DISABLE_PS extern int cmd_ps(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); diff --git a/nuttx/examples/nsh/nsh_dbgcmds.c b/nuttx/examples/nsh/nsh_dbgcmds.c index 5b4b89675..ef026c68a 100644 --- a/nuttx/examples/nsh/nsh_dbgcmds.c +++ b/nuttx/examples/nsh/nsh_dbgcmds.c @@ -1,7 +1,7 @@ /**************************************************************************** - * examples/nsh/dbg_proccmds.c + * examples/nsh/dbg_dbgcmds.c * - * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -43,7 +43,6 @@ #include <stdint.h> #include <stdbool.h> #include <stdlib.h> -#include <unistd.h> #include <string.h> #include <errno.h> @@ -286,30 +285,6 @@ int cmd_mw(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) #endif /**************************************************************************** - * Name: cmd_mem - ****************************************************************************/ - -#ifndef CONFIG_EXAMPLES_NSH_DISABLE_MEM -int cmd_mem(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) -{ - struct mallinfo mem; - -#ifdef CONFIG_CAN_PASS_STRUCTS - mem = mallinfo(); -#else - (void)mallinfo(&mem); -#endif - - nsh_output(vtbl, " arena: %8x\n", mem.arena); - nsh_output(vtbl, " ordblks: %8d\n", mem.ordblks); - nsh_output(vtbl, " mxordblk: %8x\n", mem.mxordblk); - nsh_output(vtbl, " uordblks: %8x\n", mem.uordblks); - nsh_output(vtbl, " fordblks: %8x\n", mem.fordblks); - return OK; -} -#endif - -/**************************************************************************** * Name: nsh_dumpbuffer ****************************************************************************/ diff --git a/nuttx/examples/nsh/nsh_main.c b/nuttx/examples/nsh/nsh_main.c index 2483c4919..aea823be8 100644 --- a/nuttx/examples/nsh/nsh_main.c +++ b/nuttx/examples/nsh/nsh_main.c @@ -173,6 +173,10 @@ static const struct cmdmap_s g_cmdmap[] = { "exit", cmd_exit, 1, 1, NULL }, #endif +#ifndef CONFIG_EXAMPLES_NSH_DISABLE_FREE + { "free", cmd_free, 1, 1, NULL }, +#endif + #if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0 # ifndef CONFIG_EXAMPLES_NSH_DISABLE_GET { "get", cmd_get, 4, 7, "[-b|-n] [-f <local-path>] -h <ip-address> <remote-path>" }, @@ -210,9 +214,6 @@ static const struct cmdmap_s g_cmdmap[] = #ifndef CONFIG_EXAMPLES_NSH_DISABLE_MB { "mb", cmd_mb, 2, 3, "<hex-address>[=<hex-value>][ <hex-byte-count>]" }, #endif -#ifndef CONFIG_EXAMPLES_NSH_DISABLE_MEM - { "mem", cmd_mem, 1, 1, NULL }, -#endif #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE) # ifndef CONFIG_EXAMPLES_NSH_DISABLE_MKDIR diff --git a/nuttx/examples/nsh/nsh_mmcmds.c b/nuttx/examples/nsh/nsh_mmcmds.c new file mode 100644 index 000000000..f2e572eb3 --- /dev/null +++ b/nuttx/examples/nsh/nsh_mmcmds.c @@ -0,0 +1,95 @@ +/**************************************************************************** + * examples/nsh/dbg_mmcmds.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +#include <stdlib.h> + +#include "nsh.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: cmd_free + ****************************************************************************/ + +#ifndef CONFIG_EXAMPLES_NSH_DISABLE_FREE +int cmd_free(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) +{ + struct mallinfo mem; + +#ifdef CONFIG_CAN_PASS_STRUCTS + mem = mallinfo(); +#else + (void)mallinfo(&mem); +#endif + + nsh_output(vtbl, " total used free largest\n"); + nsh_output(vtbl, "Mem: %11d%11d%11d%11d\n", + mem.arena, mem.uordblks, mem.fordblks, mem.mxordblk); + + return OK; +} +#endif |