Cleared last diff items between origin/master and fixedwing_outdoor

This commit is contained in:
Lorenz Meier 2012-12-28 15:06:19 +01:00
parent a1e1e7bf42
commit 913f5a7812
42 changed files with 629 additions and 1267 deletions

View File

@ -3,59 +3,206 @@
# see misc/tools/kconfig-language.txt. # see misc/tools/kconfig-language.txt.
# #
menu "ADC Example"
source "$APPSDIR/examples/adc/Kconfig" source "$APPSDIR/examples/adc/Kconfig"
endmenu
menu "Buttons Example"
source "$APPSDIR/examples/buttons/Kconfig" source "$APPSDIR/examples/buttons/Kconfig"
endmenu
menu "CAN Example"
source "$APPSDIR/examples/can/Kconfig" source "$APPSDIR/examples/can/Kconfig"
endmenu
menu "USB CDC/ACM Class Driver Example"
source "$APPSDIR/examples/cdcacm/Kconfig" source "$APPSDIR/examples/cdcacm/Kconfig"
endmenu
menu "USB composite Class Driver Example"
source "$APPSDIR/examples/composite/Kconfig" source "$APPSDIR/examples/composite/Kconfig"
source "$APPSDIR/examples/cxxtest/Kconfig" endmenu
menu "DHCP Server Example"
source "$APPSDIR/examples/dhcpd/Kconfig" source "$APPSDIR/examples/dhcpd/Kconfig"
source "$APPSDIR/examples/elf/Kconfig" endmenu
menu "FTP Client Example"
source "$APPSDIR/examples/ftpc/Kconfig" source "$APPSDIR/examples/ftpc/Kconfig"
endmenu
menu "FTP Server Example"
source "$APPSDIR/examples/ftpd/Kconfig" source "$APPSDIR/examples/ftpd/Kconfig"
endmenu
menu "\"Hello, World!\" Example"
source "$APPSDIR/examples/hello/Kconfig" source "$APPSDIR/examples/hello/Kconfig"
endmenu
menu "\"Hello, World!\" C++ Example"
source "$APPSDIR/examples/helloxx/Kconfig" source "$APPSDIR/examples/helloxx/Kconfig"
source "$APPSDIR/examples/json/Kconfig" endmenu
menu "USB HID Keyboard Example"
source "$APPSDIR/examples/hidkbd/Kconfig" source "$APPSDIR/examples/hidkbd/Kconfig"
endmenu
menu "IGMP Example"
source "$APPSDIR/examples/igmp/Kconfig" source "$APPSDIR/examples/igmp/Kconfig"
endmenu
menu "LCD Read/Write Example"
source "$APPSDIR/examples/lcdrw/Kconfig" source "$APPSDIR/examples/lcdrw/Kconfig"
endmenu
menu "Memory Management Example"
source "$APPSDIR/examples/mm/Kconfig" source "$APPSDIR/examples/mm/Kconfig"
endmenu
menu "File System Mount Example"
source "$APPSDIR/examples/mount/Kconfig" source "$APPSDIR/examples/mount/Kconfig"
endmenu
menu "FreeModBus Example"
source "$APPSDIR/examples/modbus/Kconfig" source "$APPSDIR/examples/modbus/Kconfig"
endmenu
menu "Network Test Example"
source "$APPSDIR/examples/nettest/Kconfig" source "$APPSDIR/examples/nettest/Kconfig"
endmenu
menu "NuttShell (NSH) Example"
source "$APPSDIR/examples/nsh/Kconfig" source "$APPSDIR/examples/nsh/Kconfig"
endmenu
menu "NULL Example"
source "$APPSDIR/examples/null/Kconfig" source "$APPSDIR/examples/null/Kconfig"
endmenu
menu "NX Graphics Example"
source "$APPSDIR/examples/nx/Kconfig" source "$APPSDIR/examples/nx/Kconfig"
endmenu
menu "NxConsole Example"
source "$APPSDIR/examples/nxconsole/Kconfig" source "$APPSDIR/examples/nxconsole/Kconfig"
endmenu
menu "NXFFS File System Example"
source "$APPSDIR/examples/nxffs/Kconfig" source "$APPSDIR/examples/nxffs/Kconfig"
endmenu
menu "NXFLAT Example"
source "$APPSDIR/examples/nxflat/Kconfig" source "$APPSDIR/examples/nxflat/Kconfig"
endmenu
menu "NX Graphics \"Hello, World!\" Example"
source "$APPSDIR/examples/nxhello/Kconfig" source "$APPSDIR/examples/nxhello/Kconfig"
endmenu
menu "NX Graphics image Example"
source "$APPSDIR/examples/nximage/Kconfig" source "$APPSDIR/examples/nximage/Kconfig"
endmenu
menu "NX Graphics lines Example"
source "$APPSDIR/examples/nxlines/Kconfig" source "$APPSDIR/examples/nxlines/Kconfig"
endmenu
menu "NX Graphics Text Example"
source "$APPSDIR/examples/nxtext/Kconfig" source "$APPSDIR/examples/nxtext/Kconfig"
endmenu
menu "OS Test Example"
source "$APPSDIR/examples/ostest/Kconfig" source "$APPSDIR/examples/ostest/Kconfig"
endmenu
menu "Pascal \"Hello, World!\"example"
source "$APPSDIR/examples/pashello/Kconfig" source "$APPSDIR/examples/pashello/Kconfig"
endmenu
menu "Pipe Example"
source "$APPSDIR/examples/pipe/Kconfig" source "$APPSDIR/examples/pipe/Kconfig"
endmenu
menu "Poll Example"
source "$APPSDIR/examples/poll/Kconfig" source "$APPSDIR/examples/poll/Kconfig"
endmenu
menu "Pulse Width Modulation (PWM) Example"
source "$APPSDIR/examples/pwm/Kconfig" source "$APPSDIR/examples/pwm/Kconfig"
endmenu
menu "Quadrature Encoder Example"
source "$APPSDIR/examples/qencoder/Kconfig" source "$APPSDIR/examples/qencoder/Kconfig"
source "$APPSDIR/examples/relays/Kconfig" endmenu
menu "RGMP Example"
source "$APPSDIR/examples/rgmp/Kconfig" source "$APPSDIR/examples/rgmp/Kconfig"
endmenu
menu "ROMFS Example"
source "$APPSDIR/examples/romfs/Kconfig" source "$APPSDIR/examples/romfs/Kconfig"
endmenu
menu "sendmail Example"
source "$APPSDIR/examples/sendmail/Kconfig" source "$APPSDIR/examples/sendmail/Kconfig"
endmenu
menu "Serial Loopback Example"
source "$APPSDIR/examples/serloop/Kconfig" source "$APPSDIR/examples/serloop/Kconfig"
endmenu
menu "Telnet Daemon Example"
source "$APPSDIR/examples/telnetd/Kconfig" source "$APPSDIR/examples/telnetd/Kconfig"
endmenu
menu "THTTPD Web Server Example"
source "$APPSDIR/examples/thttpd/Kconfig" source "$APPSDIR/examples/thttpd/Kconfig"
endmenu
menu "TIFF Generation Example"
source "$APPSDIR/examples/tiff/Kconfig" source "$APPSDIR/examples/tiff/Kconfig"
endmenu
menu "Touchscreen Example"
source "$APPSDIR/examples/touchscreen/Kconfig" source "$APPSDIR/examples/touchscreen/Kconfig"
endmenu
menu "UDP Example"
source "$APPSDIR/examples/udp/Kconfig" source "$APPSDIR/examples/udp/Kconfig"
endmenu
menu "UDP Discovery Daemon Example"
source "$APPSDIR/examples/discover/Kconfig" source "$APPSDIR/examples/discover/Kconfig"
endmenu
menu "uIP Web Server Example"
source "$APPSDIR/examples/uip/Kconfig" source "$APPSDIR/examples/uip/Kconfig"
endmenu
menu "USB Serial Test Example"
source "$APPSDIR/examples/usbserial/Kconfig" source "$APPSDIR/examples/usbserial/Kconfig"
endmenu
menu "USB Mass Storage Class Example"
source "$APPSDIR/examples/usbstorage/Kconfig" source "$APPSDIR/examples/usbstorage/Kconfig"
endmenu
menu "USB Serial Terminal Example"
source "$APPSDIR/examples/usbterm/Kconfig" source "$APPSDIR/examples/usbterm/Kconfig"
endmenu
menu "Watchdog timer Example"
source "$APPSDIR/examples/watchdog/Kconfig" source "$APPSDIR/examples/watchdog/Kconfig"
endmenu
menu "wget Example"
source "$APPSDIR/examples/wget/Kconfig" source "$APPSDIR/examples/wget/Kconfig"
source "$APPSDIR/examples/wgetjson/Kconfig" endmenu
menu "WLAN Example"
source "$APPSDIR/examples/wlan/Kconfig" source "$APPSDIR/examples/wlan/Kconfig"
endmenu
menu "XML RPC Example"
source "$APPSDIR/examples/xmlrpc/Kconfig" source "$APPSDIR/examples/xmlrpc/Kconfig"
endmenu

View File

