Merge commit '0f2decb70f505b108999fcdb80e89d7aae6760ce' into nuttx-merge-0f2decb

This commit is contained in:
px4dev
2013-01-01 15:33:39 -08:00
594 changed files with 30116 additions and 3932 deletions
+137
View File
@@ -0,0 +1,137 @@
COPYING -- Describes the terms under which Nuttx is distributed. A
copy of the BSD-style licensing is included in this file. In my
words -- I believe that you should free to use NuttX in any
environment, private, private, commercial, open, closed, etc.
provided only that you repect the modest copyright notices as
described in license (below). Please feel free to contact me if you
have any licensing concerns.
NuttX
^^^^^^
License for NuttX in general (authorship of individual files may vary):
Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
Author: Gregory Nutt <gnutt@nuttx.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. Neither the name NuttX nor the names of its contributors may be
used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
uIP
^^^
Some lower-level networking middle-ware components of NuttX
derive from uIP which has a similar BSD style license:
Copyright (c) 2001-2003, Adam Dunkels.
All rights reserved.
FreeModbus
^^^^^^^^^
FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
Copyright (c) 2006 Christian Walter <wolti@sil.at>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THTTPD
^^^^^^
Derived from the original THTTPD package:
Copyright © 1995,1998,1999,2000,2001 by Jef Poskanzer <jef@mail.acme.com>.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
cJSON
^^^^^
Derives from the cJSON Project which has an MIT license:
Copyright (c) 2009 Dave Gamble
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
+69 -2
View File
@@ -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>
+53 -19
View File
@@ -35,7 +35,6 @@
############################################################################
-include $(TOPDIR)/Make.defs
-include $(TOPDIR)/.config
APPDIR = ${shell pwd}
@@ -107,7 +106,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))))
@@ -117,8 +116,10 @@ $(foreach BUILTIN, $(CONFIGURED_APPS), $(eval $(call ADD_BUILTIN,$(BUILTIN))))
# 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
@@ -130,48 +131,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
+6 -152
View File
@@ -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
+28
View File
@@ -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
+22 -27
View File
@@ -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
context: $(foreach SDIR, $(CNTXTDIRS), $(SDIR)_context)
depend:
@for dir in $(SUBDIRS) ; do \
$(MAKE) -C $$dir depend TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
done
depend: $(foreach SDIR, $(SUBDIRS), $(SDIR)_depend)
clean:
@for dir in $(SUBDIRS) ; do \
$(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
done
clean: $(foreach SDIR, $(SUBDIRS), $(SDIR)_clean)
distclean: clean
@for dir in $(SUBDIRS) ; do \
$(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
done
distclean: clean $(foreach SDIR, $(SUBDIRS), $(SDIR)_distclean)
-include Make.dep
+161 -13
View File
@@ -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:
+13 -10
View File
@@ -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 ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
BIN = "$(APPDIR)/libapps$(LIBEXT)"
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
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
+6 -1
View File
@@ -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);
+13 -10
View File
@@ -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 ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
BIN = "$(APPDIR)/libapps$(LIBEXT)"
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
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
+13 -10
View File
@@ -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 ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
BIN = "$(APPDIR)/libapps$(LIBEXT)"
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
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
+12 -9
View File
@@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
BIN = "$(APPDIR)/libapps$(LIBEXT)"
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
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
+14
View File
@@ -0,0 +1,14 @@
#
# For a description of the syntax of this configuration file,
# see misc/tools/kconfig-language.txt.
#
config EXAMPLES_CXXTEST
bool "C++ test program"
default n
depends on HAVE_CXX
---help---
Enable the C++ test program
if EXAMPLES_CXXTEST
endif
+125
View File
@@ -0,0 +1,125 @@
############################################################################
# apps/examples/cxxtest/Makefile
#
# Copyright (C) 2009-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
# CXX test program
ASRCS =
CSRCS =
CXXSRCS = cxxtest_main.cxx
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
BIN = ../../libapps$(LIBEXT)
endif
endif
ROOTDEPPATH = --dep-path .
# cxxtest built-in application info
APPNAME = cxxtest
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 4096
# Common build
VPATH =
all: .built
.PHONY: clean depend distclean chkcxx
chkcxx:
ifneq ($(CONFIG_HAVE_CXX),y)
@echo ""
@echo "In order to use this example, you toolchain must support must"
@echo ""
@echo " (1) Explicitly select CONFIG_HAVE_CXX to build in C++ support"
@echo " (2) Define CXX, CXXFLAGS, and COMPILEXX in the Make.defs file"
@echo " of the configuration that you are using."
@echo ""
@exit 1
endif
$(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
$(CXXOBJS): %$(OBJEXT): %.cxx
$(call COMPILEXX, $<, $@)
.built: chkcxx $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
.context:
ifeq ($(CONFIG_EXAMPLES_HELLOXX_BUILTIN),y)
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
@touch $@
endif
context: .context
.depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CXX)" -- $(CXXFLAGS) -- $(SRCS) >Make.dep
@touch $@
depend: .depend
clean:
$(call DELFILE, .built)
$(call CLEAN)
distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
-include Make.dep
+227
View File
@@ -0,0 +1,227 @@
//***************************************************************************
// examples/cxxtest/main.cxx
//
// Copyright (C) 2012 Gregory Nutt. All rights reserved.
// Author: Qiang Yu, http://rgmp.sourceforge.net/wiki/index.php/Main_Page
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in
// the documentation and/or other materials provided with the
// distribution.
// 3. Neither the name NuttX nor the names of its contributors may be
// used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//***************************************************************************
//***************************************************************************
// Included Files
//***************************************************************************
#include <nuttx/config.h>
#include <nuttx/init.h>
#include <nuttx/arch.h>
#include <iostream>
#include <vector>
#include <map>
#include <stdexcept>
#include <cassert>
using namespace std;
//***************************************************************************
// Definitions
//***************************************************************************
//***************************************************************************
// Private Classes
//***************************************************************************
class Base
{
public:
virtual void printBase(void) {};
};
class Extend : public Base
{
public:
void printExtend(void)
{
cout << "extend" << endl;
}
};
//***************************************************************************
// Private Data
//***************************************************************************
//***************************************************************************
// Public Functions
//***************************************************************************
//***************************************************************************
// Name: test_iostream
//***************************************************************************/
static void test_iostream(void)
{
cout << "test iostream===========================" << endl;
cout << "Hello, this is only a test" << endl;
cout << "Print an int: " << 190 << endl;
cout << "Print a char: " << 'd' << endl;
#if 0
int a;
string s;
cout << "Please type in an int:" << endl;
cin >> a;
cout << "You type in: " << a << endl;
cout << "Please type in a string:" << endl;
cin >> s;
cout << "You type in: " << s << endl;
#endif
}
//***************************************************************************
// Name: test_stl
//***************************************************************************/
static void test_stl(void)
{
cout << "test vector=============================" << endl;
vector<int> v1;
assert(v1.empty());
v1.push_back(1);
assert(!v1.empty());
v1.push_back(2);
v1.push_back(3);
v1.push_back(4);
assert(v1.size() == 4);
v1.pop_back();
assert(v1.size() == 3);
cout << "v1=" << v1[0] << ' ' << v1[1] << ' ' << v1[2] << endl;
assert(v1[2] == 3);
vector<int> v2 = v1;
assert(v2 == v1);
string words[4] = {"Hello", "World", "Good", "Luck"};
vector<string> v3(words, words + 4);
vector<string>::iterator it;
for (it = v3.begin(); it != v3.end(); it++)
{
cout << *it << ' ';
}
cout << endl;
assert(v3[1] == "World");
cout << "test map================================" << endl;
map<int,string> m1;
m1[12] = "Hello";
m1[24] = "World";
assert(m1.size() == 2);
assert(m1[24] == "World");
}
//***************************************************************************
// Name: test_rtti
//***************************************************************************/
static void test_rtti(void)
{
cout << "test rtti===============================" << endl;
Base *a = new Base();
Base *b = new Extend();
assert(a);
assert(b);
Extend *t = dynamic_cast<Extend *>(a);
assert(t == NULL);
t = dynamic_cast<Extend *>(b);
assert(t);
t->printExtend();
delete a;
delete b;
}
//***************************************************************************
// Name: test_exception
//***************************************************************************/
#ifdef CONFIG_UCLIBCXX_EXCEPTION
static void test_exception(void)
{
cout << "test exception==========================" << endl;
try
{
throw runtime_error("runtime error");
}
catch (runtime_error &e)
{
cout << "Catch exception: " << e.what() << endl;
}
}
#endif
//***************************************************************************
// Public Functions
//***************************************************************************
//***************************************************************************
// Name: cxxtest_main
//***************************************************************************/
extern "C"
{
int cxxtest_main(int argc, char *argv[])
{
// If C++ initialization for static constructors is supported, then do
// that first
#ifdef CONFIG_HAVE_CXXINITIALIZE
up_cxxinitialize();
#endif
test_iostream();
test_stl();
test_rtti();
#ifdef CONFIG_UCLIBCXX_EXCEPTION
test_exception();
#endif
return 0;
}
}
+12 -9
View File
@@ -54,10 +54,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
BIN = "$(APPDIR)/libapps$(LIBEXT)"
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
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
+14 -11
View File
@@ -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 ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
BIN = "$(APPDIR)/libapps$(LIBEXT)"
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
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
+13 -10
View File
@@ -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 ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
BIN = "$(APPDIR)/libapps$(LIBEXT)"
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
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
+13 -10
View File
@@ -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 ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
BIN = "$(APPDIR)/libapps$(LIBEXT)"
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
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
+13 -10
View File
@@ -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 ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
BIN = "$(APPDIR)/libapps$(LIBEXT)"
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
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
+13 -10
View File
@@ -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 ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
BIN = "$(APPDIR)/libapps$(LIBEXT)"
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
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
+27
View File
@@ -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
+12 -9
View File
@@ -98,10 +98,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
BIN = "$(APPDIR)/libapps$(LIBEXT)"
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
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
+65 -91
View File
@@ -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 */
#ifndef CONFIG_EXAMPLES_OSTEST_RR_RANGE
# define CONFIG_EXAMPLES_OSTEST_RR_RANGE 10000
# warning "CONFIG_EXAMPLES_OSTEST_RR_RANGE undefined, using default value = 10000"
#elif (CONFIG_EXAMPLES_OSTEST_RR_RANGE < 1) || (CONFIG_EXAMPLES_OSTEST_RR_RANGE > 32767)
# define CONFIG_EXAMPLES_OSTEST_RR_RANGE 10000
# warning "Invalid value of CONFIG_EXAMPLES_OSTEST_RR_RANGE, using default value = 10000"
#endif
#define CONFIG_NINTEGERS 2048
/********************************************************************************
* Private Data
********************************************************************************/
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;
int number;
int local_count = 0;
*last = 0; // to make compiler happy
a = 2;
d = a;
for (number = 1; number < CONFIG_EXAMPLES_OSTEST_RR_RANGE; number++)
{
int div;
bool is_prime = true;
for (i = 0; i < CONFIG_NINTEGERS; i++)
for (div = 2; div <= number / 2; div++)
if (number % div == 0)
{
is_prime = false;
break;
}
if (is_prime)
{
prime[i] = i+2;
}
for (i = 1; i < 10; i++)
{
for (j = 0; j < CONFIG_NINTEGERS; j++)
{
d = a + d;
if (d < CONFIG_NINTEGERS)
{
prime[d]=0;
}
}
a++;
d = a;
i++;
}
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
}
}
*count = local_count;
}
/********************************************************************************
* Name: sieve1
* Name: get_primes_thread
********************************************************************************/
static void *sieve1(void *parameter)
static void *get_primes_thread(void *parameter)
{
int i;
int id = (int)parameter;
int i, count, last;
printf("sieve1 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(prime1);
get_primes(&count, &last);
}
printf("sieve1 finished\n");
pthread_exit(NULL);
return NULL; /* To keep some compilers happy */
}
/********************************************************************************
* Name: sieve2
********************************************************************************/
static void *sieve2(void *parameter)
{
int i;
printf("sieve2 started\n");
for (i = 0; i < 1000; i++)
{
dosieve(prime2);
}
printf("sieve2 finished\n");
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");
}
+13 -10
View File
@@ -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 ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
BIN = "$(APPDIR)/libapps$(LIBEXT)"
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
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
+14 -10
View File
@@ -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 ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
BIN = "$(APPDIR)/libapps$(LIBEXT)"
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
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
+13 -10
View File
@@ -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 ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
BIN = "$(APPDIR)/libapps$(LIBEXT)"
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
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
+1
View File
@@ -48,6 +48,7 @@
#include <fcntl.h>
#include <errno.h>
#include <debug.h>
#include <string.h>
#include <nuttx/pwm.h>
+12 -9
View File
@@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
BIN = "$(APPDIR)/libapps$(LIBEXT)"
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
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
+15 -11
View File
@@ -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 ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
BIN = "$(APPDIR)/libapps$(LIBEXT)"
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
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
+13 -10
View File
@@ -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 ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
BIN = "$(APPDIR)/libapps$(LIBEXT)"
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
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
+12 -9
View File
@@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
BIN = "$(APPDIR)/libapps$(LIBEXT)"
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
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
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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
+19 -13
View File
@@ -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)
+2 -2
View File
@@ -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
+16 -15
View File
@@ -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 ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
BIN = "$(APPDIR)/libapps$(LIBEXT)"
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
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
+19 -15
View File
@@ -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 ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\libapps$(LIBEXT)
else
BIN = "$(APPDIR)/libapps$(LIBEXT)"
ifeq ($(WINTOOL),y)
BIN = ..\\libapps$(LIBEXT)
else
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
+98 -2
View File
@@ -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).
+35 -28
View File
@@ -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
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
ifeq ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\libapps$(LIBEXT)
else
BIN = "$(APPDIR)/libapps$(LIBEXT)"
ifeq ($(WINTOOL),y)
BIN = ..\\libapps$(LIBEXT)
else
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
+59 -15
View File
@@ -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:
+71 -6
View File
@@ -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 */
+37 -4
View File
@@ -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();
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -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;
}
+62 -2
View File
@@ -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
+307 -20
View File
@@ -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;
}
@@ -468,6 +506,54 @@ int cmd_get(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#endif
#endif
/****************************************************************************
* Name: cmd_ifup
****************************************************************************/
#ifndef CONFIG_NSH_DISABLE_IFUPDOWN
int cmd_ifup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
FAR char *intf = NULL;
int ret;
if (argc != 2)
{
nsh_output(vtbl, "Please select nic_name:\n");
netdev_foreach(ifconfig_callback, vtbl);
return OK;
}
intf = argv[1];
ret = uip_ifup(intf);
nsh_output(vtbl, "ifup %s...%s\n", intf, (ret == OK) ? "OK" : "Failed");
return ret;
}
#endif
/****************************************************************************
* Name: cmd_ifdown
****************************************************************************/
#ifndef CONFIG_NSH_DISABLE_IFUPDOWN
int cmd_ifdown(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
FAR char *intf = NULL;
int ret;
if (argc != 2)
{
nsh_output(vtbl, "Please select nic_name:\n");
netdev_foreach(ifconfig_callback, vtbl);
return OK;
}
intf = argv[1];
ret = uip_ifdown(intf);
nsh_output(vtbl, "ifdown %s...%s\n", intf, (ret == OK) ? "OK" : "Failed");
return ret;
}
#endif
/****************************************************************************
* Name: cmd_ifconfig
****************************************************************************/
@@ -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;
}
}
}
}
}
ip = addr.s_addr = inet_addr(argv[2]);
uip_sethostaddr(argv[1], &addr);
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);
}
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 = HTONL(ip);
uip_setdraddr(argv[1], &addr);
addr.s_addr = gip;
}
/* Set netmask */
uip_setdraddr(intf, &addr);
addr.s_addr = inet_addr("255.255.255.0");
uip_setnetmask(argv[1], &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);
#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;
(void)dhcpc_request(handle, &ds);
uip_sethostaddr("eth0", &ds.ipaddr);
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));
}
}
+11 -3
View File
@@ -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);
+49 -14
View File
@@ -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);
}
+19 -14
View File
@@ -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
depend: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_depend)
clean:
@for dir in $(INSTALLED_DIRS) ; do \
$(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
done
distclean: clean
@for dir in $(INSTALLED_DIRS) ; do \
$(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
done
clean: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_clean)
distclean: clean $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_distclean)

Some files were not shown because too many files have changed in this diff Show More