diff --git a/apps/examples/Kconfig b/apps/examples/Kconfig index c0d126ad47..865268addb 100644 --- a/apps/examples/Kconfig +++ b/apps/examples/Kconfig @@ -3,59 +3,206 @@ # see misc/tools/kconfig-language.txt. # +menu "ADC Example" source "$APPSDIR/examples/adc/Kconfig" +endmenu + +menu "Buttons Example" source "$APPSDIR/examples/buttons/Kconfig" +endmenu + +menu "CAN Example" source "$APPSDIR/examples/can/Kconfig" +endmenu + +menu "USB CDC/ACM Class Driver Example" source "$APPSDIR/examples/cdcacm/Kconfig" +endmenu + +menu "USB composite Class Driver Example" source "$APPSDIR/examples/composite/Kconfig" -source "$APPSDIR/examples/cxxtest/Kconfig" +endmenu + +menu "DHCP Server Example" source "$APPSDIR/examples/dhcpd/Kconfig" -source "$APPSDIR/examples/elf/Kconfig" +endmenu + +menu "FTP Client Example" source "$APPSDIR/examples/ftpc/Kconfig" +endmenu + +menu "FTP Server Example" source "$APPSDIR/examples/ftpd/Kconfig" +endmenu + +menu "\"Hello, World!\" Example" source "$APPSDIR/examples/hello/Kconfig" +endmenu + +menu "\"Hello, World!\" C++ Example" source "$APPSDIR/examples/helloxx/Kconfig" -source "$APPSDIR/examples/json/Kconfig" +endmenu + +menu "USB HID Keyboard Example" source "$APPSDIR/examples/hidkbd/Kconfig" +endmenu + +menu "IGMP Example" source "$APPSDIR/examples/igmp/Kconfig" +endmenu + +menu "LCD Read/Write Example" source "$APPSDIR/examples/lcdrw/Kconfig" +endmenu + +menu "Memory Management Example" source "$APPSDIR/examples/mm/Kconfig" +endmenu + +menu "File System Mount Example" source "$APPSDIR/examples/mount/Kconfig" +endmenu + +menu "FreeModBus Example" source "$APPSDIR/examples/modbus/Kconfig" +endmenu + +menu "Network Test Example" source "$APPSDIR/examples/nettest/Kconfig" +endmenu + +menu "NuttShell (NSH) Example" source "$APPSDIR/examples/nsh/Kconfig" +endmenu + +menu "NULL Example" source "$APPSDIR/examples/null/Kconfig" +endmenu + +menu "NX Graphics Example" source "$APPSDIR/examples/nx/Kconfig" +endmenu + +menu "NxConsole Example" source "$APPSDIR/examples/nxconsole/Kconfig" +endmenu + +menu "NXFFS File System Example" source "$APPSDIR/examples/nxffs/Kconfig" +endmenu + +menu "NXFLAT Example" source "$APPSDIR/examples/nxflat/Kconfig" +endmenu + +menu "NX Graphics \"Hello, World!\" Example" source "$APPSDIR/examples/nxhello/Kconfig" +endmenu + +menu "NX Graphics image Example" source "$APPSDIR/examples/nximage/Kconfig" +endmenu + +menu "NX Graphics lines Example" source "$APPSDIR/examples/nxlines/Kconfig" +endmenu + +menu "NX Graphics Text Example" source "$APPSDIR/examples/nxtext/Kconfig" +endmenu + +menu "OS Test Example" source "$APPSDIR/examples/ostest/Kconfig" +endmenu + +menu "Pascal \"Hello, World!\"example" source "$APPSDIR/examples/pashello/Kconfig" +endmenu + +menu "Pipe Example" source "$APPSDIR/examples/pipe/Kconfig" +endmenu + +menu "Poll Example" source "$APPSDIR/examples/poll/Kconfig" +endmenu + +menu "Pulse Width Modulation (PWM) Example" source "$APPSDIR/examples/pwm/Kconfig" +endmenu + +menu "Quadrature Encoder Example" source "$APPSDIR/examples/qencoder/Kconfig" -source "$APPSDIR/examples/relays/Kconfig" +endmenu + +menu "RGMP Example" source "$APPSDIR/examples/rgmp/Kconfig" +endmenu + +menu "ROMFS Example" source "$APPSDIR/examples/romfs/Kconfig" +endmenu + +menu "sendmail Example" source "$APPSDIR/examples/sendmail/Kconfig" +endmenu + +menu "Serial Loopback Example" source "$APPSDIR/examples/serloop/Kconfig" +endmenu + +menu "Telnet Daemon Example" source "$APPSDIR/examples/telnetd/Kconfig" +endmenu + +menu "THTTPD Web Server Example" source "$APPSDIR/examples/thttpd/Kconfig" +endmenu + +menu "TIFF Generation Example" source "$APPSDIR/examples/tiff/Kconfig" +endmenu + +menu "Touchscreen Example" source "$APPSDIR/examples/touchscreen/Kconfig" +endmenu + +menu "UDP Example" source "$APPSDIR/examples/udp/Kconfig" +endmenu + +menu "UDP Discovery Daemon Example" source "$APPSDIR/examples/discover/Kconfig" +endmenu + +menu "uIP Web Server Example" source "$APPSDIR/examples/uip/Kconfig" +endmenu + +menu "USB Serial Test Example" source "$APPSDIR/examples/usbserial/Kconfig" +endmenu + +menu "USB Mass Storage Class Example" source "$APPSDIR/examples/usbstorage/Kconfig" +endmenu + +menu "USB Serial Terminal Example" source "$APPSDIR/examples/usbterm/Kconfig" +endmenu + +menu "Watchdog timer Example" source "$APPSDIR/examples/watchdog/Kconfig" +endmenu + +menu "wget Example" source "$APPSDIR/examples/wget/Kconfig" -source "$APPSDIR/examples/wgetjson/Kconfig" +endmenu + +menu "WLAN Example" source "$APPSDIR/examples/wlan/Kconfig" +endmenu + +menu "XML RPC Example" source "$APPSDIR/examples/xmlrpc/Kconfig" +endmenu diff --git a/apps/examples/Make.defs b/apps/examples/Make.defs index 3d95ccb16d..d03b976d25 100644 --- a/apps/examples/Make.defs +++ b/apps/examples/Make.defs @@ -54,10 +54,6 @@ ifeq ($(CONFIG_EXAMPLES_COMPOSITE),y) CONFIGURED_APPS += examples/composite endif -ifeq ($(CONFIG_EXAMPLES_CXXTEST),y) -CONFIGURED_APPS += examples/cxxtest -endif - ifeq ($(CONFIG_EXAMPLES_DHCPD),y) CONFIGURED_APPS += examples/dhcpd endif @@ -66,10 +62,6 @@ ifeq ($(CONFIG_EXAMPLES_DISCOVER),y) CONFIGURED_APPS += examples/discover endif -ifeq ($(CONFIG_EXAMPLES_ELF),y) -CONFIGURED_APPS += examples/elf -endif - ifeq ($(CONFIG_EXAMPLES_FTPC),y) CONFIGURED_APPS += examples/ftpc endif @@ -94,10 +86,6 @@ ifeq ($(CONFIG_EXAMPLES_IGMP),y) CONFIGURED_APPS += examples/igmp endif -ifeq ($(CONFIG_EXAMPLES_JSON),y) -CONFIGURED_APPS += examples/json -endif - ifeq ($(CONFIG_EXAMPLES_LCDRW),y) CONFIGURED_APPS += examples/lcdrw endif @@ -106,10 +94,6 @@ ifeq ($(CONFIG_EXAMPLES_MM),y) CONFIGURED_APPS += examples/mm endif -ifeq ($(CONFIG_EXAMPLES_MODBUS),y) -CONFIGURED_APPS += examples/modbus -endif - ifeq ($(CONFIG_EXAMPLES_MOUNT),y) CONFIGURED_APPS += examples/mount endif @@ -182,10 +166,6 @@ ifeq ($(CONFIG_EXAMPLES_QENCODER),y) CONFIGURED_APPS += examples/qencoder endif -ifeq ($(CONFIG_EXAMPLES_RELAYS),y) -CONFIGURED_APPS += examples/relays -endif - ifeq ($(CONFIG_EXAMPLES_RGMP),y) CONFIGURED_APPS += examples/rgmp endif @@ -246,10 +226,6 @@ ifeq ($(CONFIG_EXAMPLES_WGET),y) CONFIGURED_APPS += examples/wget endif -ifeq ($(CONFIG_EXAMPLES_WGETJSON),y) -CONFIGURED_APPS += examples/wgetjson -endif - ifeq ($(CONFIG_EXAMPLES_WLAN),y) CONFIGURED_APPS += examples/wlan endif diff --git a/apps/examples/Makefile b/apps/examples/Makefile index 9d20e9312d..453f99ce71 100644 --- a/apps/examples/Makefile +++ b/apps/examples/Makefile @@ -37,12 +37,12 @@ # Sub-directories -SUBDIRS = adc buttons can cdcacm composite cxxtest dhcpd discover elf ftpc -SUBDIRS += ftpd hello helloxx hidkbd igmp json lcdrw mm modbus mount -SUBDIRS += nettest nsh null nx nxconsole nxffs nxflat nxhello nximage -SUBDIRS += nxlines nxtext ostest pashello pipe poll pwm qencoder relays -SUBDIRS += rgmp romfs serloop telnetd thttpd tiff touchscreen udp uip -SUBDIRS += usbserial sendmail usbstorage usbterm watchdog wget wgetjson wlan +SUBDIRS = adc buttons can cdcacm composite dhcpd discover ftpc ftpd hello +SUBDIRS += helloxx hidkbd igmp lcdrw mm modbus mount nettest nsh null nx +SUBDIRS += nxconsole nxffs nxflat nxhello nximage nxlines nxtext ostest +SUBDIRS += pashello pipe poll pwm qencoder rgmp romfs serloop telnetd +SUBDIRS += thttpd tiff touchscreen udp uip usbserial sendmail usbstorage +SUBDIRS += usbterm watchdog wget wlan # Sub-directories that might need context setup. Directories may need # context setup for a variety of reasons, but the most common is because @@ -57,8 +57,8 @@ SUBDIRS += usbserial sendmail usbstorage usbterm watchdog wget wgetjson wlan CNTXTDIRS = pwm ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -CNTXTDIRS += adc can cdcacm composite cxxtestdhcpd discover ftpd json -CNTXTDIRS += modbus nettest nxlines relays qencoder telnetd watchdog wgetjson +CNTXTDIRS += adc can cdcacm composite discover ftpd dhcpd modbus nettest +CNTXTDIRS += qencoder telnetd watchdog endif ifeq ($(CONFIG_EXAMPLES_HELLO_BUILTIN),y) @@ -79,6 +79,9 @@ endif ifeq ($(CONFIG_EXAMPLES_NXIMAGE_BUILTIN),y) CNTXTDIRS += nximage endif +ifeq ($(CONFIG_EXAMPLES_LINES_BUILTIN),y) +CNTXTDIRS += nxlines +endif ifeq ($(CONFIG_EXAMPLES_NXTEXT_BUILTIN),y) CNTXTDIRS += nxtext endif @@ -102,25 +105,27 @@ all: nothing .PHONY: nothing context depend clean distclean -define SDIR_template -$(1)_$(2): - $(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" -endef - -$(foreach SDIR, $(CNTXTDIRS), $(eval $(call SDIR_template,$(SDIR),context))) -$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),depend))) -$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),clean))) -$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),distclean))) - nothing: -context: $(foreach SDIR, $(CNTXTDIRS), $(SDIR)_context) +context: + @for dir in $(CNTXTDIRS) ; do \ + $(MAKE) -C $$dir context TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done -depend: $(foreach SDIR, $(SUBDIRS), $(SDIR)_depend) +depend: + @for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir depend TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done -clean: $(foreach SDIR, $(SUBDIRS), $(SDIR)_clean) +clean: + @for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done -distclean: clean $(foreach SDIR, $(SUBDIRS), $(SDIR)_distclean) +distclean: clean + @for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done -include Make.dep diff --git a/apps/examples/README.txt b/apps/examples/README.txt index 1463b0253f..763427e326 100644 --- a/apps/examples/README.txt +++ b/apps/examples/README.txt @@ -239,29 +239,6 @@ examples/composite CONFIG_EXAMPLES_COMPOSITE_TRACEINTERRUPTS Show interrupt-related events. -examples/cxxtest -^^^^^^^^^^^^^^^^ - - This is a test of the C++ standard library. At present a port of the uClibc++ - C++ library is available. Due to licensinging issues, the uClibc++ C++ library - is not included in the NuttX source tree by default, but must be installed - (see misc/uClibc++/README.txt for installation). - - The NuttX setting that are required include: - - CONFIG_HAVE_CXX=y - CONFIG_HAVE_CXXINITIALIZE=y - CONFIG_UCLIBCXX=y - - Additional uClibc++ settings may be required in your build environment. - - The uClibc++ test includes simple test of: - - - iostreams, - - STL, - - RTTI, and - - Exceptions - examples/dhcpd ^^^^^^^^^^^^^^ @@ -320,68 +297,6 @@ examples/discover CONFIG_EXAMPLES_DISCOVER_DRIPADDR - Router IP address CONFIG_EXAMPLES_DISCOVER_NETMASK - Network Mask -examples/elf -^^^^^^^^^^^^ - - This example builds a small ELF loader test case. This includes several - test programs under examples/elf tests. These tests are build using - the relocatable ELF format and installed in a ROMFS file system. At run time, - each program in the ROMFS file system is executed. Requires CONFIG_ELF. - Other configuration options: - - CONFIG_EXAMPLES_ELF_DEVMINOR - The minor device number of the ROMFS block. - For example, the N in /dev/ramN. Used for registering the RAM block driver - that will hold the ROMFS file system containing the ELF executables to be - tested. Default: 0 - - CONFIG_EXAMPLES_ELF_DEVPATH - The path to the ROMFS block driver device. This - must match EXAMPLES_ELF_DEVMINOR. Used for registering the RAM block driver - that will hold the ROMFS file system containing the ELF executables to be - tested. Default: "/dev/ram0" - - NOTES: - - 1. CFLAGS should be provided in CELFFLAGS. RAM and FLASH memory regions - may require long allcs. For ARM, this might be: - - CELFFLAGS = $(CFLAGS) -mlong-calls - - Similarly for C++ flags which must be provided in CXXELFFLAGS. - - 2. Your top-level nuttx/Make.defs file must alos include an approproate definition, - LDELFFLAGS, to generate a relocatable ELF object. With GNU LD, this should - include '-r' and '-e main' (or _main on some platforms). - - LDELFFLAGS = -r -e main - - If you use GCC to link, you make also need to include '-nostdlib' or - '-nostartfiles' and '-nodefaultlibs'. - - 3. This example also requires genromfs. genromfs can be build as part of the - nuttx toolchain. Or can built from the genromfs sources that can be found - at misc/tools/genromfs-0.5.2.tar.gz. In any event, the PATH variable must - include the path to the genromfs executable. - - 4. ELF size: The ELF files in this example are, be default, quite large - because they include a lot of "build garbage". You can greatly reduce the - size of the ELF binaries are using the 'objcopy --strip-unneeded' command to - remove un-necessary information from the ELF files. - - 5. Simulator. You cannot use this example with the the NuttX simulator on - Cygwin. That is because the Cygwin GCC does not generate ELF file but - rather some Windows-native binary format. - - If you really want to do this, you can create a NuttX x86 buildroot toolchain - and use that be build the ELF executables for the ROMFS file system. - - 6. Linker scripts. You might also want to use a linker scripts to combine - sections better. An example linker script is at nuttx/binfmt/libelf/gnu-elf.ld. - That example might have to be tuned for your particular linker output to - position additional sections correctly. The GNU LD LDELFFLAGS then might - be: - - LDELFFLAGS = -r -e main -T$(TOPDIR)/binfmt/libelf/gnu-elf.ld - examples/ftpc ^^^^^^^^^^^^^ @@ -567,19 +482,6 @@ examples/igmp CONFIGURED_APPS += uiplib -examples/json -^^^^^^^^^^^^^ - - This example exercises the cJSON implementation at apps/netutils/json. - This example contains logic taken from the cJSON project: - - http://sourceforge.net/projects/cjson/ - - The example corresponds to SVN revision r42 (with lots of changes for - NuttX coding standards). As of r42, the SVN repository was last updated - on 2011-10-10 so I presume that the code is stable and there is no risk - of maintaining duplicate logic in the NuttX repository. - examples/lcdrw ^^^^^^^^^^^^^^ @@ -594,11 +496,6 @@ examples/lcdrw * CONFIG_EXAMPLES_LDCRW_YRES LCD Y resolution. Default: 320 - NOTE: This test exercises internal lcd driver interfaces. As such, it - relies on internal OS interfaces that are not normally available to a - user-space program. As a result, this example cannot be used if a - NuttX is built as a protected, supervisor kernel (CONFIG_NUTTX_KERNEL). - examples/mm ^^^^^^^^^^^ @@ -941,6 +838,8 @@ examplex/nxlines The following configuration options can be selected: + CONFIG_EXAMPLES_NXLINES_BUILTIN -- Build the NXLINES example as a "built-in" + that can be executed from the NSH command line CONFIG_EXAMPLES_NXLINES_VPLANE -- The plane to select from the frame- buffer driver for use in the test. Default: 0 CONFIG_EXAMPLES_NXLINES_DEVNO - The LCD device to select from the LCD @@ -978,9 +877,6 @@ examplex/nxlines FAR struct fb_vtable_s *up_nxdrvinit(unsigned int devno); #endif - CONFIG_NSH_BUILTIN_APPS - Build the NX lines examples as an NSH built-in - function. - examples/nxtext ^^^^^^^^^^^^^^^ @@ -1088,17 +984,6 @@ examples/ostest Specifies the number of threads to create in the barrier test. The default is 8 but a smaller number may be needed on systems without sufficient memory to start so many threads. - * CONFIG_EXAMPLES_OSTEST_RR_RANGE - During round-robin scheduling test two threads are created. Each of the threads - searches for prime numbers in the configurable range, doing that configurable - number of times. - This value specifies the end of search range and together with number of runs - allows to configure the length of this test - it should last at least a few - tens of seconds. Allowed values [1; 32767], default 10000 - * CONFIG_EXAMPLES_OSTEST_RR_RUNS - During round-robin scheduling test two threads are created. Each of the threads - searches for prime numbers in the configurable range, doing that configurable - number of times. examples/pashello ^^^^^^^^^^^^^^^^^ @@ -1225,28 +1110,17 @@ examples/qencoder Specific configuration options for this example include: - CONFIG_EXAMPLES_QENCODER_DEVPATH - The path to the QE device. Default: - /dev/qe0 - CONFIG_EXAMPLES_QENCODER_NSAMPLES - If CONFIG_NSH_BUILTIN_APPS - is defined, then the number of samples is provided on the command line - and this value is ignored. Otherwise, this number of samples is - collected and the program terminates. Default: Samples are collected - indefinitely. - CONFIG_EXAMPLES_QENCODER_DELAY - This value provides the delay (in - milliseonds) between each sample. If CONFIG_NSH_BUILTIN_APPS - is defined, then this value is the default delay if no other delay is - provided on the command line. Default: 100 milliseconds - -examples/relays -^^^^^^^^^^^^^^^ - - Requires CONFIG_ARCH_RELAYS. - Contributed by Darcy Gong. - - NOTE: This test exercises internal relay driver interfaces. As such, it - relies on internal OS interfaces that are not normally available to a - user-space program. As a result, this example cannot be used if a - NuttX is built as a protected, supervisor kernel (CONFIG_NUTTX_KERNEL). + CONFIG_EXAMPLES_QENCODER_DEVPATH - The path to the QE device. Default: + /dev/qe0 + CONFIG_EXAMPLES_QENCODER_NSAMPLES - If CONFIG_NSH_BUILTIN_APPS + is defined, then the number of samples is provided on the command line + and this value is ignored. Otherwise, this number of samples is + collected and the program terminates. Default: Samples are collected + indefinitely. + CONFIG_EXAMPLES_QENCODER_DELAY - This value provides the delay (in + milliseonds) between each sample. If CONFIG_NSH_BUILTIN_APPS + is defined, then this value is the default delay if no other delay is + provided on the command line. Default: 100 milliseconds examples/rgmp ^^^^^^^^^^^^^ @@ -1798,16 +1672,7 @@ examples/wget CONFIGURED_APPS += resolv CONFIGURED_APPS += webclient -examples/wget -^^^^^^^^^^^^^ - - Uses wget to get a JSON encoded file, then decodes the file. - - CONFIG_EXAMPLES_WDGETJSON_MAXSIZE - Max. JSON Buffer Size - CONFIG_EXAMPLES_EXAMPLES_WGETJSON_URL - wget URL - examples/xmlrpc -^^^^^^^^^^^^^^^ This example exercises the "Embeddable Lightweight XML-RPC Server" which is discussed at: diff --git a/apps/examples/adc/Makefile b/apps/examples/adc/Makefile index 69862b383d..6357dfc3db 100644 --- a/apps/examples/adc/Makefile +++ b/apps/examples/adc/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/adc/Makefile # -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -80,7 +76,9 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built .context: @@ -92,17 +90,16 @@ endif context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/adc/adc_main.c b/apps/examples/adc/adc_main.c index 553658fee0..404fba8c1f 100644 --- a/apps/examples/adc/adc_main.c +++ b/apps/examples/adc/adc_main.c @@ -289,7 +289,7 @@ int adc_main(int argc, char *argv[]) { message("adc_main: open %s failed: %d\n", g_adcstate.devpath, errno); errval = 2; - goto errout; + goto errout_with_dev; } /* Now loop the appropriate number of times, displaying the collected @@ -357,11 +357,6 @@ int adc_main(int argc, char *argv[]) } } - close(fd); - return OK; - - /* Error exits */ - errout_with_dev: close(fd); diff --git a/apps/examples/buttons/Makefile b/apps/examples/buttons/Makefile index 77c1cd67df..25d1ef2c2d 100644 --- a/apps/examples/buttons/Makefile +++ b/apps/examples/buttons/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/buttons/Makefile # -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -80,7 +76,9 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built .context: @@ -92,17 +90,16 @@ endif context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/can/Makefile b/apps/examples/can/Makefile index 8924797e37..c6dc5af84c 100644 --- a/apps/examples/can/Makefile +++ b/apps/examples/can/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/can/Makefile # -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -80,7 +76,9 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built .context: @@ -92,17 +90,16 @@ endif context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/cdcacm/Makefile b/apps/examples/cdcacm/Makefile index e8d03807d8..3fa886d561 100644 --- a/apps/examples/cdcacm/Makefile +++ b/apps/examples/cdcacm/Makefile @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -84,7 +80,9 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built .context: @@ -95,18 +93,17 @@ $(COBJS): %$(OBJEXT): %.c context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/hello/Makefile b/apps/examples/hello/Makefile index 560b0da358..1d78d723ed 100644 --- a/apps/examples/hello/Makefile +++ b/apps/examples/hello/Makefile @@ -54,14 +54,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -80,7 +76,9 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built .context: @@ -92,17 +90,16 @@ endif context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/helloxx/Makefile b/apps/examples/helloxx/Makefile index 062da7d588..8e85eab23e 100644 --- a/apps/examples/helloxx/Makefile +++ b/apps/examples/helloxx/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/helloxx/Makefile # -# Copyright (C) 2009-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2009-2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -50,14 +50,10 @@ CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS) OBJS = $(AOBJS) $(COBJS) $(CXXOBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -73,7 +69,7 @@ STACKSIZE = 2048 VPATH = all: .built -.PHONY: clean depend distclean chkcxx +.PHONY: clean depend disclean chkcxx chkcxx: ifneq ($(CONFIG_HAVE_CXX),y) @@ -97,7 +93,9 @@ $(CXXOBJS): %$(OBJEXT): %.cxx $(call COMPILEXX, $<, $@) .built: chkcxx $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built .context: @@ -109,17 +107,16 @@ endif context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/mm/Makefile b/apps/examples/mm/Makefile index 5ba7f4eec9..24ed4926f7 100644 --- a/apps/examples/mm/Makefile +++ b/apps/examples/mm/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/mm/Makefile # -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -74,23 +70,24 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/mount/Makefile b/apps/examples/mount/Makefile index 133bdfa1f5..69cf970cf0 100644 --- a/apps/examples/mount/Makefile +++ b/apps/examples/mount/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/Makefile # -# Copyright (C) 2007-2008, 2010-2010, 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2007-2008, 2010-2010 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -74,23 +70,24 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/nsh/Makefile b/apps/examples/nsh/Makefile index c7d212fc2c..bad40fb2e2 100644 --- a/apps/examples/nsh/Makefile +++ b/apps/examples/nsh/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/nsh/Makefile # -# Copyright (C) 2007-2008, 2010-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2007-2008, 2010-2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -74,23 +70,24 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/null/Makefile b/apps/examples/null/Makefile index 47ec4cdafd..6341206007 100644 --- a/apps/examples/null/Makefile +++ b/apps/examples/null/Makefile @@ -1,7 +1,7 @@ ############################################################################ # examples/null/Makefile # -# Copyright (C) 2007-2008, 2010-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2007-2008, 2010-2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -74,23 +70,24 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/ostest/Kconfig b/apps/examples/ostest/Kconfig index c3fe8f21df..0da7e4ce34 100644 --- a/apps/examples/ostest/Kconfig +++ b/apps/examples/ostest/Kconfig @@ -39,31 +39,4 @@ config EXAMPLES_OSTEST_NBARRIER_THREADS is 8 but a smaller number may be needed on systems without sufficient memory to start so many threads. -config EXAMPLES_OSTEST_RR_RANGE - int "Round-robin test - end of search range" - default 10000 - range 1 32767 - ---help--- - During round-robin scheduling test two threads are created. Each of the threads - searches for prime numbers in the configurable range, doing that configurable - number of times. - - This value specifies the end of search range and together with number of runs - allows to configure the length of this test - it should last at least a few - tens of seconds. Allowed values [1; 32767], default 10000 - -config EXAMPLES_OSTEST_RR_RUNS - int "Round-robin test - number of runs" - default 10 - range 1 32767 - ---help--- - During round-robin scheduling test two threads are created. Each of the threads - searches for prime numbers in the configurable range, doing that configurable - number of times. - - This value specifies the number of times the thread searches the range for - prime numbers and together with end of search range allows to configure the - length of this test - it should last at least a few tens of seconds. Allowed - values [1; 32767], default 10 - endif diff --git a/apps/examples/ostest/Makefile b/apps/examples/ostest/Makefile index 3e78c64e83..374964b396 100644 --- a/apps/examples/ostest/Makefile +++ b/apps/examples/ostest/Makefile @@ -98,14 +98,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -124,7 +120,9 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built .context: @@ -136,17 +134,16 @@ endif context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/ostest/roundrobin.c b/apps/examples/ostest/roundrobin.c index bfd344df34..5167a857ed 100644 --- a/apps/examples/ostest/roundrobin.c +++ b/apps/examples/ostest/roundrobin.c @@ -1,7 +1,7 @@ /******************************************************************************** * examples/ostest/roundrobin.c * - * Copyright (C) 2007, 2008, 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -39,7 +39,6 @@ #include #include -#include #include "ostest.h" #if CONFIG_RR_INTERVAL > 0 @@ -48,87 +47,115 @@ * Definitions ********************************************************************************/ -/* This numbers should be tuned for different processor speeds via .config file. - * With default values the test takes about 30s on Cortex-M3 @ 24MHz. With 32767 - * range and 10 runs it takes ~320s. */ +/* This number may need to be tuned for different processor speeds. Since these + * arrays must be large to very correct SCHED_RR behavior, this test may require + * too much memory on many targets. + */ -#ifndef CONFIG_EXAMPLES_OSTEST_RR_RANGE -# define CONFIG_EXAMPLES_OSTEST_RR_RANGE 10000 -# warning "CONFIG_EXAMPLES_OSTEST_RR_RANGE undefined, using default value = 10000" -#elif (CONFIG_EXAMPLES_OSTEST_RR_RANGE < 1) || (CONFIG_EXAMPLES_OSTEST_RR_RANGE > 32767) -# define CONFIG_EXAMPLES_OSTEST_RR_RANGE 10000 -# warning "Invalid value of CONFIG_EXAMPLES_OSTEST_RR_RANGE, using default value = 10000" -#endif +/* #define CONFIG_NINTEGERS 32768 Takes forever on 60Mhz ARM7 */ -#ifndef CONFIG_EXAMPLES_OSTEST_RR_RUNS -# define CONFIG_EXAMPLES_OSTEST_RR_RUNS 10 -# warning "CONFIG_EXAMPLES_OSTEST_RR_RUNS undefined, using default value = 10" -#elif (CONFIG_EXAMPLES_OSTEST_RR_RUNS < 1) || (CONFIG_EXAMPLES_OSTEST_RR_RUNS > 32767) -# define CONFIG_EXAMPLES_OSTEST_RR_RUNS 10 -# warning "Invalid value of CONFIG_EXAMPLES_OSTEST_RR_RUNS, using default value = 10" -#endif +#define CONFIG_NINTEGERS 2048 + +/******************************************************************************** + * Private Data + ********************************************************************************/ + +static int prime1[CONFIG_NINTEGERS]; +static int prime2[CONFIG_NINTEGERS]; /******************************************************************************** * Private Functions ********************************************************************************/ /******************************************************************************** - * Name: get_primes + * Name: dosieve * * Description - * This function searches for prime numbers in the most primitive way possible. + * This implements a "sieve of aristophanes" algorithm for finding prime number. + * Credit for this belongs to someone, but I am not sure who anymore. Anyway, + * the only purpose here is that we need some algorithm that takes a long period + * of time to execute. + * ********************************************************************************/ -static void get_primes(int *count, int *last) +static void dosieve(int *prime) { - int number; - int local_count = 0; - *last = 0; // to make compiler happy + int a,d; + int i; + int j; - for (number = 1; number < CONFIG_EXAMPLES_OSTEST_RR_RANGE; number++) - { - int div; - bool is_prime = true; + a = 2; + d = a; - for (div = 2; div <= number / 2; div++) - if (number % div == 0) - { - is_prime = false; - break; - } - - if (is_prime) + for (i = 0; i < CONFIG_NINTEGERS; i++) { - local_count++; - *last = number; -#if 0 /* We don't really care what the numbers are */ - printf(" Prime %d: %d\n", local_count, number); -#endif + prime[i] = i+2; } - } - *count = local_count; + for (i = 1; i < 10; i++) + { + for (j = 0; j < CONFIG_NINTEGERS; j++) + { + d = a + d; + if (d < CONFIG_NINTEGERS) + { + prime[d]=0; + } + } + a++; + d = a; + i++; + } + +#if 0 /* We don't really care what the numbers are */ + for (i = 0, j= 0; i < CONFIG_NINTEGERS; i++) + { + if (prime[i] != 0) + { + printf(" Prime %d: %d\n", j, prime[i]); + j++; + } + } +#endif } /******************************************************************************** - * Name: get_primes_thread + * Name: sieve1 ********************************************************************************/ -static void *get_primes_thread(void *parameter) +static void *sieve1(void *parameter) { - int id = (int)parameter; - int i, count, last; + int i; - printf("get_primes_thread id=%d started, looking for primes < %d, doing %d run(s)\n", - id, CONFIG_EXAMPLES_OSTEST_RR_RANGE, CONFIG_EXAMPLES_OSTEST_RR_RUNS); + printf("sieve1 started\n"); - for (i = 0; i < CONFIG_EXAMPLES_OSTEST_RR_RUNS; i++) + for (i = 0; i < 1000; i++) { - get_primes(&count, &last); + dosieve(prime1); } - printf("get_primes_thread id=%d finished, found %d primes, last one was %d\n", - id, count, last); + printf("sieve1 finished\n"); + + pthread_exit(NULL); + return NULL; /* To keep some compilers happy */ +} + +/******************************************************************************** + * Name: sieve2 + ********************************************************************************/ + +static void *sieve2(void *parameter) +{ + int i; + + printf("sieve2 started\n"); + + for (i = 0; i < 1000; i++) + { + dosieve(prime2); + } + + printf("sieve2 finished\n"); pthread_exit(NULL); return NULL; /* To keep some compilers happy */ @@ -144,13 +171,14 @@ static void *get_primes_thread(void *parameter) void rr_test(void) { - pthread_t get_primes1_thread; - pthread_t get_primes2_thread; + pthread_t sieve1_thread; + pthread_t sieve2_thread; struct sched_param sparam; pthread_attr_t attr; pthread_addr_t result; int status; + printf("rr_test: Starting sieve1 thread \n"); status = pthread_attr_init(&attr); if (status != OK) { @@ -175,31 +203,29 @@ void rr_test(void) } else { - printf("rr_test: Set thread policy to SCHED_RR\n"); + printf("rr_test: Set thread policty to SCHED_RR\n"); } - printf("rr_test: Starting first get_primes_thread\n"); - - status = pthread_create(&get_primes1_thread, &attr, get_primes_thread, (void*)1); + status = pthread_create(&sieve1_thread, &attr, sieve1, NULL); if (status != 0) { printf("rr_test: Error in thread 1 creation, status=%d\n", status); } - printf("rr_test: Starting second get_primes_thread\n"); + printf("rr_test: Starting sieve1 thread \n"); - status = pthread_create(&get_primes2_thread, &attr, get_primes_thread, (void*)2); + status = pthread_create(&sieve2_thread, &attr, sieve2, NULL); if (status != 0) { printf("rr_test: Error in thread 2 creation, status=%d\n", status); } - printf("rr_test: Waiting for threads to complete -- this should take awhile\n"); + printf("rr_test: Waiting for sieves to complete -- this should take awhile\n"); printf("rr_test: If RR scheduling is working, they should start and complete at\n"); printf("rr_test: about the same time\n"); - pthread_join(get_primes2_thread, &result); - pthread_join(get_primes1_thread, &result); + pthread_join(sieve2_thread, &result); + pthread_join(sieve1_thread, &result); printf("rr_test: Done\n"); } diff --git a/apps/examples/pipe/Makefile b/apps/examples/pipe/Makefile index bed3190858..956c911b34 100644 --- a/apps/examples/pipe/Makefile +++ b/apps/examples/pipe/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/pipe/Makefile # -# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -74,23 +70,24 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/poll/Makefile b/apps/examples/poll/Makefile index 13173f1253..aef61d199c 100644 --- a/apps/examples/poll/Makefile +++ b/apps/examples/poll/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/poll/Makefile # -# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -74,25 +70,25 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ # Register application depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - $(call DELFILE, host$(HOSTEXEEXT)) + @rm -f Make.dep .depend host -include Make.dep diff --git a/apps/examples/pwm/Makefile b/apps/examples/pwm/Makefile index 3a6f2520a0..efbdb048e0 100644 --- a/apps/examples/pwm/Makefile +++ b/apps/examples/pwm/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/pwm/Makefile # -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -80,7 +76,9 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built .context: @@ -90,17 +88,16 @@ $(COBJS): %$(OBJEXT): %.c context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/pwm/pwm_main.c b/apps/examples/pwm/pwm_main.c index a46c10f55c..775bdba6b1 100644 --- a/apps/examples/pwm/pwm_main.c +++ b/apps/examples/pwm/pwm_main.c @@ -48,7 +48,6 @@ #include #include #include -#include #include diff --git a/apps/examples/qencoder/Makefile b/apps/examples/qencoder/Makefile index 7d2427c6bf..3f3fc9def8 100644 --- a/apps/examples/qencoder/Makefile +++ b/apps/examples/qencoder/Makefile @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -80,7 +76,9 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built .context: @@ -92,17 +90,16 @@ endif context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/romfs/Makefile b/apps/examples/romfs/Makefile index 2b02952eda..ba930b77d0 100644 --- a/apps/examples/romfs/Makefile +++ b/apps/examples/romfs/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/romfs/Makefile # -# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -65,7 +61,7 @@ ROOTDEPPATH = --dep-path . VPATH = all: .built -.PHONY: checkgenromfs clean depend distclean +.PHONY: checkgenromfs clean depend disclean $(AOBJS): %$(OBJEXT): %.S $(call ASSEMBLE, $<, $@) @@ -90,26 +86,26 @@ romfs_testdir.h : testdir.img @xxd -i $< >$@ || { echo "xxd of $< failed" ; exit 1 ; } .built: romfs_testdir.h $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ # Register application depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - $(call DELFILE, testdir.img) + @rm -f Make.dep .depend testdir.img -include Make.dep diff --git a/apps/examples/serloop/Makefile b/apps/examples/serloop/Makefile index 4a262884bb..e1c415cdd8 100644 --- a/apps/examples/serloop/Makefile +++ b/apps/examples/serloop/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/serloop/Makefile # -# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -74,25 +70,26 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ # Register application depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/watchdog/Makefile b/apps/examples/watchdog/Makefile index 9890959fb5..d2739dbb0a 100644 --- a/apps/examples/watchdog/Makefile +++ b/apps/examples/watchdog/Makefile @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -80,7 +76,9 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built .context: @@ -90,17 +88,16 @@ $(COBJS): %$(OBJEXT): %.c context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/interpreters/Makefile b/apps/interpreters/Makefile index 867d45f996..5901fc8309 100644 --- a/apps/interpreters/Makefile +++ b/apps/interpreters/Makefile @@ -33,7 +33,7 @@ # ############################################################################ --include $(TOPDIR)/.config +-include $(TOPDIR)/.config # Current configuration # Sub-directories containing interpreter runtime @@ -41,36 +41,30 @@ SUBDIRS = pcode ficl # Create the list of installed runtime modules (INSTALLED_DIRS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) -define ADD_DIRECTORY -INSTALLED_DIRS += ${shell if exist $1\Makefile (echo $1)} -endef -else define ADD_DIRECTORY INSTALLED_DIRS += ${shell if [ -r $1/Makefile ]; then echo "$1"; fi} endef -endif $(foreach DIR, $(SUBDIRS), $(eval $(call ADD_DIRECTORY,$(DIR)))) all: nothing .PHONY: nothing context depend clean distclean -define SDIR_template -$(1)_$(2): - $(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" -endef - -$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),depend))) -$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),clean))) -$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),distclean))) - nothing: context: -depend: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_depend) +depend: + @for dir in $(INSTALLED_DIRS) ; do \ + $(MAKE) -C $$dir depend TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done -clean: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_clean) +clean: + @for dir in $(INSTALLED_DIRS) ; do \ + $(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done -distclean: clean $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_distclean) +distclean: clean + @for dir in $(INSTALLED_DIRS) ; do \ + $(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done diff --git a/apps/interpreters/ficl/Makefile b/apps/interpreters/ficl/Makefile index 990630fb89..fb953964e1 100644 --- a/apps/interpreters/ficl/Makefile +++ b/apps/interpreters/ficl/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/interpreters/ficl/Makefile # -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -35,11 +35,14 @@ BUILDDIR := ${shell pwd | sed -e 's/ /\\ /g'} +-include $(TOPDIR)/.config -include $(TOPDIR)/Make.defs include $(APPDIR)/Make.defs # Tools +INCDIR = $(TOPDIR)/tools/incdir.sh + ifeq ($(WINTOOL),y) INCDIROPT = -w endif @@ -66,14 +69,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOT_DEPPATH = --dep-path . @@ -96,24 +95,24 @@ debug: @#echo "CFLAGS: $(CFLAGS)" .built: debug $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - $(Q) touch .built + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built context: .depend: debug Makefile $(SRCS) - $(Q) $(MKDEP) $(ROOT_DEPPATH) $(SRC_DEPPATH) $(FICL_DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - $(Q) touch $@ + @$(MKDEP) $(ROOT_DEPPATH) $(SRC_DEPPATH) $(FICL_DEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ depend: .depend clean: - $(call DELFILE, .context) - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/namedapp/Makefile b/apps/namedapp/Makefile index a88c735674..6b0fd6a053 100644 --- a/apps/namedapp/Makefile +++ b/apps/namedapp/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/nshlib/Makefile # -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -54,14 +54,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -79,32 +75,32 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - $(Q) touch .built + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built .context: @echo "/* List of application requirements, generated during make context. */" > namedapp_list.h @echo "/* List of application entry points, generated during make context. */" > namedapp_proto.h - $(Q) touch $@ + @touch $@ context: .context .depend: Makefile $(SRCS) - $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - $(Q) touch $@ + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, .context) - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - $(call DELFILE, namedapp_list.h) - $(call DELFILE, namedapp_proto.h) + @rm -f .context Make.dep .depend + @rm -f namedapp_list.h + @rm -f namedapp_proto.h -include Make.dep diff --git a/apps/nshlib/Kconfig b/apps/nshlib/Kconfig index 17b107b8f5..d12a329738 100644 --- a/apps/nshlib/Kconfig +++ b/apps/nshlib/Kconfig @@ -23,194 +23,122 @@ config NSH_BUILTIN_APPS (NAMEDAPP). menu "Disable Individual commands" - -config NSH_DISABLE_BASE64DEC - bool "Disable base64dec" - default n - depends on NETUTILS_CODECS && CODECS_BASE64 - -config NSH_DISABLE_BASE64ENC - bool "Disable base64enc" - default n - depends on NETUTILS_CODECS && CODECS_BASE64 - config NSH_DISABLE_CAT bool "Disable cat" default n - config NSH_DISABLE_CD bool "Disable cd" default n - config NSH_DISABLE_CP bool "Disable cp" default n - config NSH_DISABLE_DD bool "Disable dd" default n - config NSH_DISABLE_ECHO bool "Disable echo" default n - config NSH_DISABLE_EXEC bool "Disable exec" default n - config NSH_DISABLE_EXIT bool "Disable exit" default n - config NSH_DISABLE_FREE bool "Disable free" default n - config NSH_DISABLE_GET bool "Disable get" default n - config NSH_DISABLE_HELP bool "Disable help" default n - -config NSH_DISABLE_HEXDUMP - bool "Disable hexdump" - default n - config NSH_DISABLE_IFCONFIG bool "Disable ifconfig" default n - config NSH_DISABLE_KILL bool "Disable kill" default n - config NSH_DISABLE_LOSETUP bool "Disable losetup" default n - config NSH_DISABLE_LS bool "Disable ls" default n - config NSH_DISABLE_MB bool "Disable mb" default n - -config NSH_DISABLE_MD5 - bool "Disable md5" - default n - depends on NETUTILS_CODECS && CODECS_HASH_MD5 - config NSH_DISABLE_MKDIR bool "Disable mkdir" default n - config NSH_DISABLE_MKFATFS bool "Disable mkfatfs" default n - config NSH_DISABLE_MKFIFO bool "Disable mkfifo" default n - config NSH_DISABLE_MKRD bool "Disable mkrd" default n - config NSH_DISABLE_MH bool "Disable mh" default n - config NSH_DISABLE_MOUNT bool "Disable mount" default n - config NSH_DISABLE_MW bool "Disable mw" default n - config NSH_DISABLE_NSFMOUNT bool "Disable nfsmount" default n - config NSH_DISABLE_PS bool "Disable ps" default n - config NSH_DISABLE_PING bool "Disable ping" default n - config NSH_DISABLE_PUT bool "Disable put" default n - config NSH_DISABLE_PWD bool "Disable pwd" default n - config NSH_DISABLE_RM bool "Disable rm" default n - config NSH_DISABLE_RMDIR bool "Disable rmdir" default n - config NSH_DISABLE_SET bool "Disable set" default n - config NSH_DISABLE_SH bool "Disable sh" default n - config NSH_DISABLE_SLEEP bool "Disable sleep" default n - config NSH_DISABLE_TEST bool "Disable test" default n - config NSH_DISABLE_UMOUNT bool "Disable umount" default n - config NSH_DISABLE_UNSET bool "Disable unset" default n - -config NSH_DISABLE_URLDECODE - bool "Disable urldecode" - default n - depends on NETUTILS_CODECS && CODECS_URLCODE - -config NSH_DISABLE_URLENCODE - bool "Disable urlencode" - default n - depends on NETUTILS_CODECS && CODECS_URLCODE - config NSH_DISABLE_USLEEP bool "Disable usleep" default n - config NSH_DISABLE_WGET bool "Disable wget" default n - config NSH_DISABLE_XD bool "Disable xd" default n - endmenu -config NSH_CODECS_BUFSIZE - int "File buffer size used by CODEC commands" - default 128 - config NSH_FILEIOSIZE int "NSH I/O buffer size" default 1024 @@ -562,7 +490,7 @@ config NSH_DHCPC config NSH_IPADDR hex "Target IP address" - default 0xa0000002 + default 0x10000002 depends on NSH_LIBRARY && NET && !NSH_DHCPC ---help--- If NSH_DHCPC is NOT set, then the static IP address must be provided. @@ -571,7 +499,7 @@ config NSH_IPADDR config NSH_DRIPADDR hex "Router IP address" - default 0xa0000001 + default 0x10000001 depends on NSH_LIBRARY && NET && !NSH_DHCPC ---help--- Default router IP address (aka, Gateway). This is a 32-bit integer @@ -585,21 +513,6 @@ config NSH_NETMASK Network mask. This is a 32-bit integer value in host order. So, as an example, 0xffffff00 would be 255.255.255.0. -config NSH_DNS - bool "Use DNS" - default n - depends on NSH_LIBRARY && NET && NET_UDP && NET_BROADCAST - ---help--- - Configure to use a DNS. - -config NSH_DNSIPADDR - hex "DNS IP address" - default 0xa0000001 - depends on NSH_DNS - ---help--- - Configure the DNS address. This is a 32-bit integer value in host - order. So, as an example, 0xa0000001 would be 10.0.0.1. - config NSH_NOMAC bool "Hardware has no MAC address" default n @@ -607,12 +520,3 @@ config NSH_NOMAC ---help--- Set if your ethernet hardware has no built-in MAC address. If set, a bogus MAC will be assigned. - -config NSH_MAX_ROUNDTRIP - int "Max Ping Round-Trip (DSEC)" - default 20 - depends on NSH_LIBRARY && NET && !NSH_DISABLE_PING - ---help--- - This is the maximum round trip for a response to a ICMP ECHO request. - It is in units of deciseconds. The default is 20 (2 seconds). - diff --git a/apps/nshlib/Makefile b/apps/nshlib/Makefile index 73325e899d..f616374bfd 100644 --- a/apps/nshlib/Makefile +++ b/apps/nshlib/Makefile @@ -39,72 +39,64 @@ include $(APPDIR)/Make.defs # NSH Library -ASRCS = -CSRCS = nsh_init.c nsh_parse.c nsh_console.c nsh_fscmds.c nsh_ddcmd.c \ +ASRCS = +CSRCS = nsh_init.c nsh_parse.c nsh_console.c nsh_fscmds.c nsh_ddcmd.c \ nsh_proccmds.c nsh_mmcmds.c nsh_envcmds.c nsh_dbgcmds.c ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -CSRCS += nsh_apps.c +CSRCS += nsh_apps.c endif ifeq ($(CONFIG_NSH_ROMFSETC),y) -CSRCS += nsh_romfsetc.c +CSRCS += nsh_romfsetc.c endif ifeq ($(CONFIG_NET),y) -CSRCS += nsh_netinit.c nsh_netcmds.c +CSRCS += nsh_netinit.c nsh_netcmds.c endif ifeq ($(CONFIG_RTC),y) -CSRCS += nsh_timcmds.c +CSRCS += nsh_timcmds.c endif ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y) -CSRCS += nsh_mntcmds.c +CSRCS += nsh_mntcmds.c endif ifeq ($(CONFIG_NSH_CONSOLE),y) -CSRCS += nsh_consolemain.c +CSRCS += nsh_consolemain.c endif ifeq ($(CONFIG_NSH_TELNET),y) -CSRCS += nsh_telnetd.c +CSRCS += nsh_telnetd.c endif ifneq ($(CONFIG_NSH_DISABLESCRIPT),y) -CSRCS += nsh_test.c +CSRCS += nsh_test.c endif ifeq ($(CONFIG_USBDEV),y) -CSRCS += nsh_usbdev.c +CSRCS += nsh_usbdev.c endif -ifeq ($(CONFIG_NETUTILS_CODECS),y) -CSRCS += nsh_codeccmd.c -endif +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif -ROOTDEPPATH = --dep-path . -VPATH = +ROOTDEPPATH = --dep-path . +VPATH = # Build targets -all: .built +all: .built .PHONY: context .depend depend clean distclean $(AOBJS): %$(OBJEXT): %.S @@ -114,25 +106,26 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) \ + $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, .context) - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/nshlib/README.txt b/apps/nshlib/README.txt index 59f0538f08..0f6aee759b 100644 --- a/apps/nshlib/README.txt +++ b/apps/nshlib/README.txt @@ -235,10 +235,6 @@ o test integer -gt integer | integer -le integer | integer -lt integer | integer -ne integer -o base64dec [-w] [-f] - -o base64dec [-w] [-f] - o cat [ [ ...]] This command copies and concatentates all of the files at @@ -385,11 +381,7 @@ o help [-v] [] Show full command usage only for this command -o hexdump - - Dump data in hexadecimal format from a file or character device. - -o ifconfig [nic_name [ip]] [dr|gw|gateway ] [netmask ] [dns ] [hw ] +o ifconfig Show the current configuration of the network, for example: @@ -400,22 +392,6 @@ o ifconfig [nic_name [ip]] [dr|gw|gateway ] [netmask ] [dn if uIP statistics are enabled (CONFIG_NET_STATISTICS), then this command will also show the detailed state of uIP. -o ifdown - - Take down the interface identified by the name . - - Example: - - ifdown eth0 - -o ifup - - Bring up down the interface identified by the name . - - Example: - - ifup eth0 - o kill - Send the to the task identified by . @@ -473,8 +449,6 @@ o ls [-lRs] -l Show size and mode information along with the filenames in the listing. -o md5 [-f] - o mb [=][ ] o mh [=][ ] o mw [=][ ] @@ -807,10 +781,6 @@ o unset nsh> - o urldecode [-f] - - o urlencode [-f] - o usleep Pause execution (sleep) of microseconds. @@ -856,8 +826,6 @@ Command Dependencies on Configuration Settings Command Depends on Configuration ---------- -------------------------- [ !CONFIG_NSH_DISABLESCRIPT - base64dec CONFIG_NETUTILS_CODECS && CONFIG_CODECS_BASE64 - base64enc CONFIG_NETUTILS_CODECS && CONFIG_CODECS_BASE64 cat CONFIG_NFILE_DESCRIPTORS > 0 cd !CONFIG_DISABLE_ENVIRON && CONFIG_NFILE_DESCRIPTORS > 0 cp CONFIG_NFILE_DESCRIPTORS > 0 @@ -869,14 +837,10 @@ Command Dependencies on Configuration Settings free -- get CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NET_BUFSIZE >= 558 (see note 1) help -- - hexdump CONFIG_NFILE_DESCRIPTORS > 0 ifconfig CONFIG_NET - ifdown CONFIG_NET - ifup CONFIG_NET kill !CONFIG_DISABLE_SIGNALS losetup !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 ls CONFIG_NFILE_DESCRIPTORS > 0 - md5 CONFIG_NETUTILS_CODECS && CONFIG_CODECS_HASH_MD5 mb,mh,mw --- mkdir !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE (see note 4) mkfatfs !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_FAT @@ -897,8 +861,6 @@ Command Dependencies on Configuration Settings test !CONFIG_NSH_DISABLESCRIPT umount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_READABLE unset !CONFIG_DISABLE_ENVIRON - urldecode CONFIG_NETUTILS_CODECS && CONFIG_CODECS_URLCODE - urlencode CONFIG_NETUTILS_CODECS && CONFIG_CODECS_URLCODE usleep !CONFIG_DISABLE_SIGNALS get CONFIG_NET && CONFIG_NET_TCP && CONFIG_NFILE_DESCRIPTORS > 0 xd --- @@ -918,22 +880,20 @@ In addition, each NSH command can be individually disabled via one of the follow settings. All of these settings make the configuration of NSH potentially complex but also allow it to squeeze into very small memory footprints. - CONFIG_NSH_DISABLE_BASE64DEC, CONFIG_NSH_DISABLE_BASE64ENC, CONFIG_NSH_DISABLE_CAT, - CONFIG_NSH_DISABLE_CD, CONFIG_NSH_DISABLE_CP, CONFIG_NSH_DISABLE_DD, - CONFIG_NSH_DISABLE_DF, CONFIG_NSH_DISABLE_ECHO, CONFIG_NSH_DISABLE_EXEC, - CONFIG_NSH_DISABLE_EXIT, CONFIG_NSH_DISABLE_FREE, CONFIG_NSH_DISABLE_GET, - CONFIG_NSH_DISABLE_HELP, CONFIG_NSH_DISABLE_HEXDUMP, CONFIG_NSH_DISABLE_IFCONFIG, - CONFIG_NSH_DISABLE_IFUPDOWN, CONFIG_NSH_DISABLE_KILL, CONFIG_NSH_DISABLE_LOSETUP, - CONFIG_NSH_DISABLE_LS, CONFIG_NSH_DISABLE_MD5 CONFIG_NSH_DISABLE_MB, - CONFIG_NSH_DISABLE_MKDIR, CONFIG_NSH_DISABLE_MKFATFS, CONFIG_NSH_DISABLE_MKFIFO, - CONFIG_NSH_DISABLE_MKRD, CONFIG_NSH_DISABLE_MH, CONFIG_NSH_DISABLE_MOUNT, - CONFIG_NSH_DISABLE_MW, CONFIG_NSH_DISABLE_MV, CONFIG_NSH_DISABLE_NFSMOUNT, - CONFIG_NSH_DISABLE_PS, CONFIG_NSH_DISABLE_PING, CONFIG_NSH_DISABLE_PUT, - CONFIG_NSH_DISABLE_PWD, CONFIG_NSH_DISABLE_RM, CONFIG_NSH_DISABLE_RMDIR, - CONFIG_NSH_DISABLE_SET, CONFIG_NSH_DISABLE_SH, CONFIG_NSH_DISABLE_SLEEP, - CONFIG_NSH_DISABLE_TEST, CONFIG_NSH_DISABLE_UMOUNT, CONFIG_NSH_DISABLE_UNSET, - CONFIG_NSH_DISABLE_URLDECODE, CONFIG_NSH_DISABLE_URLENCODE, CONFIG_NSH_DISABLE_USLEEP, - CONFIG_NSH_DISABLE_WGET, CONFIG_NSH_DISABLE_XD + CONFIG_NSH_DISABLE_CAT, CONFIG_NSH_DISABLE_CD, CONFIG_NSH_DISABLE_CP, + CONFIG_NSH_DISABLE_DD, CONFIG_NSH_DISABLE_DF, CONFIG_NSH_DISABLE_ECHO, + CONFIG_NSH_DISABLE_EXEC, CONFIG_NSH_DISABLE_EXIT, CONFIG_NSH_DISABLE_FREE, + CONFIG_NSH_DISABLE_GET, CONFIG_NSH_DISABLE_HELP, CONFIG_NSH_DISABLE_IFCONFIG, + CONFIG_NSH_DISABLE_KILL, CONFIG_NSH_DISABLE_LOSETUP, CONFIG_NSH_DISABLE_LS, + CONFIG_NSH_DISABLE_MB, CONFIG_NSH_DISABLE_MKDIR, CONFIG_NSH_DISABLE_MKFATFS, + CONFIG_NSH_DISABLE_MKFIFO, CONFIG_NSH_DISABLE_MKRD, CONFIG_NSH_DISABLE_MH, + CONFIG_NSH_DISABLE_MOUNT, CONFIG_NSH_DISABLE_MW, CONFIG_NSH_DISABLE_MV, + CONFIG_NSH_DISABLE_NFSMOUNT, CONFIG_NSH_DISABLE_PS, CONFIG_NSH_DISABLE_PING, + CONFIG_NSH_DISABLE_PUT, CONFIG_NSH_DISABLE_PWD, CONFIG_NSH_DISABLE_RM, + CONFIG_NSH_DISABLE_RMDIR, CONFIG_NSH_DISABLE_SET, CONFIG_NSH_DISABLE_SH, + CONFIG_NSH_DISABLE_SLEEP, CONFIG_NSH_DISABLE_TEST, CONFIG_NSH_DISABLE_UMOUNT, + CONFIG_NSH_DISABLE_UNSET, CONFIG_NSH_DISABLE_USLEEP, CONFIG_NSH_DISABLE_WGET, + CONFIG_NSH_DISABLE_XD Verbose help output can be suppressed by defining CONFIG_NSH_HELP_TERSE. In that case, the help command is still available but will be slightly smaller. @@ -1124,10 +1084,6 @@ NSH-Specific Configuration Settings Set if your ethernet hardware has no built-in MAC address. If set, a bogus MAC will be assigned. - * CONFIG_NSH_MAX_ROUNDTRIP - This is the maximum round trip for a response to a ICMP ECHO request. - It is in units of deciseconds. The default is 20 (2 seconds). - If you use DHCPC, then some special configuration network options are required. These include: diff --git a/apps/nshlib/nsh.h b/apps/nshlib/nsh.h index a046a384fc..7188477ced 100644 --- a/apps/nshlib/nsh.h +++ b/apps/nshlib/nsh.h @@ -47,7 +47,6 @@ #include #include #include -#include #include #include @@ -216,15 +215,6 @@ #endif /* CONFIG_NSH_TELNET_LOGIN */ -/* CONFIG_NSH_MAX_ROUNDTRIP - This is the maximum round trip for a response to - * a ICMP ECHO request. It is in units of deciseconds. The default is 20 - * (2 seconds). - */ - -#ifndef CONFIG_NSH_MAX_ROUNDTRIP -# define CONFIG_NSH_MAX_ROUNDTRIP 20 -#endif - /* Verify support for ROMFS /etc directory support options */ #ifdef CONFIG_NSH_ROMFSETC @@ -268,36 +258,12 @@ # undef CONFIG_NSH_ROMFSSECTSIZE #endif -/* This is the maximum number of arguments that will be accepted for a - * command. Here we attempt to select the smallest number possible depending - * upon the of commands that are available. Most commands use six or fewer - * arguments, but there are a few that require more. - * - * This value is also configurable with CONFIG_NSH_MAXARGUMENTS. This - * configurability is necessary since there may also be external, "built-in" - * commands that require more commands than NSH is aware of. - */ - -#ifndef CONFIG_NSH_MAXARGUMENTS -# define CONFIG_NSH_MAXARGUMENTS 6 +/* This is the maximum number of arguments that will be accepted for a command */ +#ifdef CONFIG_NSH_MAX_ARGUMENTS +# define NSH_MAX_ARGUMENTS CONFIG_NSH_MAX_ARGUMENTS +#else +# define NSH_MAX_ARGUMENTS 10 #endif - -#if CONFIG_NSH_MAXARGUMENTS < 11 -# if defined(CONFIG_NET) && !defined(CONFIG_NSH_DISABLE_IFCONFIG) -# undef CONFIG_NSH_MAXARGUMENTS -# define CONFIG_NSH_MAXARGUMENTS 11 -# endif -#endif - -#if CONFIG_NSH_MAXARGUMENTS < 7 -# if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0 -# if !defined(CONFIG_NSH_DISABLE_GET) || !defined(CONFIG_NSH_DISABLE_PUT) -# undef CONFIG_NSH_MAXARGUMENTS -# define CONFIG_NSH_MAXARGUMENTS 7 -# endif -# endif -#endif - /* strerror() produces much nicer output but is, however, quite large and * will only be used if CONFIG_NSH_STRERROR is defined. Note that the strerror * interface must also have been enabled with CONFIG_LIBC_STRERROR. @@ -541,7 +507,7 @@ void nsh_usbtrace(void); #ifndef CONFIG_NSH_DISABLE_XD int cmd_xd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); #endif - + #if !defined(CONFIG_NSH_DISABLESCRIPT) && !defined(CONFIG_NSH_DISABLE_TEST) int cmd_test(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); int cmd_lbracket(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); @@ -563,9 +529,6 @@ void nsh_usbtrace(void); # ifndef CONFIG_NSH_DISABLE_DD int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif -# ifndef CONFIG_NSH_DISABLE_HEXDUMP - int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif # ifndef CONFIG_NSH_DISABLE_LS int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif @@ -632,10 +595,6 @@ void nsh_usbtrace(void); # ifndef CONFIG_NSH_DISABLE_IFCONFIG int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif -# ifndef CONFIG_NSH_DISABLE_IFUPDOWN - int cmd_ifup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); - int cmd_ifdown(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif #if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0 # ifndef CONFIG_NSH_DISABLE_GET int cmd_get(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); @@ -684,28 +643,4 @@ void nsh_usbtrace(void); # endif #endif /* CONFIG_DISABLE_SIGNALS */ -#if defined(CONFIG_NETUTILS_CODECS) && defined(CONFIG_CODECS_BASE64) -# ifndef CONFIG_NSH_DISABLE_BASE64DEC - int cmd_base64decode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# ifndef CONFIG_NSH_DISABLE_BASE64ENC - int cmd_base64encode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -#endif - -#if defined(CONFIG_NETUTILS_CODECS) && defined(CONFIG_CODECS_HASH_MD5) -# ifndef CONFIG_NSH_DISABLE_MD5 - int cmd_md5(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -#endif - -#if defined(CONFIG_NETUTILS_CODECS) && defined(CONFIG_CODECS_URLCODE) -# ifndef CONFIG_NSH_DISABLE_URLDECODE - int cmd_urlencode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# ifndef CONFIG_NSH_DISABLE_URLENCODE - int cmd_urldecode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -#endif - #endif /* __APPS_NSHLIB_NSH_H */ diff --git a/apps/nshlib/nsh_dbgcmds.c b/apps/nshlib/nsh_dbgcmds.c index 5463e0f5a2..384b377f3a 100644 --- a/apps/nshlib/nsh_dbgcmds.c +++ b/apps/nshlib/nsh_dbgcmds.c @@ -46,10 +46,6 @@ #include #include -#if CONFIG_NFILE_DESCRIPTORS > 0 -# include -#endif - #include "nsh.h" #include "nsh_console.h" @@ -331,7 +327,7 @@ void nsh_dumpbuffer(FAR struct nsh_vtbl_s *vtbl, const char *msg, } /**************************************************************************** - * Name: cmd_xd, hex dump of memory + * Name: cmd_xd ****************************************************************************/ #ifndef CONFIG_NSH_DISABLE_XD @@ -357,58 +353,3 @@ int cmd_xd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) return OK; } #endif - -/**************************************************************************** - * Name: cmd_hexdump, hex dump of files - ****************************************************************************/ - -#if CONFIG_NFILE_DESCRIPTORS > 0 -#ifndef CONFIG_NSH_DISABLE_HEXDUMP -int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) -{ - uint8_t buffer[IOBUFFERSIZE]; - char msg[32]; - int position; - int fd; - int ret = OK; - - /* Open the file for reading */ - - fd = open(argv[1], O_RDONLY); - if (fd < 0) - { - nsh_output(vtbl, g_fmtcmdfailed, "hexdump", "open", NSH_ERRNO); - return ERROR; - } - - position = 0; - for (;;) - { - int nbytesread = read(fd, buffer, IOBUFFERSIZE); - - /* Check for read errors */ - - if (nbytesread < 0) - { - int errval = errno; - nsh_output(vtbl, g_fmtcmdfailed, "hexdump", "read", NSH_ERRNO_OF(errval)); - ret = ERROR; - break; - } - else if (nbytesread > 0) - { - snprintf(msg, sizeof(msg), "%s at %08x", argv[1], position); - nsh_dumpbuffer(vtbl, msg, buffer, nbytesread); - position += nbytesread; - } - else - { - break; // EOF - } - } - - (void)close(fd); - return ret; -} -#endif -#endif diff --git a/apps/nshlib/nsh_netcmds.c b/apps/nshlib/nsh_netcmds.c index d28fe873d0..cfea5a08a0 100644 --- a/apps/nshlib/nsh_netcmds.c +++ b/apps/nshlib/nsh_netcmds.c @@ -51,7 +51,6 @@ #include /* Needed for open */ #include /* Needed for basename */ #include -#include #include #include @@ -81,12 +80,6 @@ # endif #endif -#ifdef CONFIG_HAVE_GETHOSTBYNAME -# include -#else -# include -#endif - #include "nsh.h" #include "nsh_console.h" @@ -94,16 +87,8 @@ * Definitions ****************************************************************************/ -/* Size of the ECHO data */ - #define DEFAULT_PING_DATALEN 56 -/* Get the larger value */ - -#ifndef MAX -# define MAX(a,b) (a > b ? a : b) -#endif - /**************************************************************************** * Private Types ****************************************************************************/ @@ -277,34 +262,14 @@ int ifconfig_callback(FAR struct uip_driver_s *dev, void *arg) { struct nsh_vtbl_s *vtbl = (struct nsh_vtbl_s*)arg; struct in_addr addr; - bool is_running = false; - int ret; - - ret = uip_getifstatus(dev->d_ifname,&is_running); - if (ret != OK) - { - nsh_output(vtbl, "\tGet %s interface flags error: %d\n", - dev->d_ifname, ret); - } - - nsh_output(vtbl, "%s\tHWaddr %s at %s\n", - dev->d_ifname, ether_ntoa(&dev->d_mac), (is_running)?"UP":"DOWN"); + nsh_output(vtbl, "%s\tHWaddr %s\n", dev->d_ifname, ether_ntoa(&dev->d_mac)); addr.s_addr = dev->d_ipaddr; nsh_output(vtbl, "\tIPaddr:%s ", inet_ntoa(addr)); - addr.s_addr = dev->d_draddr; nsh_output(vtbl, "DRaddr:%s ", inet_ntoa(addr)); - addr.s_addr = dev->d_netmask; - nsh_output(vtbl, "Mask:%s\n", inet_ntoa(addr)); - -#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS) - resolv_getserver(&addr); - nsh_output(vtbl, "\tDNSaddr:%s\n", inet_ntoa(addr)); -#endif - - nsh_output(vtbl, "\n"); + nsh_output(vtbl, "Mask:%s\n\n", inet_ntoa(addr)); return OK; } @@ -503,54 +468,6 @@ int cmd_get(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) #endif #endif -/**************************************************************************** - * Name: cmd_ifup - ****************************************************************************/ - -#ifndef CONFIG_NSH_DISABLE_IFUPDOWN -int cmd_ifup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) -{ - FAR char *intf = NULL; - int ret; - - if (argc != 2) - { - nsh_output(vtbl, "Please select nic_name:\n"); - netdev_foreach(ifconfig_callback, vtbl); - return OK; - } - - intf = argv[1]; - ret = uip_ifup(intf); - nsh_output(vtbl, "ifup %s...%s\n", intf, (ret == OK) ? "OK" : "Failed"); - return ret; -} -#endif - -/**************************************************************************** - * Name: cmd_ifdown - ****************************************************************************/ - -#ifndef CONFIG_NSH_DISABLE_IFUPDOWN -int cmd_ifdown(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) -{ - FAR char *intf = NULL; - int ret; - - if (argc != 2) - { - nsh_output(vtbl, "Please select nic_name:\n"); - netdev_foreach(ifconfig_callback, vtbl); - return OK; - } - - intf = argv[1]; - ret = uip_ifdown(intf); - nsh_output(vtbl, "ifdown %s...%s\n", intf, (ret == OK) ? "OK" : "Failed"); - return ret; -} -#endif - /**************************************************************************** * Name: cmd_ifconfig ****************************************************************************/ @@ -559,17 +476,7 @@ int cmd_ifdown(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { struct in_addr addr; - in_addr_t gip; - int i; - FAR char *intf = NULL; - FAR char *hostip = NULL; - FAR char *gwip = NULL; - FAR char *mask = NULL; - FAR char *tmp = NULL; - FAR char *hw = NULL; - FAR char *dns = NULL; - bool badarg=false; - uint8_t mac[6]; + in_addr_t ip; /* With one or no arguments, ifconfig simply shows the status of ethernet * device: @@ -591,142 +498,24 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) * ifconfig nic_name ip_address */ - if (argc > 2) - { - for(i = 0; i < argc; i++) - { - if (i == 1) - { - intf = argv[i]; - } - else if (i == 2) - { - hostip = argv[i]; - } - else - { - tmp = argv[i]; - if (!strcmp(tmp, "dr") || !strcmp(tmp, "gw") || !strcmp(tmp, "gateway")) - { - if (argc-1 >= i+1) - { - gwip = argv[i+1]; - i++; - } - else - { - badarg = true; - } - } - else if(!strcmp(tmp, "netmask")) - { - if (argc-1 >= i+1) - { - mask = argv[i+1]; - i++; - } - else - { - badarg = true; - } - } - else if(!strcmp(tmp, "hw")) - { - if (argc-1>=i+1) - { - hw = argv[i+1]; - i++; - badarg = !uiplib_hwmacconv(hw, mac); - } - else - { - badarg = true; - } - } - else if(!strcmp(tmp, "dns")) - { - if (argc-1 >= i+1) - { - dns = argv[i+1]; - i++; - } - else - { - badarg = true; - } - } - } - } - } - - if (badarg) - { - nsh_output(vtbl, g_fmtargrequired, argv[0]); - return ERROR; - } - - /* Set Hardware ethernet MAC addr */ - - if (hw) - { - ndbg("HW MAC: %s\n", hw); - uip_setmacaddr(intf, mac); - } - /* Set host ip address */ - ndbg("Host IP: %s\n", hostip); - gip = addr.s_addr = inet_addr(hostip); - uip_sethostaddr(intf, &addr); + ip = addr.s_addr = inet_addr(argv[2]); + uip_sethostaddr(argv[1], &addr); /* Set gateway */ - if (gwip) - { - ndbg("Gateway: %s\n", gwip); - gip = addr.s_addr = inet_addr(gwip); - } - else - { - ndbg("Gateway: default\n"); - gip = NTOHL(gip); - gip &= ~0x000000ff; - gip |= 0x00000001; - gip = HTONL(gip); - addr.s_addr = gip; - } + ip = NTOHL(ip); + ip &= ~0x000000ff; + ip |= 0x00000001; - uip_setdraddr(intf, &addr); + addr.s_addr = HTONL(ip); + uip_setdraddr(argv[1], &addr); - /* Set network mask */ + /* Set netmask */ - if (mask) - { - ndbg("Netmask: %s\n",mask); - addr.s_addr = inet_addr(mask); - } - else - { - ndbg("Netmask: Default\n"); - addr.s_addr = inet_addr("255.255.255.0"); - } - - uip_setnetmask(intf, &addr); - -#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS) - if (dns) - { - ndbg("DNS: %s\n", dns); - addr.s_addr = inet_addr(dns); - } - else - { - ndbg("DNS: Default\n"); - addr.s_addr = gip; - } - - resolv_conf(&addr); -#endif + addr.s_addr = inet_addr("255.255.255.0"); + uip_setnetmask(argv[1], &addr); return OK; } @@ -747,7 +536,6 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) uint32_t start; uint32_t next; uint32_t dsec = 10; - uint32_t maxwait; uint16_t id; bool badarg = false; int count = 10; @@ -811,7 +599,7 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) if (optind == argc-1) { staddr = argv[optind]; - if (dns_gethostip(staddr, &ipaddr) < 0) + if (!uiplib_ipaddrconv(staddr, (FAR unsigned char*)&ipaddr)) { goto errout; } @@ -831,26 +619,16 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) id = ping_newid(); - /* The maximum wait for a response will be the larger of the inter-ping time and - * the configured maximum round-trip time. - */ - - maxwait = MAX(dsec, CONFIG_NSH_MAX_ROUNDTRIP); - /* Loop for the specified count */ - nsh_output(vtbl, "PING %d.%d.%d.%d %d bytes of data\n", - (ipaddr ) & 0xff, (ipaddr >> 8 ) & 0xff, - (ipaddr >> 16 ) & 0xff, (ipaddr >> 24 ) & 0xff, - DEFAULT_PING_DATALEN); - + nsh_output(vtbl, "PING %s %d bytes of data\n", staddr, DEFAULT_PING_DATALEN); start = g_system_timer; for (i = 1; i <= count; i++) { /* Send the ECHO request and wait for the response */ next = g_system_timer; - seqno = uip_ping(ipaddr, id, i, DEFAULT_PING_DATALEN, maxwait); + seqno = uip_ping(ipaddr, id, i, DEFAULT_PING_DATALEN, dsec); /* Was any response returned? We can tell if a non-negative sequence * number was returned. @@ -858,7 +636,7 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) if (seqno >= 0 && seqno <= i) { - /* Get the elapsed time from the time that the request was + /* Get the elpased time from the time that the request was * sent until the response was received. If we got a response * to an earlier request, then fudge the elpased time. */ @@ -866,7 +644,7 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) elapsed = TICK2MSEC(g_system_timer - next); if (seqno < i) { - elapsed += 100 * dsec * (i - seqno); + elapsed += 100*dsec*(i - seqno); } /* Report the receipt of the reply */ @@ -884,7 +662,7 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) elapsed = TICK2DSEC(g_system_timer - next); if (elapsed < dsec) { - usleep(100000 * (dsec - elapsed)); + usleep(100000*dsec); } } diff --git a/apps/nshlib/nsh_netinit.c b/apps/nshlib/nsh_netinit.c index bb1c73dffe..bc845c4ed3 100644 --- a/apps/nshlib/nsh_netinit.c +++ b/apps/nshlib/nsh_netinit.c @@ -47,7 +47,7 @@ #include #include -#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS) +#if defined(CONFIG_NSH_DHCPC) # include # include #endif @@ -60,10 +60,6 @@ * Definitions ****************************************************************************/ -#if defined(CONFIG_NSH_DRIPADDR) && !defined(CONFIG_NSH_DNSIPADDR) -# define CONFIG_NSH_DNSIPADDR CONFIG_NSH_DRIPADDR -#endif - /**************************************************************************** * Private Types ****************************************************************************/ @@ -129,14 +125,10 @@ int nsh_netinit(void) addr.s_addr = HTONL(CONFIG_NSH_NETMASK); uip_setnetmask("eth0", &addr); -#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS) +#if defined(CONFIG_NSH_DHCPC) /* Set up the resolver */ resolv_init(); -#if defined(CONFIG_NSH_DNS) - addr.s_addr = HTONL(CONFIG_NSH_DNSIPADDR); - resolv_conf(&addr); -#endif #endif #if defined(CONFIG_NSH_DHCPC) diff --git a/apps/nshlib/nsh_parse.c b/apps/nshlib/nsh_parse.c index abdf5c321e..df2f7c3e39 100644 --- a/apps/nshlib/nsh_parse.c +++ b/apps/nshlib/nsh_parse.c @@ -73,19 +73,19 @@ /* Argument list size * * argv[0]: The command name. - * argv[1]: The beginning of argument (up to CONFIG_NSH_MAXARGUMENTS) + * argv[1]: The beginning of argument (up to NSH_MAX_ARGUMENTS) * argv[argc-3]: Possibly '>' or '>>' * argv[argc-2]: Possibly * argv[argc-1]: Possibly '&' (if pthreads are enabled) * argv[argc]: NULL terminating pointer * - * Maximum size is CONFIG_NSH_MAXARGUMENTS+5 + * Maximum size is NSH_MAX_ARGUMENTS+5 */ #ifndef CONFIG_NSH_DISABLEBG -# define MAX_ARGV_ENTRIES (CONFIG_NSH_MAXARGUMENTS+5) +# define MAX_ARGV_ENTRIES (NSH_MAX_ARGUMENTS+5) #else -# define MAX_ARGV_ENTRIES (CONFIG_NSH_MAXARGUMENTS+4) +# define MAX_ARGV_ENTRIES (NSH_MAX_ARGUMENTS+4) #endif /* Help command summary layout */ @@ -146,25 +146,16 @@ static const char g_failure[] = "1"; static const struct cmdmap_s g_cmdmap[] = { #if !defined(CONFIG_NSH_DISABLESCRIPT) && !defined(CONFIG_NSH_DISABLE_TEST) - { "[", cmd_lbracket, 4, CONFIG_NSH_MAXARGUMENTS, " ]" }, + { "[", cmd_lbracket, 4, NSH_MAX_ARGUMENTS, " ]" }, #endif #ifndef CONFIG_NSH_DISABLE_HELP { "?", cmd_help, 1, 1, NULL }, #endif -#if defined(CONFIG_NETUTILS_CODECS) && defined(CONFIG_CODECS_BASE64) -# ifndef CONFIG_NSH_DISABLE_BASE64DEC - { "base64dec", cmd_base64decode, 2, 4, "[-w] [-f] " }, -# endif -# ifndef CONFIG_NSH_DISABLE_BASE64ENC - { "base64enc", cmd_base64encode, 2, 4, "[-w] [-f] " }, -# endif -#endif - #if CONFIG_NFILE_DESCRIPTORS > 0 # ifndef CONFIG_NSH_DISABLE_CAT - { "cat", cmd_cat, 2, CONFIG_NSH_MAXARGUMENTS, " [ [ ...]]" }, + { "cat", cmd_cat, 2, NSH_MAX_ARGUMENTS, " [ [ ...]]" }, # endif #ifndef CONFIG_DISABLE_ENVIRON # ifndef CONFIG_NSH_DISABLE_CD @@ -196,9 +187,9 @@ static const struct cmdmap_s g_cmdmap[] = #ifndef CONFIG_NSH_DISABLE_ECHO # ifndef CONFIG_DISABLE_ENVIRON - { "echo", cmd_echo, 0, CONFIG_NSH_MAXARGUMENTS, "[ [...]]" }, + { "echo", cmd_echo, 0, NSH_MAX_ARGUMENTS, "[ [...]]" }, # else - { "echo", cmd_echo, 0, CONFIG_NSH_MAXARGUMENTS, "[ [...]]" }, + { "echo", cmd_echo, 0, NSH_MAX_ARGUMENTS, "[ [...]]" }, # endif #endif @@ -226,20 +217,10 @@ static const struct cmdmap_s g_cmdmap[] = { "help", cmd_help, 1, 3, "[-v] []" }, # endif #endif - -#if CONFIG_NFILE_DESCRIPTORS > 0 -#ifndef CONFIG_NSH_DISABLE_HEXDUMP - { "hexdump", cmd_hexdump, 2, 2, "" }, -#endif -#endif #ifdef CONFIG_NET # ifndef CONFIG_NSH_DISABLE_IFCONFIG - { "ifconfig", cmd_ifconfig, 1, 11, "[nic_name [ip]] [dr|gw|gateway ] [netmask ] [dns ] [hw ]" }, -# endif -# ifndef CONFIG_NSH_DISABLE_IFUPDOWN - { "ifdown", cmd_ifdown, 2, 2, "" }, - { "ifup", cmd_ifup, 2, 2, "" }, + { "ifconfig", cmd_ifconfig, 1, 3, "[nic_name [ip]]" }, # endif #endif @@ -265,12 +246,6 @@ static const struct cmdmap_s g_cmdmap[] = { "mb", cmd_mb, 2, 3, "[=][ ]" }, #endif -#if defined(CONFIG_NETUTILS_CODECS) && defined(CONFIG_CODECS_HASH_MD5) -# ifndef CONFIG_NSH_DISABLE_MD5 - { "md5", cmd_md5, 2, 3, "[-f] " }, -# endif -#endif - #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE) # ifndef CONFIG_NSH_DISABLE_MKDIR { "mkdir", cmd_mkdir, 2, 2, "" }, @@ -373,7 +348,7 @@ static const struct cmdmap_s g_cmdmap[] = #endif #if !defined(CONFIG_NSH_DISABLESCRIPT) && !defined(CONFIG_NSH_DISABLE_TEST) - { "test", cmd_test, 3, CONFIG_NSH_MAXARGUMENTS, "" }, + { "test", cmd_test, 3, NSH_MAX_ARGUMENTS, "" }, #endif #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE) @@ -388,15 +363,6 @@ static const struct cmdmap_s g_cmdmap[] = # endif #endif -#if defined(CONFIG_NETUTILS_CODECS) && defined(CONFIG_CODECS_URLCODE) -# ifndef CONFIG_NSH_DISABLE_URLDECODE - { "urldecode", cmd_urldecode, 2, 3, "[-f] " }, -# endif -# ifndef CONFIG_NSH_DISABLE_URLENCODE - { "urlencode", cmd_urlencode, 2, 3, "[-f] " }, -# endif -#endif - #ifndef CONFIG_DISABLE_SIGNALS # ifndef CONFIG_NSH_DISABLE_USLEEP { "usleep", cmd_usleep, 2, 2, "" }, @@ -412,7 +378,6 @@ static const struct cmdmap_s g_cmdmap[] = #ifndef CONFIG_NSH_DISABLE_XD { "xd", cmd_xd, 3, 3, " " }, #endif - { NULL, NULL, 1, 1, NULL } }; @@ -746,7 +711,7 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl, int argc, char *argv[]) * * argv[0]: The command name. This is argv[0] when the arguments * are, finally, received by the command vtblr - * argv[1]: The beginning of argument (up to CONFIG_NSH_MAXARGUMENTS) + * argv[1]: The beginning of argument (up to NSH_MAX_ARGUMENTS) * argv[argc]: NULL terminating pointer */ @@ -1353,13 +1318,13 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline) * of argv is: * * argv[0]: The command name. - * argv[1]: The beginning of argument (up to CONFIG_NSH_MAXARGUMENTS) + * argv[1]: The beginning of argument (up to NSH_MAX_ARGUMENTS) * argv[argc-3]: Possibly '>' or '>>' * argv[argc-2]: Possibly * argv[argc-1]: Possibly '&' * argv[argc]: NULL terminating pointer * - * Maximum size is CONFIG_NSH_MAXARGUMENTS+5 + * Maximum size is NSH_MAX_ARGUMENTS+5 */ argv[0] = cmd; @@ -1433,7 +1398,7 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline) /* Check if the maximum number of arguments was exceeded */ - if (argc > CONFIG_NSH_MAXARGUMENTS) + if (argc > NSH_MAX_ARGUMENTS) { nsh_output(vtbl, g_fmttoomanyargs, cmd); } diff --git a/apps/system/Makefile b/apps/system/Makefile index 9955a6b2ce..d64bb54c6e 100644 --- a/apps/system/Makefile +++ b/apps/system/Makefile @@ -41,36 +41,31 @@ SUBDIRS = free i2c install readline poweroff ramtron sdcard sysinfo # Create the list of installed runtime modules (INSTALLED_DIRS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) define ADD_DIRECTORY - INSTALLED_DIRS += $(if $(wildcard .\$1\Makefile),$1,) +INSTALLED_DIRS += ${shell if [ -r $1/Makefile ]; then echo "$1"; fi} endef -else -define ADD_DIRECTORY - INSTALLED_DIRS += $(if $(wildcard ./$1/Makefile),$1,) -endef -endif $(foreach DIR, $(SUBDIRS), $(eval $(call ADD_DIRECTORY,$(DIR)))) all: nothing .PHONY: nothing context depend clean distclean -define SDIR_template -$(1)_$(2): - $(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" -endef - -$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),depend))) -$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),clean))) -$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),distclean))) - nothing: context: -depend: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_depend) +depend: + @for dir in $(INSTALLED_DIRS) ; do \ + $(MAKE) -C $$dir depend TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done -clean: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_clean) +clean: + @for dir in $(INSTALLED_DIRS) ; do \ + $(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done + +distclean: clean + @for dir in $(INSTALLED_DIRS) ; do \ + $(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ + done -distclean: clean $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_distclean) diff --git a/apps/system/free/Makefile b/apps/system/free/Makefile index dada00d992..7f911d81cc 100644 --- a/apps/system/free/Makefile +++ b/apps/system/free/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/system/free/Makefile # -# Copyright (C) 2011-2012 Uros Platise. All rights reserved. +# Copyright (C) 2011 Uros Platise. All rights reserved. # Author: Uros Platise # Gregory Nutt # @@ -61,14 +61,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -87,32 +83,32 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - $(Q) touch .built + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built # Register application .context: $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - $(Q) touch $@ + @touch $@ context: .context # Create dependencies .depend: Makefile $(SRCS) - $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - $(Q) touch $@ + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, .context) - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f .context Make.dep .depend -include Make.dep diff --git a/apps/system/i2c/Makefile b/apps/system/i2c/Makefile index 029d2b6fe4..00db91bb70 100644 --- a/apps/system/i2c/Makefile +++ b/apps/system/i2c/Makefile @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -77,29 +73,30 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - $(Q) touch .built + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built .context: $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - $(Q) touch $@ + @touch $@ context: .context .depend: Makefile $(SRCS) - $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - $(Q) touch $@ + @$(MKDEP) $(ROOTDEPPATH) \ + $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, .context) - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/system/install/Makefile b/apps/system/install/Makefile index 6a02d859ff..71d82f34ce 100644 --- a/apps/system/install/Makefile +++ b/apps/system/install/Makefile @@ -2,7 +2,6 @@ # apps/system/install/Makefile # # Copyright (C) 2011 Uros Platise. All rights reserved. -# Copyright (C) 2012 Gregory Nutt. All rights reserved. # Author: Uros Platise # Gregory Nutt # @@ -62,14 +61,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -88,32 +83,32 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - $(Q) touch .built + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built # Register application .context: $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - $(Q) touch $@ + @touch $@ context: .context # Create dependencies .depend: Makefile $(SRCS) - $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - $(Q) touch $@ + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, .context) - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f .context Make.dep .depend -include Make.dep diff --git a/apps/system/readline/Makefile b/apps/system/readline/Makefile index 3a48d324e7..34fab7e810 100644 --- a/apps/system/readline/Makefile +++ b/apps/system/readline/Makefile @@ -52,14 +52,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -78,8 +74,10 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - $(Q) touch .built + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built # Context build phase target @@ -88,20 +86,18 @@ context: # Dependency build phase target .depend: Makefile $(SRCS) - $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - $(Q) touch $@ + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ depend: .depend # Housekeeping targets clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, .context) - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f .context Make.dep .depend -include Make.dep