mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 07:03:33 +08:00
Rename namedapp as simply builtin
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5454 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -439,4 +439,5 @@
|
|||||||
* Makefiles: Removed dependency of distclean on clean in most top-level
|
* Makefiles: Removed dependency of distclean on clean in most top-level
|
||||||
files. It makes sense for 'leaf' Makefiles to have this dependency,
|
files. It makes sense for 'leaf' Makefiles to have this dependency,
|
||||||
but it does not make sense for upper-level Makefiles.
|
but it does not make sense for upper-level Makefiles.
|
||||||
|
* namedapp/: Renamed to builtins in preparation for another change.
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -3,8 +3,8 @@
|
|||||||
# see misc/tools/kconfig-language.txt.
|
# see misc/tools/kconfig-language.txt.
|
||||||
#
|
#
|
||||||
|
|
||||||
menu "Named Applications"
|
menu "Built-In Applications"
|
||||||
source "$APPSDIR/namedapp/Kconfig"
|
source "$APPSDIR/builtin/Kconfig"
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
menu "Examples"
|
menu "Examples"
|
||||||
|
|||||||
+2
-2
@@ -36,6 +36,6 @@
|
|||||||
|
|
||||||
define REGISTER
|
define REGISTER
|
||||||
@echo "Register: $1"
|
@echo "Register: $1"
|
||||||
@echo "{ \"$1\", $2, $3, $4 }," >> "$(APPDIR)/namedapp/namedapp_list.h"
|
@echo "{ \"$1\", $2, $3, $4 }," >> "$(APPDIR)/builtin/builtin_list.h"
|
||||||
@echo "EXTERN int $4(int argc, char *argv[]);" >> "$(APPDIR)/namedapp/namedapp_proto.h"
|
@echo "EXTERN int $4(int argc, char *argv[]);" >> "$(APPDIR)/builtin/builtin_proto.h"
|
||||||
endef
|
endef
|
||||||
|
|||||||
+7
-7
@@ -44,11 +44,11 @@ APPDIR = ${shell pwd}
|
|||||||
# action. It is created by the configured appconfig file (a copy of which
|
# action. It is created by the configured appconfig file (a copy of which
|
||||||
# appears in this directory as .config)
|
# appears in this directory as .config)
|
||||||
# SUBDIRS is the list of all directories containing Makefiles. It is used
|
# SUBDIRS is the list of all directories containing Makefiles. It is used
|
||||||
# only for cleaning. namedapp must always be the first in the list. This
|
# only for cleaning. builtin must always be the first in the list. This
|
||||||
# list can be extended by the .config file as well.
|
# list can be extended by the .config file as well.
|
||||||
|
|
||||||
CONFIGURED_APPS =
|
CONFIGURED_APPS =
|
||||||
SUBDIRS = examples graphics interpreters modbus namedapp nshlib netutils system
|
SUBDIRS = examples graphics interpreters modbus builtin nshlib netutils system
|
||||||
|
|
||||||
# There are two different mechanisms for obtaining the list of configured
|
# There are two different mechanisms for obtaining the list of configured
|
||||||
# directories:
|
# directories:
|
||||||
@@ -69,9 +69,9 @@ SUBDIRS = examples graphics interpreters modbus namedapp nshlib netutils system
|
|||||||
|
|
||||||
ifeq ($(CONFIG_NUTTX_NEWCONFIG),y)
|
ifeq ($(CONFIG_NUTTX_NEWCONFIG),y)
|
||||||
|
|
||||||
# namedapp/Make.defs must be included first
|
# builtin/Make.defs must be included first
|
||||||
|
|
||||||
include namedapp/Make.defs
|
include builtin/Make.defs
|
||||||
include examples/Make.defs
|
include examples/Make.defs
|
||||||
include graphics/Make.defs
|
include graphics/Make.defs
|
||||||
include interpreters/Make.defs
|
include interpreters/Make.defs
|
||||||
@@ -82,7 +82,7 @@ include system/Make.defs
|
|||||||
|
|
||||||
# INSTALLED_APPS is the list of currently available application directories. It
|
# INSTALLED_APPS is the list of currently available application directories. It
|
||||||
# is the same as CONFIGURED_APPS, but filtered to exclude any non-existent
|
# is the same as CONFIGURED_APPS, but filtered to exclude any non-existent
|
||||||
# application directory. namedapp is always in the list of applications to be
|
# application directory. builtin is always in the list of applications to be
|
||||||
# built.
|
# built.
|
||||||
|
|
||||||
INSTALLED_APPS =
|
INSTALLED_APPS =
|
||||||
@@ -94,10 +94,10 @@ else
|
|||||||
|
|
||||||
# INSTALLED_APPS is the list of currently available application directories. It
|
# INSTALLED_APPS is the list of currently available application directories. It
|
||||||
# is the same as CONFIGURED_APPS, but filtered to exclude any non-existent
|
# is the same as CONFIGURED_APPS, but filtered to exclude any non-existent
|
||||||
# application directory. namedapp is always in the list of applications to be
|
# application directory. builtin is always in the list of applications to be
|
||||||
# built.
|
# built.
|
||||||
|
|
||||||
INSTALLED_APPS = namedapp
|
INSTALLED_APPS = builtin
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Create the list of available applications (INSTALLED_APPS)
|
# Create the list of available applications (INSTALLED_APPS)
|
||||||
|
|||||||
+15
-15
@@ -6,12 +6,12 @@ Contents
|
|||||||
|
|
||||||
General
|
General
|
||||||
Directory Location
|
Directory Location
|
||||||
Named Applications
|
Built-In Applications
|
||||||
Named Startup main() function
|
Built-In Startup main() function
|
||||||
NuttShell (NSH) Built-In Commands
|
NuttShell (NSH) Built-In Commands
|
||||||
Synchronous Built-In Commands
|
Synchronous Built-In Commands
|
||||||
Application Configuration File
|
Application Configuration File
|
||||||
Example Named Application
|
Example Built-In Application
|
||||||
Building NuttX with Board-Specific Pieces Outside the Source Tree
|
Building NuttX with Board-Specific Pieces Outside the Source Tree
|
||||||
|
|
||||||
General
|
General
|
||||||
@@ -47,14 +47,14 @@ ways to do that:
|
|||||||
path to the application directory on the configuration command line
|
path to the application directory on the configuration command line
|
||||||
like: ./configure.sh -a <app-dir> <board-name>/<config-name>
|
like: ./configure.sh -a <app-dir> <board-name>/<config-name>
|
||||||
|
|
||||||
Named Applications
|
Built-In Applications
|
||||||
------------------
|
---------------------
|
||||||
NuttX also supports applications that can be started using a name string.
|
NuttX also supports applications that can be started using a name string.
|
||||||
In this case, application entry points with their requirements are gathered
|
In this case, application entry points with their requirements are gathered
|
||||||
together in two files:
|
together in two files:
|
||||||
|
|
||||||
- namedapp/namedapp_proto.h Entry points, prototype function
|
- builtin/builtin_proto.h Entry points, prototype function
|
||||||
- namedapp/namedapp_list.h Application specific information and requirements
|
- builtin/builtin_list.h Application specific information and requirements
|
||||||
|
|
||||||
The build occurs in several phases as different build targets are executed:
|
The build occurs in several phases as different build targets are executed:
|
||||||
(1) context, (2) depend, and (3) default (all). Application information is
|
(1) context, (2) depend, and (3) default (all). Application information is
|
||||||
@@ -62,18 +62,18 @@ collected during the make context build phase.
|
|||||||
|
|
||||||
To execute an application function:
|
To execute an application function:
|
||||||
|
|
||||||
exec_namedapp() is defined in the nuttx/include/apps/apps.h
|
exec_builtin() is defined in the nuttx/include/apps/apps.h
|
||||||
|
|
||||||
NuttShell (NSH) Built-In Commands
|
NuttShell (NSH) Built-In Commands
|
||||||
---------------------------------
|
---------------------------------
|
||||||
One use of named applications is to provide a way of invoking your custom
|
One use of builtin applications is to provide a way of invoking your custom
|
||||||
application through the NuttShell (NSH) command line. NSH will support
|
application through the NuttShell (NSH) command line. NSH will support
|
||||||
a seamless method invoking the applications, when the following option is
|
a seamless method invoking the applications, when the following option is
|
||||||
enabled in the NuttX configuration file:
|
enabled in the NuttX configuration file:
|
||||||
|
|
||||||
CONFIG_NSH_BUILTIN_APPS=y
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
|
||||||
Applications registered in the apps/namedapp/namedapp_list.h file will then
|
Applications registered in the apps/builtin/builtin_list.h file will then
|
||||||
be accessible from the NSH command line. If you type 'help' at the NSH
|
be accessible from the NSH command line. If you type 'help' at the NSH
|
||||||
prompt, you will see a list of the registered commands.
|
prompt, you will see a list of the registered commands.
|
||||||
|
|
||||||
@@ -109,9 +109,9 @@ CONFIGURED_APPS list like:
|
|||||||
|
|
||||||
CONFIGURED_APPS += examples/hello system/poweroff
|
CONFIGURED_APPS += examples/hello system/poweroff
|
||||||
|
|
||||||
Named Start-Up main() function
|
Built-In Start-Up main() function
|
||||||
------------------------------
|
------------------------------
|
||||||
A named application can even be used as the main, start-up entry point
|
A builtin application can even be used as the main, start-up entry point
|
||||||
into your embedded software. When the user defines this option in
|
into your embedded software. When the user defines this option in
|
||||||
the NuttX configuration file:
|
the NuttX configuration file:
|
||||||
|
|
||||||
@@ -124,10 +124,10 @@ will call:
|
|||||||
|
|
||||||
int hello_main(int argc, char *argv[])
|
int hello_main(int argc, char *argv[])
|
||||||
|
|
||||||
Example Named Application
|
Example Built-In Application
|
||||||
-------------------------
|
----------------------------
|
||||||
An example application skeleton can be found under the examples/hello
|
An example application skeleton can be found under the examples/hello
|
||||||
sub-directory. This example shows how a named application can be added
|
sub-directory. This example shows how a builtin application can be added
|
||||||
to the project. One must define:
|
to the project. One must define:
|
||||||
|
|
||||||
1. create sub-directory as: appname
|
1. create sub-directory as: appname
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
# see misc/tools/kconfig-language.txt.
|
# see misc/tools/kconfig-language.txt.
|
||||||
#
|
#
|
||||||
|
|
||||||
config NAMEDAPP
|
config BUILTIN
|
||||||
bool "Support named applications"
|
bool "Support Builtin Applications"
|
||||||
default n
|
default n
|
||||||
---help---
|
---help---
|
||||||
Enable support for named applications. This features assigns a string
|
Enable support for builtin applications. This features assigns a string
|
||||||
name to an application. This feature is also the underlying requirement
|
name to an application. This feature is also the underlying requirement
|
||||||
to support built-in applications in the NuttShell (NSH).
|
to support built-in applications in the NuttShell (NSH).
|
||||||
|
|
||||||
if NAMEDAPP
|
if BUILTIN
|
||||||
endif
|
endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
# apps/namedapps/Make.defs
|
# apps/builtin/Make.defs
|
||||||
# Adds selected applications to apps/ build
|
# Adds selected applications to apps/ build
|
||||||
#
|
#
|
||||||
# Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
# Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
ifeq ($(CONFIG_NAMEDAPP),y)
|
ifeq ($(CONFIG_BUILTIN),y)
|
||||||
CONFIGURED_APPS += namedapp
|
CONFIGURED_APPS += builtin
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
# apps/nshlib/Makefile
|
# apps/builtin/Makefile
|
||||||
#
|
#
|
||||||
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -42,7 +42,7 @@ include $(APPDIR)/Make.defs
|
|||||||
# Source and object files
|
# Source and object files
|
||||||
|
|
||||||
ASRCS =
|
ASRCS =
|
||||||
CSRCS = namedapp.c exec_namedapp.c
|
CSRCS = builtin.c exec_builtin.c
|
||||||
|
|
||||||
ifeq ($(CONFIG_APPS_BINDIR),y)
|
ifeq ($(CONFIG_APPS_BINDIR),y)
|
||||||
CSRCS += binfs.c
|
CSRCS += binfs.c
|
||||||
@@ -83,8 +83,8 @@ $(COBJS): %$(OBJEXT): %.c
|
|||||||
$(Q) touch .built
|
$(Q) touch .built
|
||||||
|
|
||||||
.context:
|
.context:
|
||||||
@echo "/* List of application requirements, generated during make context. */" > namedapp_list.h
|
@echo "/* List of application requirements, generated during make context. */" > builtin_list.h
|
||||||
@echo "/* List of application entry points, generated during make context. */" > namedapp_proto.h
|
@echo "/* List of application entry points, generated during make context. */" > builtin_proto.h
|
||||||
$(Q) touch $@
|
$(Q) touch $@
|
||||||
|
|
||||||
context: .context
|
context: .context
|
||||||
@@ -103,8 +103,8 @@ distclean: clean
|
|||||||
$(call DELFILE, .context)
|
$(call DELFILE, .context)
|
||||||
$(call DELFILE, Make.dep)
|
$(call DELFILE, Make.dep)
|
||||||
$(call DELFILE, .depend)
|
$(call DELFILE, .depend)
|
||||||
$(call DELFILE, namedapp_list.h)
|
$(call DELFILE, builtin_list.h)
|
||||||
$(call DELFILE, namedapp_proto.h)
|
$(call DELFILE, builtin_proto.h)
|
||||||
|
|
||||||
-include Make.dep
|
-include Make.dep
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* apps/namedapps/binfs.c
|
* apps/builtin/binfs.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
#include <nuttx/fs/fs.h>
|
#include <nuttx/fs/fs.h>
|
||||||
#include <nuttx/fs/dirent.h>
|
#include <nuttx/fs/dirent.h>
|
||||||
|
|
||||||
#include "namedapp.h"
|
#include "builtin.h"
|
||||||
|
|
||||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_APPS_BINDIR)
|
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_APPS_BINDIR)
|
||||||
|
|
||||||
@@ -362,7 +362,7 @@ static int binfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir)
|
|||||||
/* Have we reached the end of the directory */
|
/* Have we reached the end of the directory */
|
||||||
|
|
||||||
index = dir->u.binfs.fb_index;
|
index = dir->u.binfs.fb_index;
|
||||||
if (namedapps[index].name == NULL)
|
if (builtins[index].name == NULL)
|
||||||
{
|
{
|
||||||
/* We signal the end of the directory by returning the
|
/* We signal the end of the directory by returning the
|
||||||
* special error -ENOENT
|
* special error -ENOENT
|
||||||
@@ -375,9 +375,9 @@ static int binfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir)
|
|||||||
{
|
{
|
||||||
/* Save the filename and file type */
|
/* Save the filename and file type */
|
||||||
|
|
||||||
fvdbg("Entry %d: \"%s\"\n", index, namedapps[index].name);
|
fvdbg("Entry %d: \"%s\"\n", index, builtins[index].name);
|
||||||
dir->fd_dir.d_type = DTYPE_FILE;
|
dir->fd_dir.d_type = DTYPE_FILE;
|
||||||
strncpy(dir->fd_dir.d_name, namedapps[index].name, NAME_MAX+1);
|
strncpy(dir->fd_dir.d_name, builtins[index].name, NAME_MAX+1);
|
||||||
|
|
||||||
/* The application list is terminated by an entry with a NULL name.
|
/* The application list is terminated by an entry with a NULL name.
|
||||||
* Therefore, there is at least one more entry in the list.
|
* Therefore, there is at least one more entry in the list.
|
||||||
@@ -559,7 +559,7 @@ static int binfs_stat(struct inode *mountpt, const char *relpath, struct stat *b
|
|||||||
{
|
{
|
||||||
/* Check if there is a file with this name. */
|
/* Check if there is a file with this name. */
|
||||||
|
|
||||||
if (namedapp_isavail(relpath) < 0)
|
if (builtin_isavail(relpath) < 0)
|
||||||
{
|
{
|
||||||
ret = -ENOENT;
|
ret = -ENOENT;
|
||||||
goto errout_with_semaphore;
|
goto errout_with_semaphore;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* apps/namedaps/namedapp.c
|
* apps/builtin/builtin.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||||
@@ -62,11 +62,11 @@ extern "C" {
|
|||||||
#define EXTERN extern
|
#define EXTERN extern
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "namedapp_proto.h"
|
#include "builtin_proto.h"
|
||||||
|
|
||||||
const struct namedapp_s namedapps[] =
|
const struct builtin_s builtins[] =
|
||||||
{
|
{
|
||||||
# include "namedapp_list.h"
|
# include "builtin_list.h"
|
||||||
{ NULL, 0, 0, 0 }
|
{ NULL, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -88,9 +88,9 @@ const struct namedapp_s namedapps[] =
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int number_namedapps(void)
|
int number_builtins(void)
|
||||||
{
|
{
|
||||||
return sizeof(namedapps)/sizeof(struct namedapp_s) - 1;
|
return sizeof(builtins)/sizeof(struct builtin_s) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* apps/namedaps/namedapp.h
|
* apps/builtin/builtin.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||||
@@ -35,8 +35,8 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef __APPS_NAMEDAPP_NAMEDAPP_H
|
#ifndef __APPS_BUILTIN_BUILTIN_H
|
||||||
#define __APPS_NAMEDAPP_NAMEDAPP_H
|
#define __APPS_BUILTIN_BUILTIN_H
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
@@ -53,7 +53,6 @@
|
|||||||
* Public Data
|
* Public Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#undef EXTERN
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
#define EXTERN extern "C"
|
#define EXTERN extern "C"
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -61,18 +60,18 @@ extern "C" {
|
|||||||
#define EXTERN extern
|
#define EXTERN extern
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EXTERN const struct namedapp_s namedapps[];
|
EXTERN const struct builtin_s builtins[];
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
EXTERN int number_namedapps(void);
|
EXTERN int number_builtins(void);
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __APPS_NAMEDAPP_NAMEDAPP_H */
|
#endif /* __APPS_BUILTIN_BUILTIN_H */
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* apps/namedaps/exec_namedapp.c
|
* apps/builtin/exec_builtin.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
* Author: Uros Platise <uros.platise@isotel.eu>
|
* Author: Uros Platise <uros.platise@isotel.eu>
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "namedapp.h"
|
#include "builtin.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Types
|
* Private Types
|
||||||
@@ -72,26 +72,26 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: namedapp_getname
|
* Name: builtin_getname
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return the name of the application at index in the table of named
|
* Return the name of the application at index in the table of builtin
|
||||||
* applications.
|
* applications.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
const char *namedapp_getname(int index)
|
const char *builtin_getname(int index)
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= number_namedapps())
|
if (index < 0 || index >= number_builtins())
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return namedapps[index].name;
|
return builtins[index].name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: namedapp_isavail
|
* Name: builtin_isavail
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return the index into the table of applications for the applicaiton with
|
* Return the index into the table of applications for the applicaiton with
|
||||||
@@ -99,13 +99,13 @@ const char *namedapp_getname(int index)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int namedapp_isavail(FAR const char *appname)
|
int builtin_isavail(FAR const char *appname)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; namedapps[i].name; i++)
|
for (i = 0; builtins[i].name; i++)
|
||||||
{
|
{
|
||||||
if (!strcmp(namedapps[i].name, appname))
|
if (!strcmp(builtins[i].name, appname))
|
||||||
{
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@@ -116,39 +116,39 @@ int namedapp_isavail(FAR const char *appname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: namedapp_isavail
|
* Name: builtin_isavail
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Execute the application with name 'appname', providing the arguments
|
* Execute the application with name 'appname', providing the arguments
|
||||||
* in the argv[] array.
|
* in the argv[] array.
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* On success, the task ID of the named application is returned. On
|
* On success, the task ID of the builtin application is returned. On
|
||||||
* failure, -1 (ERROR) is returned an the errno value is set appropriately.
|
* failure, -1 (ERROR) is returned an the errno value is set appropriately.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int exec_namedapp(FAR const char *appname, FAR const char **argv)
|
int exec_builtin(FAR const char *appname, FAR const char **argv)
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
/* Verify that an application with this name exists */
|
/* Verify that an application with this name exists */
|
||||||
|
|
||||||
index = namedapp_isavail(appname);
|
index = builtin_isavail(appname);
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
{
|
{
|
||||||
/* Disable pre-emption. This means that although we start the named
|
/* Disable pre-emption. This means that although we start the builtin
|
||||||
* application here, it will not actually run until pre-emption is
|
* application here, it will not actually run until pre-emption is
|
||||||
* re-enabled below.
|
* re-enabled below.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sched_lock();
|
sched_lock();
|
||||||
|
|
||||||
/* Start the named application task */
|
/* Start the builtin application task */
|
||||||
|
|
||||||
pid = TASK_CREATE(namedapps[index].name, namedapps[index].priority,
|
pid = TASK_CREATE(builtins[index].name, builtins[index].priority,
|
||||||
namedapps[index].stacksize, namedapps[index].main,
|
builtins[index].stacksize, builtins[index].main,
|
||||||
(argv) ? &argv[1] : (const char **)NULL);
|
(argv) ? &argv[1] : (const char **)NULL);
|
||||||
|
|
||||||
/* If robin robin scheduling is enabled, then set the scheduling policy
|
/* If robin robin scheduling is enabled, then set the scheduling policy
|
||||||
@@ -165,11 +165,11 @@ int exec_namedapp(FAR const char *appname, FAR const char **argv)
|
|||||||
* new task cannot yet have changed from its initial value.
|
* new task cannot yet have changed from its initial value.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
param.sched_priority = namedapps[index].priority;
|
param.sched_priority = builtins[index].priority;
|
||||||
sched_setscheduler(pid, SCHED_RR, ¶m);
|
sched_setscheduler(pid, SCHED_RR, ¶m);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Now let the named application run */
|
/* Now let the builtin application run */
|
||||||
|
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
|
|
||||||
+9
-9
@@ -52,7 +52,7 @@
|
|||||||
* Public Types
|
* Public Types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
struct namedapp_s
|
struct builtin_s
|
||||||
{
|
{
|
||||||
const char *name; /* Invocation name and as seen under /sbin/ */
|
const char *name; /* Invocation name and as seen under /sbin/ */
|
||||||
int priority; /* Use: SCHED_PRIORITY_DEFAULT */
|
int priority; /* Use: SCHED_PRIORITY_DEFAULT */
|
||||||
@@ -64,7 +64,7 @@ struct namedapp_s
|
|||||||
* Public Data
|
* Public Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* The "bindir" is file system that supports access to the named applications.
|
/* The "bindir" is file system that supports access to the builtin applications.
|
||||||
* It is typically mounted under /bin.
|
* It is typically mounted under /bin.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: namedapp_isavail
|
* Name: builtin_isavail
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Checks for availabiliy of application registerred during compile time.
|
* Checks for availabiliy of application registerred during compile time.
|
||||||
@@ -101,10 +101,10 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
EXTERN int namedapp_isavail(FAR const char *appname);
|
EXTERN int builtin_isavail(FAR const char *appname);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: namedapp_getname
|
* Name: builtin_getname
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Returns pointer to a name of built-in application pointed by the
|
* Returns pointer to a name of built-in application pointed by the
|
||||||
@@ -119,13 +119,13 @@ EXTERN int namedapp_isavail(FAR const char *appname);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
EXTERN const char *namedapp_getname(int index);
|
EXTERN const char *builtin_getname(int index);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: exec_namedapp
|
* Name: exec_builtin
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Executes builtin named application registered during compile time.
|
* Executes builtin applications registered during 'make context' time.
|
||||||
* New application is run in a separate task context (and thread).
|
* New application is run in a separate task context (and thread).
|
||||||
*
|
*
|
||||||
* Input Parameter:
|
* Input Parameter:
|
||||||
@@ -139,7 +139,7 @@ EXTERN const char *namedapp_getname(int index);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
EXTERN int exec_namedapp(FAR const char *appname, FAR const char **argv);
|
EXTERN int exec_builtin(FAR const char *appname, FAR const char **argv);
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
|
|||||||
+4
-4
@@ -15,12 +15,12 @@ if NSH_LIBRARY
|
|||||||
config NSH_BUILTIN_APPS
|
config NSH_BUILTIN_APPS
|
||||||
bool "Enable built-in applications"
|
bool "Enable built-in applications"
|
||||||
default y
|
default y
|
||||||
depends on NAMEDAPP
|
depends on BUILTIN
|
||||||
---help---
|
---help---
|
||||||
Support external registered, "named" applications that can be
|
Support external registered, "built-in" applications that can be
|
||||||
executed from the NSH command line (see apps/README.txt for
|
executed from the NSH command line (see apps/README.txt for
|
||||||
more information). This options requires support for named applications
|
more information). This options requires support for builtin
|
||||||
(NAMEDAPP).
|
applications (BUILTIN).
|
||||||
|
|
||||||
menu "Disable Individual commands"
|
menu "Disable Individual commands"
|
||||||
|
|
||||||
|
|||||||
@@ -945,7 +945,7 @@ NSH-Specific Configuration Settings
|
|||||||
the configs/<board-name>/defconfig file:
|
the configs/<board-name>/defconfig file:
|
||||||
|
|
||||||
* CONFIG_NSH_BUILTIN_APPS
|
* CONFIG_NSH_BUILTIN_APPS
|
||||||
Support external registered, "named" applications that can be
|
Support external registered, "builtin" applications that can be
|
||||||
executed from the NSH command line (see apps/README.txt for
|
executed from the NSH command line (see apps/README.txt for
|
||||||
more information).
|
more information).
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,7 @@
|
|||||||
* Attempt to execute the application task whose name is 'cmd'
|
* Attempt to execute the application task whose name is 'cmd'
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* <0 If exec_namedapp() fails, then the negated errno value
|
* <0 If exec_builtin() fails, then the negated errno value
|
||||||
* is returned.
|
* is returned.
|
||||||
* -1 (ERROR) if the application task corresponding to 'cmd' could not
|
* -1 (ERROR) if the application task corresponding to 'cmd' could not
|
||||||
* be started (possibly because it doesn not exist).
|
* be started (possibly because it doesn not exist).
|
||||||
@@ -119,7 +119,7 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
|||||||
* applications.
|
* applications.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ret = exec_namedapp(cmd, (FAR const char **)argv);
|
ret = exec_builtin(cmd, (FAR const char **)argv);
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
{
|
{
|
||||||
/* The application was successfully started (but still blocked because
|
/* The application was successfully started (but still blocked because
|
||||||
@@ -205,7 +205,7 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
|||||||
|
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
|
|
||||||
/* If exec_namedapp() or waitpid() failed, then return the negated errno
|
/* If exec_builtin() or waitpid() failed, then return the negated errno
|
||||||
* value.
|
* value.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -605,7 +605,7 @@ static inline void help_builtins(FAR struct nsh_vtbl_s *vtbl)
|
|||||||
/* List the set of available built-in commands */
|
/* List the set of available built-in commands */
|
||||||
|
|
||||||
nsh_output(vtbl, "\nBuiltin Apps:\n");
|
nsh_output(vtbl, "\nBuiltin Apps:\n");
|
||||||
for (i = 0; (name = namedapp_getname(i)) != NULL; i++)
|
for (i = 0; (name = builtin_getname(i)) != NULL; i++)
|
||||||
{
|
{
|
||||||
nsh_output(vtbl, " %s\n", name);
|
nsh_output(vtbl, " %s\n", name);
|
||||||
}
|
}
|
||||||
@@ -726,7 +726,7 @@ static int cmd_exit(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
|||||||
* Exectue the command in argv[0]
|
* Exectue the command in argv[0]
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* <0 If exec_namedapp() fails, then the negated errno value
|
* <0 If exec_builtin() fails, then the negated errno value
|
||||||
* is returned.
|
* is returned.
|
||||||
* -1 (ERRROR) if the command was unsuccessful
|
* -1 (ERRROR) if the command was unsuccessful
|
||||||
* 0 (OK) if the command was successful
|
* 0 (OK) if the command was successful
|
||||||
@@ -1439,13 +1439,13 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Handle the case where the command is executed in background.
|
/* Handle the case where the command is executed in background.
|
||||||
* However is app is to be started as namedapp new process will
|
* However is app is to be started as builtin new process will
|
||||||
* be created anyway, so skip this step. */
|
* be created anyway, so skip this step. */
|
||||||
|
|
||||||
#ifndef CONFIG_NSH_DISABLEBG
|
#ifndef CONFIG_NSH_DISABLEBG
|
||||||
if (vtbl->np.np_bg
|
if (vtbl->np.np_bg
|
||||||
#ifdef CONFIG_NSH_BUILTIN_APPS
|
#ifdef CONFIG_NSH_BUILTIN_APPS
|
||||||
&& namedapp_isavail(argv[0]) < 0
|
&& builtin_isavail(argv[0]) < 0
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2515,7 +2515,7 @@ nsh>
|
|||||||
<tr>
|
<tr>
|
||||||
<td valign="top"><b><code>CONFIG_NSH_BUILTIN_APPS</code></b></td>
|
<td valign="top"><b><code>CONFIG_NSH_BUILTIN_APPS</code></b></td>
|
||||||
<td>
|
<td>
|
||||||
Support external registered, "named" applications that can be
|
Support external registered, "builtin" applications that can be
|
||||||
executed from the NSH command line (see apps/README.txt for
|
executed from the NSH command line (see apps/README.txt for
|
||||||
more information).
|
more information).
|
||||||
</td>
|
</td>
|
||||||
@@ -3239,48 +3239,48 @@ Builtin Apps:
|
|||||||
Note that no detailed help information beyond the name of the built-in application is provided.
|
Note that no detailed help information beyond the name of the built-in application is provided.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h3>4.3.1 Named Applications</h3>
|
<h3>4.3.1 Built-In Applications</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<b>Overview.</b>
|
<b>Overview.</b>
|
||||||
The underlying logic that supports the NSH built-in applications is called "Named Applications".
|
The underlying logic that supports the NSH built-in applications is called "Built-In Applications".
|
||||||
The named application logic can be found at <code>apps/namedapp</code>.
|
The builtin application logic can be found at <code>apps/builtin</code>.
|
||||||
This logic simply does the following:
|
This logic simply does the following:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
<li>
|
<li>
|
||||||
<p>
|
<p>
|
||||||
It supports registration mechanism so that named applications can dynamically register themselves at build time, and
|
It supports registration mechanism so that builtin applications can dynamically register themselves at build time, and
|
||||||
</p>
|
</p>
|
||||||
<li>
|
<li>
|
||||||
<p>
|
<p>
|
||||||
Utility functions to look up, list, and execute the named applications.
|
Utility functions to look up, list, and execute the builtin applications.
|
||||||
</p>
|
</p>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<b>Named Application Utility Functions</b>.
|
<b>Built-In Application Utility Functions</b>.
|
||||||
The utility functions exported by the named application logic are prototyped in <code>apps/include/apps.h</code>.
|
The utility functions exported by the builtin application logic are prototyped in <code>apps/include/apps.h</code>.
|
||||||
These utility functions include:
|
These utility functions include:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<p>
|
<p>
|
||||||
<code>int namedapp_isavail(FAR const char *appname);</code>
|
<code>int builtin_isavail(FAR const char *appname);</code>
|
||||||
Checks for availability of application registered as <code>appname</code> during build time.
|
Checks for availability of application registered as <code>appname</code> during build time.
|
||||||
</p>
|
</p>
|
||||||
<li>
|
<li>
|
||||||
<p>
|
<p>
|
||||||
<code>const char *namedapp_getname(int index);</code>
|
<code>const char *builtin_getname(int index);</code>
|
||||||
Returns a pointer to a name of built-in application pointed by the <code>index</code>.
|
Returns a pointer to a name of built-in application pointed by the <code>index</code>.
|
||||||
This is the utility function that is used by NSH in order to list the available built-in applications when "<code>nsh> help</code>" is entered.
|
This is the utility function that is used by NSH in order to list the available built-in applications when "<code>nsh> help</code>" is entered.
|
||||||
</p>
|
</p>
|
||||||
<li>
|
<li>
|
||||||
<p>
|
<p>
|
||||||
<code>int exec_namedapp(FAR const char *appname, FAR const char **argv);</code>
|
<code>int exec_builtin(FAR const char *appname, FAR const char **argv);</code>
|
||||||
Executes built-in named application registered during compile time.
|
Executes built-in builtin application registered during compile time.
|
||||||
This is the utility function used by NSH to execute the built-in application.
|
This is the utility function used by NSH to execute the built-in application.
|
||||||
</p>
|
</p>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -3292,23 +3292,23 @@ Builtin Apps:
|
|||||||
<ol>
|
<ol>
|
||||||
<li>
|
<li>
|
||||||
<p>
|
<p>
|
||||||
<code>apps/namedapp/namedapp_proto.h</code>:
|
<code>apps/builtin/builtin_proto.h</code>:
|
||||||
Prototypes of application task entry points.
|
Prototypes of application task entry points.
|
||||||
</p>
|
</p>
|
||||||
<li>
|
<li>
|
||||||
<p>
|
<p>
|
||||||
<code>apps/namedapp/namedapp_list.h</code>:
|
<code>apps/builtin/builtin_list.h</code>:
|
||||||
Application specific information and start-up requirements
|
Application specific information and start-up requirements
|
||||||
</p>
|
</p>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<b>Registration of Named Applications</b>.
|
<b>Registration of Built-In Applications</b>.
|
||||||
The NuttX build occurs in several phases as different build targets are executed:
|
The NuttX build occurs in several phases as different build targets are executed:
|
||||||
(1) <i>context</i> when the configuration is established,
|
(1) <i>context</i> when the configuration is established,
|
||||||
(2) <i>depend </i>when target dependencies are generated, and
|
(2) <i>depend </i>when target dependencies are generated, and
|
||||||
(3) <i>default</i> (<code>all</code>) when the normal compilation and link operations are performed.
|
(3) <i>default</i> (<code>all</code>) when the normal compilation and link operations are performed.
|
||||||
Named application information is collected during the make <i>context</i> build phase.
|
Built-in application information is collected during the make <i>context</i> build phase.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@@ -3376,7 +3376,7 @@ make apps_distclean
|
|||||||
</pre></ul>
|
</pre></ul>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Logic for the <code>context</code> target in <code>apps/examples/hello/Makefile</code> registers the <code>hello_main()</code> application in the <code>namedapp</code>'s <code>namedapp_proto.h</code>and <code>namedapp_list.h</code> files.
|
Logic for the <code>context</code> target in <code>apps/examples/hello/Makefile</code> registers the <code>hello_main()</code> application in the <code>builtin</code>'s <code>builtin_proto.h</code>and <code>builtin_list.h</code> files.
|
||||||
That logic that does that in <code>apps/examples/hello/Makefile</code> is abstracted below:
|
That logic that does that in <code>apps/examples/hello/Makefile</code> is abstracted below:
|
||||||
</p>
|
</p>
|
||||||
<ol>
|
<ol>
|
||||||
@@ -3388,13 +3388,13 @@ make apps_distclean
|
|||||||
include $(APPDIR)/Make.defs
|
include $(APPDIR)/Make.defs
|
||||||
</pre></ul>
|
</pre></ul>
|
||||||
<p>
|
<p>
|
||||||
This defines a macro called <code>REGISTER</code> that adds data to the <i>namedapp</i> header files:
|
This defines a macro called <code>REGISTER</code> that adds data to the <i>builtin</i> header files:
|
||||||
</p>
|
</p>
|
||||||
<ul><pre>
|
<ul><pre>
|
||||||
define REGISTER
|
define REGISTER
|
||||||
@echo "Register: $1"
|
@echo "Register: $1"
|
||||||
@echo "{ \"$1\", $2, $3, $4 }," >> "$(APPDIR)/namedapp/namedapp_list.h"
|
@echo "{ \"$1\", $2, $3, $4 }," >> "$(APPDIR)/builtin/builtin_list.h"
|
||||||
@echo "EXTERN int $4(int argc, char *argv[]);" >> "$(APPDIR)/namedapp/namedapp_proto.h"
|
@echo "EXTERN int $4(int argc, char *argv[]);" >> "$(APPDIR)/builtin/builtin_proto.h"
|
||||||
endef
|
endef
|
||||||
</pre></ul>
|
</pre></ul>
|
||||||
<p>
|
<p>
|
||||||
@@ -3412,7 +3412,7 @@ STACKSIZE = 2048
|
|||||||
|
|
||||||
<li>
|
<li>
|
||||||
<p>
|
<p>
|
||||||
And finally, the <code>Makefile</code> invokes the <code>REGISTER</code> macro to added the <code>hello_main()</code> named application.
|
And finally, the <code>Makefile</code> invokes the <code>REGISTER</code> macro to added the <code>hello_main()</code> builtin application.
|
||||||
Then, when the system build completes, the <code>hello</code> command can be executed from the NSH command line.
|
Then, when the system build completes, the <code>hello</code> command can be executed from the NSH command line.
|
||||||
When the <code>hello</code> command is executed, it will start the task with entry point <code>hello_main()</code> with the default priority and with a stack size of 2K.
|
When the <code>hello</code> command is executed, it will start the task with entry point <code>hello_main()</code> with the default priority and with a stack size of 2K.
|
||||||
</p>
|
</p>
|
||||||
@@ -3424,16 +3424,16 @@ STACKSIZE = 2048
|
|||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<b>Other Uses of Named Application.</b>
|
<b>Other Uses of Built-In Application.</b>
|
||||||
The primary purpose of named applications is to support command line execution of applications from NSH.
|
The primary purpose of builtin applications is to support command line execution of applications from NSH.
|
||||||
However, there are two other uses of named applications that should be mentioned.
|
However, there are two other uses of builtin applications that should be mentioned.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
<li>
|
<li>
|
||||||
<p>
|
<p>
|
||||||
<b>Named Application Start-Up <code>main()</code> function</b>.
|
<b>Built-In Application Start-Up <code>main()</code> function</b>.
|
||||||
A named application can even be used as the main, start-up entry point into your embedded software.
|
A builtin application can even be used as the main, start-up entry point into your embedded software.
|
||||||
When the user defines this option in the NuttX configuration file:
|
When the user defines this option in the NuttX configuration file:
|
||||||
</p>
|
</p>
|
||||||
<ul><pre>
|
<ul><pre>
|
||||||
@@ -3451,11 +3451,11 @@ CONFIG_BUILTIN_APP_START=<application name>
|
|||||||
|
|
||||||
<li>
|
<li>
|
||||||
<p><b><i>binfs</i></b>.
|
<p><b><i>binfs</i></b>.
|
||||||
<i>binfs</i> is a tiny file system located at <code>apps/namedapp/binfs.c</code>.
|
<i>binfs</i> is a tiny file system located at <code>apps/builtin/binfs.c</code>.
|
||||||
This provides an alternative what of visualizing installed named applications.
|
This provides an alternative what of visualizing installed builtin applications.
|
||||||
Without <i>binfs</i>, you can see the installed named applications using the NSH help command.
|
Without <i>binfs</i>, you can see the installed builtin applications using the NSH help command.
|
||||||
<i>binfs</i> will create a tiny pseudo-file system mounted at <code>/bin</code>.
|
<i>binfs</i> will create a tiny pseudo-file system mounted at <code>/bin</code>.
|
||||||
Using <i>binfs</i>, you can see the available named applications by listing the contents of <code>/bin</code> directory.
|
Using <i>binfs</i>, you can see the available builtin applications by listing the contents of <code>/bin</code> directory.
|
||||||
This gives some superficial Unix compatibility, but does not really add any new functionality.
|
This gives some superficial Unix compatibility, but does not really add any new functionality.
|
||||||
</p>
|
</p>
|
||||||
</ol>
|
</ol>
|
||||||
@@ -3762,7 +3762,12 @@ mount -t vfat /dev/ram1 /tmp
|
|||||||
<li><a href="#cmdoverview">Background command priority</a></li>
|
<li><a href="#cmdoverview">Background command priority</a></li>
|
||||||
<li><a href="#custapps"><code>binfs</code></a></li>
|
<li><a href="#custapps"><code>binfs</code></a></li>
|
||||||
<li><a href="#custapps">Built-In applications</a></li>
|
<li><a href="#custapps">Built-In applications</a></li>
|
||||||
|
<li><a href="#custapps">Built-In application start-up <code>main()</code></a></li>
|
||||||
<li><a href="#builtinvars">Built-in variables</a></li>
|
<li><a href="#builtinvars">Built-in variables</a></li>
|
||||||
|
<li><a href="#custapps"><code>builtin_getname()</code></a></li>
|
||||||
|
<li><a href="#custapps"><code>builtin_isavail()</code></a></li>
|
||||||
|
<li><a href="#custapps"><code>builtin_list.h</code></a></li>
|
||||||
|
<li><a href="#custapps"><code>builtin_proto.h</code></a></li>
|
||||||
<li><a href="#cmdbase64dec"><code>base64dec</code></a></li>
|
<li><a href="#cmdbase64dec"><code>base64dec</code></a></li>
|
||||||
<li><a href="#cmdbase64enc"><code>base64enc</code></a></li>
|
<li><a href="#cmdbase64enc"><code>base64enc</code></a></li>
|
||||||
<li><a href="#cmdcat"><code>cat</code></a></li>
|
<li><a href="#cmdcat"><code>cat</code></a></li>
|
||||||
@@ -3827,12 +3832,12 @@ mount -t vfat /dev/ram1 /tmp
|
|||||||
<li><a href="#cmdecho"><code>echo</code></a></li>
|
<li><a href="#cmdecho"><code>echo</code></a></li>
|
||||||
<li><a href="#environvars">Environment Variables</a></li>
|
<li><a href="#environvars">Environment Variables</a></li>
|
||||||
<li><a href="#startupscript"><code>/etc/init.d/rcS</code></a>
|
<li><a href="#startupscript"><code>/etc/init.d/rcS</code></a>
|
||||||
<li><a href="#cmdexec"><code>exec</code></a></li>
|
|
||||||
<li><a href="#custapps"><code>exec_namedapp()</code></a></li>
|
|
||||||
<li><a href="#cmdexit"><code>exit</code></a></li>
|
|
||||||
<li><a href="#cmdfree"><code>free</code></a></li>
|
|
||||||
</ul></td>
|
</ul></td>
|
||||||
<td></ul>
|
<td></ul>
|
||||||
|
<li><a href="#cmdexec"><code>exec</code></a></li>
|
||||||
|
<li><a href="#custapps"><code>exec_builtin()</code></a></li>
|
||||||
|
<li><a href="#cmdexit"><code>exit</code></a></li>
|
||||||
|
<li><a href="#cmdfree"><code>free</code></a></li>
|
||||||
<li><a href="#custoncmds"><code>g_cmdmap</code></a></li>
|
<li><a href="#custoncmds"><code>g_cmdmap</code></a></li>
|
||||||
<li><a href="#custinit"><code>genromfs</code></a></li>
|
<li><a href="#custinit"><code>genromfs</code></a></li>
|
||||||
<li><a href="#cmdget"><code>get</code></a></li>
|
<li><a href="#cmdget"><code>get</code></a></li>
|
||||||
@@ -3858,12 +3863,6 @@ mount -t vfat /dev/ram1 /tmp
|
|||||||
<li><a href="#custinit"><code>mkromfsimg.sh</code></a></li>
|
<li><a href="#custinit"><code>mkromfsimg.sh</code></a></li>
|
||||||
<li><a href="#cmdmount"><code>mount</code></a></li>
|
<li><a href="#cmdmount"><code>mount</code></a></li>
|
||||||
<li><a href="#cmdmv"><code>mv</code></a></li>
|
<li><a href="#cmdmv"><code>mv</code></a></li>
|
||||||
<li><a href="#custapps">Named application start-up <code>main()</code></a></li>
|
|
||||||
<li><a href="#custapps">Named applications</a></li>
|
|
||||||
<li><a href="#custapps"><code>namedapp_getname()</code></a></li>
|
|
||||||
<li><a href="#custapps"><code>namedapp_isavail()</code></a></li>
|
|
||||||
<li><a href="#custapps"><code>namedapp_list.h</code></a></li>
|
|
||||||
<li><a href="#custapps"><code>namedapp_proto.h</code></a></li>
|
|
||||||
<li><a href="#cmdnfsmount"><code>nfsmount</code></a></li>
|
<li><a href="#cmdnfsmount"><code>nfsmount</code></a></li>
|
||||||
<li><a href="#cmdoverview"><code>nice</code></a></li>
|
<li><a href="#cmdoverview"><code>nice</code></a></li>
|
||||||
<li><a href="#custonshlib">NSH library (<code>nshlib</code>)</a></li>
|
<li><a href="#custonshlib">NSH library (<code>nshlib</code>)</a></li>
|
||||||
@@ -3887,7 +3886,7 @@ mount -t vfat /dev/ram1 /tmp
|
|||||||
<li><a href="#environvars"><code>PWD</code></a></li>
|
<li><a href="#environvars"><code>PWD</code></a></li>
|
||||||
<li><a href="#custinit"><code>rcS.template</code></a></li>
|
<li><a href="#custinit"><code>rcS.template</code></a></li>
|
||||||
<li><a href="#cmdoverview">Re-directed commands</a></li>
|
<li><a href="#cmdoverview">Re-directed commands</a></li>
|
||||||
<li><a href="#custapps">Registration of named applications</a></li>
|
<li><a href="#custapps">Registration of builtin applications</a></li>
|
||||||
<li><a href="#cmdrm"><code>rm</code></a></li>
|
<li><a href="#cmdrm"><code>rm</code></a></li>
|
||||||
<li><a href="#cmdrmdir"><code>rmdir</code></a></li>
|
<li><a href="#cmdrmdir"><code>rmdir</code></a></li>
|
||||||
<li><a href="#custinit">ROMFS, Modifying the ROMFS image</a></li>
|
<li><a href="#custinit">ROMFS, Modifying the ROMFS image</a></li>
|
||||||
|
|||||||
@@ -505,7 +505,7 @@ CONFIG_HAVE_CXX=y
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
CONFIG_NAMEDAPP=y
|
CONFIG_BUILTIN=y
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -531,7 +531,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
CONFIG_NAMEDAPP=y
|
CONFIG_BUILTIN=y
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -505,7 +505,7 @@ CONFIG_HAVE_CXX=y
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
CONFIG_NAMEDAPP=y
|
CONFIG_BUILTIN=y
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -630,7 +630,7 @@ CONFIG_HAVE_CXXINITIALIZE=y
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
CONFIG_NAMEDAPP=y
|
CONFIG_BUILTIN=y
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -474,7 +474,7 @@ CONFIG_HAVE_CXX=y
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
CONFIG_NAMEDAPP=y
|
CONFIG_BUILTIN=y
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -148,9 +148,9 @@ If you are running X11 applications as NSH add-on programs, then the stack
|
|||||||
size of the add-on program is controlled in another way. Here are the
|
size of the add-on program is controlled in another way. Here are the
|
||||||
steps for increasing the stack size in that case:
|
steps for increasing the stack size in that case:
|
||||||
|
|
||||||
cd ../apps/namedapps # Go to the namedapps directory
|
cd ../apps/builtin # Go to the builtin apps directory
|
||||||
vi namedapps_list.h # Edit this file and increase the stack size of the add-on
|
vi builtin_list.h # Edit this file and increase the stack size of the add-on
|
||||||
rm .built *.o # This will force the namedapps logic to rebuild
|
rm .built *.o # This will force the builtin apps logic to rebuild
|
||||||
|
|
||||||
Buffered I/O Issues
|
Buffered I/O Issues
|
||||||
-------------------
|
-------------------
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ CONFIG_UCLIBCXX_HAVE_LIBSUPCXX=y
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -376,7 +376,7 @@ CONFIG_HAVE_CXX=y
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -659,7 +659,7 @@ CONFIG_HAVE_CXXINITIALIZE=y
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -494,7 +494,7 @@ CONFIG_HAVE_CXXINITIALIZE=y
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -487,7 +487,7 @@ CONFIG_HAVE_CXXINITIALIZE=y
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
CONFIG_NAMEDAPP=y
|
CONFIG_BUILTIN=y
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -410,7 +410,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -426,7 +426,7 @@ CONFIG_UCLIBCXX_HAVE_LIBSUPCXX=y
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -460,7 +460,7 @@ CONFIG_HAVE_CXX=y
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -518,7 +518,7 @@ CONFIG_HAVE_CXXINITIALIZE=y
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -430,7 +430,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -430,7 +430,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ Execution starts in the following order:
|
|||||||
is set. It must be set for the VSN board.
|
is set. It must be set for the VSN board.
|
||||||
|
|
||||||
- boot, performs initial chip and board initialization
|
- boot, performs initial chip and board initialization
|
||||||
- sched/os_bringup.c then calls either user_start or exec_namedapp()
|
- sched/os_bringup.c then calls either user_start or exec_builtin()
|
||||||
with application as set in the .config
|
with application as set in the .config
|
||||||
|
|
||||||
|
|
||||||
@@ -55,4 +55,5 @@ Compile notes
|
|||||||
To link-in the sif_main() utility do, in this folder:
|
To link-in the sif_main() utility do, in this folder:
|
||||||
- make context TOPDIR=<path to nuttx top dir>
|
- make context TOPDIR=<path to nuttx top dir>
|
||||||
|
|
||||||
This will result in registering the application into the namedapp.
|
This will result in registering the application into the builtin application
|
||||||
|
registry.
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
|
|||||||
#
|
#
|
||||||
# Named Applications
|
# Named Applications
|
||||||
#
|
#
|
||||||
# CONFIG_NAMEDAPP is not set
|
# CONFIG_BUILTIN is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
|
|||||||
@@ -189,11 +189,11 @@ int os_bringup(void)
|
|||||||
svdbg("Starting init thread\n");
|
svdbg("Starting init thread\n");
|
||||||
|
|
||||||
#ifdef CONFIG_BUILTIN_APP_START
|
#ifdef CONFIG_BUILTIN_APP_START
|
||||||
/* Start the built-in named application, passing an "init" argument, so that
|
/* Start the built-in application, passing an "init" argument, so that
|
||||||
* application can distinguish different run-levels
|
* application can distinguish different run-levels
|
||||||
*/
|
*/
|
||||||
|
|
||||||
init_taskid = exec_namedapp(CONFIG_BUILTIN_APP_START, argv);
|
init_taskid = exec_builtin(CONFIG_BUILTIN_APP_START, argv);
|
||||||
#else
|
#else
|
||||||
/* Start the default application at CONFIG_USER_ENTRYPOINT() */
|
/* Start the default application at CONFIG_USER_ENTRYPOINT() */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user