@ -54,10 +54,6 @@ ifeq ($(CONFIG_EXAMPLES_COMPOSITE),y)
CONFIGURED_APPS += examples/composite CONFIGURED_APPS += examples/composite
endif endif
ifeq ($(CONFIG_EXAMPLES_CXXTEST),y)
CONFIGURED_APPS += examples/cxxtest
endif
ifeq ($(CONFIG_EXAMPLES_DHCPD),y) ifeq ($(CONFIG_EXAMPLES_DHCPD),y)
CONFIGURED_APPS += examples/dhcpd CONFIGURED_APPS += examples/dhcpd
endif endif
@ -66,10 +62,6 @@ ifeq ($(CONFIG_EXAMPLES_DISCOVER),y)
CONFIGURED_APPS += examples/discover CONFIGURED_APPS += examples/discover
endif endif
ifeq ($(CONFIG_EXAMPLES_ELF),y)
CONFIGURED_APPS += examples/elf
endif
ifeq ($(CONFIG_EXAMPLES_FTPC),y) ifeq ($(CONFIG_EXAMPLES_FTPC),y)
CONFIGURED_APPS += examples/ftpc CONFIGURED_APPS += examples/ftpc
endif endif
@ -94,10 +86,6 @@ ifeq ($(CONFIG_EXAMPLES_IGMP),y)
CONFIGURED_APPS += examples/igmp CONFIGURED_APPS += examples/igmp
endif endif
ifeq ($(CONFIG_EXAMPLES_JSON),y)
CONFIGURED_APPS += examples/json
endif
ifeq ($(CONFIG_EXAMPLES_LCDRW),y) ifeq ($(CONFIG_EXAMPLES_LCDRW),y)
CONFIGURED_APPS += examples/lcdrw CONFIGURED_APPS += examples/lcdrw
endif endif
@ -106,10 +94,6 @@ ifeq ($(CONFIG_EXAMPLES_MM),y)
CONFIGURED_APPS += examples/mm CONFIGURED_APPS += examples/mm
endif endif
ifeq ($(CONFIG_EXAMPLES_MODBUS),y)
CONFIGURED_APPS += examples/modbus
endif
ifeq ($(CONFIG_EXAMPLES_MOUNT),y) ifeq ($(CONFIG_EXAMPLES_MOUNT),y)
CONFIGURED_APPS += examples/mount CONFIGURED_APPS += examples/mount
endif endif
@ -182,10 +166,6 @@ ifeq ($(CONFIG_EXAMPLES_QENCODER),y)
CONFIGURED_APPS += examples/qencoder CONFIGURED_APPS += examples/qencoder
endif endif
ifeq ($(CONFIG_EXAMPLES_RELAYS),y)
CONFIGURED_APPS += examples/relays
endif
ifeq ($(CONFIG_EXAMPLES_RGMP),y) ifeq ($(CONFIG_EXAMPLES_RGMP),y)
CONFIGURED_APPS += examples/rgmp CONFIGURED_APPS += examples/rgmp
endif endif
@ -246,10 +226,6 @@ ifeq ($(CONFIG_EXAMPLES_WGET),y)
CONFIGURED_APPS += examples/wget CONFIGURED_APPS += examples/wget
endif endif
ifeq ($(CONFIG_EXAMPLES_WGETJSON),y)
CONFIGURED_APPS += examples/wgetjson
endif
ifeq ($(CONFIG_EXAMPLES_WLAN),y) ifeq ($(CONFIG_EXAMPLES_WLAN),y)
CONFIGURED_APPS += examples/wlan CONFIGURED_APPS += examples/wlan
endif endif

View File

@ -37,12 +37,12 @@
# Sub-directories # Sub-directories
SUBDIRS = adc buttons can cdcacm composite cxxtest dhcpd discover elf ftpc SUBDIRS = adc buttons can cdcacm composite dhcpd discover ftpc ftpd hello
SUBDIRS += ftpd hello helloxx hidkbd igmp json lcdrw mm modbus mount SUBDIRS += helloxx hidkbd igmp lcdrw mm modbus mount nettest nsh null nx
SUBDIRS += nettest nsh null nx nxconsole nxffs nxflat nxhello nximage SUBDIRS += nxconsole nxffs nxflat nxhello nximage nxlines nxtext ostest
SUBDIRS += nxlines nxtext ostest pashello pipe poll pwm qencoder relays SUBDIRS += pashello pipe poll pwm qencoder rgmp romfs serloop telnetd
SUBDIRS += rgmp romfs serloop telnetd thttpd tiff touchscreen udp uip SUBDIRS += thttpd tiff touchscreen udp uip usbserial sendmail usbstorage
SUBDIRS += usbserial sendmail usbstorage usbterm watchdog wget wgetjson wlan SUBDIRS += usbterm watchdog wget wlan
# Sub-directories that might need context setup. Directories may need # Sub-directories that might need context setup. Directories may need
# context setup for a variety of reasons, but the most common is because # context setup for a variety of reasons, but the most common is because
@ -57,8 +57,8 @@ SUBDIRS += usbserial sendmail usbstorage usbterm watchdog wget wgetjson wlan
CNTXTDIRS = pwm CNTXTDIRS = pwm
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
CNTXTDIRS += adc can cdcacm composite cxxtestdhcpd discover ftpd json CNTXTDIRS += adc can cdcacm composite discover ftpd dhcpd modbus nettest
CNTXTDIRS += modbus nettest nxlines relays qencoder telnetd watchdog wgetjson CNTXTDIRS += qencoder telnetd watchdog
endif endif
ifeq ($(CONFIG_EXAMPLES_HELLO_BUILTIN),y) ifeq ($(CONFIG_EXAMPLES_HELLO_BUILTIN),y)
@ -79,6 +79,9 @@ endif
ifeq ($(CONFIG_EXAMPLES_NXIMAGE_BUILTIN),y) ifeq ($(CONFIG_EXAMPLES_NXIMAGE_BUILTIN),y)
CNTXTDIRS += nximage CNTXTDIRS += nximage
endif endif
ifeq ($(CONFIG_EXAMPLES_LINES_BUILTIN),y)
CNTXTDIRS += nxlines
endif
ifeq ($(CONFIG_EXAMPLES_NXTEXT_BUILTIN),y) ifeq ($(CONFIG_EXAMPLES_NXTEXT_BUILTIN),y)
CNTXTDIRS += nxtext CNTXTDIRS += nxtext
endif endif
@ -102,25 +105,27 @@ all: nothing
.PHONY: nothing context depend clean distclean .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: nothing:
context: $(foreach SDIR, $(CNTXTDIRS), $(SDIR)_context) context:
@for dir in $(CNTXTDIRS) ; do \
$(MAKE) -C $$dir context TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
done
depend: $(foreach SDIR, $(SUBDIRS), $(SDIR)_depend) depend:
@for dir in $(SUBDIRS) ; do \
$(MAKE) -C $$dir depend TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
done
clean: $(foreach SDIR, $(SUBDIRS), $(SDIR)_clean) clean:
@for dir in $(SUBDIRS) ; do \
$(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
done
distclean: clean $(foreach SDIR, $(SUBDIRS), $(SDIR)_distclean) distclean: clean
@for dir in $(SUBDIRS) ; do \
$(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
done
-include Make.dep -include Make.dep

View File

@ -239,29 +239,6 @@ examples/composite
CONFIG_EXAMPLES_COMPOSITE_TRACEINTERRUPTS CONFIG_EXAMPLES_COMPOSITE_TRACEINTERRUPTS
Show interrupt-related events. 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 examples/dhcpd
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
@ -320,68 +297,6 @@ examples/discover
CONFIG_EXAMPLES_DISCOVER_DRIPADDR - Router IP address CONFIG_EXAMPLES_DISCOVER_DRIPADDR - Router IP address
CONFIG_EXAMPLES_DISCOVER_NETMASK - Network Mask 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 examples/ftpc
^^^^^^^^^^^^^ ^^^^^^^^^^^^^
@ -567,19 +482,6 @@ examples/igmp
CONFIGURED_APPS += uiplib CONFIGURED_APPS += uiplib
examples/json
^^^^^^^^^^^^^
This example exercises the cJSON implementation at apps/netutils/json.
This example contains logic taken from the cJSON project:
http://sourceforge.net/projects/cjson/
The example corresponds to SVN revision r42 (with lots of changes for
NuttX coding standards). As of r42, the SVN repository was last updated
on 2011-10-10 so I presume that the code is stable and there is no risk
of maintaining duplicate logic in the NuttX repository.
examples/lcdrw examples/lcdrw
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
@ -594,11 +496,6 @@ examples/lcdrw
* CONFIG_EXAMPLES_LDCRW_YRES * CONFIG_EXAMPLES_LDCRW_YRES
LCD Y resolution. Default: 320 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 examples/mm
^^^^^^^^^^^ ^^^^^^^^^^^
@ -941,6 +838,8 @@ examplex/nxlines
The following configuration options can be selected: 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- CONFIG_EXAMPLES_NXLINES_VPLANE -- The plane to select from the frame-
buffer driver for use in the test. Default: 0 buffer driver for use in the test. Default: 0
CONFIG_EXAMPLES_NXLINES_DEVNO - The LCD device to select from the LCD CONFIG_EXAMPLES_NXLINES_DEVNO - The LCD device to select from the LCD
@ -978,9 +877,6 @@ examplex/nxlines
FAR struct fb_vtable_s *up_nxdrvinit(unsigned int devno); FAR struct fb_vtable_s *up_nxdrvinit(unsigned int devno);
#endif #endif
CONFIG_NSH_BUILTIN_APPS - Build the NX lines examples as an NSH built-in
function.
examples/nxtext examples/nxtext
^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
@ -1088,17 +984,6 @@ examples/ostest
Specifies the number of threads to create in the barrier Specifies the number of threads to create in the barrier
test. The default is 8 but a smaller number may be needed on test. The default is 8 but a smaller number may be needed on
systems without sufficient memory to start so many threads. 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 examples/pashello
^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
@ -1237,17 +1122,6 @@ examples/qencoder
is defined, then this value is the default delay if no other delay is is defined, then this value is the default delay if no other delay is
provided on the command line. Default: 100 milliseconds 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 examples/rgmp
^^^^^^^^^^^^^ ^^^^^^^^^^^^^
@ -1798,16 +1672,7 @@ examples/wget
CONFIGURED_APPS += resolv CONFIGURED_APPS += resolv
CONFIGURED_APPS += webclient 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 examples/xmlrpc
^^^^^^^^^^^^^^^
This example exercises the "Embeddable Lightweight XML-RPC Server" which This example exercises the "Embeddable Lightweight XML-RPC Server" which
is discussed at: is discussed at:

View File

@ -1,7 +1,7 @@
############################################################################ ############################################################################
# apps/examples/adc/Makefile # apps/examples/adc/Makefile
# #
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -80,7 +76,9 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@) $(call COMPILE, $<, $@)
.built: $(OBJS) .built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built @touch .built
.context: .context:
@ -92,17 +90,16 @@ endif
context: .context context: .context
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@ @touch $@
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, Make.dep) @rm -f Make.dep .depend
$(call DELFILE, .depend)
-include Make.dep -include Make.dep

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); message("adc_main: open %s failed: %d\n", g_adcstate.devpath, errno);
errval = 2; errval = 2;
goto errout; goto errout_with_dev;
} }
/* Now loop the appropriate number of times, displaying the collected /* Now loop the appropriate number of times, displaying the collected
@ -357,11 +357,6 @@ int adc_main(int argc, char *argv[])
} }
} }
close(fd);
return OK;
/* Error exits */
errout_with_dev: errout_with_dev:
close(fd); close(fd);

View File

@ -1,7 +1,7 @@
############################################################################ ############################################################################
# apps/examples/buttons/Makefile # apps/examples/buttons/Makefile
# #
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -80,7 +76,9 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@) $(call COMPILE, $<, $@)
.built: $(OBJS) .built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built @touch .built
.context: .context:
@ -92,17 +90,16 @@ endif
context: .context context: .context
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@ @touch $@
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, Make.dep) @rm -f Make.dep .depend
$(call DELFILE, .depend)
-include Make.dep -include Make.dep

View File

