NFS update + make some examples configurable as NSH built-ins

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4501 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo
2012-03-22 00:51:01 +00:00
parent a58d4b265f
commit 1018c9e441
25 changed files with 5290 additions and 1003 deletions
+6
View File
@@ -59,6 +59,9 @@ ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
CNTXTDIRS += adc can cdcacm composite ftpd dhcpd nettest qencoder telnetd
endif
ifeq ($(CONFIG_EXAMPLES_HELLO_BUILTIN),y)
CNTXTDIRS += hello
endif
ifeq ($(CONFIG_EXAMPLES_HELLOXX_BUILTIN),y)
CNTXTDIRS += helloxx
endif
@@ -80,6 +83,9 @@ endif
ifeq ($(CONFIG_EXAMPLES_NXTEXT_BUILTIN),y)
CNTXTDIRS += nxtext
endif
ifeq ($(CONFIG_EXAMPLES_OSTEST_BUILTIN),y)
CNTXTDIRS += ostest
endif
ifeq ($(CONFIG_EXAMPLES_TIFF_BUILTIN),y)
CNTXTDIRS += tiff
endif
+5
View File
@@ -384,6 +384,9 @@ examples/hello
than examples/null with a single printf statement. Really useful only
for bringing up new NuttX architectures.
* CONFIG_EXAMPLES_HELLO_BUILTIN
Build the "Hello, World" example as an NSH built-in application.
examples/helloxx
^^^^^^^^^^^^^^^^
@@ -848,6 +851,8 @@ examples/ostest
The behavior of the ostest can be modified with the following
settings in the configs/<board-name>/defconfig file:
* CONFIG_EXAMPLES_OSTEST_BUILTIN
Build the OS test example as an NSH built-in application.
* CONFIG_EXAMPLES_OSTEST_LOOPS
Used to control the number of executions of the test. If
undefined, the test executes one time. If defined to be
+15 -3
View File
@@ -1,8 +1,8 @@
############################################################################
# apps/examples/hello/Makefile
#
# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -37,6 +37,12 @@
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
# Hello, World! built-in application info
APPNAME = hello
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 2048
# Hello, World! Example
ASRCS =
@@ -75,7 +81,13 @@ $(COBJS): %$(OBJEXT): %.c
done ; )
@touch .built
context:
.context:
ifeq ($(CONFIG_EXAMPLES_HELLO_BUILTIN),y)
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
@touch $@
endif
context: .context
.depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+10 -4
View File
@@ -1,8 +1,8 @@
/****************************************************************************
* examples/hello/main.c
*
* Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* Copyright (C) 2008, 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -53,10 +53,16 @@
****************************************************************************/
/****************************************************************************
* user_start
* user_start/hello_main
****************************************************************************/
int user_start(int argc, char *argv[])
#ifdef CONFIG_EXAMPLES_HELLO_BUILTIN
# define MAIN_NAME hello_main
#else
# define MAIN_NAME user_start
#endif
int MAIN_NAME(int argc, char *argv[])
{
printf("Hello, World!!\n");
return 0;
+13 -1
View File
@@ -37,6 +37,12 @@
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
# ostest built-in application info
APPNAME = ostest
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 2048
# NuttX OS Test
ASRCS =
@@ -119,7 +125,13 @@ $(COBJS): %$(OBJEXT): %.c
done ; )
@touch .built
context:
.context:
ifeq ($(CONFIG_EXAMPLES_OSTEST_BUILTIN),y)
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
@touch $@
endif
context: .context
.depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+19 -11
View File
@@ -458,10 +458,18 @@ static void stdio_test(void)
****************************************************************************/
/****************************************************************************
* user_start
* user_start/ostest_main
****************************************************************************/
int user_start(int argc, char *argv[])
#ifdef CONFIG_EXAMPLES_OSTEST_BUILTIN
# define MAIN_NAME ostest_main
# define MAIN_STRING "ostest_main: "
#else
# define MAIN_NAME user_start
# define MAIN_STRING "user_start: "
#endif
int MAIN_NAME(int argc, char *argv[])
{
int result;
@@ -484,19 +492,19 @@ int user_start(int argc, char *argv[])
/* Set up some environment variables */
#ifndef CONFIG_DISABLE_ENVIRON
printf("user_start: putenv(%s)\n", g_putenv_value);
printf(MAIN_STRING "putenv(%s)\n", g_putenv_value);
putenv(g_putenv_value); /* Varaible1=BadValue3 */
printf("user_start: setenv(%s, %s, TRUE)\n", g_var1_name, g_var1_value);
printf(MAIN_STRING "setenv(%s, %s, TRUE)\n", g_var1_name, g_var1_value);
setenv(g_var1_name, g_var1_value, TRUE); /* Variable1=GoodValue1 */
printf("user_start: setenv(%s, %s, FALSE)\n", g_var2_name, g_bad_value1);
printf(MAIN_STRING "setenv(%s, %s, FALSE)\n", g_var2_name, g_bad_value1);
setenv(g_var2_name, g_bad_value1, FALSE); /* Variable2=BadValue1 */
printf("user_start: setenv(%s, %s, TRUE)\n", g_var2_name, g_var2_value);
printf(MAIN_STRING "setenv(%s, %s, TRUE)\n", g_var2_name, g_var2_value);
setenv(g_var2_name, g_var2_value, TRUE); /* Variable2=GoodValue2 */
printf("user_start: setenv(%s, %s, FALSE)\n", g_var3_name, g_var3_name);
printf(MAIN_STRING "setenv(%s, %s, FALSE)\n", g_var3_name, g_var3_name);
setenv(g_var3_name, g_var3_value, FALSE); /* Variable3=GoodValue3 */
printf("user_start: setenv(%s, %s, FALSE)\n", g_var3_name, g_var3_name);
printf(MAIN_STRING "setenv(%s, %s, FALSE)\n", g_var3_name, g_var3_name);
setenv(g_var3_name, g_bad_value2, FALSE); /* Variable3=GoodValue3 */
show_environment(true, true, true);
#endif
@@ -510,13 +518,13 @@ int user_start(int argc, char *argv[])
#endif
if (result == ERROR)
{
printf("user_start: ERROR Failed to start user_main\n");
printf(MAIN_STRING "ERROR Failed to start user_main\n");
}
else
{
printf("user_start: Started user_main at PID=%d\n", result);
printf(MAIN_STRING "Started user_main at PID=%d\n", result);
}
printf("user_start: Exitting\n");
printf(MAIN_STRING "Exitting\n");
return 0;
}