From ab14fe398b2693da319e4bd47ed1adda704e8175 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 16 Jul 2011 15:52:15 +0000 Subject: Make NX and NXTEXT built-ins; extend stm3210e-eval/nsh2 config to run the NX example from the NX command line git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3791 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 3 +++ apps/Makefile | 4 ++-- apps/examples/Makefile | 7 +++++++ apps/examples/README.txt | 4 ++++ apps/examples/nx/Makefile | 16 ++++++++++++++-- apps/examples/nx/nx_main.c | 6 +++++- apps/examples/nxtext/Makefile | 16 ++++++++++++++-- apps/examples/nxtext/nxtext_main.c | 6 +++++- apps/nshlib/README.txt | 5 +++++ 9 files changed, 59 insertions(+), 8 deletions(-) (limited to 'apps') diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index cd6cc3071..85da11502 100755 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -72,3 +72,6 @@ 6.7 2011-xx-xx Gregory Nutt + * apps/examples/nx and nxtext: These examples can now be built as NSH + "built-in" commands. + diff --git a/apps/Makefile b/apps/Makefile index c11829f15..d4a6b2e73 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -2,8 +2,8 @@ # apps/Makefile # # Copyright (C) 2011 Uros Platise. All rights reserved. -# Author: Uros Platise -# Gregory Nutt +# Authors: Uros Platise +# Gregory Nutt # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions diff --git a/apps/examples/Makefile b/apps/examples/Makefile index b19dff483..f79a366ef 100644 --- a/apps/examples/Makefile +++ b/apps/examples/Makefile @@ -41,12 +41,19 @@ SUBDIRS = buttons dhcpd ftpc hello helloxx hidkbd igmp mm mount nettest \ nsh null nx nxffs nxflat nxtext ostest pashello pipe poll rgmp romfs \ sendmail serloop thttpd udp uip usbserial usbstorage wget wlan +# Sub-directories that might need context setup + +CNTXTDIRS = nx nxtext + all: nothing .PHONY: nothing context depend clean distclean nothing: context: + @for dir in $(CNTXTDIRS) ; do \ + $(MAKE) -C $$dir context TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done depend: @for dir in $(SUBDIRS) ; do \ diff --git a/apps/examples/README.txt b/apps/examples/README.txt index 07d92a76d..6c1c1e55d 100644 --- a/apps/examples/README.txt +++ b/apps/examples/README.txt @@ -237,6 +237,8 @@ examples/nx defined in include/nuttx/nx.h. The following configuration options can be selected: + CONFIG_EXAMPLES_NX_BUILTIN -- Build the NX example as a "built-in" + that can be executed from the NSH command line CONFIG_EXAMPLES_NX_VPLANE -- The plane to select from the frame- buffer driver for use in the test. Default: 0 CONFIG_EXAMPLES_NX_DEVNO - The LCD device to select from the LCD @@ -322,6 +324,8 @@ examples/nxtest The following configuration options can be selected: + CONFIG_EXAMPLES_NXTEXT_BUILTIN -- Build the NXTEXT example as a "built-in" + that can be executed from the NSH command line CONFIG_EXAMPLES_NXTEXT_VPLANE -- The plane to select from the frame- buffer driver for use in the test. Default: 0 CONFIG_EXAMPLES_NXTEXT_DEVNO - The LCD device to select from the LCD diff --git a/apps/examples/nx/Makefile b/apps/examples/nx/Makefile index 326edd118..bdeb57e22 100644 --- a/apps/examples/nx/Makefile +++ b/apps/examples/nx/Makefile @@ -59,12 +59,18 @@ endif ROOTDEPPATH = --dep-path . +# NX built-in application info + +APPNAME = nx +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 + # Common build VPATH = all: .built -.PHONY: clean depend distclean +.PHONY: context clean depend distclean $(AOBJS): %$(OBJEXT): %.S $(call ASSEMBLE, $<, $@) @@ -78,7 +84,13 @@ $(COBJS): %$(OBJEXT): %.c done ; ) @touch .built -context: +.context: +ifeq ($(CONFIG_EXAMPLES_NX_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/nx/nx_main.c b/apps/examples/nx/nx_main.c index 3f0578e3f..d8b1eaba0 100644 --- a/apps/examples/nx/nx_main.c +++ b/apps/examples/nx/nx_main.c @@ -610,10 +610,14 @@ static int nxeg_initialize(void) ****************************************************************************/ /**************************************************************************** - * Name: user_start + * Name: user_start/nx_main ****************************************************************************/ +#ifdef CONFIG_EXAMPLES_NX_BUILTIN +int nx_main(int argc, char **argv) +#else int user_start(int argc, char *argv[]) +#endif { NXEGWINDOW hwnd1; NXEGWINDOW hwnd2; diff --git a/apps/examples/nxtext/Makefile b/apps/examples/nxtext/Makefile index 4451c9faf..75e489943 100644 --- a/apps/examples/nxtext/Makefile +++ b/apps/examples/nxtext/Makefile @@ -60,12 +60,18 @@ endif ROOTDEPPATH = --dep-path . +# NXTEXT built-in application info + +APPNAME = nxtext +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 + # Common build VPATH = all: .built -.PHONY: clean depend distclean +.PHONY: context clean depend distclean $(AOBJS): %$(OBJEXT): %.S $(call ASSEMBLE, $<, $@) @@ -79,7 +85,13 @@ $(COBJS): %$(OBJEXT): %.c done ; ) @touch .built -context: +.context: +ifeq ($(CONFIG_EXAMPLES_NXTEXT_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/nxtext/nxtext_main.c b/apps/examples/nxtext/nxtext_main.c index a3027165d..6a53f9d2c 100644 --- a/apps/examples/nxtext/nxtext_main.c +++ b/apps/examples/nxtext/nxtext_main.c @@ -339,10 +339,14 @@ static int nxtext_initialize(void) ****************************************************************************/ /**************************************************************************** - * Name: user_start + * Name: user_start/nxtext_main ****************************************************************************/ +#ifdef CONFIG_EXAMPLES_NXTEXT_BUILTIN +int nxtext_main(int argc, char **argv) +#else int user_start(int argc, char *argv[]) +#endif { FAR struct nxtext_state_s *bgstate; NXWINDOW hwnd = NULL; diff --git a/apps/nshlib/README.txt b/apps/nshlib/README.txt index a678824e3..8435f6317 100644 --- a/apps/nshlib/README.txt +++ b/apps/nshlib/README.txt @@ -841,6 +841,11 @@ NSH-Specific Configuration Settings The behavior of NSH can be modified with the following settings in the configs//defconfig file: + * CONFIG_NSH_BUILTIN_APPS + Support external registered, "named" applications that can be + executed from the NSH command line (see apps/README.txt for + more information). + * CONFIG_NSH_FILEIOSIZE Size of a static I/O buffer used for file access (ignored if there is no filesystem). Default is 1024. -- cgit v1.2.3