@ -1,7 +1,7 @@
############################################################################ ############################################################################
# apps/examples/can/Makefile # apps/examples/can/Makefile
# #
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -80,7 +76,9 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@) $(call COMPILE, $<, $@)
.built: $(OBJS) .built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built @touch .built
.context: .context:
@ -92,17 +90,16 @@ endif
context: .context context: .context
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@ @touch $@
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, Make.dep) @rm -f Make.dep .depend
$(call DELFILE, .depend)
-include Make.dep -include Make.dep

View File

@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -84,7 +80,9 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@) $(call COMPILE, $<, $@)
.built: $(OBJS) .built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built @touch .built
.context: .context:
@ -95,18 +93,17 @@ $(COBJS): %$(OBJEXT): %.c
context: .context context: .context
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@ @touch $@
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, Make.dep) @rm -f Make.dep .depend
$(call DELFILE, .depend)
-include Make.dep -include Make.dep

View File

@ -54,14 +54,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -80,7 +76,9 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@) $(call COMPILE, $<, $@)
.built: $(OBJS) .built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built @touch .built
.context: .context:
@ -92,17 +90,16 @@ endif
context: .context context: .context
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@ @touch $@
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, Make.dep) @rm -f Make.dep .depend
$(call DELFILE, .depend)
-include Make.dep -include Make.dep

View File

@ -1,7 +1,7 @@
############################################################################ ############################################################################
# apps/examples/helloxx/Makefile # apps/examples/helloxx/Makefile
# #
# Copyright (C) 2009-2012 Gregory Nutt. All rights reserved. # Copyright (C) 2009-2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -50,14 +50,10 @@ CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS) SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
OBJS = $(AOBJS) $(COBJS) $(CXXOBJS) OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -73,7 +69,7 @@ STACKSIZE = 2048
VPATH = VPATH =
all: .built all: .built
.PHONY: clean depend distclean chkcxx .PHONY: clean depend disclean chkcxx
chkcxx: chkcxx:
ifneq ($(CONFIG_HAVE_CXX),y) ifneq ($(CONFIG_HAVE_CXX),y)
@ -97,7 +93,9 @@ $(CXXOBJS): %$(OBJEXT): %.cxx
$(call COMPILEXX, $<, $@) $(call COMPILEXX, $<, $@)
.built: chkcxx $(OBJS) .built: chkcxx $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built @touch .built
.context: .context:
@ -109,17 +107,16 @@ endif
context: .context context: .context
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@ @touch $@
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, Make.dep) @rm -f Make.dep .depend
$(call DELFILE, .depend)
-include Make.dep -include Make.dep

View File

@ -1,7 +1,7 @@
############################################################################ ############################################################################
# apps/examples/mm/Makefile # apps/examples/mm/Makefile
# #
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -74,23 +70,24 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@) $(call COMPILE, $<, $@)
.built: $(OBJS) .built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built @touch .built
context: context:
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@ @touch $@
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, Make.dep) @rm -f Make.dep .depend
$(call DELFILE, .depend)
-include Make.dep -include Make.dep

View File

@ -1,7 +1,7 @@
############################################################################ ############################################################################
# apps/Makefile # apps/Makefile
# #
# Copyright (C) 2007-2008, 2010-2010, 2012 Gregory Nutt. All rights reserved. # Copyright (C) 2007-2008, 2010-2010 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -74,23 +70,24 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@) $(call COMPILE, $<, $@)
.built: $(OBJS) .built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built @touch .built
context: context:
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@ @touch $@
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, Make.dep) @rm -f Make.dep .depend
$(call DELFILE, .depend)
-include Make.dep -include Make.dep

View File

@ -1,7 +1,7 @@
############################################################################ ############################################################################
# apps/examples/nsh/Makefile # apps/examples/nsh/Makefile
# #
# Copyright (C) 2007-2008, 2010-2012 Gregory Nutt. All rights reserved. # Copyright (C) 2007-2008, 2010-2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -74,23 +70,24 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@) $(call COMPILE, $<, $@)
.built: $(OBJS) .built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built @touch .built
context: context:
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@ @touch $@
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, Make.dep) @rm -f Make.dep .depend
$(call DELFILE, .depend)
-include Make.dep -include Make.dep

View File

@ -1,7 +1,7 @@
############################################################################ ############################################################################
# examples/null/Makefile # examples/null/Makefile
# #
# Copyright (C) 2007-2008, 2010-2012 Gregory Nutt. All rights reserved. # Copyright (C) 2007-2008, 2010-2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -74,23 +70,24 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@) $(call COMPILE, $<, $@)
.built: $(OBJS) .built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built @touch .built
context: context:
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@ @touch $@
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, Make.dep) @rm -f Make.dep .depend
$(call DELFILE, .depend)
-include Make.dep -include Make.dep

View File

@ -39,31 +39,4 @@ config EXAMPLES_OSTEST_NBARRIER_THREADS
is 8 but a smaller number may be needed on systems without sufficient memory is 8 but a smaller number may be needed on systems without sufficient memory
to start so many threads. 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 endif

View File

@ -98,14 +98,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -124,7 +120,9 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@) $(call COMPILE, $<, $@)
.built: $(OBJS) .built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built @touch .built
.context: .context:
@ -136,17 +134,16 @@ endif
context: .context context: .context
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@ @touch $@
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, Make.dep) @rm -f Make.dep .depend
$(call DELFILE, .depend)
-include Make.dep -include Make.dep

View File

@ -1,7 +1,7 @@
/******************************************************************************** /********************************************************************************
* examples/ostest/roundrobin.c * examples/ostest/roundrobin.c
* *
* Copyright (C) 2007, 2008, 2012 Gregory Nutt. All rights reserved. * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -39,7 +39,6 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <stdio.h> #include <stdio.h>
#include <stdbool.h>
#include "ostest.h" #include "ostest.h"
#if CONFIG_RR_INTERVAL > 0 #if CONFIG_RR_INTERVAL > 0
@ -48,87 +47,115 @@
* Definitions * Definitions
********************************************************************************/ ********************************************************************************/
/* This numbers should be tuned for different processor speeds via .config file. /* This number may need to be tuned for different processor speeds. Since these
* With default values the test takes about 30s on Cortex-M3 @ 24MHz. With 32767 * arrays must be large to very correct SCHED_RR behavior, this test may require
* range and 10 runs it takes ~320s. */ * too much memory on many targets.
*/
#ifndef CONFIG_EXAMPLES_OSTEST_RR_RANGE /* #define CONFIG_NINTEGERS 32768 Takes forever on 60Mhz ARM7 */
# 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
#ifndef CONFIG_EXAMPLES_OSTEST_RR_RUNS #define CONFIG_NINTEGERS 2048
# 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) * Private Data
# define CONFIG_EXAMPLES_OSTEST_RR_RUNS 10 ********************************************************************************/
# warning "Invalid value of CONFIG_EXAMPLES_OSTEST_RR_RUNS, using default value = 10"
#endif static int prime1[CONFIG_NINTEGERS];
static int prime2[CONFIG_NINTEGERS];
/******************************************************************************** /********************************************************************************
* Private Functions * Private Functions
********************************************************************************/ ********************************************************************************/
/******************************************************************************** /********************************************************************************
* Name: get_primes * Name: dosieve
* *
* Description * Description
* This function searches for prime numbers in the most primitive way possible. * This implements a "sieve of aristophanes" algorithm for finding prime number.
* Credit for this belongs to someone, but I am not sure who anymore. Anyway,
* the only purpose here is that we need some algorithm that takes a long period
* of time to execute.
*
********************************************************************************/ ********************************************************************************/
static void get_primes(int *count, int *last) static void dosieve(int *prime)
{ {
int number; int a,d;
int local_count = 0; int i;
*last = 0; // to make compiler happy int j;
for (number = 1; number < CONFIG_EXAMPLES_OSTEST_RR_RANGE; number++) a = 2;
{ d = a;
int div;
bool is_prime = true;
for (div = 2; div <= number / 2; div++) for (i = 0; i < CONFIG_NINTEGERS; i++)
if (number % div == 0)
{ {
is_prime = false; prime[i] = i+2;
break;
} }
if (is_prime) for (i = 1; i < 10; i++)
{ {
local_count++; for (j = 0; j < CONFIG_NINTEGERS; j++)
*last = number; {
d = a + d;
if (d < CONFIG_NINTEGERS)
{
prime[d]=0;
}
}
a++;
d = a;
i++;
}
#if 0 /* We don't really care what the numbers are */ #if 0 /* We don't really care what the numbers are */
printf(" Prime %d: %d\n", local_count, number); for (i = 0, j= 0; i < CONFIG_NINTEGERS; i++)
{
if (prime[i] != 0)
{
printf(" Prime %d: %d\n", j, prime[i]);
j++;
}
}
#endif #endif
} }
}
*count = local_count;
}
/******************************************************************************** /********************************************************************************
* Name: get_primes_thread * Name: sieve1
********************************************************************************/ ********************************************************************************/
static void *get_primes_thread(void *parameter) static void *sieve1(void *parameter)
{ {
int id = (int)parameter; int i;
int i, count, last;
printf("get_primes_thread id=%d started, looking for primes < %d, doing %d run(s)\n", printf("sieve1 started\n");
id, CONFIG_EXAMPLES_OSTEST_RR_RANGE, CONFIG_EXAMPLES_OSTEST_RR_RUNS);
for (i = 0; i < CONFIG_EXAMPLES_OSTEST_RR_RUNS; i++) for (i = 0; i < 1000; i++)
{ {
get_primes(&count, &last); dosieve(prime1);
} }
printf("get_primes_thread id=%d finished, found %d primes, last one was %d\n", printf("sieve1 finished\n");
id, count, last);
pthread_exit(NULL);
return NULL; /* To keep some compilers happy */
}
/********************************************************************************
* Name: sieve2
********************************************************************************/
static void *sieve2(void *parameter)
{
int i;
printf("sieve2 started\n");
for (i = 0; i < 1000; i++)
{
dosieve(prime2);
}
printf("sieve2 finished\n");
pthread_exit(NULL); pthread_exit(NULL);
return NULL; /* To keep some compilers happy */ return NULL; /* To keep some compilers happy */
@ -144,13 +171,14 @@ static void *get_primes_thread(void *parameter)
void rr_test(void) void rr_test(void)
{ {
pthread_t get_primes1_thread; pthread_t sieve1_thread;
pthread_t get_primes2_thread; pthread_t sieve2_thread;
struct sched_param sparam; struct sched_param sparam;
pthread_attr_t attr; pthread_attr_t attr;
pthread_addr_t result; pthread_addr_t result;
int status; int status;
printf("rr_test: Starting sieve1 thread \n");
status = pthread_attr_init(&attr); status = pthread_attr_init(&attr);
if (status != OK) if (status != OK)
{ {
@ -175,31 +203,29 @@ void rr_test(void)
} }
else else
{ {
printf("rr_test: Set thread policy to SCHED_RR\n"); printf("rr_test: Set thread policty to SCHED_RR\n");
} }
printf("rr_test: Starting first get_primes_thread\n"); status = pthread_create(&sieve1_thread, &attr, sieve1, NULL);
status = pthread_create(&get_primes1_thread, &attr, get_primes_thread, (void*)1);
if (status != 0) if (status != 0)
{ {
printf("rr_test: Error in thread 1 creation, status=%d\n", status); printf("rr_test: Error in thread 1 creation, status=%d\n", status);
} }
printf("rr_test: Starting second get_primes_thread\n"); printf("rr_test: Starting sieve1 thread \n");
status = pthread_create(&get_primes2_thread, &attr, get_primes_thread, (void*)2); status = pthread_create(&sieve2_thread, &attr, sieve2, NULL);
if (status != 0) if (status != 0)
{ {
printf("rr_test: Error in thread 2 creation, status=%d\n", status); printf("rr_test: Error in thread 2 creation, status=%d\n", status);
} }
printf("rr_test: Waiting for threads to complete -- this should take awhile\n"); printf("rr_test: Waiting for sieves to complete -- this should take awhile\n");
printf("rr_test: If RR scheduling is working, they should start and complete at\n"); printf("rr_test: If RR scheduling is working, they should start and complete at\n");
printf("rr_test: about the same time\n"); printf("rr_test: about the same time\n");
pthread_join(get_primes2_thread, &result); pthread_join(sieve2_thread, &result);
pthread_join(get_primes1_thread, &result); pthread_join(sieve1_thread, &result);
printf("rr_test: Done\n"); printf("rr_test: Done\n");
} }

View File

@ -1,7 +1,7 @@
############################################################################ ############################################################################
# apps/examples/pipe/Makefile # apps/examples/pipe/Makefile
# #
# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved. # Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -74,23 +70,24 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@) $(call COMPILE, $<, $@)
.built: $(OBJS) .built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built @touch .built
context: context:
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@ @touch $@
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, Make.dep) @rm -f Make.dep .depend
$(call DELFILE, .depend)
-include Make.dep -include Make.dep

View File

@ -1,7 +1,7 @@
############################################################################ ############################################################################
# apps/examples/poll/Makefile # apps/examples/poll/Makefile
# #
# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved. # Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -74,25 +70,25 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@) $(call COMPILE, $<, $@)
.built: $(OBJS) .built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built @touch .built
context: context:
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@ @touch $@
# Register application # Register application
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, Make.dep) @rm -f Make.dep .depend host
$(call DELFILE, .depend)
$(call DELFILE, host$(HOSTEXEEXT))
-include Make.dep -include Make.dep

