2011-03-10 15:42:28 +01:00
|
|
|
Application Folder
|
|
|
|
==================
|
|
|
|
|
2011-03-12 23:09:14 +01:00
|
|
|
This folder provides various applications found in sub-directories.
|
2011-03-10 15:42:28 +01:00
|
|
|
|
|
|
|
Application entry points with their requirements are gathered together in
|
2011-03-14 15:14:54 +01:00
|
|
|
in two files:
|
2011-03-18 19:31:26 +01:00
|
|
|
|
2011-03-28 15:01:57 +02:00
|
|
|
- namedapp/namedapp_proto.h Entry points, prototype function
|
|
|
|
- namedapp/namedapp_list.h Application specific information and requirements
|
2011-03-10 15:42:28 +01:00
|
|
|
|
2011-03-24 01:28:50 +01:00
|
|
|
The build occurs in several phases as different build targets are executed:
|
|
|
|
(1) contex, (2) depend, and (3) default (all). Application information is
|
|
|
|
collected during the make context build phase.
|
2011-03-10 15:42:28 +01:00
|
|
|
|
|
|
|
To execute an application function:
|
2011-03-18 19:31:26 +01:00
|
|
|
|
2011-03-28 15:01:57 +02:00
|
|
|
exec_namedapp() is defined in the nuttx/include/apps/apps.h
|
2011-03-10 15:42:28 +01:00
|
|
|
|
|
|
|
NuttShell provides transparent method of invoking the command, when the
|
2011-03-12 23:09:14 +01:00
|
|
|
following option is enabled:
|
2011-03-18 19:31:26 +01:00
|
|
|
|
2011-03-18 21:35:31 +01:00
|
|
|
CONFIG_NSH_BUILTIN_APPS=y
|
2011-03-10 15:42:28 +01:00
|
|
|
|
2011-03-18 19:31:26 +01:00
|
|
|
in the NuttX configuration.
|
|
|
|
|
|
|
|
A special configuration file is used to configure which applications
|
|
|
|
are to be included in the build. This file is configs/<board>/<configuration>/appconfig.
|
|
|
|
The existence of the appconfig file in the board configuration directory
|
|
|
|
is sufficient to enable building of applications.
|
|
|
|
|
|
|
|
The appconfig file is copied into the apps/ directory as .config when
|
|
|
|
NuttX is configured. .config is included in the toplevel apps/Makefile.
|
|
|
|
As a minimum, this configuration file must define files to add to the
|
|
|
|
CONFIGURED_APPS list like:
|
|
|
|
|
2011-04-01 16:30:43 +02:00
|
|
|
CONFIGURED_APPS += hello poweroff jvm
|
2011-03-18 19:31:26 +01:00
|
|
|
|
2011-03-24 01:28:50 +01:00
|
|
|
The form of each entry is <dir>=<dependency> when:
|
2011-03-18 19:31:26 +01:00
|
|
|
|
|
|
|
<dir> is the name of a subdirectory in the apps directory, and
|
|
|
|
|
|
|
|
<dependency> is a make dependency. This will be "touch"-ed each time
|
|
|
|
that the sub-directory is rebuilt.
|
2011-03-10 15:42:28 +01:00
|
|
|
|
2011-03-12 23:09:14 +01:00
|
|
|
When the user defines an option:
|
2011-03-10 15:42:28 +01:00
|
|
|
CONFIG_BUILTIN_APP_START=<application name>
|
2011-03-12 23:09:14 +01:00
|
|
|
|
2011-03-14 15:14:54 +01:00
|
|
|
that application shall be invoked immediately after system starts.
|
|
|
|
Note that application name must be provided in ".." as: "hello",
|
|
|
|
will call:
|
2011-03-12 23:09:14 +01:00
|
|
|
int hello_main(int argc, char *argv[])
|
2011-03-10 15:42:28 +01:00
|
|
|
|
|
|
|
Application skeleton can be found under the hello sub-directory,
|
|
|
|
which shows how an application can be added to the project. One must
|
|
|
|
define:
|
2011-03-19 22:04:13 +01:00
|
|
|
|
2011-03-10 15:42:28 +01:00
|
|
|
1. create sub-directory as: appname
|
|
|
|
2. provide entry point: appname_main()
|
|
|
|
3. set the requirements in the file: Makefile, specially the lines:
|
|
|
|
APPNAME = appname
|
|
|
|
PRIORITY = SCHED_PRIORITY_DEFAULT
|
|
|
|
STACKSIZE = 768
|
|
|
|
ASRCS = asm source file list as a.asm b.asm ...
|
|
|
|
CSRCS = C source file list as foo1.c foo2.c ..
|
|
|
|
|
2011-03-12 23:09:14 +01:00
|
|
|
4. add application in the apps/Makefile
|
2011-03-19 22:04:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|