From e097c475ae7d36d75d0d48fedbf7a914483eeeb9 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 28 Feb 2011 12:48:23 +0000 Subject: [PATCH] Rename NSH mem command to free git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@3325 7fd9a85b-ad96-42d3-883c-3090e2eb8679 --- nuttx/ChangeLog | 5 + nuttx/Documentation/NuttShell.html | 175 ++++++++++++++--------------- nuttx/Documentation/NuttX.html | 9 +- nuttx/TODO | 23 +++- nuttx/examples/nsh/Makefile | 3 +- nuttx/examples/nsh/README.txt | 64 +++++------ nuttx/examples/nsh/nsh.h | 4 +- nuttx/examples/nsh/nsh_dbgcmds.c | 29 +---- nuttx/examples/nsh/nsh_main.c | 7 +- nuttx/examples/nsh/nsh_mmcmds.c | 95 ++++++++++++++++ 10 files changed, 252 insertions(+), 162 deletions(-) create mode 100644 nuttx/examples/nsh/nsh_mmcmds.c 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 + + * 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 @@

NuttShell (NSH)

-

Last Updated: February 27, 2011

+

Last Updated: February 28, 2011

@@ -125,55 +125,55 @@
- 2.8 Get File Via TFTP (get) + 2.8 Exit NSH (exit)
- 2.9 Exit NSH (exit) + 2.9 Show Memory Manager Status (free)
- 2.10 Show Usage Command Usage (help) + 2.10 Get File Via TFTP (get)
- 2.11 Show Network Configuration (ifconfig) + 2.11 Show Usage Command Usage (help)
- 2.12 Send a signal to a task (kill) + 2.12 Show Network Configuration (ifconfig)
- 2.13 Setup/teardown the Loop Device (losetup) + 2.13 Send a signal to a task (kill)
- 2.14 List Directory Contents (ls) + 2.14 Setup/teardown the Loop Device (losetup)
- 2.15 Access Memory (mb, mh, and mw) + 2.15 List Directory Contents (ls)
- 2.16 Show Memory Manager Status (mem) + 2.16 Access Memory (mb, mh, and mw) @@ -857,7 +857,68 @@ exec <hex-address> + +
-

2.8 Get File Via TFTP (get)

+

2.8 Exit NSH (exit)

+
+ +

Command Syntax:

+ +

+ Synopsis. + Exit NSH. Only useful for the serial front end if you have started some other tasks (perhaps + using the exec command) and you would like to have NSH out of the + way. For the telnet front-end, exit terminates the telenet session. +

+ + + + + +
+

2.9 Show Memory Manager Status (free)

+
+ +

Command Syntax:

+ +

+ Synopsis. + Show the current state of the memory allocator. For example, +

+ +

Where:

+ + + + +
+

2.10 Get File Via TFTP (get)

@@ -892,26 +953,7 @@ get [-b|-n] [-f <local-path>] -h <ip-address> <remote-path> - -
-

2.9 Exit NSH (exit)

-
- -

Command Syntax:

- -

- Synopsis. - Exit NSH. Only useful for the serial front end if you have started some other tasks (perhaps - using the exec command) and you would like to have NSH out of the - way. For the telnet front-end, exit terminates the telenet session. -

- - - -
-

2.10 Show Usage Command Usage (help)

+

2.11 Show Usage Command Usage (help)

@@ -928,7 +970,7 @@ help
-

2.11 Show Network Configuration (ifconfig)

+

2.12 Show Network Configuration (ifconfig)

@@ -954,7 +996,7 @@ eth0 HWaddr 00:18:11:80:10:06
-

2.12 Send a signal to a task (kill)

+

2.13 Send a signal to a task (kill)

@@ -970,7 +1012,7 @@ kill -<signal> <pid>
-

2.13 Setup/teardown the Loop Device (losetup)

+

2.14 Setup/teardown the Loop Device (losetup)

@@ -1023,7 +1065,7 @@ losetup d <dev-path>
-

2.14 List Directory Contents (ls)

+

2.15 List Directory Contents (ls)

@@ -1060,7 +1102,7 @@ ls [-lRs] <dir-path>
-

2.15 Access Memory (mb, mh, and mw)

+

2.16 Access Memory (mb, mh, and mw)

@@ -1111,55 +1153,6 @@ nsh> mh 0 16 nsh> - - - - -
-

2.16 Show Memory Manager Status (mem)

-
- -

Command Syntax:

- -

- Synopsis. - Show the current state of the memory allocator. For example, -

- -

Where:

- - + + + + + - - - - - @@ -2353,6 +2346,7 @@ nsh>
@@ -1831,6 +1824,11 @@ nsh>
CONFIG_EXAMPLES_NSH_DISABLE_EXIT
free
CONFIG_EXAMPLES_NSH_DISABLE_FREE
get CONFIG_NET && CONFIG_NET_UDP && @@ -1871,11 +1869,6 @@ nsh> CONFIG_EXAMPLES_NSH_DISABLE_MW
mem
CONFIG_EXAMPLES_NSH_DISABLE_MEM
mkdir !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE4
  • exec
  • exit
  • +
  • free
  • get
  • Greeting
  • help
  • @@ -2364,7 +2358,6 @@ nsh>
  • mb
  • mh
  • mw
  • -
  • mem
  • mkdir
  • mkfatfs
  • mkfifo
  • 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>
       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 
      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 ] -h  
       
         Use TFTP to copy the file at  from the host whose IP
      @@ -417,28 +435,6 @@ o mw [=][ ]
             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 
       
         Create the directory at .  All components of of 
      @@ -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 
        *
        * Redistribution and use in source and binary forms, with or without
      @@ -43,7 +43,6 @@
       #include 
       #include 
       #include 
      -#include 
       #include 
       #include 
       
      @@ -285,30 +284,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 ] -h  " },
      @@ -210,9 +214,6 @@ static const struct cmdmap_s g_cmdmap[] =
       #ifndef CONFIG_EXAMPLES_NSH_DISABLE_MB
         { "mb",       cmd_mb,       2, 3, "[=][ ]" },
       #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 
      + *
      + * 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 
      +
      +#include 
      +
      +#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