View File

@ -1,7 +1,7 @@
############################################################################ ############################################################################
# apps/examples/pwm/Makefile # apps/examples/pwm/Makefile
# #
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -80,7 +76,9 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@) $(call COMPILE, $<, $@)
.built: $(OBJS) .built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built @touch .built
.context: .context:
@ -90,17 +88,16 @@ $(COBJS): %$(OBJEXT): %.c
context: .context context: .context
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@ @touch $@
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, Make.dep) @rm -f Make.dep .depend
$(call DELFILE, .depend)
-include Make.dep -include Make.dep

View File

@ -48,7 +48,6 @@
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>
#include <string.h>
#include <nuttx/pwm.h> #include <nuttx/pwm.h>

View File

@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -80,7 +76,9 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@) $(call COMPILE, $<, $@)
.built: $(OBJS) .built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built @touch .built
.context: .context:
@ -92,17 +90,16 @@ endif
context: .context context: .context
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@ @touch $@
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, Make.dep) @rm -f Make.dep .depend
$(call DELFILE, .depend)
-include Make.dep -include Make.dep

View File

@ -1,7 +1,7 @@
############################################################################ ############################################################################
# apps/examples/romfs/Makefile # apps/examples/romfs/Makefile
# #
# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved. # Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -65,7 +61,7 @@ ROOTDEPPATH = --dep-path .
VPATH = VPATH =
all: .built all: .built
.PHONY: checkgenromfs clean depend distclean .PHONY: checkgenromfs clean depend disclean
$(AOBJS): %$(OBJEXT): %.S $(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@) $(call ASSEMBLE, $<, $@)
@ -90,26 +86,26 @@ romfs_testdir.h : testdir.img
@xxd -i $< >$@ || { echo "xxd of $< failed" ; exit 1 ; } @xxd -i $< >$@ || { echo "xxd of $< failed" ; exit 1 ; }
.built: romfs_testdir.h $(OBJS) .built: romfs_testdir.h $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built @touch .built
context: context:
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@ @touch $@
# Register application # Register application
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, Make.dep) @rm -f Make.dep .depend testdir.img
$(call DELFILE, .depend)
$(call DELFILE, testdir.img)
-include Make.dep -include Make.dep

View File

@ -1,7 +1,7 @@
############################################################################ ############################################################################
# apps/examples/serloop/Makefile # apps/examples/serloop/Makefile
# #
# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved. # Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -74,25 +70,26 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@) $(call COMPILE, $<, $@)
.built: $(OBJS) .built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built @touch .built
context: context:
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@ @touch $@
# Register application # Register application
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, Make.dep) @rm -f Make.dep .depend
$(call DELFILE, .depend)
-include Make.dep -include Make.dep

View File

@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -80,7 +76,9 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@) $(call COMPILE, $<, $@)
.built: $(OBJS) .built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built @touch .built
.context: .context:
@ -90,17 +88,16 @@ $(COBJS): %$(OBJEXT): %.c
context: .context context: .context
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@ @touch $@
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, Make.dep) @rm -f Make.dep .depend
$(call DELFILE, .depend)
-include Make.dep -include Make.dep

View File

