From 0c7804b74dcec7d746e95425157bd6afc1435de6 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 22 Mar 2012 00:51:01 +0000 Subject: 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 --- apps/examples/hello/Makefile | 18 +++++++++++++++--- apps/examples/hello/main.c | 14 ++++++++++---- 2 files changed, 25 insertions(+), 7 deletions(-) (limited to 'apps/examples/hello') diff --git a/apps/examples/hello/Makefile b/apps/examples/hello/Makefile index 0798c5f90..9c3cda894 100644 --- a/apps/examples/hello/Makefile +++ b/apps/examples/hello/Makefile @@ -1,8 +1,8 @@ ############################################################################ # apps/examples/hello/Makefile # -# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt +# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt # # 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 diff --git a/apps/examples/hello/main.c b/apps/examples/hello/main.c index 308603f33..7934dc34b 100644 --- a/apps/examples/hello/main.c +++ b/apps/examples/hello/main.c @@ -1,8 +1,8 @@ /**************************************************************************** * examples/hello/main.c * - * Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Copyright (C) 2008, 2011-2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt * * 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; -- cgit v1.2.3