NFS update + make some examples configurable as NSH built-ins
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4501 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
8d9253461a
commit
4c4cd3f8e2
@ -208,3 +208,7 @@
|
||||
* apps/examples/can: Add conditional compilation so that the test can be
|
||||
configured to only send messages or to only receive messages. This will
|
||||
let the test work in other modes than simple loopback testing.
|
||||
* apps/examples/hello and apps/examples/ostest: Can now be built as NSH
|
||||
built-int functions.
|
||||
* vsn/hello: Removed. The modified apps/examples/hello is enough "Hello,
|
||||
World!"
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
############################################################################
|
||||
# apps/vsn/Makefile
|
||||
#
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
# Copyright (C) 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
|
||||
@ -37,7 +37,7 @@
|
||||
|
||||
# Sub-directories
|
||||
|
||||
SUBDIRS = hello poweroff ramtron sdcard sysinfo
|
||||
SUBDIRS = poweroff ramtron sdcard sysinfo
|
||||
|
||||
all: nothing
|
||||
.PHONY: nothing context depend clean distclean
|
||||
|
@ -1,114 +0,0 @@
|
||||
############################################################################
|
||||
# Makefile
|
||||
#
|
||||
# Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||
# Author: Uros Platise <uros.platise@isotel.eu>
|
||||
# Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
# TODO, this makefile should run make under the app dirs, instead of
|
||||
# sourcing the Make.defs!
|
||||
|
||||
-include $(TOPDIR)/.config
|
||||
-include $(TOPDIR)/Make.defs
|
||||
include $(APPDIR)/Make.defs
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
INCDIROPT = -w
|
||||
endif
|
||||
|
||||
# Hello Application
|
||||
# TODO: appname can be automatically extracted from the directory name
|
||||
|
||||
APPNAME = hello
|
||||
PRIORITY = SCHED_PRIORITY_DEFAULT
|
||||
STACKSIZE = 768
|
||||
|
||||
ASRCS =
|
||||
CSRCS = hello.c
|
||||
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
||||
# Common build
|
||||
|
||||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: context depend clean distclean
|
||||
|
||||
$(AOBJS): %$(OBJEXT): %.S
|
||||
$(call ASSEMBLE, $<, $@)
|
||||
|
||||
$(COBJS): %$(OBJEXT): %.c
|
||||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
@touch .built
|
||||
|
||||
# Register application
|
||||
|
||||
.context:
|
||||
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
|
||||
@touch $@
|
||||
|
||||
context: .context
|
||||
|
||||
# Create dependencies
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f .context Make.dep .depend
|
||||
|
||||
-include Make.dep
|
@ -1,5 +0,0 @@
|
||||
|
||||
This application provides Hello Builtin Application skeleton
|
||||
|
||||
Source: NuttX
|
||||
Date: 13. March 2011
|
@ -1,75 +0,0 @@
|
||||
/****************************************************************************
|
||||
* hello/hello.c
|
||||
*
|
||||
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||
* Author: Uros Platise <uros.platise@isotel.eu>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
void memtest(void)
|
||||
{
|
||||
char *p;
|
||||
int i, j;
|
||||
|
||||
for (i=0; i<1000; i++) {
|
||||
p = malloc(40000);
|
||||
if (!p) {
|
||||
printf("No memory\n");
|
||||
break;
|
||||
}
|
||||
for (j=0; j<40000; j++) p[j] = 0;
|
||||
free(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Example of a standalone application
|
||||
*/
|
||||
int hello_main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
printf("Hello Builtin Application\n"
|
||||
"Found argc=%d arguments and are as follows:\n", argc);
|
||||
|
||||
// note that stdout is bufferred and that fflush() and is called on exit.
|
||||
fflush(stdout);
|
||||
|
||||
for (i=0; i<argc; i++)
|
||||
printf("%s\n", argv[i]);
|
||||
|
||||
//memtest();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user