@ -33,7 +33,7 @@
# #
############################################################################ ############################################################################
-include $(TOPDIR)/.config -include $(TOPDIR)/.config # Current configuration
# Sub-directories containing interpreter runtime # Sub-directories containing interpreter runtime
@ -41,36 +41,30 @@ SUBDIRS = pcode ficl
# Create the list of installed runtime modules (INSTALLED_DIRS) # 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 define ADD_DIRECTORY
INSTALLED_DIRS += ${shell if [ -r $1/Makefile ]; then echo "$1"; fi} INSTALLED_DIRS += ${shell if [ -r $1/Makefile ]; then echo "$1"; fi}
endef endef
endif
$(foreach DIR, $(SUBDIRS), $(eval $(call ADD_DIRECTORY,$(DIR)))) $(foreach DIR, $(SUBDIRS), $(eval $(call ADD_DIRECTORY,$(DIR))))
all: nothing all: nothing
.PHONY: nothing context depend clean distclean .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: nothing:
context: context:
depend: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_depend) depend:
@for dir in $(INSTALLED_DIRS) ; do \
$(MAKE) -C $$dir depend TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
done
clean: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_clean) clean:
@for dir in $(INSTALLED_DIRS) ; do \
$(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
done
distclean: clean $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_distclean) distclean: clean
@for dir in $(INSTALLED_DIRS) ; do \
$(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
done

View File

@ -1,7 +1,7 @@
############################################################################ ############################################################################
# apps/interpreters/ficl/Makefile # apps/interpreters/ficl/Makefile
# #
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -35,11 +35,14 @@
BUILDDIR := ${shell pwd | sed -e 's/ /\\ /g'} BUILDDIR := ${shell pwd | sed -e 's/ /\\ /g'}
-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs -include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs include $(APPDIR)/Make.defs
# Tools # Tools
INCDIR = $(TOPDIR)/tools/incdir.sh
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
INCDIROPT = -w INCDIROPT = -w
endif endif
@ -66,14 +69,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOT_DEPPATH = --dep-path . ROOT_DEPPATH = --dep-path .
@ -96,24 +95,24 @@ debug:
@#echo "CFLAGS: $(CFLAGS)" @#echo "CFLAGS: $(CFLAGS)"
.built: debug $(OBJS) .built: debug $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(Q) touch .built $(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built
context: context:
.depend: debug Makefile $(SRCS) .depend: debug Makefile $(SRCS)
$(Q) $(MKDEP) $(ROOT_DEPPATH) $(SRC_DEPPATH) $(FICL_DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOT_DEPPATH) $(SRC_DEPPATH) $(FICL_DEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
$(Q) touch $@ @touch $@
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .context) @rm -f *.o *~ .*.swp .built
$(call DELFILE, .built)
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, Make.dep) @rm -f Make.dep .depend
$(call DELFILE, .depend)
-include Make.dep -include Make.dep

View File

@ -1,7 +1,7 @@
############################################################################ ############################################################################
# apps/nshlib/Makefile # apps/nshlib/Makefile
# #
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -54,14 +54,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -79,32 +75,32 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@) $(call COMPILE, $<, $@)
.built: $(OBJS) .built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(Q) touch .built $(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built
.context: .context:
@echo "/* List of application requirements, generated during make context. */" > namedapp_list.h @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 @echo "/* List of application entry points, generated during make context. */" > namedapp_proto.h
$(Q) touch $@ @touch $@
context: .context context: .context
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
$(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
$(Q) touch $@ @touch $@
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, .context) @rm -f .context Make.dep .depend
$(call DELFILE, Make.dep) @rm -f namedapp_list.h
$(call DELFILE, .depend) @rm -f namedapp_proto.h
$(call DELFILE, namedapp_list.h)
$(call DELFILE, namedapp_proto.h)
-include Make.dep -include Make.dep

View File

@ -23,194 +23,122 @@ config NSH_BUILTIN_APPS
(NAMEDAPP). (NAMEDAPP).
menu "Disable Individual commands" 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 config NSH_DISABLE_CAT
bool "Disable cat" bool "Disable cat"
default n default n
config NSH_DISABLE_CD config NSH_DISABLE_CD
bool "Disable cd" bool "Disable cd"
default n default n
config NSH_DISABLE_CP config NSH_DISABLE_CP
bool "Disable cp" bool "Disable cp"
default n default n
config NSH_DISABLE_DD config NSH_DISABLE_DD
bool "Disable dd" bool "Disable dd"
default n default n
config NSH_DISABLE_ECHO config NSH_DISABLE_ECHO
bool "Disable echo" bool "Disable echo"
default n default n
config NSH_DISABLE_EXEC config NSH_DISABLE_EXEC
bool "Disable exec" bool "Disable exec"
default n default n
config NSH_DISABLE_EXIT config NSH_DISABLE_EXIT
bool "Disable exit" bool "Disable exit"
default n default n
config NSH_DISABLE_FREE config NSH_DISABLE_FREE
bool "Disable free" bool "Disable free"
default n default n
config NSH_DISABLE_GET config NSH_DISABLE_GET
bool "Disable get" bool "Disable get"
default n default n
config NSH_DISABLE_HELP config NSH_DISABLE_HELP
bool "Disable help" bool "Disable help"
default n default n
config NSH_DISABLE_HEXDUMP
bool "Disable hexdump"
default n
config NSH_DISABLE_IFCONFIG config NSH_DISABLE_IFCONFIG
bool "Disable ifconfig" bool "Disable ifconfig"
default n default n
config NSH_DISABLE_KILL config NSH_DISABLE_KILL
bool "Disable kill" bool "Disable kill"
default n default n
config NSH_DISABLE_LOSETUP config NSH_DISABLE_LOSETUP
bool "Disable losetup" bool "Disable losetup"
default n default n
config NSH_DISABLE_LS config NSH_DISABLE_LS
bool "Disable ls" bool "Disable ls"
default n default n
config NSH_DISABLE_MB config NSH_DISABLE_MB
bool "Disable mb" bool "Disable mb"
default n default n
config NSH_DISABLE_MD5
bool "Disable md5"
default n
depends on NETUTILS_CODECS && CODECS_HASH_MD5
config NSH_DISABLE_MKDIR config NSH_DISABLE_MKDIR
bool "Disable mkdir" bool "Disable mkdir"
default n default n
config NSH_DISABLE_MKFATFS config NSH_DISABLE_MKFATFS
bool "Disable mkfatfs" bool "Disable mkfatfs"
default n default n
config NSH_DISABLE_MKFIFO config NSH_DISABLE_MKFIFO
bool "Disable mkfifo" bool "Disable mkfifo"
default n default n
config NSH_DISABLE_MKRD config NSH_DISABLE_MKRD
bool "Disable mkrd" bool "Disable mkrd"
default n default n
config NSH_DISABLE_MH config NSH_DISABLE_MH
bool "Disable mh" bool "Disable mh"
default n default n
config NSH_DISABLE_MOUNT config NSH_DISABLE_MOUNT
bool "Disable mount" bool "Disable mount"
default n default n
config NSH_DISABLE_MW config NSH_DISABLE_MW
bool "Disable mw" bool "Disable mw"
default n default n
config NSH_DISABLE_NSFMOUNT config NSH_DISABLE_NSFMOUNT
bool "Disable nfsmount" bool "Disable nfsmount"
default n default n
config NSH_DISABLE_PS config NSH_DISABLE_PS
bool "Disable ps" bool "Disable ps"
default n default n
config NSH_DISABLE_PING config NSH_DISABLE_PING
bool "Disable ping" bool "Disable ping"
default n default n
config NSH_DISABLE_PUT config NSH_DISABLE_PUT
bool "Disable put" bool "Disable put"
default n default n
config NSH_DISABLE_PWD config NSH_DISABLE_PWD
bool "Disable pwd" bool "Disable pwd"
default n default n
config NSH_DISABLE_RM config NSH_DISABLE_RM
bool "Disable rm" bool "Disable rm"
default n default n
config NSH_DISABLE_RMDIR config NSH_DISABLE_RMDIR
bool "Disable rmdir" bool "Disable rmdir"
default n default n
config NSH_DISABLE_SET config NSH_DISABLE_SET
bool "Disable set" bool "Disable set"
default n default n
config NSH_DISABLE_SH config NSH_DISABLE_SH
bool "Disable sh" bool "Disable sh"
default n default n
config NSH_DISABLE_SLEEP config NSH_DISABLE_SLEEP
bool "Disable sleep" bool "Disable sleep"
default n default n
config NSH_DISABLE_TEST config NSH_DISABLE_TEST
bool "Disable test" bool "Disable test"
default n default n
config NSH_DISABLE_UMOUNT config NSH_DISABLE_UMOUNT
bool "Disable umount" bool "Disable umount"
default n default n
config NSH_DISABLE_UNSET config NSH_DISABLE_UNSET
bool "Disable unset" bool "Disable unset"
default n 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 config NSH_DISABLE_USLEEP
bool "Disable usleep" bool "Disable usleep"
default n default n
config NSH_DISABLE_WGET config NSH_DISABLE_WGET
bool "Disable wget" bool "Disable wget"
default n default n
config NSH_DISABLE_XD config NSH_DISABLE_XD
bool "Disable xd" bool "Disable xd"
default n default n
endmenu endmenu
config NSH_CODECS_BUFSIZE
int "File buffer size used by CODEC commands"
default 128
config NSH_FILEIOSIZE config NSH_FILEIOSIZE
int "NSH I/O buffer size" int "NSH I/O buffer size"
default 1024 default 1024
@ -562,7 +490,7 @@ config NSH_DHCPC
config NSH_IPADDR config NSH_IPADDR
hex "Target IP address" hex "Target IP address"
default 0xa0000002 default 0x10000002
depends on NSH_LIBRARY && NET && !NSH_DHCPC depends on NSH_LIBRARY && NET && !NSH_DHCPC
---help--- ---help---
If NSH_DHCPC is NOT set, then the static IP address must be provided. If NSH_DHCPC is NOT set, then the static IP address must be provided.
@ -571,7 +499,7 @@ config NSH_IPADDR
config NSH_DRIPADDR config NSH_DRIPADDR
hex "Router IP address" hex "Router IP address"
default 0xa0000001 default 0x10000001
depends on NSH_LIBRARY && NET && !NSH_DHCPC depends on NSH_LIBRARY && NET && !NSH_DHCPC
---help--- ---help---
Default router IP address (aka, Gateway). This is a 32-bit integer Default router IP address (aka, Gateway). This is a 32-bit integer
@ -585,21 +513,6 @@ config NSH_NETMASK
Network mask. This is a 32-bit integer value in host order. So, as Network mask. This is a 32-bit integer value in host order. So, as
an example, 0xffffff00 would be 255.255.255.0. 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 config NSH_NOMAC
bool "Hardware has no MAC address" bool "Hardware has no MAC address"
default n default n
@ -607,12 +520,3 @@ config NSH_NOMAC
---help--- ---help---
Set if your ethernet hardware has no built-in MAC address. Set if your ethernet hardware has no built-in MAC address.
If set, a bogus MAC will be assigned. 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).

View File

@ -79,24 +79,16 @@ ifeq ($(CONFIG_USBDEV),y)
CSRCS += nsh_usbdev.c CSRCS += nsh_usbdev.c
endif endif
ifeq ($(CONFIG_NETUTILS_CODECS),y)
CSRCS += nsh_codeccmd.c
endif
AOBJS = $(ASRCS:.S=$(OBJEXT)) AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT)) COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -114,25 +106,26 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@) $(call COMPILE, $<, $@)
.built: $(OBJS) .built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built @touch .built
context: context:
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) \
$(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@ @touch $@
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, .context) @rm -f Make.dep .depend
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
-include Make.dep -include Make.dep

View File

