aboutsummaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/ChangeLog.txt71
-rw-r--r--apps/Makefile71
-rw-r--r--apps/examples/Kconfig158
-rw-r--r--apps/examples/Make.defs28
-rw-r--r--apps/examples/Makefile55
-rw-r--r--apps/examples/README.txt174
-rw-r--r--apps/examples/adc/Makefile21
-rw-r--r--apps/examples/adc/adc_main.c7
-rw-r--r--apps/examples/buttons/Makefile21
-rw-r--r--apps/examples/can/Makefile21
-rw-r--r--apps/examples/cdcacm/Makefile19
-rw-r--r--apps/examples/hello/Makefile19
-rw-r--r--apps/examples/helloxx/Makefile23
-rw-r--r--apps/examples/mm/Makefile21
-rw-r--r--apps/examples/mount/Makefile21
-rw-r--r--apps/examples/nsh/Makefile21
-rw-r--r--apps/examples/null/Makefile21
-rw-r--r--apps/examples/ostest/Kconfig27
-rw-r--r--apps/examples/ostest/Makefile19
-rw-r--r--apps/examples/ostest/roundrobin.c156
-rw-r--r--apps/examples/pipe/Makefile21
-rw-r--r--apps/examples/poll/Makefile22
-rw-r--r--apps/examples/pwm/Makefile21
-rw-r--r--apps/examples/pwm/pwm_main.c1
-rw-r--r--apps/examples/qencoder/Makefile19
-rw-r--r--apps/examples/romfs/Makefile24
-rw-r--r--apps/examples/serloop/Makefile21
-rw-r--r--apps/examples/watchdog/Makefile19
-rw-r--r--apps/interpreters/Kconfig4
-rw-r--r--apps/interpreters/Make.defs4
-rw-r--r--apps/interpreters/Makefile32
-rw-r--r--apps/interpreters/ficl/Kconfig4
-rw-r--r--apps/interpreters/ficl/Makefile29
-rw-r--r--apps/namedapp/Makefile32
-rw-r--r--apps/nshlib/Kconfig100
-rw-r--r--apps/nshlib/Makefile61
-rw-r--r--apps/nshlib/README.txt74
-rw-r--r--apps/nshlib/nsh.h77
-rw-r--r--apps/nshlib/nsh_apps.c41
-rw-r--r--apps/nshlib/nsh_consolemain.c8
-rw-r--r--apps/nshlib/nsh_dbgcmds.c64
-rw-r--r--apps/nshlib/nsh_netcmds.c327
-rw-r--r--apps/nshlib/nsh_netinit.c14
-rw-r--r--apps/nshlib/nsh_parse.c63
-rw-r--r--apps/px4/tests/test_time.c8
-rw-r--r--apps/px4/tests/tests_main.c85
-rw-r--r--apps/system/Makefile33
-rw-r--r--apps/system/free/Makefile28
-rw-r--r--apps/system/i2c/Makefile27
-rw-r--r--apps/system/install/Makefile27
-rw-r--r--apps/system/readline/Makefile24
51 files changed, 1568 insertions, 720 deletions
diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt
index 7375adccf..0695747f8 100644
--- a/apps/ChangeLog.txt
+++ b/apps/ChangeLog.txt
@@ -33,7 +33,7 @@
6.3 2011-05-15 Gregory Nutt <gnutt@nuttx.org>
- * apps/interpreter: Add a directory to hold interpreters. The Pascal add-
+ * apps/interpreter: Add a directory to hold interpreters. The Pascal add-
on module now installs and builds under this directory.
* apps/interpreter/ficl: Added logic to build Ficl (the "Forth Inspired
Command Language"). See http://ficl.sourceforge.net/.
@@ -349,7 +349,7 @@
* apps/NxWidgets/Kconfig: Add option to turn on the memory monitor
feature of the NxWidgets/NxWM unit tests.
-6.23 2012-xx-xx Gregory Nutt <gnutt@nuttx.org>
+6.23 2012-11-05 Gregory Nutt <gnutt@nuttx.org>
* vsn: Moved all NSH commands from vsn/ to system/. Deleted the vsn/
directory.
@@ -368,3 +368,70 @@
recent check-ins (Darcy Gong).
* apps/netutils/webclient/webclient.c: Fix another but that I introduced
when I was trying to add correct handling for loss of connection (Darcy Gong)
+ * apps/nshlib/nsh_telnetd.c: Add support for login to Telnet session via
+ username and password (Darcy Gong).
+ * apps/netutils/resolv/resolv.c (and files using the DNS resolver): Various
+ DNS address resolution improvements from Darcy Gong.
+ * apps/nshlib/nsh_netcmds.c: The ping command now passes a maximum round
+ trip time to uip_icmpping(). This allows pinging of hosts on complex
+ networks where the ICMP ECHO round trip time may exceed the ping interval.
+ * apps/examples/nxtext/nxtext_main.c: Fix bad conditional compilation
+ when CONFIG_NX_KBD is not defined. Submitted by Petteri Aimonen.
+ * apps/examples/nximage/nximage_main.c: Add a 5 second delay after the
+ NX logo is presented so that there is time for the image to be verified.
+ Suggested by Petteri Aimonen.
+ * apps/Makefile: Small change that reduces the number of shell invocations
+ by one (Mike Smith).
+ * apps/examples/elf: Test example for the ELF loader.
+ * apps/examples/elf: The ELF module test example appears fully functional.
+ * apps/netutils/json: Add a snapshot of the cJSON project. Contributed by
+ Darcy Gong.
+ * apps/examples/json: Test example for cJSON from Darcy Gong
+ * apps/nshlib/nsh_netinit.c: Fix static IP DNS problem (Darcy Gong)
+ * apps/netutils/resolv/resolv.c: DNS fixes from Darcy Gong.
+ * COPYING: Licensing information added.
+ * apps/netutils/codec and include/netutils/urldecode.h, base64.h, and md5.h:
+ A port of the BASE46, MD5 and URL CODEC library from Darcy Gong.
+ * nsnlib/nsh_codeccmd.c: NSH commands to use the CODEC library.
+ Contributed by Darcy Gong.
+ * apps/examples/wgetjson: Test example contributed by Darcy Gong
+ * apps/examples/cxxtest: A test for the uClibc++ library provided by
+ Qiang Yu and the RGMP team.
+ * apps/netutils/webclient, apps/netutils.codes, and apps/examples/wgetjson:
+ Add support for wget POST interface. Contributed by Darcy Gong.
+ * apps/examples/relays: A relay example contributed by Darcy Gong.
+ * apps/nshlib/nsh_netcmds: Add ifup and ifdown commands (from Darcy
+ Gong).
+ * apps/nshlib/nsh_netcmds: Extend the ifconfig command so that it
+ supports setting IP addresses, network masks, name server addresses,
+ and hardware address (from Darcy Gong).
+
+6.24 2012-12-20 Gregory Nutt <gnutt@nuttx.org>
+
+ * apps/examples/ostest/roundrobin.c: Replace large tables with
+ algorithmic prime number generation. This allows the roundrobin
+ test to run on platforms with minimal SRAM (Freddie Chopin).
+ * apps/nshlib/nsh_dbgcmds.c: Add hexdump command to dump the contents
+ of a file (or character device) to the console Contributed by Petteri
+ Aimonen.
+ * apps/examples/modbus: Fixes from Freddie Chopin
+ * apps/examples/modbus/Kconfig: Kconfig logic for FreeModBus contributed
+ by Freddie Chopin.
+ * Makefile, */Makefile: Various fixes for Windows native build. Now uses
+ make foreach loops instead of shell loops.
+ * apps/examples/elf/test/*/Makefile: OSX doesn't support install -D, use
+ mkdir -p then install without the -D. From Mike Smith.
+ * apps/examples/relays/Makefile: Reduced stack requirement (Darcy Gong).
+ * apps/nshlib and apps/netutils/dhcpc: Extend the NSH ifconfig command plus
+ various DHCPC improvements(Darcy Gong).
+ * apps/nshlib/nsh_apps.c: Fix compilation errors when CONFIG_NSH_DISABLEBG=y.
+ From Freddie Chopin.
+ * Rename CONFIG_PCODE and CONFIG_FICL as CONFIG_INTERPRETERS_PCODE and
+ CONFIG_INTERPRETERS_FICL for consistency with other configuration naming.
+ * apps/examples/keypadtest: A keypad test example contributed by Denis
+ Carikli.
+ * apps/examples/elf and nxflat: If CONFIG_BINFMT_EXEPATH is defined, these
+ tests will now use a relative path to the program and expect the binfmt/
+ logic to find the absolute path to the program using the PATH variable.
+
+6.25 2013-xx-xx Gregory Nutt <gnutt@nuttx.org>
diff --git a/apps/Makefile b/apps/Makefile
index 11d95bc19..f0de58e25 100644
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -107,7 +107,7 @@ endif
# Create the list of available applications (INSTALLED_APPS)
define ADD_BUILTIN
-INSTALLED_APPS += ${shell if [ -r $1/Makefile ]; then echo "$1"; fi}
+ INSTALLED_APPS += $(if $(wildcard $1$(DELIM)Makefile),$1,)
endef
$(foreach BUILTIN, $(CONFIGURED_APPS), $(eval $(call ADD_BUILTIN,$(BUILTIN))))
@@ -120,8 +120,10 @@ INSTALLED_APPS += $(EXTERNAL_APPS)
# provided by the user (possibly as a symbolic link) to add libraries and
# applications to the standard build from the repository.
-INSTALLED_APPS += ${shell if [ -r external/Makefile ]; then echo "external"; fi}
-SUBDIRS += ${shell if [ -r external/Makefile ]; then echo "external"; fi}
+EXTERNAL_DIR := $(dir $(wildcard external$(DELIM)Makefile))
+
+INSTALLED_APPS += $(EXTERNAL_DIR)
+SUBDIRS += $(EXTERNAL_DIR)
# The final build target
@@ -133,48 +135,81 @@ all: $(BIN)
.PHONY: $(INSTALLED_APPS) context depend clean distclean
$(INSTALLED_APPS):
- @$(MAKE) -C $@ TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)";
+ $(Q) $(MAKE) -C $@ TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"
$(BIN): $(INSTALLED_APPS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $@, $${obj}); \
- done ; )
.context:
- @for dir in $(INSTALLED_APPS) ; do \
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ $(Q) for %%G in ($(INSTALLED_APPS)) do ( \
+ if exist %%G\.context del /f /q %%G\.context \
+ $(MAKE) -C %%G TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" context \
+ )
+else
+ $(Q) for dir in $(INSTALLED_APPS) ; do \
rm -f $$dir/.context ; \
- $(MAKE) -C $$dir TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" context ; \
+ $(MAKE) -C $$dir TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" context ; \
done
- @touch $@
+endif
+ $(Q) touch $@
context: .context
.depend: context Makefile $(SRCS)
- @for dir in $(INSTALLED_APPS) ; do \
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ $(Q) for %%G in ($(INSTALLED_APPS)) do ( \
+ if exist %%G\.depend del /f /q %%G\.depend \
+ $(MAKE) -C %%G TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" depend \
+ )
+else
+ $(Q) for dir in $(INSTALLED_APPS) ; do \
rm -f $$dir/.depend ; \
- $(MAKE) -C $$dir TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" depend ; \
+ $(MAKE) -C $$dir TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" depend ; \
done
- @touch $@
+endif
+ $(Q) touch $@
depend: .depend
clean:
- @for dir in $(SUBDIRS) ; do \
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ $(Q) for %%G in ($(SUBDIRS)) do ( \
+ $(MAKE) -C %%G clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" \
+ )
+else
+ $(Q) for dir in $(SUBDIRS) ; do \
$(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
done
- @rm -f $(BIN) *~ .*.swp *.o
+endif
+ $(call DELFILE, $(BIN))
$(call CLEAN)
distclean: # clean
- @for dir in $(SUBDIRS) ; do \
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ $(Q) for %%G in ($(SUBDIRS)) do ( \
+ $(MAKE) -C %%G distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" \
+ )
+ $(call DELFILE, .config)
+ $(call DELFILE, .context)
+ $(call DELFILE, .depend)
+ $(Q) ( if exist external ( \
+ echo ********************************************************" \
+ echo * The external directory/link must be removed manually *" \
+ echo ********************************************************" \
+ )
+else
+ $(Q) for dir in $(SUBDIRS) ; do \
$(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
done
- @rm -f .config .context .depend
- @( if [ -e external ]; then \
+ $(call DELFILE, .config)
+ $(call DELFILE, .context)
+ $(call DELFILE, .depend)
+ $(Q) ( if [ -e external ]; then \
echo "********************************************************"; \
echo "* The external directory/link must be removed manually *"; \
echo "********************************************************"; \
fi; \
)
+endif
diff --git a/apps/examples/Kconfig b/apps/examples/Kconfig
index 865268add..ae5f0a61a 100644
--- a/apps/examples/Kconfig
+++ b/apps/examples/Kconfig
@@ -3,206 +3,60 @@
# 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"
-endmenu
-
-menu "DHCP Server Example"
+source "$APPSDIR/examples/cxxtest/Kconfig"
source "$APPSDIR/examples/dhcpd/Kconfig"
-endmenu
-
-menu "FTP Client Example"
+source "$APPSDIR/examples/elf/Kconfig"
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"
-endmenu
-
-menu "USB HID Keyboard Example"
+source "$APPSDIR/examples/json/Kconfig"
source "$APPSDIR/examples/hidkbd/Kconfig"
-endmenu
-
-menu "IGMP Example"
+source "$APPSDIR/examples/keypadtest/Kconfig"
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"
-endmenu
-
-menu "RGMP Example"
+source "$APPSDIR/examples/relays/Kconfig"
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"
-endmenu
-
-menu "WLAN Example"
+source "$APPSDIR/examples/wgetjson/Kconfig"
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 d03b976d2..91f1331df 100644
--- a/apps/examples/Make.defs
+++ b/apps/examples/Make.defs
@@ -54,6 +54,10 @@ 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
@@ -62,6 +66,10 @@ 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
@@ -86,6 +94,14 @@ ifeq ($(CONFIG_EXAMPLES_IGMP),y)
CONFIGURED_APPS += examples/igmp
endif
+ifeq ($(CONFIG_EXAMPLES_JSON),y)
+CONFIGURED_APPS += examples/json
+endif
+
+ifeq ($(CONFIG_EXAMPLES_KEYPADTEST),y)
+CONFIGURED_APPS += examples/keypadtest
+endif
+
ifeq ($(CONFIG_EXAMPLES_LCDRW),y)
CONFIGURED_APPS += examples/lcdrw
endif
@@ -94,6 +110,10 @@ 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
@@ -166,6 +186,10 @@ 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
@@ -226,6 +250,10 @@ 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 453f99ce7..bdbfd4de8 100644
--- a/apps/examples/Makefile
+++ b/apps/examples/Makefile
@@ -37,12 +37,12 @@
# Sub-directories
-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
+SUBDIRS = adc buttons can cdcacm composite cxxtest dhcpd discover elf ftpc
+SUBDIRS += ftpd hello helloxx hidkbd igmp json keypadtest 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
# 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 += usbterm watchdog wget wlan
CNTXTDIRS = pwm
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
-CNTXTDIRS += adc can cdcacm composite discover ftpd dhcpd modbus nettest
-CNTXTDIRS += qencoder telnetd watchdog
+CNTXTDIRS += adc can cdcacm composite cxxtest dhcpd discover ftpd json keypadtest
+CNTXTDIRS += modbus nettest nxlines relays qencoder telnetd watchdog wgetjson
endif
ifeq ($(CONFIG_EXAMPLES_HELLO_BUILTIN),y)
@@ -79,9 +79,6 @@ 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
@@ -105,27 +102,25 @@ 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:
- @for dir in $(CNTXTDIRS) ; do \
- $(MAKE) -C $$dir context TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
- done
-
-depend:
- @for dir in $(SUBDIRS) ; do \
- $(MAKE) -C $$dir depend TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
- done
-
-clean:
- @for dir in $(SUBDIRS) ; do \
- $(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
- done
-
-distclean: clean
- @for dir in $(SUBDIRS) ; do \
- $(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
- done
+context: $(foreach SDIR, $(CNTXTDIRS), $(SDIR)_context)
+
+depend: $(foreach SDIR, $(SUBDIRS), $(SDIR)_depend)
+
+clean: $(foreach SDIR, $(SUBDIRS), $(SDIR)_clean)
+
+distclean: clean $(foreach SDIR, $(SUBDIRS), $(SDIR)_distclean)
-include Make.dep
diff --git a/apps/examples/README.txt b/apps/examples/README.txt
index 763427e32..e40a63be9 100644
--- a/apps/examples/README.txt
+++ b/apps/examples/README.txt
@@ -239,6 +239,29 @@ 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
^^^^^^^^^^^^^^
@@ -297,6 +320,68 @@ 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
^^^^^^^^^^^^^
@@ -482,6 +567,32 @@ 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/keypadtest
+^^^^^^^^^^^^^^^^^^^
+
+ This is a generic keypad test example. It is similar to the USB hidkbd
+ example, but makes no assumptions about the underlying keyboard interface.
+ It uses the interfaces of include/nuttx/input/keypad.h.
+
+ CONFIG_EXAMPLES_KEYPADTEST - Selects the keypadtest example (only need
+ if the mconf/Kconfig tool is used.
+
+ CONFIG_EXAMPLES_KEYPAD_DEVNAME - The name of the keypad device that will
+ be opened in order to perform the keypad test. Default: "/dev/keypad"
+
examples/lcdrw
^^^^^^^^^^^^^^
@@ -496,6 +607,11 @@ 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
^^^^^^^^^^^
@@ -838,8 +954,6 @@ 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
@@ -877,6 +991,9 @@ 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
^^^^^^^^^^^^^^^
@@ -984,6 +1101,17 @@ 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
^^^^^^^^^^^^^^^^^
@@ -1110,17 +1238,28 @@ 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
+ 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).
examples/rgmp
^^^^^^^^^^^^^
@@ -1672,7 +1811,16 @@ 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 6357dfc3d..69862b383 100644
--- a/apps/examples/adc/Makefile
+++ b/apps/examples/adc/Makefile
@@ -1,7 +1,7 @@
############################################################################
# apps/examples/adc/Makefile
#
-# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -76,9 +80,7 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
+ $(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
.context:
@@ -90,16 +92,17 @@ endif
context: .context
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
depend: .depend
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/examples/adc/adc_main.c b/apps/examples/adc/adc_main.c
index 404fba8c1..553658fee 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_with_dev;
+ goto errout;
}
/* Now loop the appropriate number of times, displaying the collected
@@ -357,6 +357,11 @@ 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 25d1ef2c2..77c1cd67d 100644
--- a/apps/examples/buttons/Makefile
+++ b/apps/examples/buttons/Makefile
@@ -1,7 +1,7 @@
############################################################################
# apps/examples/buttons/Makefile
#
-# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -76,9 +80,7 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
+ $(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
.context:
@@ -90,16 +92,17 @@ endif
context: .context
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
depend: .depend
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/examples/can/Makefile b/apps/examples/can/Makefile
index c6dc5af84..8924797e3 100644
--- a/apps/examples/can/Makefile
+++ b/apps/examples/can/Makefile
@@ -1,7 +1,7 @@
############################################################################
# apps/examples/can/Makefile
#
-# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -76,9 +80,7 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
+ $(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
.context:
@@ -90,16 +92,17 @@ endif
context: .context
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
depend: .depend
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/examples/cdcacm/Makefile b/apps/examples/cdcacm/Makefile
index 3fa886d56..e8d03807d 100644
--- a/apps/examples/cdcacm/Makefile
+++ b/apps/examples/cdcacm/Makefile
@@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -80,9 +84,7 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
+ $(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
.context:
@@ -93,17 +95,18 @@ $(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:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/examples/hello/Makefile b/apps/examples/hello/Makefile
index 1d78d723e..560b0da35 100644
--- a/apps/examples/hello/Makefile
+++ b/apps/examples/hello/Makefile
@@ -54,10 +54,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -76,9 +80,7 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
+ $(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
.context:
@@ -90,16 +92,17 @@ endif
context: .context
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
depend: .depend
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/examples/helloxx/Makefile b/apps/examples/helloxx/Makefile
index 8e85eab23..062da7d58 100644
--- a/apps/examples/helloxx/Makefile
+++ b/apps/examples/helloxx/Makefile
@@ -1,7 +1,7 @@
############################################################################
# apps/examples/helloxx/Makefile
#
-# Copyright (C) 2009-2011 Gregory Nutt. All rights reserved.
+# Copyright (C) 2009-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -50,10 +50,14 @@ 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 = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -69,7 +73,7 @@ STACKSIZE = 2048
VPATH =
all: .built
-.PHONY: clean depend disclean chkcxx
+.PHONY: clean depend distclean chkcxx
chkcxx:
ifneq ($(CONFIG_HAVE_CXX),y)
@@ -93,9 +97,7 @@ $(CXXOBJS): %$(OBJEXT): %.cxx
$(call COMPILEXX, $<, $@)
.built: chkcxx $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
+ $(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
.context:
@@ -107,16 +109,17 @@ endif
context: .context
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
depend: .depend
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/examples/mm/Makefile b/apps/examples/mm/Makefile
index 24ed4926f..5ba7f4eec 100644
--- a/apps/examples/mm/Makefile
+++ b/apps/examples/mm/Makefile
@@ -1,7 +1,7 @@
############################################################################
# apps/examples/mm/Makefile
#
-# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -70,24 +74,23 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
+ $(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
context:
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
depend: .depend
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/examples/mount/Makefile b/apps/examples/mount/Makefile
index 69cf970cf..133bdfa1f 100644
--- a/apps/examples/mount/Makefile
+++ b/apps/examples/mount/Makefile
@@ -1,7 +1,7 @@
############################################################################
# apps/Makefile
#
-# Copyright (C) 2007-2008, 2010-2010 Gregory Nutt. All rights reserved.
+# Copyright (C) 2007-2008, 2010-2010, 2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -70,24 +74,23 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
+ $(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
context:
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
depend: .depend
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/examples/nsh/Makefile b/apps/examples/nsh/Makefile
index bad40fb2e..c7d212fc2 100644
--- a/apps/examples/nsh/Makefile
+++ b/apps/examples/nsh/Makefile
@@ -1,7 +1,7 @@
############################################################################
# apps/examples/nsh/Makefile
#
-# Copyright (C) 2007-2008, 2010-2011 Gregory Nutt. All rights reserved.
+# Copyright (C) 2007-2008, 2010-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -70,24 +74,23 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
+ $(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
context:
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
depend: .depend
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/examples/null/Makefile b/apps/examples/null/Makefile
index 634120600..47ec4cdaf 100644
--- a/apps/examples/null/Makefile
+++ b/apps/examples/null/Makefile
@@ -1,7 +1,7 @@
############################################################################
# examples/null/Makefile
#
-# Copyright (C) 2007-2008, 2010-2011 Gregory Nutt. All rights reserved.
+# Copyright (C) 2007-2008, 2010-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -70,24 +74,23 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
+ $(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
context:
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
depend: .depend
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/examples/ostest/Kconfig b/apps/examples/ostest/Kconfig
index 0da7e4ce3..c3fe8f21d 100644
--- a/apps/examples/ostest/Kconfig
+++ b/apps/examples/ostest/Kconfig
@@ -39,4 +39,31 @@ 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 374964b39..3e78c64e8 100644
--- a/apps/examples/ostest/Makefile
+++ b/apps/examples/ostest/Makefile
@@ -98,10 +98,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -120,9 +124,7 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
+ $(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
.context:
@@ -134,16 +136,17 @@ endif
context: .context
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
depend: .depend
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/examples/ostest/roundrobin.c b/apps/examples/ostest/roundrobin.c
index 5167a857e..bfd344df3 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 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008, 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -39,6 +39,7 @@
#include <nuttx/config.h>
#include <stdio.h>
+#include <stdbool.h>
#include "ostest.h"
#if CONFIG_RR_INTERVAL > 0
@@ -47,115 +48,87 @@
* Definitions
********************************************************************************/
-/* 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.
- */
+/* 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. */
-/* #define CONFIG_NINTEGERS 32768 Takes forever on 60Mhz ARM7 */
-
-#define CONFIG_NINTEGERS 2048
-
-/********************************************************************************
- * Private Data
- ********************************************************************************/
+#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
-static int prime1[CONFIG_NINTEGERS];
-static int prime2[CONFIG_NINTEGERS];
+#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
/********************************************************************************
* Private Functions
********************************************************************************/
/********************************************************************************
- * Name: dosieve
+ * Name: get_primes
*
* Description
- * 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.
- *
+ * This function searches for prime numbers in the most primitive way possible.
********************************************************************************/
-static void dosieve(int *prime)
+static void get_primes(int *count, int *last)
{
- int a,d;
- int i;
- int j;
-
- a = 2;
- d = a;
-
- for (i = 0; i < CONFIG_NINTEGERS; i++)
- {
- prime[i] = i+2;
- }
-
- for (i = 1; i < 10; i++)
+ int number;
+ int local_count = 0;
+ *last = 0; // to make compiler happy
+
+ for (number = 1; number < CONFIG_EXAMPLES_OSTEST_RR_RANGE; number++)
+ {
+ int div;
+ bool is_prime = true;
+
+ for (div = 2; div <= number / 2; div++)
+ if (number % div == 0)
+ {
+ is_prime = false;
+ break;
+ }
+
+ if (is_prime)
{
- for (j = 0; j < CONFIG_NINTEGERS; j++)
- {
- d = a + d;
- if (d < CONFIG_NINTEGERS)
- {
- prime[d]=0;
- }
- }
- a++;
- d = a;
- i++;
- }
-
+ local_count++;
+ *last = number;
#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++;
- }
- }
+ printf(" Prime %d: %d\n", local_count, number);
#endif
-}
-
-/********************************************************************************
- * Name: sieve1
- ********************************************************************************/
-
-static void *sieve1(void *parameter)
-{
- int i;
-
- printf("sieve1 started\n");
-
- for (i = 0; i < 1000; i++)
- {
- dosieve(prime1);
}
+ }
- printf("sieve1 finished\n");
-
- pthread_exit(NULL);
- return NULL; /* To keep some compilers happy */
+ *count = local_count;
}
/********************************************************************************
- * Name: sieve2
+ * Name: get_primes_thread
********************************************************************************/
-static void *sieve2(void *parameter)
+static void *get_primes_thread(void *parameter)
{
- int i;
+ int id = (int)parameter;
+ int i, count, last;
- printf("sieve2 started\n");
+ 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);
- for (i = 0; i < 1000; i++)
+ for (i = 0; i < CONFIG_EXAMPLES_OSTEST_RR_RUNS; i++)
{
- dosieve(prime2);
+ get_primes(&count, &last);
}
- printf("sieve2 finished\n");
+ printf("get_primes_thread id=%d finished, found %d primes, last one was %d\n",
+ id, count, last);
pthread_exit(NULL);
return NULL; /* To keep some compilers happy */
@@ -171,14 +144,13 @@ static void *sieve2(void *parameter)
void rr_test(void)
{
- pthread_t sieve1_thread;
- pthread_t sieve2_thread;
+ pthread_t get_primes1_thread;
+ pthread_t get_primes2_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)
{
@@ -203,29 +175,31 @@ void rr_test(void)
}
else
{
- printf("rr_test: Set thread policty to SCHED_RR\n");
+ printf("rr_test: Set thread policy to SCHED_RR\n");
}
- status = pthread_create(&sieve1_thread, &attr, sieve1, NULL);
+ printf("rr_test: Starting first get_primes_thread\n");
+
+ status = pthread_create(&get_primes1_thread, &attr, get_primes_thread, (void*)1);
if (status != 0)
{
printf("rr_test: Error in thread 1 creation, status=%d\n", status);
}
- printf("rr_test: Starting sieve1 thread \n");
+ printf("rr_test: Starting second get_primes_thread\n");
- status = pthread_create(&sieve2_thread, &attr, sieve2, NULL);
+ status = pthread_create(&get_primes2_thread, &attr, get_primes_thread, (void*)2);
if (status != 0)
{
printf("rr_test: Error in thread 2 creation, status=%d\n", status);
}
- printf("rr_test: Waiting for sieves to complete -- this should take awhile\n");
+ printf("rr_test: Waiting for threads 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(sieve2_thread, &result);
- pthread_join(sieve1_thread, &result);
+ pthread_join(get_primes2_thread, &result);
+ pthread_join(get_primes1_thread, &result);
printf("rr_test: Done\n");
}
diff --git a/apps/examples/pipe/Makefile b/apps/examples/pipe/Makefile
index 956c911b3..bed319085 100644
--- a/apps/examples/pipe/Makefile
+++ b/apps/examples/pipe/Makefile
@@ -1,7 +1,7 @@
############################################################################
# apps/examples/pipe/Makefile
#
-# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved.
+# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -70,24 +74,23 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
+ $(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
context:
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
depend: .depend
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/examples/poll/Makefile b/apps/examples/poll/Makefile
index aef61d199..13173f125 100644
--- a/apps/examples/poll/Makefile
+++ b/apps/examples/poll/Makefile
@@ -1,7 +1,7 @@
############################################################################
# apps/examples/poll/Makefile
#
-# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved.
+# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -70,25 +74,25 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
+ $(call ARCHIVE, $(BIN), $(OBJS))
@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:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend host
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
+ $(call DELFILE, host$(HOSTEXEEXT))
-include Make.dep
diff --git a/apps/examples/pwm/Makefile b/apps/examples/pwm/Makefile
index efbdb048e..3a6f2520a 100644
--- a/apps/examples/pwm/Makefile
+++ b/apps/examples/pwm/Makefile
@@ -1,7 +1,7 @@
############################################################################
# apps/examples/pwm/Makefile
#
-# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -76,9 +80,7 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
+ $(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
.context:
@@ -88,16 +90,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:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/examples/pwm/pwm_main.c b/apps/examples/pwm/pwm_main.c
index 775bdba6b..a46c10f55 100644
--- a/apps/examples/pwm/pwm_main.c
+++ b/apps/examples/pwm/pwm_main.c
@@ -48,6 +48,7 @@
#include <fcntl.h>
#include <errno.h>
#include <debug.h>
+#include <string.h>
#include <nuttx/pwm.h>
diff --git a/apps/examples/qencoder/Makefile b/apps/examples/qencoder/Makefile
index 3f3fc9def..7d2427c6b 100644
--- a/apps/examples/qencoder/Makefile
+++ b/apps/examples/qencoder/Makefile
@@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -76,9 +80,7 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
+ $(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
.context:
@@ -90,16 +92,17 @@ endif
context: .context
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
depend: .depend
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/examples/romfs/Makefile b/apps/examples/romfs/Makefile
index ba930b77d..2b02952ed 100644
--- a/apps/examples/romfs/Makefile
+++ b/apps/examples/romfs/Makefile
@@ -1,7 +1,7 @@
############################################################################
# apps/examples/romfs/Makefile
#
-# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved.
+# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -61,7 +65,7 @@ ROOTDEPPATH = --dep-path .
VPATH =
all: .built
-.PHONY: checkgenromfs clean depend disclean
+.PHONY: checkgenromfs clean depend distclean
$(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
@@ -86,26 +90,26 @@ romfs_testdir.h : testdir.img
@xxd -i $< >$@ || { echo "xxd of $< failed" ; exit 1 ; }
.built: romfs_testdir.h $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
+ $(call ARCHIVE, $(BIN), $(OBJS))
@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:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend testdir.img
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
+ $(call DELFILE, testdir.img)
-include Make.dep
diff --git a/apps/examples/serloop/Makefile b/apps/examples/serloop/Makefile
index e1c415cdd..4a262884b 100644
--- a/apps/examples/serloop/Makefile
+++ b/apps/examples/serloop/Makefile
@@ -1,7 +1,7 @@
############################################################################
# apps/examples/serloop/Makefile
#
-# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved.
+# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -70,26 +74,25 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
+ $(call ARCHIVE, $(BIN), $(OBJS))
@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:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/examples/watchdog/Makefile b/apps/examples/watchdog/Makefile
index d2739dbb0..9890959fb 100644
--- a/apps/examples/watchdog/Makefile
+++ b/apps/examples/watchdog/Makefile
@@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -76,9 +80,7 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
+ $(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
.context:
@@ -88,16 +90,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:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/interpreters/Kconfig b/apps/interpreters/Kconfig
index 34cbf2eee..6e7d1ac4f 100644
--- a/apps/interpreters/Kconfig
+++ b/apps/interpreters/Kconfig
@@ -7,7 +7,7 @@ comment "Interpreters"
source "$APPSDIR/interpreters/ficl/Kconfig"
-config PCODE
+config INTERPRETERS_PCODE
bool "Pascal p-code interpreter"
default n
---help---
@@ -16,6 +16,6 @@ config PCODE
configuration implies that you have performed the required installation of the
Pascal run-time code.
-if PCODE
+if INTERPRETERS_PCODE
endif
diff --git a/apps/interpreters/Make.defs b/apps/interpreters/Make.defs
index 2fc4b26d4..5d808d5d6 100644
--- a/apps/interpreters/Make.defs
+++ b/apps/interpreters/Make.defs
@@ -34,10 +34,10 @@
#
############################################################################
-ifeq ($(CONFIG_PCODE),y)
+ifeq ($(CONFIG_INTERPRETERS_PCODE),y)
CONFIGURED_APPS += interpreters/pcode
endif
-ifeq ($(CONFIG_FICL),y)
+ifeq ($(CONFIG_INTERPRETERS_FICL),y)
CONFIGURED_APPS += interpreters/ficl
endif
diff --git a/apps/interpreters/Makefile b/apps/interpreters/Makefile
index 5901fc830..867d45f99 100644
--- a/apps/interpreters/Makefile
+++ b/apps/interpreters/Makefile
@@ -33,7 +33,7 @@
#
############################################################################
--include $(TOPDIR)/.config # Current configuration
+-include $(TOPDIR)/.config
# Sub-directories containing interpreter runtime
@@ -41,30 +41,36 @@ 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:
- @for dir in $(INSTALLED_DIRS) ; do \
- $(MAKE) -C $$dir depend TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
- done
+depend: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_depend)
-clean:
- @for dir in $(INSTALLED_DIRS) ; do \
- $(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
- done
+clean: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_clean)
-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/interpreters/ficl/Kconfig b/apps/interpreters/ficl/Kconfig
index 1860a1591..ba6a7bc35 100644
--- a/apps/interpreters/ficl/Kconfig
+++ b/apps/interpreters/ficl/Kconfig
@@ -3,7 +3,7 @@
# see misc/tools/kconfig-language.txt.
#
-config FICL
+config INTERPRETERS_FICL
bool "Ficl Forth interpreter"
default n
---help---
@@ -11,6 +11,6 @@ config FICL
apps/interpreters/ficl directory. Use of this configuration assumes
that you have performed the required installation of the Ficl run-time code.
-if FICL
+if INTERPRETERS_FICL
endif
diff --git a/apps/interpreters/ficl/Makefile b/apps/interpreters/ficl/Makefile
index fb953964e..990630fb8 100644
--- a/apps/interpreters/ficl/Makefile
+++ b/apps/interpreters/ficl/Makefile
@@ -1,7 +1,7 @@
############################################################################
# apps/interpreters/ficl/Makefile
#
-# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -35,14 +35,11 @@
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
@@ -69,10 +66,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOT_DEPPATH = --dep-path .
@@ -95,24 +96,24 @@ debug:
@#echo "CFLAGS: $(CFLAGS)"
.built: debug $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
- @touch .built
+ $(call ARCHIVE, $(BIN), $(OBJS))
+ $(Q) touch .built
context:
.depend: debug Makefile $(SRCS)
- @$(MKDEP) $(ROOT_DEPPATH) $(SRC_DEPPATH) $(FICL_DEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
- @touch $@
+ $(Q) $(MKDEP) $(ROOT_DEPPATH) $(SRC_DEPPATH) $(FICL_DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
+ $(Q) touch $@
depend: .depend
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .context)
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/namedapp/Makefile b/apps/namedapp/Makefile
index 6b0fd6a05..a88c73567 100644
--- a/apps/namedapp/Makefile
+++ b/apps/namedapp/Makefile
@@ -1,7 +1,7 @@
############################################################################
# apps/nshlib/Makefile
#
-# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -54,10 +54,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -75,32 +79,32 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
- @touch .built
+ $(call ARCHIVE, $(BIN), $(OBJS))
+ $(Q) 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
- @touch $@
+ $(Q) touch $@
context: .context
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
- @touch $@
+ $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
+ $(Q) touch $@
depend: .depend
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f .context Make.dep .depend
- @rm -f namedapp_list.h
- @rm -f namedapp_proto.h
+ $(call DELFILE, .context)
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
+ $(call DELFILE, namedapp_list.h)
+ $(call DELFILE, namedapp_proto.h)
-include Make.dep
diff --git a/apps/nshlib/Kconfig b/apps/nshlib/Kconfig
index d12a32973..17b107b8f 100644
--- a/apps/nshlib/Kconfig
+++ b/apps/nshlib/Kconfig
@@ -23,122 +23,194 @@ 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
@@ -490,7 +562,7 @@ config NSH_DHCPC
config NSH_IPADDR
hex "Target IP address"
- default 0x10000002
+ default 0xa0000002
depends on NSH_LIBRARY && NET && !NSH_DHCPC
---help---
If NSH_DHCPC is NOT set, then the static IP address must be provided.
@@ -499,7 +571,7 @@ config NSH_IPADDR
config NSH_DRIPADDR
hex "Router IP address"
- default 0x10000001
+ default 0xa0000001
depends on NSH_LIBRARY && NET && !NSH_DHCPC
---help---
Default router IP address (aka, Gateway). This is a 32-bit integer
@@ -513,6 +585,21 @@ 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
@@ -520,3 +607,12 @@ 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 f616374bf..73325e899 100644
--- a/apps/nshlib/Makefile
+++ b/apps/nshlib/Makefile
@@ -39,64 +39,72 @@ 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
-AOBJS = $(ASRCS:.S=$(OBJEXT))
-COBJS = $(CSRCS:.c=$(OBJEXT))
+ifeq ($(CONFIG_NETUTILS_CODECS),y)
+CSRCS += nsh_codeccmd.c
+endif
+
+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 = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../libapps$(LIBEXT)
+endif
endif
-ROOTDEPPATH = --dep-path .
-VPATH =
+ROOTDEPPATH = --dep-path .
+VPATH =
# Build targets
-all: .built
+all: .built
.PHONY: context .depend depend clean distclean
$(AOBJS): %$(OBJEXT): %.S
@@ -106,26 +114,25 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
+ $(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
context:
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) \
- $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
depend: .depend
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend
+ $(call DELFILE, .context)
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/nshlib/README.txt b/apps/nshlib/README.txt
index 0f6aee759..bc626e699 100644
--- a/apps/nshlib/README.txt
+++ b/apps/nshlib/README.txt
@@ -235,6 +235,10 @@ o test <expression>
integer -gt integer | integer -le integer |
integer -lt integer | integer -ne integer
+o base64dec [-w] [-f] <string or filepath>
+
+o base64dec [-w] [-f] <string or filepath>
+
o cat <path> [<path> [<path> ...]]
This command copies and concatentates all of the files at <path>
@@ -381,7 +385,11 @@ o help [-v] [<cmd>]
<cmd>
Show full command usage only for this command
-o ifconfig
+o hexdump <file or device>
+
+ Dump data in hexadecimal format from a file or character device.
+
+o ifconfig [nic_name [<ip-address>|dhcp]] [dr|gw|gateway <dr-address>] [netmask <net-mask>] [dns <dns-address>] [hw <hw-mac>]
Show the current configuration of the network, for example:
@@ -392,6 +400,22 @@ o ifconfig
if uIP statistics are enabled (CONFIG_NET_STATISTICS), then
this command will also show the detailed state of uIP.
+o ifdown <nic-name>
+
+ Take down the interface identified by the name <nic-name>.
+
+ Example:
+
+ ifdown eth0
+
+o ifup <nic-name>
+
+ Bring up down the interface identified by the name <nic-name>.
+
+ Example:
+
+ ifup eth0
+
o kill -<signal> <pid>
Send the <signal> to the task identified by <pid>.
@@ -449,6 +473,8 @@ o ls [-lRs] <dir-path>
-l Show size and mode information along with the filenames
in the listing.
+o md5 [-f] <string or filepath>
+
o mb <hex-address>[=<hex-value>][ <hex-byte-count>]
o mh <hex-address>[=<hex-value>][ <hex-byte-count>]
o mw <hex-address>[=<hex-value>][ <hex-byte-count>]
@@ -781,6 +807,10 @@ o unset <name>
nsh>
+ o urldecode [-f] <string or filepath>
+
+ o urlencode [-f] <string or filepath>
+
o usleep <usec>
Pause execution (sleep) of <usec> microseconds.
@@ -826,6 +856,8 @@ 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
@@ -837,10 +869,14 @@ 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
@@ -861,6 +897,8 @@ 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 ---
@@ -880,20 +918,22 @@ 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_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
+ 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
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.
@@ -1084,6 +1124,10 @@ 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 7188477ce..a046a384f 100644
--- a/apps/nshlib/nsh.h
+++ b/apps/nshlib/nsh.h
@@ -47,6 +47,7 @@
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
+#include <unistd.h>
#include <errno.h>
#include <nuttx/usb/usbdev_trace.h>
@@ -215,6 +216,15 @@
#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
@@ -258,12 +268,36 @@
# undef CONFIG_NSH_ROMFSSECTSIZE
#endif
-/* 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
+/* 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
#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.
@@ -507,7 +541,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);
@@ -529,6 +563,9 @@ 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
@@ -595,6 +632,10 @@ 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);
@@ -643,4 +684,28 @@ 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_apps.c b/apps/nshlib/nsh_apps.c
index e335c2e2c..7dbaf9ba8 100644
--- a/apps/nshlib/nsh_apps.c
+++ b/apps/nshlib/nsh_apps.c
@@ -122,13 +122,28 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
ret = exec_namedapp(cmd, (FAR const char **)argv);
if (ret >= 0)
{
- /* The application was successfully started (but still blocked because the
- * scheduler is locked). If the application was not backgrounded, then we
- * need to wait here for the application to exit.
+ /* The application was successfully started (but still blocked because
+ * the scheduler is locked). If the application was not backgrounded,
+ * then we need to wait here for the application to exit. These really
+ * only works works with the following options:
+ *
+ * - CONFIG_NSH_DISABLEBG - Do not run commands in background
+ * - CONFIG_SCHED_WAITPID - Required to run external commands in
+ * foreground
+ *
+ * These concepts do not apply cleanly to the external applications.
*/
#ifdef CONFIG_SCHED_WAITPID
+
+ /* CONFIG_SCHED_WAITPID is selected, so we may run the command in
+ * foreground unless we were specifically requested to run the command
+ * in background (and running commands in background is enabled).
+ */
+
+# ifndef CONFIG_NSH_DISABLEBG
if (vtbl->np.np_bg == false)
+# endif /* CONFIG_NSH_DISABLEBG */
{
int rc = 0;
@@ -155,8 +170,25 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
*/
}
}
+# ifndef CONFIG_NSH_DISABLEBG
else
-#endif
+# endif /* CONFIG_NSH_DISABLEBG */
+#endif /* CONFIG_SCHED_WAITPID */
+
+ /* We get here if either:
+ *
+ * - CONFIG_SCHED_WAITPID is not selected meaning that all commands
+ * have to be run in background, or
+ * - CONFIG_SCHED_WAITPID and CONFIG_NSH_DISABLEBG are both selected, but the
+ * user requested to run the command in background.
+ *
+ * NOTE that the case of a) CONFIG_SCHED_WAITPID is not selected and
+ * b) CONFIG_NSH_DISABLEBG selected cannot be supported. In that event, all
+ * commands will have to run in background. The waitpid() API must be
+ * available to support running the command in foreground.
+ */
+
+#if !defined(CONFIG_SCHED_WAITPID) || !defined(CONFIG_NSH_DISABLEBG)
{
struct sched_param param;
sched_getparam(0, &param);
@@ -168,6 +200,7 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
ret = OK;
}
+#endif /* !CONFIG_SCHED_WAITPID || !CONFIG_NSH_DISABLEBG */
}
sched_unlock();
diff --git a/apps/nshlib/nsh_consolemain.c b/apps/nshlib/nsh_consolemain.c
index 6b51be470..f05447a64 100644
--- a/apps/nshlib/nsh_consolemain.c
+++ b/apps/nshlib/nsh_consolemain.c
@@ -160,11 +160,11 @@ int nsh_consolemain(int argc, char *argv[])
}
}
- /* Clean up */
+ /* Clean up. We do not get here, but this is necessary to keep some
+ * compilers happy. But others will complain that this code is not
+ * reachable.
+ */
nsh_exit(&pstate->cn_vtbl, 0);
-
- /* We do not get here, but this is necessary to keep some compilers happy */
-
return OK;
}
diff --git a/apps/nshlib/nsh_dbgcmds.c b/apps/nshlib/nsh_dbgcmds.c
index 384b377f3..85a4ccb9c 100644
--- a/apps/nshlib/nsh_dbgcmds.c
+++ b/apps/nshlib/nsh_dbgcmds.c
@@ -46,6 +46,10 @@
#include <string.h>
#include <errno.h>
+#if CONFIG_NFILE_DESCRIPTORS > 0
+# include <fcntl.h>
+#endif
+
#include "nsh.h"
#include "nsh_console.h"
@@ -99,7 +103,7 @@ int mem_parse(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
pcvalue++;
lvalue = (unsigned long)strtol(pcvalue, NULL, 16);
- if (lvalue > 0xffffffff)
+ if (lvalue > 0xffffffffL)
{
return -EINVAL;
}
@@ -127,6 +131,7 @@ int mem_parse(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
{
mem->dm_count = 1;
}
+
return OK;
}
@@ -327,7 +332,7 @@ void nsh_dumpbuffer(FAR struct nsh_vtbl_s *vtbl, const char *msg,
}
/****************************************************************************
- * Name: cmd_xd
+ * Name: cmd_xd, hex dump of memory
****************************************************************************/
#ifndef CONFIG_NSH_DISABLE_XD
@@ -353,3 +358,58 @@ 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 cfea5a08a..371d30460 100644
--- a/apps/nshlib/nsh_netcmds.c
+++ b/apps/nshlib/nsh_netcmds.c
@@ -51,6 +51,7 @@
#include <fcntl.h> /* Needed for open */
#include <libgen.h> /* Needed for basename */
#include <errno.h>
+#include <debug.h>
#include <nuttx/net/net.h>
#include <nuttx/clock.h>
@@ -80,6 +81,15 @@
# endif
#endif
+#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS)
+# ifdef CONFIG_HAVE_GETHOSTBYNAME
+# include <netdb.h>
+# else
+# include <apps/netutils/resolv.h>
+# endif
+# include <apps/netutils/dhcpc.h>
+#endif
+
#include "nsh.h"
#include "nsh_console.h"
@@ -87,8 +97,16 @@
* 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
****************************************************************************/
@@ -262,14 +280,34 @@ 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\n", inet_ntoa(addr));
+ 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");
return OK;
}
@@ -469,6 +507,54 @@ int cmd_get(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#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
****************************************************************************/
@@ -476,7 +562,20 @@ int cmd_get(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 ip;
+ 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[IFHWADDRLEN];
+#if defined(CONFIG_NSH_DHCPC)
+ FAR void *handle;
+#endif
/* With one or no arguments, ifconfig simply shows the status of ethernet
* device:
@@ -498,24 +597,201 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* ifconfig nic_name ip_address
*/
- /* Set host 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);
+ }
+
+#if defined(CONFIG_NSH_DHCPC)
+ if (!strcmp(hostip, "dhcp"))
+ {
+ /* Set DHCP addr */
+
+ ndbg("DHCPC Mode\n");
+ gip = addr.s_addr = 0;
+ }
+ else
+#endif
+ {
+ /* Set host IP address */
+
+ ndbg("Host IP: %s\n", hostip);
+ gip = addr.s_addr = inet_addr(hostip);
+ }
- ip = addr.s_addr = inet_addr(argv[2]);
- uip_sethostaddr(argv[1], &addr);
+ uip_sethostaddr(intf, &addr);
/* Set gateway */
- ip = NTOHL(ip);
- ip &= ~0x000000ff;
- ip |= 0x00000001;
+ if (gwip)
+ {
+ ndbg("Gateway: %s\n", gwip);
+ gip = addr.s_addr = inet_addr(gwip);
+ }
+ else
+ {
+ if (gip)
+ {
+ ndbg("Gateway: default\n");
+ gip = NTOHL(gip);
+ gip &= ~0x000000ff;
+ gip |= 0x00000001;
+ gip = HTONL(gip);
+ }
+
+ addr.s_addr = gip;
+ }
+
+ uip_setdraddr(intf, &addr);
+
+ /* Set network mask */
+
+ 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);
- addr.s_addr = HTONL(ip);
- uip_setdraddr(argv[1], &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
+
+#if defined(CONFIG_NSH_DHCPC)
+ /* Get the MAC address of the NIC */
+
+ if (!gip)
+ {
+ uip_getmacaddr("eth0", mac);
+
+ /* Set up the DHCPC modules */
+
+ handle = dhcpc_open(&mac, IFHWADDRLEN);
+
+ /* Get an IP address. Note that there is no logic for renewing the IP address in this
+ * example. The address should be renewed in ds.lease_time/2 seconds.
+ */
+
+ if (handle)
+ {
+ struct dhcpc_state ds;
- /* Set netmask */
+ (void)dhcpc_request(handle, &ds);
+ uip_sethostaddr("eth0", &ds.ipaddr);
- addr.s_addr = inet_addr("255.255.255.0");
- uip_setnetmask(argv[1], &addr);
+ if (ds.netmask.s_addr != 0)
+ {
+ uip_setnetmask("eth0", &ds.netmask);
+ }
+
+ if (ds.default_router.s_addr != 0)
+ {
+ uip_setdraddr("eth0", &ds.default_router);
+ }
+
+ if (ds.dnsaddr.s_addr != 0)
+ {
+ resolv_conf(&ds.dnsaddr);
+ }
+
+ dhcpc_close(handle);
+ }
+ }
+#endif
return OK;
}
@@ -536,6 +812,7 @@ 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;
@@ -599,7 +876,7 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
if (optind == argc-1)
{
staddr = argv[optind];
- if (!uiplib_ipaddrconv(staddr, (FAR unsigned char*)&ipaddr))
+ if (dns_gethostip(staddr, &ipaddr) < 0)
{
goto errout;
}
@@ -619,16 +896,26 @@ 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 %s %d bytes of data\n", staddr, DEFAULT_PING_DATALEN);
+ 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);
+
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, dsec);
+ seqno = uip_ping(ipaddr, id, i, DEFAULT_PING_DATALEN, maxwait);
/* Was any response returned? We can tell if a non-negative sequence
* number was returned.
@@ -636,7 +923,7 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
if (seqno >= 0 && seqno <= i)
{
- /* Get the elpased time from the time that the request was
+ /* Get the elapsed 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.
*/
@@ -644,7 +931,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 */
@@ -662,7 +949,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);
+ usleep(100000 * (dsec - elapsed));
}
}
diff --git a/apps/nshlib/nsh_netinit.c b/apps/nshlib/nsh_netinit.c
index bc845c4ed..58d238312 100644
--- a/apps/nshlib/nsh_netinit.c
+++ b/apps/nshlib/nsh_netinit.c
@@ -47,7 +47,7 @@
#include <net/if.h>
#include <apps/netutils/uiplib.h>
-#if defined(CONFIG_NSH_DHCPC)
+#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS)
# include <apps/netutils/resolv.h>
# include <apps/netutils/dhcpc.h>
#endif
@@ -60,6 +60,10 @@
* Definitions
****************************************************************************/
+#if defined(CONFIG_NSH_DRIPADDR) && !defined(CONFIG_NSH_DNSIPADDR)
+# define CONFIG_NSH_DNSIPADDR CONFIG_NSH_DRIPADDR
+#endif
+
/****************************************************************************
* Private Types
****************************************************************************/
@@ -125,10 +129,14 @@ int nsh_netinit(void)
addr.s_addr = HTONL(CONFIG_NSH_NETMASK);
uip_setnetmask("eth0", &addr);
-#if defined(CONFIG_NSH_DHCPC)
+#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS)
/* 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)
@@ -148,7 +156,7 @@ int nsh_netinit(void)
{
struct dhcpc_state ds;
(void)dhcpc_request(handle, &ds);
- uip_sethostaddr("eth1", &ds.ipaddr);
+ uip_sethostaddr("eth0", &ds.ipaddr);
if (ds.netmask.s_addr != 0)
{
uip_setnetmask("eth0", &ds.netmask);
diff --git a/apps/nshlib/nsh_parse.c b/apps/nshlib/nsh_parse.c
index df2f7c3e3..27068acff 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 NSH_MAX_ARGUMENTS)
+ * argv[1]: The beginning of argument (up to CONFIG_NSH_MAXARGUMENTS)
* argv[argc-3]: Possibly '>' or '>>'
* argv[argc-2]: Possibly <file>
* argv[argc-1]: Possibly '&' (if pthreads are enabled)
* argv[argc]: NULL terminating pointer
*
- * Maximum size is NSH_MAX_ARGUMENTS+5
+ * Maximum size is CONFIG_NSH_MAXARGUMENTS+5
*/
#ifndef CONFIG_NSH_DISABLEBG
-# define MAX_ARGV_ENTRIES (NSH_MAX_ARGUMENTS+5)
+# define MAX_ARGV_ENTRIES (CONFIG_NSH_MAXARGUMENTS+5)
#else
-# define MAX_ARGV_ENTRIES (NSH_MAX_ARGUMENTS+4)
+# define MAX_ARGV_ENTRIES (CONFIG_NSH_MAXARGUMENTS+4)
#endif
/* Help command summary layout */
@@ -146,16 +146,25 @@ 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, NSH_MAX_ARGUMENTS, "<expression> ]" },
+ { "[", cmd_lbracket, 4, CONFIG_NSH_MAXARGUMENTS, "<expression> ]" },
#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] <string or filepath>" },
+# endif
+# ifndef CONFIG_NSH_DISABLE_BASE64ENC
+ { "base64enc", cmd_base64encode, 2, 4, "[-w] [-f] <string or filepath>" },
+# endif
+#endif
+
#if CONFIG_NFILE_DESCRIPTORS > 0
# ifndef CONFIG_NSH_DISABLE_CAT
- { "cat", cmd_cat, 2, NSH_MAX_ARGUMENTS, "<path> [<path> [<path> ...]]" },
+ { "cat", cmd_cat, 2, CONFIG_NSH_MAXARGUMENTS, "<path> [<path> [<path> ...]]" },
# endif
#ifndef CONFIG_DISABLE_ENVIRON
# ifndef CONFIG_NSH_DISABLE_CD
@@ -187,9 +196,9 @@ static const struct cmdmap_s g_cmdmap[] =
#ifndef CONFIG_NSH_DISABLE_ECHO
# ifndef CONFIG_DISABLE_ENVIRON
- { "echo", cmd_echo, 0, NSH_MAX_ARGUMENTS, "[<string|$name> [<string|$name>...]]" },
+ { "echo", cmd_echo, 0, CONFIG_NSH_MAXARGUMENTS, "[<string|$name> [<string|$name>...]]" },
# else
- { "echo", cmd_echo, 0, NSH_MAX_ARGUMENTS, "[<string> [<string>...]]" },
+ { "echo", cmd_echo, 0, CONFIG_NSH_MAXARGUMENTS, "[<string> [<string>...]]" },
# endif
#endif
@@ -217,10 +226,20 @@ static const struct cmdmap_s g_cmdmap[] =
{ "help", cmd_help, 1, 3, "[-v] [<cmd>]" },
# endif
#endif
+
+#if CONFIG_NFILE_DESCRIPTORS > 0
+#ifndef CONFIG_NSH_DISABLE_HEXDUMP
+ { "hexdump", cmd_hexdump, 2, 2, "<file or device>" },
+#endif
+#endif
#ifdef CONFIG_NET
# ifndef CONFIG_NSH_DISABLE_IFCONFIG
- { "ifconfig", cmd_ifconfig, 1, 3, "[nic_name [ip]]" },
+ { "ifconfig", cmd_ifconfig, 1, 11, "[nic_name [<ip-address>|dhcp]] [dr|gw|gateway <dr-address>] [netmask <net-mask>] [dns <dns-address>] [hw <hw-mac>]" },
+# endif
+# ifndef CONFIG_NSH_DISABLE_IFUPDOWN
+ { "ifdown", cmd_ifdown, 2, 2, "<nic_name>" },
+ { "ifup", cmd_ifup, 2, 2, "<nic_name>" },
# endif
#endif
@@ -246,6 +265,12 @@ static const struct cmdmap_s g_cmdmap[] =
{ "mb", cmd_mb, 2, 3, "<hex-address>[=<hex-value>][ <hex-byte-count>]" },
#endif
+#if defined(CONFIG_NETUTILS_CODECS) && defined(CONFIG_CODECS_HASH_MD5)
+# ifndef CONFIG_NSH_DISABLE_MD5
+ { "md5", cmd_md5, 2, 3, "[-f] <string or filepath>" },
+# 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, "<path>" },
@@ -348,7 +373,7 @@ static const struct cmdmap_s g_cmdmap[] =
#endif
#if !defined(CONFIG_NSH_DISABLESCRIPT) && !defined(CONFIG_NSH_DISABLE_TEST)
- { "test", cmd_test, 3, NSH_MAX_ARGUMENTS, "<expression>" },
+ { "test", cmd_test, 3, CONFIG_NSH_MAXARGUMENTS, "<expression>" },
#endif
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE)
@@ -363,6 +388,15 @@ 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] <string or filepath>" },
+# endif
+# ifndef CONFIG_NSH_DISABLE_URLENCODE
+ { "urlencode", cmd_urlencode, 2, 3, "[-f] <string or filepath>" },
+# endif
+#endif
+
#ifndef CONFIG_DISABLE_SIGNALS
# ifndef CONFIG_NSH_DISABLE_USLEEP
{ "usleep", cmd_usleep, 2, 2, "<usec>" },
@@ -378,6 +412,7 @@ static const struct cmdmap_s g_cmdmap[] =
#ifndef CONFIG_NSH_DISABLE_XD
{ "xd", cmd_xd, 3, 3, "<hex-address> <byte-count>" },
#endif
+
{ NULL, NULL, 1, 1, NULL }
};
@@ -711,7 +746,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 NSH_MAX_ARGUMENTS)
+ * argv[1]: The beginning of argument (up to CONFIG_NSH_MAXARGUMENTS)
* argv[argc]: NULL terminating pointer
*/
@@ -1318,13 +1353,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 NSH_MAX_ARGUMENTS)
+ * argv[1]: The beginning of argument (up to CONFIG_NSH_MAXARGUMENTS)
* argv[argc-3]: Possibly '>' or '>>'
* argv[argc-2]: Possibly <file>
* argv[argc-1]: Possibly '&'
* argv[argc]: NULL terminating pointer
*
- * Maximum size is NSH_MAX_ARGUMENTS+5
+ * Maximum size is CONFIG_NSH_MAXARGUMENTS+5
*/
argv[0] = cmd;
@@ -1398,7 +1433,7 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
/* Check if the maximum number of arguments was exceeded */
- if (argc > NSH_MAX_ARGUMENTS)
+ if (argc > CONFIG_NSH_MAXARGUMENTS)
{
nsh_output(vtbl, g_fmttoomanyargs, cmd);
}
diff --git a/apps/px4/tests/test_time.c b/apps/px4/tests/test_time.c
index 25bf02c31..8a164f3fc 100644
--- a/apps/px4/tests/test_time.c
+++ b/apps/px4/tests/test_time.c
@@ -95,7 +95,7 @@ cycletime(void)
lasttime = cycles;
- return (basetime + cycles) / 168;
+ return (basetime + cycles) / 168; /* XXX magic number */
}
/****************************************************************************
@@ -133,9 +133,9 @@ int test_time(int argc, char *argv[])
lowdelta = abs(delta / 100);
/* loop checking the time */
- for (unsigned i = 0; i < 100000; i++) {
+ for (unsigned i = 0; i < 100; i++) {
- usleep(rand() * 10);
+ usleep(rand());
uint32_t flags = irqsave();
@@ -154,7 +154,7 @@ int test_time(int argc, char *argv[])
fprintf(stderr, "h %llu c %llu d %lld\n", h, c, delta - lowdelta);
}
- printf("Maximum jitter %lld\n", maxdelta);
+ printf("Maximum jitter %lldus\n", maxdelta);
return 0;
}
diff --git a/apps/px4/tests/tests_main.c b/apps/px4/tests/tests_main.c
index 9fb5ac482..5bedd257b 100644
--- a/apps/px4/tests/tests_main.c
+++ b/apps/px4/tests/tests_main.c
@@ -86,33 +86,35 @@ const struct {
#define OPT_NOALLTEST (1<<1)
#define OPT_NOJIGTEST (1<<2)
} tests[] = {
- {"led", test_led, 0, 0},
- {"int", test_int, 0, 0},
- {"float", test_float, 0, 0},
- {"sensors", test_sensors, 0, 0},
- {"gpio", test_gpio, OPT_NOJIGTEST | OPT_NOALLTEST, 0},
- {"hrt", test_hrt, OPT_NOJIGTEST | OPT_NOALLTEST, 0},
- {"ppm", test_ppm, OPT_NOJIGTEST | OPT_NOALLTEST, 0},
- {"servo", test_servo, OPT_NOJIGTEST | OPT_NOALLTEST, 0},
- {"adc", test_adc, OPT_NOJIGTEST, 0},
- {"jig_voltages", test_jig_voltages, OPT_NOALLTEST, 0},
- {"uart_loopback", test_uart_loopback, OPT_NOJIGTEST | OPT_NOALLTEST, 0},
- {"uart_baudchange", test_uart_baudchange, OPT_NOJIGTEST | OPT_NOALLTEST, 0},
- {"uart_send", test_uart_send, OPT_NOJIGTEST | OPT_NOALLTEST, 0},
- {"uart_console", test_uart_console, OPT_NOJIGTEST | OPT_NOALLTEST, 0},
- {"tone", test_tone, 0, 0},
- {"sleep", test_sleep, OPT_NOJIGTEST, 0},
- {"time", test_time, OPT_NOJIGTEST, 0},
- {"perf", test_perf, OPT_NOJIGTEST, 0},
- {"all", test_all, OPT_NOALLTEST | OPT_NOJIGTEST, 0},
- {"jig", test_jig, OPT_NOJIGTEST | OPT_NOALLTEST, 0},
- {"param", test_param, OPT_NOJIGTEST, 0},
- {"bson", test_bson, OPT_NOJIGTEST, 0},
- {"file", test_file, OPT_NOJIGTEST, 0},
- {"help", test_help, OPT_NOALLTEST | OPT_NOHELP | OPT_NOJIGTEST, 0},
- {NULL, NULL, 0, 0}
+ {"led", test_led, 0},
+ {"int", test_int, 0},
+ {"float", test_float, 0},
+ {"sensors", test_sensors, 0},
+ {"gpio", test_gpio, OPT_NOJIGTEST | OPT_NOALLTEST},
+ {"hrt", test_hrt, OPT_NOJIGTEST | OPT_NOALLTEST},
+ {"ppm", test_ppm, OPT_NOJIGTEST | OPT_NOALLTEST},
+ {"servo", test_servo, OPT_NOJIGTEST | OPT_NOALLTEST},
+ {"adc", test_adc, OPT_NOJIGTEST},
+ {"jig_voltages", test_jig_voltages, OPT_NOALLTEST},
+ {"uart_loopback", test_uart_loopback, OPT_NOJIGTEST | OPT_NOALLTEST},
+ {"uart_baudchange", test_uart_baudchange, OPT_NOJIGTEST | OPT_NOALLTEST},
+ {"uart_send", test_uart_send, OPT_NOJIGTEST | OPT_NOALLTEST},
+ {"uart_console", test_uart_console, OPT_NOJIGTEST | OPT_NOALLTEST},
+ {"tone", test_tone, 0},
+ {"sleep", test_sleep, OPT_NOJIGTEST},
+ {"time", test_time, OPT_NOJIGTEST},
+ {"perf", test_perf, OPT_NOJIGTEST},
+ {"all", test_all, OPT_NOALLTEST | OPT_NOJIGTEST},
+ {"jig", test_jig, OPT_NOJIGTEST | OPT_NOALLTEST},
+ {"param", test_param, 0},
+ {"bson", test_bson, 0},
+ {"file", test_file, 0},
+ {"help", test_help, OPT_NOALLTEST | OPT_NOHELP | OPT_NOJIGTEST},
+ {NULL, NULL, 0}
};
+#define NTESTS (sizeof(tests) / sizeof(tests[0]))
+
static int
test_help(int argc, char *argv[])
{
@@ -132,11 +134,7 @@ test_all(int argc, char *argv[])
unsigned i;
char *args[2] = {"all", NULL};
unsigned int failcount = 0;
- unsigned int testscount = 0;
-
- /* store test results */
- bool passed[(sizeof(tests) / sizeof(tests[0]))];
- memset(&passed, 0, sizeof(passed));
+ bool passed[NTESTS];
printf("\nRunning all tests...\n\n");
@@ -151,14 +149,12 @@ test_all(int argc, char *argv[])
fprintf(stderr, " [%s] \t\t\tFAIL\n", tests[i].name);
fflush(stderr);
failcount++;
-
+ passed[i] = false;
} else {
- passed[i] = true;
printf(" [%s] \t\t\tPASS\n", tests[i].name);
fflush(stdout);
+ passed[i] = true;
}
-
- testscount++;
}
}
@@ -181,7 +177,7 @@ test_all(int argc, char *argv[])
printf(" \\ \\_\\ \\_\\ \\ \\_____\\ \\ \\_____\\ \\ \\_____\\ \\ \\_\\ \\_\\ \n");
printf(" \\/_/\\/_/ \\/_____/ \\/_____/ \\/_____/ \\/_/\\/_/ \n");
printf("\n");
- printf(" All tests passed (%d of %d)\n", testscount, testscount);
+ printf(" All tests passed (%d of %d)\n", i, i);
} else {
printf(" ______ ______ __ __ \n");
@@ -190,7 +186,7 @@ test_all(int argc, char *argv[])
printf(" \\ \\_\\ \\ \\_\\ \\_\\ \\ \\_\\ \\ \\_____\\ \n");
printf(" \\/_/ \\/_/\\/_/ \\/_/ \\/_____/ \n");
printf("\n");
- printf(" Some tests failed (%d of %d)\n", failcount, testscount);
+ printf(" Some tests failed (%d of %d)\n", failcount, i);
}
printf("\n");
@@ -248,11 +244,7 @@ int test_jig(int argc, char *argv[])
unsigned i;
char *args[2] = {"jig", NULL};
unsigned int failcount = 0;
- unsigned int testscount = 0;
-
- /* store test results */
- bool passed[(sizeof(tests) / sizeof(tests[0]))];
- memset(&passed, 0, sizeof(passed));
+ bool passed[NTESTS];
printf("\nRunning all tests...\n\n");
for (i = 0; tests[i].name; i++) {
@@ -265,13 +257,12 @@ int test_jig(int argc, char *argv[])
fprintf(stderr, " [%s] \t\t\tFAIL\n", tests[i].name);
fflush(stderr);
failcount++;
+ passed[i] = false;
} else {
- passed[i] = true;
printf(" [%s] \t\t\tPASS\n", tests[i].name);
fflush(stdout);
+ passed[i] = true;
}
-
- testscount++;
}
}
@@ -292,7 +283,7 @@ int test_jig(int argc, char *argv[])
printf(" \\ \\_\\ \\_\\ \\ \\_____\\ \\ \\_____\\ \\ \\_____\\ \\ \\_\\ \\_\\ \n");
printf(" \\/_/\\/_/ \\/_____/ \\/_____/ \\/_____/ \\/_/\\/_/ \n");
printf("\n");
- printf(" All tests passed (%d of %d)\n", testscount, testscount);
+ printf(" All tests passed (%d of %d)\n", i, i);
} else {
printf(" ______ ______ __ __ \n");
printf(" /\\ ___\\ /\\ __ \\ /\\ \\ /\\ \\ \n");
@@ -300,7 +291,7 @@ int test_jig(int argc, char *argv[])
printf(" \\ \\_\\ \\ \\_\\ \\_\\ \\ \\_\\ \\ \\_____\\ \n");
printf(" \\/_/ \\/_/\\/_/ \\/_/ \\/_____/ \n");
printf("\n");
- printf(" Some tests failed (%d of %d)\n", failcount, testscount);
+ printf(" Some tests failed (%d of %d)\n", failcount, i);
}
printf("\n");
@@ -309,7 +300,7 @@ int test_jig(int argc, char *argv[])
unsigned int k;
for (k = 0; k < i; k++)
{
- if (!passed[k] && !(tests[k].options & OPT_NOJIGTEST))
+ if (!passed[i] && !(tests[k].options & OPT_NOJIGTEST))
{
printf(" [%s] to obtain details, please re-run with\n\t nsh> tests %s\n\n", tests[k].name, tests[k].name);
}
diff --git a/apps/system/Makefile b/apps/system/Makefile
index d64bb54c6..9955a6b2c 100644
--- a/apps/system/Makefile
+++ b/apps/system/Makefile
@@ -41,31 +41,36 @@ 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 += ${shell if [ -r $1/Makefile ]; then echo "$1"; fi}
+ INSTALLED_DIRS += $(if $(wildcard .\$1\Makefile),$1,)
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:
- @for dir in $(INSTALLED_DIRS) ; do \
- $(MAKE) -C $$dir depend TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
- done
-
-clean:
- @for dir in $(INSTALLED_DIRS) ; do \
- $(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
- done
+depend: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_depend)
-distclean: clean
- @for dir in $(INSTALLED_DIRS) ; do \
- $(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
- done
+clean: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_clean)
+distclean: clean $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_distclean)
diff --git a/apps/system/free/Makefile b/apps/system/free/Makefile
index 7f911d81c..dada00d99 100644
--- a/apps/system/free/Makefile
+++ b/apps/system/free/Makefile
@@ -1,7 +1,7 @@
############################################################################
# apps/system/free/Makefile
#
-# Copyright (C) 2011 Uros Platise. All rights reserved.
+# Copyright (C) 2011-2012 Uros Platise. All rights reserved.
# Author: Uros Platise <uros.platise@isotel.eu>
# Gregory Nutt <gnutt@nuttx.org>
#
@@ -61,10 +61,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -83,32 +87,32 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
- @touch .built
+ $(call ARCHIVE, $(BIN), $(OBJS))
+ $(Q) touch .built
# Register application
.context:
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
- @touch $@
+ $(Q) touch $@
context: .context
# Create dependencies
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
- @touch $@
+ $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
+ $(Q) touch $@
depend: .depend
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f .context Make.dep .depend
+ $(call DELFILE, .context)
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/system/i2c/Makefile b/apps/system/i2c/Makefile
index 00db91bb7..029d2b6fe 100644
--- a/apps/system/i2c/Makefile
+++ b/apps/system/i2c/Makefile
@@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -73,30 +77,29 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
- @touch .built
+ $(call ARCHIVE, $(BIN), $(OBJS))
+ $(Q) touch .built
.context:
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
- @touch $@
+ $(Q) touch $@
context: .context
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) \
- $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
- @touch $@
+ $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
+ $(Q) touch $@
depend: .depend
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend
+ $(call DELFILE, .context)
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/system/install/Makefile b/apps/system/install/Makefile
index 71d82f34c..6a02d859f 100644
--- a/apps/system/install/Makefile
+++ b/apps/system/install/Makefile
@@ -2,6 +2,7 @@
# apps/system/install/Makefile
#
# Copyright (C) 2011 Uros Platise. All rights reserved.
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
# Author: Uros Platise <uros.platise@isotel.eu>
# Gregory Nutt <gnutt@nuttx.org>
#
@@ -61,10 +62,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -83,32 +88,32 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
- @touch .built
+ $(call ARCHIVE, $(BIN), $(OBJS))
+ $(Q) touch .built
# Register application
.context:
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
- @touch $@
+ $(Q) touch $@
context: .context
# Create dependencies
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
- @touch $@
+ $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
+ $(Q) touch $@
depend: .depend
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f .context Make.dep .depend
+ $(call DELFILE, .context)
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/system/readline/Makefile b/apps/system/readline/Makefile
index 34fab7e81..3a48d324e 100644
--- a/apps/system/readline/Makefile
+++ b/apps/system/readline/Makefile
@@ -52,10 +52,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -74,10 +78,8 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
- @touch .built
+ $(call ARCHIVE, $(BIN), $(OBJS))
+ $(Q) touch .built
# Context build phase target
@@ -86,18 +88,20 @@ context:
# Dependency build phase target
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
- @touch $@
+ $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
+ $(Q) touch $@
depend: .depend
# Housekeeping targets
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f .context Make.dep .depend
+ $(call DELFILE, .context)
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep