Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

1. Executing Builtin Applications

...

Builtin Applications

The current implementation of NSH allows for the execution of "named" or "builtin" applications. The applications are simply task entry points in the common FLASH image that have names assigned to them. Simply entering that name from the NSH command line will cause the associated application to run.

See the NSH documentation for further details.

Example

...

NuttX supports running applications that reside on a file system as well.
The standard interfaces used to do this include:

  • execv(),
  • execl(), and
  • posix_spawn().

Configuration Settings

Execution of applications on a file system is currently supported by Nuttx. This feature is enabled with:

...

When this feature is enabled, you will be able to do the following:

Code Block

  NuttShell (NSH) NuttX-6.24
  nsh> mount -t vfat /dev/mmcsd0 /mnt/sdcard
  nsh> ls -l /mnt/sdcard
  /mnt/sdcard:
  -rw-r--r--  198 hello

...

Code Block
  nsh> /mnt/sdcard/hello
  Hello, World!!
  nsh>

The PATH Variable

Notice that the absolute path to the hello program was used. This can be simplified by setting the following in your configuration:

...

Then, the example becomes:

Code Block

  NuttShell (NSH) NuttX-6.24
  nsh> mount -t vfat /dev/mmcsd0 /mnt/sdcard
  nsh> ls -l /mnt/sdcard
  /mnt/sdcard:
  -rw-r--r--  198 hello

...

Code Block
  nsh> set PATH /mnt/sdcard
  nsh> hello
  Hello, World!!
  nsh>

Pre-initialized PATH Variables

...

When this feature is enable, will will be able to do this (where myapplication is the name of some, arbitrary "built-in" application):

Code Block

  NuttShell (NSH) NuttX-6.24
  nsh> mount -t binfs /bin
  nsh> ls -l /bin
  /bin:
  -rw-r--r--  0 myapplication

...

Code Block
  nsh> echo $PATH
  /mnt/sdcard:/bin
  nsh> myapplication
  ... and your FLASH based application runs ...
  nsh>

Auto-Mounting BINFS

BINFS, like any file system, could be mounted by an startup script at /etc/init.d/rcS.

...