@ -235,10 +235,6 @@ o test <expression>
integer -gt integer | integer -le integer | integer -gt integer | integer -le integer |
integer -lt integer | integer -ne 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> ...]] o cat <path> [<path> [<path> ...]]
This command copies and concatentates all of the files at <path> This command copies and concatentates all of the files at <path>
@ -385,11 +381,7 @@ o help [-v] [<cmd>]
<cmd> <cmd>
Show full command usage only for this command Show full command usage only for this command
o hexdump <file or device> o ifconfig
Dump data in hexadecimal format from a file or character device.
o ifconfig [nic_name [ip]] [dr|gw|gateway <dr-address>] [netmask <net-mask>] [dns <dns-address>] [hw <hw-mac>]
Show the current configuration of the network, for example: Show the current configuration of the network, for example:
@ -400,22 +392,6 @@ o ifconfig [nic_name [ip]] [dr|gw|gateway <dr-address>] [netmask <net-mask>] [dn
if uIP statistics are enabled (CONFIG_NET_STATISTICS), then if uIP statistics are enabled (CONFIG_NET_STATISTICS), then
this command will also show the detailed state of uIP. 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> o kill -<signal> <pid>
Send the <signal> to the task identified by <pid>. Send the <signal> to the task identified by <pid>.
@ -473,8 +449,6 @@ o ls [-lRs] <dir-path>
-l Show size and mode information along with the filenames -l Show size and mode information along with the filenames
in the listing. in the listing.
o md5 [-f] <string or filepath>
o mb <hex-address>[=<hex-value>][ <hex-byte-count>] o mb <hex-address>[=<hex-value>][ <hex-byte-count>]
o mh <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>] o mw <hex-address>[=<hex-value>][ <hex-byte-count>]
@ -807,10 +781,6 @@ o unset <name>
nsh> nsh>
o urldecode [-f] <string or filepath>
o urlencode [-f] <string or filepath>
o usleep <usec> o usleep <usec>
Pause execution (sleep) of <usec> microseconds. Pause execution (sleep) of <usec> microseconds.
@ -856,8 +826,6 @@ Command Dependencies on Configuration Settings
Command Depends on Configuration Command Depends on Configuration
---------- -------------------------- ---------- --------------------------
[ !CONFIG_NSH_DISABLESCRIPT [ !CONFIG_NSH_DISABLESCRIPT
base64dec CONFIG_NETUTILS_CODECS && CONFIG_CODECS_BASE64
base64enc CONFIG_NETUTILS_CODECS && CONFIG_CODECS_BASE64
cat CONFIG_NFILE_DESCRIPTORS > 0 cat CONFIG_NFILE_DESCRIPTORS > 0
cd !CONFIG_DISABLE_ENVIRON && CONFIG_NFILE_DESCRIPTORS > 0 cd !CONFIG_DISABLE_ENVIRON && CONFIG_NFILE_DESCRIPTORS > 0
cp CONFIG_NFILE_DESCRIPTORS > 0 cp CONFIG_NFILE_DESCRIPTORS > 0
@ -869,14 +837,10 @@ Command Dependencies on Configuration Settings
free -- free --
get CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NET_BUFSIZE >= 558 (see note 1) get CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NET_BUFSIZE >= 558 (see note 1)
help -- help --
hexdump CONFIG_NFILE_DESCRIPTORS > 0
ifconfig CONFIG_NET ifconfig CONFIG_NET
ifdown CONFIG_NET
ifup CONFIG_NET
kill !CONFIG_DISABLE_SIGNALS kill !CONFIG_DISABLE_SIGNALS
losetup !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 losetup !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0
ls CONFIG_NFILE_DESCRIPTORS > 0 ls CONFIG_NFILE_DESCRIPTORS > 0
md5 CONFIG_NETUTILS_CODECS && CONFIG_CODECS_HASH_MD5
mb,mh,mw --- mb,mh,mw ---
mkdir !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE (see note 4) 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 mkfatfs !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_FAT
@ -897,8 +861,6 @@ Command Dependencies on Configuration Settings
test !CONFIG_NSH_DISABLESCRIPT test !CONFIG_NSH_DISABLESCRIPT
umount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_READABLE umount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_READABLE
unset !CONFIG_DISABLE_ENVIRON unset !CONFIG_DISABLE_ENVIRON
urldecode CONFIG_NETUTILS_CODECS && CONFIG_CODECS_URLCODE
urlencode CONFIG_NETUTILS_CODECS && CONFIG_CODECS_URLCODE
usleep !CONFIG_DISABLE_SIGNALS usleep !CONFIG_DISABLE_SIGNALS
get CONFIG_NET && CONFIG_NET_TCP && CONFIG_NFILE_DESCRIPTORS > 0 get CONFIG_NET && CONFIG_NET_TCP && CONFIG_NFILE_DESCRIPTORS > 0
xd --- xd ---
@ -918,22 +880,20 @@ In addition, each NSH command can be individually disabled via one of the follow
settings. All of these settings make the configuration of NSH potentially complex but settings. All of these settings make the configuration of NSH potentially complex but
also allow it to squeeze into very small memory footprints. also allow it to squeeze into very small memory footprints.
CONFIG_NSH_DISABLE_BASE64DEC, CONFIG_NSH_DISABLE_BASE64ENC, CONFIG_NSH_DISABLE_CAT, CONFIG_NSH_DISABLE_CAT, CONFIG_NSH_DISABLE_CD, CONFIG_NSH_DISABLE_CP,
CONFIG_NSH_DISABLE_CD, CONFIG_NSH_DISABLE_CP, CONFIG_NSH_DISABLE_DD, CONFIG_NSH_DISABLE_DD, CONFIG_NSH_DISABLE_DF, CONFIG_NSH_DISABLE_ECHO,
CONFIG_NSH_DISABLE_DF, CONFIG_NSH_DISABLE_ECHO, CONFIG_NSH_DISABLE_EXEC, CONFIG_NSH_DISABLE_EXEC, CONFIG_NSH_DISABLE_EXIT, CONFIG_NSH_DISABLE_FREE,
CONFIG_NSH_DISABLE_EXIT, CONFIG_NSH_DISABLE_FREE, CONFIG_NSH_DISABLE_GET, CONFIG_NSH_DISABLE_GET, CONFIG_NSH_DISABLE_HELP, CONFIG_NSH_DISABLE_IFCONFIG,
CONFIG_NSH_DISABLE_HELP, CONFIG_NSH_DISABLE_HEXDUMP, CONFIG_NSH_DISABLE_IFCONFIG, CONFIG_NSH_DISABLE_KILL, CONFIG_NSH_DISABLE_LOSETUP, CONFIG_NSH_DISABLE_LS,
CONFIG_NSH_DISABLE_IFUPDOWN, CONFIG_NSH_DISABLE_KILL, CONFIG_NSH_DISABLE_LOSETUP, CONFIG_NSH_DISABLE_MB, CONFIG_NSH_DISABLE_MKDIR, CONFIG_NSH_DISABLE_MKFATFS,
CONFIG_NSH_DISABLE_LS, CONFIG_NSH_DISABLE_MD5 CONFIG_NSH_DISABLE_MB, CONFIG_NSH_DISABLE_MKFIFO, CONFIG_NSH_DISABLE_MKRD, CONFIG_NSH_DISABLE_MH,
CONFIG_NSH_DISABLE_MKDIR, CONFIG_NSH_DISABLE_MKFATFS, CONFIG_NSH_DISABLE_MKFIFO, CONFIG_NSH_DISABLE_MOUNT, CONFIG_NSH_DISABLE_MW, CONFIG_NSH_DISABLE_MV,
CONFIG_NSH_DISABLE_MKRD, CONFIG_NSH_DISABLE_MH, CONFIG_NSH_DISABLE_MOUNT, CONFIG_NSH_DISABLE_NFSMOUNT, CONFIG_NSH_DISABLE_PS, CONFIG_NSH_DISABLE_PING,
CONFIG_NSH_DISABLE_MW, CONFIG_NSH_DISABLE_MV, CONFIG_NSH_DISABLE_NFSMOUNT, CONFIG_NSH_DISABLE_PUT, CONFIG_NSH_DISABLE_PWD, CONFIG_NSH_DISABLE_RM,
CONFIG_NSH_DISABLE_PS, CONFIG_NSH_DISABLE_PING, CONFIG_NSH_DISABLE_PUT, CONFIG_NSH_DISABLE_RMDIR, CONFIG_NSH_DISABLE_SET, CONFIG_NSH_DISABLE_SH,
CONFIG_NSH_DISABLE_PWD, CONFIG_NSH_DISABLE_RM, CONFIG_NSH_DISABLE_RMDIR, CONFIG_NSH_DISABLE_SLEEP, CONFIG_NSH_DISABLE_TEST, CONFIG_NSH_DISABLE_UMOUNT,
CONFIG_NSH_DISABLE_SET, CONFIG_NSH_DISABLE_SH, CONFIG_NSH_DISABLE_SLEEP, CONFIG_NSH_DISABLE_UNSET, CONFIG_NSH_DISABLE_USLEEP, CONFIG_NSH_DISABLE_WGET,
CONFIG_NSH_DISABLE_TEST, CONFIG_NSH_DISABLE_UMOUNT, CONFIG_NSH_DISABLE_UNSET, CONFIG_NSH_DISABLE_XD
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 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. case, the help command is still available but will be slightly smaller.
@ -1124,10 +1084,6 @@ NSH-Specific Configuration Settings
Set if your ethernet hardware has no built-in MAC address. Set if your ethernet hardware has no built-in MAC address.
If set, a bogus MAC will be assigned. 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 If you use DHCPC, then some special configuration network options are
required. These include: required. These include:

View File

@ -47,7 +47,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <unistd.h>
#include <errno.h> #include <errno.h>
#include <nuttx/usb/usbdev_trace.h> #include <nuttx/usb/usbdev_trace.h>
@ -216,15 +215,6 @@
#endif /* CONFIG_NSH_TELNET_LOGIN */ #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 */ /* Verify support for ROMFS /etc directory support options */
#ifdef CONFIG_NSH_ROMFSETC #ifdef CONFIG_NSH_ROMFSETC
@ -268,36 +258,12 @@
# undef CONFIG_NSH_ROMFSSECTSIZE # undef CONFIG_NSH_ROMFSSECTSIZE
#endif #endif
/* This is the maximum number of arguments that will be accepted for a /* This is the maximum number of arguments that will be accepted for a command */
* command. Here we attempt to select the smallest number possible depending #ifdef CONFIG_NSH_MAX_ARGUMENTS
* upon the of commands that are available. Most commands use six or fewer # define NSH_MAX_ARGUMENTS CONFIG_NSH_MAX_ARGUMENTS
* arguments, but there are a few that require more. #else
* # define NSH_MAX_ARGUMENTS 10
* 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 #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 /* 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 * will only be used if CONFIG_NSH_STRERROR is defined. Note that the strerror
* interface must also have been enabled with CONFIG_LIBC_STRERROR. * interface must also have been enabled with CONFIG_LIBC_STRERROR.
@ -563,9 +529,6 @@ void nsh_usbtrace(void);
# ifndef CONFIG_NSH_DISABLE_DD # ifndef CONFIG_NSH_DISABLE_DD
int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif # 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 # ifndef CONFIG_NSH_DISABLE_LS
int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif # endif
@ -632,10 +595,6 @@ void nsh_usbtrace(void);
# ifndef CONFIG_NSH_DISABLE_IFCONFIG # ifndef CONFIG_NSH_DISABLE_IFCONFIG
int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif # 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 #if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0
# ifndef CONFIG_NSH_DISABLE_GET # ifndef CONFIG_NSH_DISABLE_GET
int cmd_get(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); int cmd_get(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
@ -684,28 +643,4 @@ void nsh_usbtrace(void);
# endif # endif
#endif /* CONFIG_DISABLE_SIGNALS */ #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 */ #endif /* __APPS_NSHLIB_NSH_H */

View File

@ -46,10 +46,6 @@
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#if CONFIG_NFILE_DESCRIPTORS > 0
# include <fcntl.h>
#endif
#include "nsh.h" #include "nsh.h"
#include "nsh_console.h" #include "nsh_console.h"
@ -331,7 +327,7 @@ void nsh_dumpbuffer(FAR struct nsh_vtbl_s *vtbl, const char *msg,
} }
/**************************************************************************** /****************************************************************************
* Name: cmd_xd, hex dump of memory * Name: cmd_xd
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_NSH_DISABLE_XD #ifndef CONFIG_NSH_DISABLE_XD
@ -357,58 +353,3 @@ int cmd_xd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
return OK; return OK;
} }
#endif #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

View File

@ -51,7 +51,6 @@
#include <fcntl.h> /* Needed for open */ #include <fcntl.h> /* Needed for open */
#include <libgen.h> /* Needed for basename */ #include <libgen.h> /* Needed for basename */
#include <errno.h> #include <errno.h>
#include <debug.h>
#include <nuttx/net/net.h> #include <nuttx/net/net.h>
#include <nuttx/clock.h> #include <nuttx/clock.h>
@ -81,12 +80,6 @@
# endif # endif
#endif #endif
#ifdef CONFIG_HAVE_GETHOSTBYNAME
# include <netdb.h>
#else
# include <apps/netutils/resolv.h>
#endif
#include "nsh.h" #include "nsh.h"
#include "nsh_console.h" #include "nsh_console.h"
@ -94,16 +87,8 @@
* Definitions * Definitions
****************************************************************************/ ****************************************************************************/
/* Size of the ECHO data */
#define DEFAULT_PING_DATALEN 56 #define DEFAULT_PING_DATALEN 56
/* Get the larger value */
#ifndef MAX
# define MAX(a,b) (a > b ? a : b)
#endif
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/
@ -277,34 +262,14 @@ int ifconfig_callback(FAR struct uip_driver_s *dev, void *arg)
{ {
struct nsh_vtbl_s *vtbl = (struct nsh_vtbl_s*)arg; struct nsh_vtbl_s *vtbl = (struct nsh_vtbl_s*)arg;
struct in_addr addr; 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; addr.s_addr = dev->d_ipaddr;
nsh_output(vtbl, "\tIPaddr:%s ", inet_ntoa(addr)); nsh_output(vtbl, "\tIPaddr:%s ", inet_ntoa(addr));
addr.s_addr = dev->d_draddr; addr.s_addr = dev->d_draddr;
nsh_output(vtbl, "DRaddr:%s ", inet_ntoa(addr)); nsh_output(vtbl, "DRaddr:%s ", inet_ntoa(addr));
addr.s_addr = dev->d_netmask; addr.s_addr = dev->d_netmask;
nsh_output(vtbl, "Mask:%s\n", inet_ntoa(addr)); nsh_output(vtbl, "Mask:%s\n\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; return OK;
} }
@ -503,54 +468,6 @@ int cmd_get(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#endif #endif
#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 * Name: cmd_ifconfig
****************************************************************************/ ****************************************************************************/
@ -559,17 +476,7 @@ int cmd_ifdown(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{ {
struct in_addr addr; struct in_addr addr;
in_addr_t gip; in_addr_t ip;
int i;
FAR char *intf = NULL;
FAR char *hostip = NULL;
FAR char *gwip = NULL;
FAR char *mask = NULL;
FAR char *tmp = NULL;
FAR char *hw = NULL;
FAR char *dns = NULL;
bool badarg=false;
uint8_t mac[6];
/* With one or no arguments, ifconfig simply shows the status of ethernet /* With one or no arguments, ifconfig simply shows the status of ethernet
* device: * device:
@ -591,142 +498,24 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* ifconfig nic_name ip_address * ifconfig nic_name ip_address
*/ */
if (argc > 2)
{
for(i = 0; i < argc; i++)
{
if (i == 1)
{
intf = argv[i];
}
else if (i == 2)
{
hostip = argv[i];
}
else
{
tmp = argv[i];
if (!strcmp(tmp, "dr") || !strcmp(tmp, "gw") || !strcmp(tmp, "gateway"))
{
if (argc-1 >= i+1)
{
gwip = argv[i+1];
i++;
}
else
{
badarg = true;
}
}
else if(!strcmp(tmp, "netmask"))
{
if (argc-1 >= i+1)
{
mask = argv[i+1];
i++;
}
else
{
badarg = true;
}
}
else if(!strcmp(tmp, "hw"))
{
if (argc-1>=i+1)
{
hw = argv[i+1];
i++;
badarg = !uiplib_hwmacconv(hw, mac);
}
else
{
badarg = true;
}
}
else if(!strcmp(tmp, "dns"))
{
if (argc-1 >= i+1)
{
dns = argv[i+1];
i++;
}
else
{
badarg = true;
}
}
}
}
}
if (badarg)
{
nsh_output(vtbl, g_fmtargrequired, argv[0]);
return ERROR;
}
/* Set Hardware ethernet MAC addr */
if (hw)
{
ndbg("HW MAC: %s\n", hw);
uip_setmacaddr(intf, mac);
}
/* Set host ip address */ /* Set host ip address */
ndbg("Host IP: %s\n", hostip); ip = addr.s_addr = inet_addr(argv[2]);
gip = addr.s_addr = inet_addr(hostip); uip_sethostaddr(argv[1], &addr);
uip_sethostaddr(intf, &addr);
/* Set gateway */ /* Set gateway */
if (gwip) ip = NTOHL(ip);
{ ip &= ~0x000000ff;
ndbg("Gateway: %s\n", gwip); ip |= 0x00000001;
gip = addr.s_addr = inet_addr(gwip);
}
else
{
ndbg("Gateway: default\n");
gip = NTOHL(gip);
gip &= ~0x000000ff;
gip |= 0x00000001;
gip = HTONL(gip);
addr.s_addr = gip;
}
uip_setdraddr(intf, &addr); addr.s_addr = HTONL(ip);
uip_setdraddr(argv[1], &addr);
/* Set network mask */ /* Set netmask */
if (mask)
{
ndbg("Netmask: %s\n",mask);
addr.s_addr = inet_addr(mask);
}
else
{
ndbg("Netmask: Default\n");
addr.s_addr = inet_addr("255.255.255.0"); addr.s_addr = inet_addr("255.255.255.0");
} uip_setnetmask(argv[1], &addr);
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
return OK; return OK;
} }
@ -747,7 +536,6 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
uint32_t start; uint32_t start;
uint32_t next; uint32_t next;
uint32_t dsec = 10; uint32_t dsec = 10;
uint32_t maxwait;
uint16_t id; uint16_t id;
bool badarg = false; bool badarg = false;
int count = 10; int count = 10;
@ -811,7 +599,7 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
if (optind == argc-1) if (optind == argc-1)
{ {
staddr = argv[optind]; staddr = argv[optind];
if (dns_gethostip(staddr, &ipaddr) < 0) if (!uiplib_ipaddrconv(staddr, (FAR unsigned char*)&ipaddr))
{ {
goto errout; goto errout;
} }
@ -831,26 +619,16 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
id = ping_newid(); 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 */ /* Loop for the specified count */
nsh_output(vtbl, "PING %d.%d.%d.%d %d bytes of data\n", nsh_output(vtbl, "PING %s %d bytes of data\n", staddr, DEFAULT_PING_DATALEN);
(ipaddr ) & 0xff, (ipaddr >> 8 ) & 0xff,
(ipaddr >> 16 ) & 0xff, (ipaddr >> 24 ) & 0xff,
DEFAULT_PING_DATALEN);
start = g_system_timer; start = g_system_timer;
for (i = 1; i <= count; i++) for (i = 1; i <= count; i++)
{ {
/* Send the ECHO request and wait for the response */ /* Send the ECHO request and wait for the response */
next = g_system_timer; next = g_system_timer;
seqno = uip_ping(ipaddr, id, i, DEFAULT_PING_DATALEN, maxwait); seqno = uip_ping(ipaddr, id, i, DEFAULT_PING_DATALEN, dsec);
/* Was any response returned? We can tell if a non-negative sequence /* Was any response returned? We can tell if a non-negative sequence
* number was returned. * number was returned.
@ -858,7 +636,7 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
if (seqno >= 0 && seqno <= i) if (seqno >= 0 && seqno <= i)
{ {
/* Get the elapsed time from the time that the request was /* Get the elpased time from the time that the request was
* sent until the response was received. If we got a response * sent until the response was received. If we got a response
* to an earlier request, then fudge the elpased time. * to an earlier request, then fudge the elpased time.
*/ */
@ -884,7 +662,7 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
elapsed = TICK2DSEC(g_system_timer - next); elapsed = TICK2DSEC(g_system_timer - next);
if (elapsed < dsec) if (elapsed < dsec)
{ {
usleep(100000 * (dsec - elapsed)); usleep(100000*dsec);
} }
} }

View File

@ -47,7 +47,7 @@
#include <net/if.h> #include <net/if.h>
#include <apps/netutils/uiplib.h> #include <apps/netutils/uiplib.h>
#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS) #if defined(CONFIG_NSH_DHCPC)
# include <apps/netutils/resolv.h> # include <apps/netutils/resolv.h>
# include <apps/netutils/dhcpc.h> # include <apps/netutils/dhcpc.h>
#endif #endif
@ -60,10 +60,6 @@
* Definitions * Definitions
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_NSH_DRIPADDR) && !defined(CONFIG_NSH_DNSIPADDR)
# define CONFIG_NSH_DNSIPADDR CONFIG_NSH_DRIPADDR
#endif
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/
@ -129,14 +125,10 @@ int nsh_netinit(void)
addr.s_addr = HTONL(CONFIG_NSH_NETMASK); addr.s_addr = HTONL(CONFIG_NSH_NETMASK);
uip_setnetmask("eth0", &addr); uip_setnetmask("eth0", &addr);
#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS) #if defined(CONFIG_NSH_DHCPC)
/* Set up the resolver */ /* Set up the resolver */
resolv_init(); resolv_init();
#if defined(CONFIG_NSH_DNS)
addr.s_addr = HTONL(CONFIG_NSH_DNSIPADDR);
resolv_conf(&addr);
#endif
#endif #endif
#if defined(CONFIG_NSH_DHCPC) #if defined(CONFIG_NSH_DHCPC)

View File

@ -73,19 +73,19 @@
/* Argument list size /* Argument list size
* *
* argv[0]: The command name. * argv[0]: The command name.
* argv[1]: The beginning of argument (up to CONFIG_NSH_MAXARGUMENTS) * argv[1]: The beginning of argument (up to NSH_MAX_ARGUMENTS)
* argv[argc-3]: Possibly '>' or '>>' * argv[argc-3]: Possibly '>' or '>>'
* argv[argc-2]: Possibly <file> * argv[argc-2]: Possibly <file>
* argv[argc-1]: Possibly '&' (if pthreads are enabled) * argv[argc-1]: Possibly '&' (if pthreads are enabled)
* argv[argc]: NULL terminating pointer * argv[argc]: NULL terminating pointer
* *
* Maximum size is CONFIG_NSH_MAXARGUMENTS+5 * Maximum size is NSH_MAX_ARGUMENTS+5
*/ */
#ifndef CONFIG_NSH_DISABLEBG #ifndef CONFIG_NSH_DISABLEBG
# define MAX_ARGV_ENTRIES (CONFIG_NSH_MAXARGUMENTS+5) # define MAX_ARGV_ENTRIES (NSH_MAX_ARGUMENTS+5)
#else #else
# define MAX_ARGV_ENTRIES (CONFIG_NSH_MAXARGUMENTS+4) # define MAX_ARGV_ENTRIES (NSH_MAX_ARGUMENTS+4)
#endif #endif
/* Help command summary layout */ /* Help command summary layout */
@ -146,25 +146,16 @@ static const char g_failure[] = "1";
static const struct cmdmap_s g_cmdmap[] = static const struct cmdmap_s g_cmdmap[] =
{ {
#if !defined(CONFIG_NSH_DISABLESCRIPT) && !defined(CONFIG_NSH_DISABLE_TEST) #if !defined(CONFIG_NSH_DISABLESCRIPT) && !defined(CONFIG_NSH_DISABLE_TEST)
{ "[", cmd_lbracket, 4, CONFIG_NSH_MAXARGUMENTS, "<expression> ]" }, { "[", cmd_lbracket, 4, NSH_MAX_ARGUMENTS, "<expression> ]" },
#endif #endif
#ifndef CONFIG_NSH_DISABLE_HELP #ifndef CONFIG_NSH_DISABLE_HELP
{ "?", cmd_help, 1, 1, NULL }, { "?", cmd_help, 1, 1, NULL },
#endif #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 #if CONFIG_NFILE_DESCRIPTORS > 0
# ifndef CONFIG_NSH_DISABLE_CAT # ifndef CONFIG_NSH_DISABLE_CAT
{ "cat", cmd_cat, 2, CONFIG_NSH_MAXARGUMENTS, "<path> [<path> [<path> ...]]" }, { "cat", cmd_cat, 2, NSH_MAX_ARGUMENTS, "<path> [<path> [<path> ...]]" },
# endif # endif
#ifndef CONFIG_DISABLE_ENVIRON #ifndef CONFIG_DISABLE_ENVIRON
# ifndef CONFIG_NSH_DISABLE_CD # ifndef CONFIG_NSH_DISABLE_CD
@ -196,9 +187,9 @@ static const struct cmdmap_s g_cmdmap[] =
#ifndef CONFIG_NSH_DISABLE_ECHO #ifndef CONFIG_NSH_DISABLE_ECHO
# ifndef CONFIG_DISABLE_ENVIRON # ifndef CONFIG_DISABLE_ENVIRON
{ "echo", cmd_echo, 0, CONFIG_NSH_MAXARGUMENTS, "[<string|$name> [<string|$name>...]]" }, { "echo", cmd_echo, 0, NSH_MAX_ARGUMENTS, "[<string|$name> [<string|$name>...]]" },
# else # else
{ "echo", cmd_echo, 0, CONFIG_NSH_MAXARGUMENTS, "[<string> [<string>...]]" }, { "echo", cmd_echo, 0, NSH_MAX_ARGUMENTS, "[<string> [<string>...]]" },
# endif # endif
#endif #endif
@ -227,19 +218,9 @@ static const struct cmdmap_s g_cmdmap[] =
# endif # endif
#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 #ifdef CONFIG_NET
# ifndef CONFIG_NSH_DISABLE_IFCONFIG # ifndef CONFIG_NSH_DISABLE_IFCONFIG
{ "ifconfig", cmd_ifconfig, 1, 11, "[nic_name [ip]] [dr|gw|gateway <dr-address>] [netmask <net-mask>] [dns <dns-address>] [hw <hw-mac>]" }, { "ifconfig", cmd_ifconfig, 1, 3, "[nic_name [ip]]" },
# endif
# ifndef CONFIG_NSH_DISABLE_IFUPDOWN
{ "ifdown", cmd_ifdown, 2, 2, "<nic_name>" },
{ "ifup", cmd_ifup, 2, 2, "<nic_name>" },
# endif # endif
#endif #endif
@ -265,12 +246,6 @@ static const struct cmdmap_s g_cmdmap[] =
{ "mb", cmd_mb, 2, 3, "<hex-address>[=<hex-value>][ <hex-byte-count>]" }, { "mb", cmd_mb, 2, 3, "<hex-address>[=<hex-value>][ <hex-byte-count>]" },
#endif #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) #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE)
# ifndef CONFIG_NSH_DISABLE_MKDIR # ifndef CONFIG_NSH_DISABLE_MKDIR
{ "mkdir", cmd_mkdir, 2, 2, "<path>" }, { "mkdir", cmd_mkdir, 2, 2, "<path>" },
@ -373,7 +348,7 @@ static const struct cmdmap_s g_cmdmap[] =
#endif #endif
#if !defined(CONFIG_NSH_DISABLESCRIPT) && !defined(CONFIG_NSH_DISABLE_TEST) #if !defined(CONFIG_NSH_DISABLESCRIPT) && !defined(CONFIG_NSH_DISABLE_TEST)
{ "test", cmd_test, 3, CONFIG_NSH_MAXARGUMENTS, "<expression>" }, { "test", cmd_test, 3, NSH_MAX_ARGUMENTS, "<expression>" },
#endif #endif
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE) #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE)
@ -388,15 +363,6 @@ static const struct cmdmap_s g_cmdmap[] =
# endif # endif
#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_DISABLE_SIGNALS
# ifndef CONFIG_NSH_DISABLE_USLEEP # ifndef CONFIG_NSH_DISABLE_USLEEP
{ "usleep", cmd_usleep, 2, 2, "<usec>" }, { "usleep", cmd_usleep, 2, 2, "<usec>" },
@ -412,7 +378,6 @@ static const struct cmdmap_s g_cmdmap[] =
#ifndef CONFIG_NSH_DISABLE_XD #ifndef CONFIG_NSH_DISABLE_XD
{ "xd", cmd_xd, 3, 3, "<hex-address> <byte-count>" }, { "xd", cmd_xd, 3, 3, "<hex-address> <byte-count>" },
#endif #endif
{ NULL, NULL, 1, 1, NULL } { NULL, NULL, 1, 1, NULL }
}; };
@ -746,7 +711,7 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl, int argc, char *argv[])
* *
* argv[0]: The command name. This is argv[0] when the arguments * argv[0]: The command name. This is argv[0] when the arguments
* are, finally, received by the command vtblr * are, finally, received by the command vtblr
* argv[1]: The beginning of argument (up to CONFIG_NSH_MAXARGUMENTS) * argv[1]: The beginning of argument (up to NSH_MAX_ARGUMENTS)
* argv[argc]: NULL terminating pointer * argv[argc]: NULL terminating pointer
*/ */
@ -1353,13 +1318,13 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
* of argv is: * of argv is:
* *
* argv[0]: The command name. * argv[0]: The command name.
* argv[1]: The beginning of argument (up to CONFIG_NSH_MAXARGUMENTS) * argv[1]: The beginning of argument (up to NSH_MAX_ARGUMENTS)
* argv[argc-3]: Possibly '>' or '>>' * argv[argc-3]: Possibly '>' or '>>'
* argv[argc-2]: Possibly <file> * argv[argc-2]: Possibly <file>
* argv[argc-1]: Possibly '&' * argv[argc-1]: Possibly '&'
* argv[argc]: NULL terminating pointer * argv[argc]: NULL terminating pointer
* *
* Maximum size is CONFIG_NSH_MAXARGUMENTS+5 * Maximum size is NSH_MAX_ARGUMENTS+5
*/ */
argv[0] = cmd; argv[0] = cmd;
@ -1433,7 +1398,7 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
/* Check if the maximum number of arguments was exceeded */ /* Check if the maximum number of arguments was exceeded */
if (argc > CONFIG_NSH_MAXARGUMENTS) if (argc > NSH_MAX_ARGUMENTS)
{ {
nsh_output(vtbl, g_fmttoomanyargs, cmd); nsh_output(vtbl, g_fmttoomanyargs, cmd);
} }

View File

@ -41,36 +41,31 @@ SUBDIRS = free i2c install readline poweroff ramtron sdcard sysinfo
# Create the list of installed runtime modules (INSTALLED_DIRS) # Create the list of installed runtime modules (INSTALLED_DIRS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
define ADD_DIRECTORY define ADD_DIRECTORY
INSTALLED_DIRS += $(if $(wildcard .\$1\Makefile),$1,) INSTALLED_DIRS += ${shell if [ -r $1/Makefile ]; then echo "$1"; fi}
endef endef
else
define ADD_DIRECTORY
INSTALLED_DIRS += $(if $(wildcard ./$1/Makefile),$1,)
endef
endif
$(foreach DIR, $(SUBDIRS), $(eval $(call ADD_DIRECTORY,$(DIR)))) $(foreach DIR, $(SUBDIRS), $(eval $(call ADD_DIRECTORY,$(DIR))))
all: nothing all: nothing
.PHONY: nothing context depend clean distclean .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: nothing:
context: context:
depend: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_depend) depend:
@for dir in $(INSTALLED_DIRS) ; do \
$(MAKE) -C $$dir depend TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
done
clean: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_clean) clean:
@for dir in $(INSTALLED_DIRS) ; do \
$(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
done
distclean: clean
@for dir in $(INSTALLED_DIRS) ; do \
$(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
done
distclean: clean $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_distclean)

View File

@ -1,7 +1,7 @@
############################################################################ ############################################################################
# apps/system/free/Makefile # apps/system/free/Makefile
# #
# Copyright (C) 2011-2012 Uros Platise. All rights reserved. # Copyright (C) 2011 Uros Platise. All rights reserved.
# Author: Uros Platise <uros.platise@isotel.eu> # Author: Uros Platise <uros.platise@isotel.eu>
# Gregory Nutt <gnutt@nuttx.org> # Gregory Nutt <gnutt@nuttx.org>
# #
@ -61,14 +61,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -87,32 +83,32 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@) $(call COMPILE, $<, $@)
.built: $(OBJS) .built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(Q) touch .built $(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built
# Register application # Register application
.context: .context:
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
$(Q) touch $@ @touch $@
context: .context context: .context
# Create dependencies # Create dependencies
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
$(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
$(Q) touch $@ @touch $@
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, .context) @rm -f .context Make.dep .depend
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
-include Make.dep -include Make.dep

View File

@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -77,29 +73,30 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@) $(call COMPILE, $<, $@)
.built: $(OBJS) .built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(Q) touch .built $(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built
.context: .context:
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
$(Q) touch $@ @touch $@
context: .context context: .context
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
$(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) \
$(Q) touch $@ $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, .context) @rm -f Make.dep .depend
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
-include Make.dep -include Make.dep

View File

@ -2,7 +2,6 @@
# apps/system/install/Makefile # apps/system/install/Makefile
# #
# Copyright (C) 2011 Uros Platise. All rights reserved. # Copyright (C) 2011 Uros Platise. All rights reserved.
# Copyright (C) 2012 Gregory Nutt. All rights reserved.
# Author: Uros Platise <uros.platise@isotel.eu> # Author: Uros Platise <uros.platise@isotel.eu>
# Gregory Nutt <gnutt@nuttx.org> # Gregory Nutt <gnutt@nuttx.org>
# #
@ -62,14 +61,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -88,32 +83,32 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@) $(call COMPILE, $<, $@)
.built: $(OBJS) .built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(Q) touch .built $(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built
# Register application # Register application
.context: .context:
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
$(Q) touch $@ @touch $@
context: .context context: .context
# Create dependencies # Create dependencies
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
$(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
$(Q) touch $@ @touch $@
depend: .depend depend: .depend
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, .context) @rm -f .context Make.dep .depend
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
-include Make.dep -include Make.dep

View File

@ -52,14 +52,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else else
BIN = ../../libapps$(LIBEXT) BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
endif endif
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
@ -78,8 +74,10 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@) $(call COMPILE, $<, $@)
.built: $(OBJS) .built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS)) @( for obj in $(OBJS) ; do \
$(Q) touch .built $(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built
# Context build phase target # Context build phase target
@ -88,20 +86,18 @@ context:
# Dependency build phase target # Dependency build phase target
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
$(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
$(Q) touch $@ @touch $@
depend: .depend depend: .depend
# Housekeeping targets # Housekeeping targets
clean: clean:
$(call DELFILE, .built) @rm -f *.o *~ .*.swp .built
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(call DELFILE, .context) @rm -f .context Make.dep .depend
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
-include Make.dep -include Make.dep