apps/-related updates
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3364 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
ce549bd9e9
commit
411b30916b
4
Makefile
4
Makefile
@ -97,11 +97,11 @@ $(BIN): $(OBJS) $(BUILTIN_APPS_BUILT)
|
|||||||
done ; )
|
done ; )
|
||||||
|
|
||||||
.depend: Makefile $(SRCS)
|
.depend: Makefile $(SRCS)
|
||||||
|
@echo "/* List of application requirements, generated during make depend. */" > exec_nuttapp_list.h
|
||||||
|
@echo "/* List of application entry points, generated during make depend. */" > exec_nuttapp_proto.h
|
||||||
@$(MKDEP) $(ROOTDEPPATH) \
|
@$(MKDEP) $(ROOTDEPPATH) \
|
||||||
$(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
$(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||||
@touch $@
|
@touch $@
|
||||||
echo "/* List of application requirements, generated during make depend. */" > exec_nuttapp_list.h
|
|
||||||
echo "/* List of application entry points, generated during make depend. */" > exec_nuttapp_proto.h
|
|
||||||
@for dir in $(BUILTIN_APPS_DIR) ; do \
|
@for dir in $(BUILTIN_APPS_DIR) ; do \
|
||||||
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" depend ; \
|
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" depend ; \
|
||||||
done
|
done
|
||||||
|
6
README
6
README
@ -35,7 +35,7 @@ where each application can be controlled as:
|
|||||||
To include applications under the user ../apps directory:
|
To include applications under the user ../apps directory:
|
||||||
CONFIG_BUILTIN_APPS_USER=y/n
|
CONFIG_BUILTIN_APPS_USER=y/n
|
||||||
|
|
||||||
When the user defines an option:
|
When the user defines an option: (NOT IMPLEMENTED YET)
|
||||||
CONFIG_BUILTIN_APP_START=<application name>
|
CONFIG_BUILTIN_APP_START=<application name>
|
||||||
|
|
||||||
then after initialization of the NuttX OS it starts this application
|
then after initialization of the NuttX OS it starts this application
|
||||||
@ -56,7 +56,3 @@ define:
|
|||||||
4. add enable/disable option in the top file in this directory as:
|
4. add enable/disable option in the top file in this directory as:
|
||||||
ifeq CONFIG_BUILTIN_APPS_<NAME>
|
ifeq CONFIG_BUILTIN_APPS_<NAME>
|
||||||
...
|
...
|
||||||
|
|
||||||
To include user (external) application create an application under
|
|
||||||
../apps directory and steps 1. - 3. The last 4. step is not needed, as,
|
|
||||||
all applications under ../apps becomes a part of the build process.
|
|
||||||
|
@ -91,27 +91,49 @@ static const struct nuttapp_s nuttapps[] = {
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
const char * nuttapp_getname(int index)
|
||||||
|
{
|
||||||
|
if ( index < 0 || index >= (sizeof(nuttapps)/sizeof(struct nuttapp_s)) )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return nuttapps[index].name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int nuttapp_isavail(FAR const char *appname)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i=0; nuttapps[i].name; i++)
|
||||||
|
{
|
||||||
|
if ( !strcmp(nuttapps[i].name, appname) )
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
errno = ENOENT;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int exec_nuttapp(FAR const char *appname, FAR const char *argv[])
|
int exec_nuttapp(FAR const char *appname, FAR const char *argv[])
|
||||||
{
|
{
|
||||||
int i, ret = ERROR;
|
int i;
|
||||||
|
|
||||||
// Not sure what to do with exports and nexports ... as found in exec
|
// Not sure what to do with exports and nexports ... as found in exec
|
||||||
// FAR const struct symtab_s *exports, int nexports
|
// FAR const struct symtab_s *exports, int nexports
|
||||||
// so they are ommited in the args list.
|
// so they are ommited in the args list.
|
||||||
|
|
||||||
for (i=0; nuttapps[i].name; i++)
|
if ( (i = nuttapp_isavail(appname)) >= 0 )
|
||||||
{
|
{
|
||||||
if ( !strcmp(nuttapps[i].name, appname) )
|
|
||||||
{
|
|
||||||
#ifndef CONFIG_CUSTOM_STACK
|
#ifndef CONFIG_CUSTOM_STACK
|
||||||
ret = task_create(nuttapps[i].name, nuttapps[i].priority,
|
i = task_create(nuttapps[i].name, nuttapps[i].priority,
|
||||||
nuttapps[i].stacksize, nuttapps[i].main, &argv[1]);
|
nuttapps[i].stacksize, nuttapps[i].main, &argv[1]);
|
||||||
#else
|
#else
|
||||||
ret = task_create(nuttapps[i].name, nuttapps[i].priority, nuttapps[i].main, &argv[1]);
|
i = task_create(nuttapps[i].name, nuttapps[i].priority, nuttapps[i].main, &argv[1]);
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return i;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
errno = ENOENT;
|
|
||||||
return ret;
|
return i;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user