Merge branch 'master' of https://bitbucket.org/slorquet/apps into ieee
Conflicts: Kconfig Makefile
This commit is contained in:
commit
2d14369b87
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,6 +10,7 @@ Make.dep
|
|||||||
core
|
core
|
||||||
.gdbinit
|
.gdbinit
|
||||||
cscope.out
|
cscope.out
|
||||||
|
/Kconfig
|
||||||
/bin
|
/bin
|
||||||
/external
|
/external
|
||||||
/.context
|
/.context
|
||||||
|
49
ChangeLog.txt
Normal file → Executable file
49
ChangeLog.txt
Normal file → Executable file
@ -1313,7 +1313,7 @@
|
|||||||
* apps/nshlib/: The NSH mount command now recognizes the Union file
|
* apps/nshlib/: The NSH mount command now recognizes the Union file
|
||||||
system type when listing mounted file systems (2015-06-07).
|
system type when listing mounted file systems (2015-06-07).
|
||||||
|
|
||||||
7.11 2015-xx-xx Gregory Nutt <gnutt@nuttx.org>
|
7.11 2015-08-13 Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
|
||||||
* apps/netutils/thttpd: Fix compilation problems when
|
* apps/netutils/thttpd: Fix compilation problems when
|
||||||
CONFIG_THTTPD_GENERATE_INDICES is defined (2015-06-12).
|
CONFIG_THTTPD_GENERATE_INDICES is defined (2015-06-12).
|
||||||
@ -1359,7 +1359,7 @@
|
|||||||
don't have the wherewithal for that change today (2015-04-14)`.
|
don't have the wherewithal for that change today (2015-04-14)`.
|
||||||
* apps/nshlib and apps/examaples/thttpd: Change decoding to handle the
|
* apps/nshlib and apps/examaples/thttpd: Change decoding to handle the
|
||||||
increased size of the scheduling policy field in the TCB (2015-07-23).
|
increased size of the scheduling policy field in the TCB (2015-07-23).
|
||||||
* apps/examples/ostest: Improve syncrhonization in round robin tests.
|
* apps/examples/ostest: Improve synchronization in round robin tests.
|
||||||
On very fast processors, there are race conditions that make the test
|
On very fast processors, there are race conditions that make the test
|
||||||
failure. Need better interlocking to assure that the threads actually
|
failure. Need better interlocking to assure that the threads actually
|
||||||
do start at the same time (2015-07-24).
|
do start at the same time (2015-07-24).
|
||||||
@ -1373,3 +1373,48 @@
|
|||||||
* apps/system/readline and apps/nshlib: Add support for an in-memory
|
* apps/system/readline and apps/nshlib: Add support for an in-memory
|
||||||
command line history that can be retrieved using the up and down
|
command line history that can be retrieved using the up and down
|
||||||
arrows. Contributed by Nghia Ho (2015-08-09).
|
arrows. Contributed by Nghia Ho (2015-08-09).
|
||||||
|
* apps/Makefile: No longer depends on hardcoded lists of directories.
|
||||||
|
Instead, it does a wildcard search to find all appropriate
|
||||||
|
directories. This means that to install a new application, you
|
||||||
|
simply have to copy the directory (or link it) into the apps/
|
||||||
|
directory. If the new directory includes a Makefile and Make.defs
|
||||||
|
file, then it will automatically be included in the build (2015-08-11).
|
||||||
|
* apps/Makefile, Kconfig, */Kconfig, tools/mkkconfig.sh: Add the tool
|
||||||
|
mkkconfig.sh that dynamically builds the apps/Kconfig file at
|
||||||
|
configuration time. The hardcoded configuration file has been removed
|
||||||
|
and now the top-level Makefile executes tools/mkkconfig.sh to auto-
|
||||||
|
generate the top-level Kconfig file. A new apps/ make target call
|
||||||
|
preconfig: was added to support this operation. Now you do not have
|
||||||
|
to modify the top-level Kconfig file to add a new directory into the
|
||||||
|
configuration; the top-level subdirectory simply needs to include a
|
||||||
|
Kconfig file and it will automatically be included in the
|
||||||
|
configuration. The native Windows build is temporarily broken until
|
||||||
|
a new apps/tools/mkconfig.bat script is generated (2015-08-11).
|
||||||
|
* apps/tools/mkkconfig.bat: Add the Windows script corresponding to
|
||||||
|
apps/tools/mkkconfig.sh. Needed for a Windows native build. Untested
|
||||||
|
on initial commit (2015-08-12).
|
||||||
|
|
||||||
|
7.12 2015-xx-xx Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
|
||||||
|
* apps/examples/can: Extend the CAN loopback test by adding more
|
||||||
|
command line options (2015-08-17).
|
||||||
|
* apps/examples/usbserial: Can now be run as an NSH builtin-function.
|
||||||
|
Now uses a configurable IO buffer size (2015-08-20).
|
||||||
|
* Various Kconfig files in netutils: Fix some changes from from
|
||||||
|
NETUTILS_DNSCLIENT to NETDB_DNSCLIENT. From Pavel Pisa (2015-08-20).
|
||||||
|
* system/netdb: Failed to build if CONFIG_NET_HOSTFILE was not defined
|
||||||
|
because gethostbyaddr() was not available. Noted by OrbitalFox
|
||||||
|
(2015-08-21).
|
||||||
|
* apps/system/symtab: Optional canned symtab inclusion to the build. When
|
||||||
|
option CONFIG_SYSTEM_SYMTAB is selected and symbol table file
|
||||||
|
libc/symtab/canned_symtab.inc is prepared then application can
|
||||||
|
use system provided complete symbol table. The option has
|
||||||
|
substantial effect on system image size. Mainly code/text. If
|
||||||
|
loading of applications at runtime is not planned do not select
|
||||||
|
this. From Pavel Pisa (2015-08-23).
|
||||||
|
* apps/nettest: Add option to suppress network initialization. This
|
||||||
|
is necessary if the nettest is run from NSH which has already
|
||||||
|
initialized the network (2015-08-26).
|
||||||
|
* apps/nettest: Extend test so that can be performed using the local
|
||||||
|
loopback device (2015-08-26).
|
||||||
|
|
||||||
|
48
Kconfig
48
Kconfig
@ -1,48 +0,0 @@
|
|||||||
#
|
|
||||||
# For a description of the syntax of this configuration file,
|
|
||||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
|
||||||
#
|
|
||||||
|
|
||||||
menu "Built-In Applications"
|
|
||||||
source "$APPSDIR/builtin/Kconfig"
|
|
||||||
endmenu
|
|
||||||
|
|
||||||
menu "Examples"
|
|
||||||
source "$APPSDIR/examples/Kconfig"
|
|
||||||
endmenu
|
|
||||||
|
|
||||||
menu "Graphics Support"
|
|
||||||
source "$APPSDIR/graphics/Kconfig"
|
|
||||||
endmenu
|
|
||||||
|
|
||||||
menu "IEEE 802.15.4"
|
|
||||||
source "$APPSDIR/ieee802154/Kconfig"
|
|
||||||
endmenu
|
|
||||||
|
|
||||||
menu "Interpreters"
|
|
||||||
source "$APPSDIR/interpreters/Kconfig"
|
|
||||||
endmenu
|
|
||||||
|
|
||||||
menu "Network Utilities"
|
|
||||||
source "$APPSDIR/netutils/Kconfig"
|
|
||||||
endmenu
|
|
||||||
|
|
||||||
menu "FreeModBus"
|
|
||||||
source "$APPSDIR/modbus/Kconfig"
|
|
||||||
endmenu
|
|
||||||
|
|
||||||
menu "NSH Library"
|
|
||||||
source "$APPSDIR/nshlib/Kconfig"
|
|
||||||
endmenu
|
|
||||||
|
|
||||||
menu "NxWidgets/NxWM"
|
|
||||||
source "$APPSDIR/NxWidgets/Kconfig"
|
|
||||||
endmenu
|
|
||||||
|
|
||||||
menu "Platform-specific Support"
|
|
||||||
source "$APPSDIR/platform/Kconfig"
|
|
||||||
endmenu
|
|
||||||
|
|
||||||
menu "System Libraries and NSH Add-Ons"
|
|
||||||
source "$APPSDIR/system/Kconfig"
|
|
||||||
endmenu
|
|
110
Makefile
110
Makefile
@ -40,66 +40,33 @@ TOPDIR ?= $(APPDIR)/import
|
|||||||
|
|
||||||
-include $(TOPDIR)/Make.defs
|
-include $(TOPDIR)/Make.defs
|
||||||
|
|
||||||
|
# Tools
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||||
|
MKKCONFIG = ${shell $(APPDIR)\tools\mkkconfig.bat}
|
||||||
|
else
|
||||||
|
MKKCONFIG = ${shell $(APPDIR)/tools/mkkconfig.sh}
|
||||||
|
endif
|
||||||
|
|
||||||
# Application Directories
|
# Application Directories
|
||||||
|
|
||||||
# CONFIGURED_APPS is the list of all configured built-in directories/built
|
# BUILDIRS is the list of top-level directories containing Make.defs files
|
||||||
# action.
|
# CLEANDIRS is the list of all top-level directories containing Makefiles.
|
||||||
# SUBDIRS is the list of all directories containing Makefiles. It is used
|
# It is used only for cleaning.
|
||||||
# only for cleaning.
|
|
||||||
|
BUILDIRS := $(dir $(filter-out import/Make.defs,$(wildcard */Make.defs)))
|
||||||
|
CLEANDIRS := $(dir $(wildcard */Makefile))
|
||||||
|
|
||||||
|
# CONFIGURED_APPS is the application directories that should be built in
|
||||||
|
# the current configuration.
|
||||||
|
|
||||||
CONFIGURED_APPS =
|
CONFIGURED_APPS =
|
||||||
SUBDIRS = examples graphics interpreters modbus builtin import nshlib
|
|
||||||
SUBDIRS += netutils platform system
|
|
||||||
SUBDIRS += ieee802154
|
|
||||||
|
|
||||||
# The list of configured directories is derived from NuttX configuration
|
define Add_Application
|
||||||
# file: The selected applications are enabled settings in the configuration
|
include $(1)Make.defs
|
||||||
# file. For example,
|
|
||||||
#
|
|
||||||
# CONFIG_EXAMPLES_HELLO=y
|
|
||||||
#
|
|
||||||
# Will cause the "Hello, World!" example at apps/examples/hello to be
|
|
||||||
# built and added int libapps.a.
|
|
||||||
# out.
|
|
||||||
|
|
||||||
# builtin/Make.defs must be included first
|
|
||||||
|
|
||||||
include builtin/Make.defs
|
|
||||||
include examples/Make.defs
|
|
||||||
include graphics/Make.defs
|
|
||||||
include interpreters/Make.defs
|
|
||||||
include modbus/Make.defs
|
|
||||||
include netutils/Make.defs
|
|
||||||
include nshlib/Make.defs
|
|
||||||
include platform/Make.defs
|
|
||||||
include system/Make.defs
|
|
||||||
include ieee802154/Make.defs
|
|
||||||
-include external/Make.defs
|
|
||||||
|
|
||||||
# INSTALLED_APPS is the list of currently available application directories. It
|
|
||||||
# is the same as CONFIGURED_APPS, but filtered to exclude any non-existent
|
|
||||||
# application directory. builtin is always in the list of applications to be
|
|
||||||
# built.
|
|
||||||
|
|
||||||
INSTALLED_APPS =
|
|
||||||
|
|
||||||
# Create the list of available applications (INSTALLED_APPS)
|
|
||||||
|
|
||||||
define ADD_BUILTIN
|
|
||||||
INSTALLED_APPS += $(if $(wildcard $1$(DELIM)Makefile),$1,)
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(foreach BUILTIN, $(CONFIGURED_APPS), $(eval $(call ADD_BUILTIN,$(BUILTIN))))
|
$(foreach BDIR, $(BUILDIRS), $(eval $(call Add_Application,$(BDIR))))
|
||||||
|
|
||||||
# The external/ directory may also be added to the INSTALLED_APPS. But there
|
|
||||||
# is no external/ directory in the repository. Rather, this directory may be
|
|
||||||
# provided by the user (possibly as a symbolic link) to add libraries and
|
|
||||||
# applications to the standard build from the repository.
|
|
||||||
|
|
||||||
EXTERNAL_DIR := $(dir $(wildcard external$(DELIM)Makefile))
|
|
||||||
|
|
||||||
INSTALLED_APPS += $(EXTERNAL_DIR)
|
|
||||||
SUBDIRS += $(EXTERNAL_DIR)
|
|
||||||
|
|
||||||
# Library path
|
# Library path
|
||||||
|
|
||||||
@ -116,23 +83,23 @@ BIN = libapps$(LIBEXT)
|
|||||||
# Build targets
|
# Build targets
|
||||||
|
|
||||||
all: $(BIN)
|
all: $(BIN)
|
||||||
.PHONY: import install context context_serialize context_rest .depdirs depend clean distclean
|
.PHONY: import install context context_serialize context_rest .depdirs preconfig depend clean distclean
|
||||||
|
|
||||||
define SDIR_template
|
define SDIR_template
|
||||||
$(1)_$(2):
|
$(1)_$(2):
|
||||||
$(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" BIN_DIR="$(BIN_DIR)"
|
$(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" BIN_DIR="$(BIN_DIR)"
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(foreach SDIR, $(INSTALLED_APPS), $(eval $(call SDIR_template,$(SDIR),all)))
|
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),all)))
|
||||||
$(foreach SDIR, $(INSTALLED_APPS), $(eval $(call SDIR_template,$(SDIR),install)))
|
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),install)))
|
||||||
$(foreach SDIR, $(INSTALLED_APPS), $(eval $(call SDIR_template,$(SDIR),context)))
|
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),context)))
|
||||||
$(foreach SDIR, $(INSTALLED_APPS), $(eval $(call SDIR_template,$(SDIR),depend)))
|
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),depend)))
|
||||||
$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),clean)))
|
$(foreach SDIR, $(CLEANDIRS), $(eval $(call SDIR_template,$(SDIR),clean)))
|
||||||
$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),distclean)))
|
$(foreach SDIR, $(CLEANDIRS), $(eval $(call SDIR_template,$(SDIR),distclean)))
|
||||||
|
|
||||||
$(BIN): $(foreach SDIR, $(INSTALLED_APPS), $(SDIR)_all)
|
$(BIN): $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all)
|
||||||
|
|
||||||
.install: $(foreach SDIR, $(INSTALLED_APPS), $(SDIR)_install)
|
.install: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_install)
|
||||||
|
|
||||||
$(BIN_DIR):
|
$(BIN_DIR):
|
||||||
mkdir -p $(BIN_DIR)
|
mkdir -p $(BIN_DIR)
|
||||||
@ -144,7 +111,7 @@ install: $(BIN_DIR) .install
|
|||||||
import:
|
import:
|
||||||
$(Q) $(MAKE) .import TOPDIR="$(APPDIR)$(DELIM)import"
|
$(Q) $(MAKE) .import TOPDIR="$(APPDIR)$(DELIM)import"
|
||||||
|
|
||||||
context_rest: $(foreach SDIR, $(INSTALLED_APPS), $(SDIR)_context)
|
context_rest: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_context)
|
||||||
|
|
||||||
context_serialize:
|
context_serialize:
|
||||||
$(Q) $(MAKE) -C builtin context TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"
|
$(Q) $(MAKE) -C builtin context TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"
|
||||||
@ -152,19 +119,25 @@ context_serialize:
|
|||||||
|
|
||||||
context: context_serialize
|
context: context_serialize
|
||||||
|
|
||||||
.depdirs: $(foreach SDIR, $(INSTALLED_APPS), $(SDIR)_depend)
|
Kconfig: $(MKKCONFIG)
|
||||||
|
$(MKKCONFIG)
|
||||||
|
|
||||||
|
preconfig: Kconfig
|
||||||
|
|
||||||
|
.depdirs: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_depend)
|
||||||
|
|
||||||
.depend: context Makefile .depdirs
|
.depend: context Makefile .depdirs
|
||||||
$(Q) touch $@
|
$(Q) touch $@
|
||||||
|
|
||||||
depend: .depend
|
depend: .depend
|
||||||
|
|
||||||
clean: $(foreach SDIR, $(SUBDIRS), $(SDIR)_clean)
|
clean: $(foreach SDIR, $(CLEANDIRS), $(SDIR)_clean)
|
||||||
$(call DELFILE, $(BIN))
|
$(call DELFILE, $(BIN))
|
||||||
|
$(call DELFILE, Kconfig)
|
||||||
$(call DELDIR, $(BIN_DIR))
|
$(call DELDIR, $(BIN_DIR))
|
||||||
$(call CLEAN)
|
$(call CLEAN)
|
||||||
|
|
||||||
distclean: $(foreach SDIR, $(SUBDIRS), $(SDIR)_distclean)
|
distclean: $(foreach SDIR, $(CLEANDIRS), $(SDIR)_distclean)
|
||||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||||
$(Q) ( if exist external ( \
|
$(Q) ( if exist external ( \
|
||||||
echo ********************************************************" \
|
echo ********************************************************" \
|
||||||
@ -180,6 +153,7 @@ else
|
|||||||
)
|
)
|
||||||
endif
|
endif
|
||||||
$(call DELFILE, .depend)
|
$(call DELFILE, .depend)
|
||||||
|
$(call DELFILE, $(BIN))
|
||||||
|
$(call DELFILE, Kconfig)
|
||||||
$(call DELDIR, $(BIN_DIR))
|
$(call DELDIR, $(BIN_DIR))
|
||||||
|
$(call CLEAN)
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
menu "NxWidgets/NxWM"
|
||||||
|
|
||||||
config NXWIDGETS
|
config NXWIDGETS
|
||||||
bool "Enable NxWidgets"
|
bool "Enable NxWidgets"
|
||||||
default n
|
default n
|
||||||
@ -1281,3 +1283,4 @@ endif # NXWM_MEDIAPLAYER
|
|||||||
endmenu # NxWM Media Player Display Settings
|
endmenu # NxWM Media Player Display Settings
|
||||||
|
|
||||||
endif # NXWM
|
endif # NXWM
|
||||||
|
endmenu # NxWidgets/NxWM
|
||||||
|
60
README.txt
60
README.txt
@ -150,7 +150,7 @@ Building NuttX with Board-Specific Pieces Outside the Source Tree
|
|||||||
|
|
||||||
Q: Has anyone come up with a tidy way to build NuttX with board-
|
Q: Has anyone come up with a tidy way to build NuttX with board-
|
||||||
specific pieces outside the source tree?
|
specific pieces outside the source tree?
|
||||||
A: Here are four:
|
A: Here are three:
|
||||||
|
|
||||||
1) There is a make target called 'make export'. It will build
|
1) There is a make target called 'make export'. It will build
|
||||||
NuttX, then bundle all of the header files, libaries, startup
|
NuttX, then bundle all of the header files, libaries, startup
|
||||||
@ -176,15 +176,39 @@ A: Here are four:
|
|||||||
3) If you like the random collection of stuff in the apps/ directory
|
3) If you like the random collection of stuff in the apps/ directory
|
||||||
but just want to expand the existing components with your own,
|
but just want to expand the existing components with your own,
|
||||||
external sub-directory then there is an easy way to that too:
|
external sub-directory then there is an easy way to that too:
|
||||||
You just create the sympolic link at apps/external that
|
You just create a sympolic link in the apps/ directory that
|
||||||
redirects to your application sub-directory. The apps/Makefile
|
redirects to your application sub-directory.
|
||||||
will always automatically check for the existence of an
|
|
||||||
apps/external directory and if it exists, it will automatically
|
|
||||||
incorporate it into the build.
|
|
||||||
|
|
||||||
This feature of the apps/Makefile is documented only here.
|
In order to be incorporated into the build, the directory that
|
||||||
|
you link under the apps/ directory should contain (1) a Makefile
|
||||||
|
that supports the clean and distclean targets (see other Makefiles
|
||||||
|
for examples), and (2) a tiny Make.defs file that simply adds the
|
||||||
|
custon build directories to the variable CONFIGURED_APPS like:
|
||||||
|
|
||||||
You can, for example, create a script called install.sh that
|
CONFIGURED_APPS += my_directory1 my_directory2
|
||||||
|
|
||||||
|
The apps/Makefile will always automatically check for the
|
||||||
|
existence of subdirectories containing a Makefile and a Make.defs
|
||||||
|
file. The Makefile will be used only to support cleaning operations.
|
||||||
|
The Make.defs file provides the set of directories to be built; these
|
||||||
|
directories must also contain a Makefile. That Makefile must be able
|
||||||
|
to build the sources and add the objects to the apps/libapps.a archive.
|
||||||
|
(see other Makefiles for examples). It should support the all,
|
||||||
|
install, context, and depend targets.
|
||||||
|
|
||||||
|
apps/Makefile does not depend on any hardcoded lists of directories.
|
||||||
|
Instead, it does a wildcard search to find all appropriate
|
||||||
|
directories. This means that to install a new application, you
|
||||||
|
simply have to copy the directory (or link it) into the apps/
|
||||||
|
directory. If the new directory includes a Makefile and Make.defs
|
||||||
|
file, then it will automatically be included in the build.
|
||||||
|
|
||||||
|
If the directory that you add also includes a Kconfig file, then it
|
||||||
|
will automatically be included in the NuttX configuration system as
|
||||||
|
well. apps/Makefile uses a tool at apps/tools/mkkconfig.sh that
|
||||||
|
dynamically builds the apps/Kconfig file at pre-configuration time.
|
||||||
|
|
||||||
|
You could, for example, create a script called install.sh that
|
||||||
installs a custom application, configuration, and board specific
|
installs a custom application, configuration, and board specific
|
||||||
directory:
|
directory:
|
||||||
|
|
||||||
@ -194,20 +218,6 @@ A: Here are four:
|
|||||||
|
|
||||||
tools/configure.sh MyBoard/MyConfiguration
|
tools/configure.sh MyBoard/MyConfiguration
|
||||||
|
|
||||||
or simply by copying defconfig->nuttx/.config,
|
Use of the name ''apps/external'' is suggested because that name
|
||||||
setenv.sh->nuttx/setenv.sh, and Make.defs->nuttx/Make.defs.
|
is included in the .gitignore file and will save you some nuisance
|
||||||
|
when working with GIT.
|
||||||
Using the 'external' link makes it especially easy to add a
|
|
||||||
'built-in' application an existing configuration.
|
|
||||||
|
|
||||||
4) Add any link to apps/
|
|
||||||
|
|
||||||
a) Add symbolic links apps/ to as many other directories as you
|
|
||||||
want,
|
|
||||||
b) Add the symbolic link to the list of candidate paths in the
|
|
||||||
top level apps/Makefile, and
|
|
||||||
b) Add the (relative) paths to the CONFIGURED_APPS list
|
|
||||||
in the Make.defs file in your new directory.
|
|
||||||
|
|
||||||
That is basically the same as my option #3 but doesn't use the
|
|
||||||
magic 'external' link.
|
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
#
|
#
|
||||||
|
|
||||||
if BUILTIN
|
menu "Built-In Applications"
|
||||||
|
depends on BUILTIN
|
||||||
|
|
||||||
config BUILTIN_PROXY_STACKSIZE
|
config BUILTIN_PROXY_STACKSIZE
|
||||||
int "Builtin Proxy Stack Size"
|
int "Builtin Proxy Stack Size"
|
||||||
@ -14,4 +15,4 @@ config BUILTIN_PROXY_STACKSIZE
|
|||||||
configuration item specifies the stack size used for the proxy. Default:
|
configuration item specifies the stack size used for the proxy. Default:
|
||||||
1024 bytes.
|
1024 bytes.
|
||||||
|
|
||||||
endif
|
endmenu # Built-In Applications
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
menu "Examples"
|
||||||
|
|
||||||
source "$APPSDIR/examples/adc/Kconfig"
|
source "$APPSDIR/examples/adc/Kconfig"
|
||||||
source "$APPSDIR/examples/ajoystick/Kconfig"
|
source "$APPSDIR/examples/ajoystick/Kconfig"
|
||||||
source "$APPSDIR/examples/bastest/Kconfig"
|
source "$APPSDIR/examples/bastest/Kconfig"
|
||||||
@ -83,3 +85,5 @@ source "$APPSDIR/examples/watchdog/Kconfig"
|
|||||||
source "$APPSDIR/examples/wget/Kconfig"
|
source "$APPSDIR/examples/wget/Kconfig"
|
||||||
source "$APPSDIR/examples/wgetjson/Kconfig"
|
source "$APPSDIR/examples/wgetjson/Kconfig"
|
||||||
source "$APPSDIR/examples/xmlrpc/Kconfig"
|
source "$APPSDIR/examples/xmlrpc/Kconfig"
|
||||||
|
|
||||||
|
endmenu # Examples
|
||||||
|
@ -47,7 +47,7 @@ config EXAMPLES_BRIDGE_NET1_DHCPC
|
|||||||
bool "DHCP Client"
|
bool "DHCP Client"
|
||||||
default n
|
default n
|
||||||
select NETUTILS_DHCPC
|
select NETUTILS_DHCPC
|
||||||
select NETUTILS_DNSCLIENT
|
select NETDB_DNSCLIENT
|
||||||
|
|
||||||
config EXAMPLES_BRIDGE_NET1_NOMAC
|
config EXAMPLES_BRIDGE_NET1_NOMAC
|
||||||
bool "Use Canned MAC Address"
|
bool "Use Canned MAC Address"
|
||||||
@ -129,7 +129,7 @@ config EXAMPLES_BRIDGE_NET2_DHCPC
|
|||||||
bool "DHCP Client"
|
bool "DHCP Client"
|
||||||
default n
|
default n
|
||||||
select NETUTILS_DHCPC
|
select NETUTILS_DHCPC
|
||||||
select NETUTILS_DNSCLIENT
|
select NETDB_DNSCLIENT
|
||||||
|
|
||||||
config EXAMPLES_BRIDGE_NET2_NOMAC
|
config EXAMPLES_BRIDGE_NET2_NOMAC
|
||||||
bool "Use Canned MAC Address"
|
bool "Use Canned MAC Address"
|
||||||
|
@ -6,9 +6,18 @@
|
|||||||
config EXAMPLES_CAN
|
config EXAMPLES_CAN
|
||||||
bool "CAN example"
|
bool "CAN example"
|
||||||
default n
|
default n
|
||||||
|
depends on CAN && LIB_BOARDCTL
|
||||||
|
select BOARDCTL_CANINIT
|
||||||
---help---
|
---help---
|
||||||
Enable the CAN example
|
Enable the CAN example
|
||||||
|
|
||||||
if EXAMPLES_CAN
|
if EXAMPLES_CAN
|
||||||
|
|
||||||
|
config EXAMPLES_CAN_NMSGS
|
||||||
|
int "Number of Messages"
|
||||||
|
default 32
|
||||||
|
---help---
|
||||||
|
The number of CAN messages to send before returning
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -97,15 +97,4 @@
|
|||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: can_devinit()
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Perform architecuture-specific initialization of the CAN hardware. This
|
|
||||||
* interface must be provided by all configurations using apps/examples/can
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
int can_devinit(void);
|
|
||||||
|
|
||||||
#endif /* __APPS_EXAMPLES_CAN_CAN_H */
|
#endif /* __APPS_EXAMPLES_CAN_CAN_H */
|
||||||
|
@ -40,6 +40,8 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/boardctl.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -70,10 +72,17 @@
|
|||||||
# define CAN_OFLAGS O_RDWR
|
# define CAN_OFLAGS O_RDWR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_EXAMPLES_CAN_NMSGS
|
||||||
|
# define CONFIG_EXAMPLES_CAN_NMSGS 32
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MAX_EXTID (1 << 29)
|
||||||
|
#define MAX_STDID (1 << 11)
|
||||||
|
|
||||||
#ifdef CONFIG_CAN_EXTID
|
#ifdef CONFIG_CAN_EXTID
|
||||||
# define MAX_ID (1 << 29)
|
# define MAX_ID MAX_EXTID
|
||||||
#else
|
#else
|
||||||
# define MAX_ID (1 << 11)
|
# define MAX_ID MAX_STDID
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -96,6 +105,27 @@
|
|||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
static void show_usage(FAR const char *progname)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_CAN_EXTID
|
||||||
|
fprintf(stderr, "USAGE: %s [-s] [-n <nmsgs] [-a <min-id>] [b <max-id>]\n",
|
||||||
|
progname);
|
||||||
|
#else
|
||||||
|
fprintf(stderr, "USAGE: %s [-n <nmsgs] [-a <min-id>] [b <max-id>]\n",
|
||||||
|
progname);
|
||||||
|
#endif
|
||||||
|
fprintf(stderr, "USAGE: %s -h\n",
|
||||||
|
progname);
|
||||||
|
fprintf(stderr, "\nWhere:\n");
|
||||||
|
#ifdef CONFIG_CAN_EXTID
|
||||||
|
fprintf(stderr, "-s: Use standard IDs. Default: Extended ID\n");
|
||||||
|
#endif
|
||||||
|
fprintf(stderr, "-n <nmsgs>: The number of messages to send. Default: 32\n");
|
||||||
|
fprintf(stderr, "-a <min-id>: The start message id. Default 1\n");
|
||||||
|
fprintf(stderr, "-b <max-id>: The start message id. Default %d\n", MAX_ID - 1);
|
||||||
|
fprintf(stderr, "-h: Show this message and exit\n");
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -110,13 +140,17 @@ int main(int argc, FAR char *argv[])
|
|||||||
int can_main(int argc, char *argv[])
|
int can_main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
struct canioc_bittiming_s bt;
|
||||||
#ifndef CONFIG_EXAMPLES_CAN_READONLY
|
#ifndef CONFIG_EXAMPLES_CAN_READONLY
|
||||||
struct can_msg_s txmsg;
|
struct can_msg_s txmsg;
|
||||||
#ifdef CONFIG_CAN_EXTID
|
#ifdef CONFIG_CAN_EXTID
|
||||||
|
bool extended;
|
||||||
uint32_t msgid;
|
uint32_t msgid;
|
||||||
#else
|
#else
|
||||||
uint16_t msgid;
|
uint16_t msgid;
|
||||||
#endif
|
#endif
|
||||||
|
long minid;
|
||||||
|
long maxid;
|
||||||
int msgdlc;
|
int msgdlc;
|
||||||
uint8_t msgdata;
|
uint8_t msgdata;
|
||||||
#endif
|
#endif
|
||||||
@ -127,73 +161,170 @@ int can_main(int argc, char *argv[])
|
|||||||
|
|
||||||
size_t msgsize;
|
size_t msgsize;
|
||||||
ssize_t nbytes;
|
ssize_t nbytes;
|
||||||
#if defined(CONFIG_NSH_BUILTIN_APPS) || defined(CONFIG_EXAMPLES_CAN_NMSGS)
|
bool badarg;
|
||||||
|
bool help;
|
||||||
long nmsgs;
|
long nmsgs;
|
||||||
#endif
|
int option;
|
||||||
|
|
||||||
int fd;
|
int fd;
|
||||||
int errval = 0;
|
int errval = 0;
|
||||||
|
int msgno;
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* If this example is configured as an NX add-on, then limit the number of
|
/* Parse command line parameters */
|
||||||
* samples that we collect before returning. Otherwise, we never return
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(CONFIG_NSH_BUILTIN_APPS)
|
|
||||||
nmsgs = CONFIG_EXAMPLES_CAN_NMSGS;
|
nmsgs = CONFIG_EXAMPLES_CAN_NMSGS;
|
||||||
if (argc > 1)
|
minid = 1;
|
||||||
|
maxid = MAX_ID - 1;
|
||||||
|
badarg = false;
|
||||||
|
#ifdef CONFIG_CAN_EXTID
|
||||||
|
extended = true;
|
||||||
|
#endif
|
||||||
|
badarg = false;
|
||||||
|
help = false;
|
||||||
|
|
||||||
|
#ifdef CONFIG_CAN_EXTID
|
||||||
|
while ((option = getopt(argc, argv, ":n:a:b:hs")) != ERROR)
|
||||||
|
#else
|
||||||
|
while ((option = getopt(argc, argv, ":n:a:b:h")) != ERROR)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
nmsgs = strtol(argv[1], NULL, 10);
|
switch (option)
|
||||||
|
{
|
||||||
|
case 'a':
|
||||||
|
minid = strtol(optarg, NULL, 10);
|
||||||
|
if (minid < 1 || minid > maxid)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "<min-id> out of range\n");
|
||||||
|
badarg = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'b':
|
||||||
|
maxid = strtol(optarg, NULL, 10);
|
||||||
|
if (maxid < minid || maxid >= MAX_ID)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ERROR: <max-id> out of range\n");
|
||||||
|
badarg = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'h':
|
||||||
|
help = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#ifdef CONFIG_CAN_EXTID
|
||||||
|
case 's':
|
||||||
|
extended = false;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
case 'n':
|
||||||
|
nmsgs = strtol(optarg, NULL, 10);
|
||||||
|
if (nmsgs < 1)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ERROR: <nmsgs> out of range\n");
|
||||||
|
badarg = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ':':
|
||||||
|
fprintf(stderr, "ERROR: Bad option argument\n");
|
||||||
|
badarg = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '?':
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "ERROR: Unrecognized option\n");
|
||||||
|
badarg = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("can_main: nmsgs: %ld\n", nmsgs);
|
if (badarg)
|
||||||
#elif defined(CONFIG_EXAMPLES_CAN_NMSGS)
|
{
|
||||||
printf("can_main: nmsgs: %d\n", CONFIG_EXAMPLES_CAN_NMSGS);
|
show_usage(argv[0]);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (help)
|
||||||
|
{
|
||||||
|
show_usage(argv[0]);
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_CAN_EXTID
|
||||||
|
if (!extended && maxid >= MAX_STDID)
|
||||||
|
{
|
||||||
|
maxid = MAX_STDID - 1;
|
||||||
|
if (minid > maxid)
|
||||||
|
{
|
||||||
|
minid = maxid;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (optind != argc)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ERROR: Garbage on command line\n");
|
||||||
|
show_usage(argv[0]);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("nmsgs: %d min ID: %d max ID: %d\n", nmsgs, minid, maxid);
|
||||||
|
|
||||||
/* Initialization of the CAN hardware is performed by logic external to
|
/* Initialization of the CAN hardware is performed by logic external to
|
||||||
* this test.
|
* this test.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
printf("can_main: Initializing external CAN device\n");
|
ret = boardctl(BOARDIOC_CAN_INITIALIZE, 0);
|
||||||
ret = can_devinit();
|
|
||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
printf("can_main: can_devinit failed: %d\n", ret);
|
printf("ERROR: BOARDIOC_CAN_INITIALIZE failed: %d\n", ret);
|
||||||
errval = 1;
|
errval = 1;
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open the CAN device for reading */
|
/* Open the CAN device for reading */
|
||||||
|
|
||||||
printf("can_main: Hardware initialized. Opening the CAN device\n");
|
|
||||||
fd = open(CONFIG_EXAMPLES_CAN_DEVPATH, CAN_OFLAGS);
|
fd = open(CONFIG_EXAMPLES_CAN_DEVPATH, CAN_OFLAGS);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
printf("can_main: open %s failed: %d\n",
|
printf("ERROR: open %s failed: %d\n",
|
||||||
CONFIG_EXAMPLES_CAN_DEVPATH, errno);
|
CONFIG_EXAMPLES_CAN_DEVPATH, errno);
|
||||||
errval = 2;
|
errval = 2;
|
||||||
goto errout_with_dev;
|
goto errout_with_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Show bit timing information .. if provided by the driver. Not all CAN
|
||||||
|
* drivers will support this IOCTL.
|
||||||
|
*/
|
||||||
|
|
||||||
|
ret = ioctl(fd, CANIOC_GET_BITTIMING, (unsigned long)((uintptr_t)&bt));
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
printf("Bit timing not available: %d\n", errno);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("Bit timing:\n");
|
||||||
|
printf(" Baud: %lu\n", (unsigned long)bt.bt_baud);
|
||||||
|
printf(" TSEG1: %u\n", bt.bt_tseg1);
|
||||||
|
printf(" TSEG2: %u\n", bt.bt_tseg2);
|
||||||
|
printf(" SJW: %u\n", bt.bt_sjw);
|
||||||
|
}
|
||||||
|
|
||||||
/* Now loop the appropriate number of times, performing one loopback test
|
/* Now loop the appropriate number of times, performing one loopback test
|
||||||
* on each pass.
|
* on each pass.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CONFIG_EXAMPLES_CAN_READONLY
|
#ifndef CONFIG_EXAMPLES_CAN_READONLY
|
||||||
msgdlc = 1;
|
msgdlc = 1;
|
||||||
msgid = 1;
|
msgid = minid;
|
||||||
msgdata = 0;
|
msgdata = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_NSH_BUILTIN_APPS)
|
for (msgno = 0; msgno < nmsgs; msgno++)
|
||||||
for (; nmsgs > 0; nmsgs--)
|
|
||||||
#elif defined(CONFIG_EXAMPLES_CAN_NMSGS)
|
|
||||||
for (nmsgs = 0; nmsgs < CONFIG_EXAMPLES_CAN_NMSGS; nmsgs++)
|
|
||||||
#else
|
|
||||||
for (;;)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
/* Flush any output before the loop entered or from the previous pass
|
/* Flush any output before the loop entered or from the previous pass
|
||||||
* through the loop.
|
* through the loop.
|
||||||
@ -207,9 +338,11 @@ int can_main(int argc, char *argv[])
|
|||||||
txmsg.cm_hdr.ch_id = msgid;
|
txmsg.cm_hdr.ch_id = msgid;
|
||||||
txmsg.cm_hdr.ch_rtr = false;
|
txmsg.cm_hdr.ch_rtr = false;
|
||||||
txmsg.cm_hdr.ch_dlc = msgdlc;
|
txmsg.cm_hdr.ch_dlc = msgdlc;
|
||||||
|
txmsg.cm_hdr.ch_error = 0;
|
||||||
#ifdef CONFIG_CAN_EXTID
|
#ifdef CONFIG_CAN_EXTID
|
||||||
txmsg.cm_hdr.ch_extid = true;
|
txmsg.cm_hdr.ch_extid = extended;
|
||||||
#endif
|
#endif
|
||||||
|
txmsg.cm_hdr.ch_unused = 0;
|
||||||
|
|
||||||
for (i = 0; i < msgdlc; i++)
|
for (i = 0; i < msgdlc; i++)
|
||||||
{
|
{
|
||||||
@ -222,7 +355,8 @@ int can_main(int argc, char *argv[])
|
|||||||
nbytes = write(fd, &txmsg, msgsize);
|
nbytes = write(fd, &txmsg, msgsize);
|
||||||
if (nbytes != msgsize)
|
if (nbytes != msgsize)
|
||||||
{
|
{
|
||||||
printf("ERROR: write(%ld) returned %ld\n", (long)msgsize, (long)nbytes);
|
printf("ERROR: write(%ld) returned %ld\n",
|
||||||
|
(long)msgsize, (long)nbytes);
|
||||||
errval = 3;
|
errval = 3;
|
||||||
goto errout_with_dev;
|
goto errout_with_dev;
|
||||||
}
|
}
|
||||||
@ -239,16 +373,81 @@ int can_main(int argc, char *argv[])
|
|||||||
nbytes = read(fd, &rxmsg, msgsize);
|
nbytes = read(fd, &rxmsg, msgsize);
|
||||||
if (nbytes < CAN_MSGLEN(0) || nbytes > msgsize)
|
if (nbytes < CAN_MSGLEN(0) || nbytes > msgsize)
|
||||||
{
|
{
|
||||||
printf("ERROR: read(%ld) returned %ld\n", (long)msgsize, (long)nbytes);
|
printf("ERROR: read(%ld) returned %ld\n",
|
||||||
|
(long)msgsize, (long)nbytes);
|
||||||
errval = 4;
|
errval = 4;
|
||||||
goto errout_with_dev;
|
goto errout_with_dev;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_EXAMPLES_CAN_READONLY
|
#ifndef CONFIG_EXAMPLES_CAN_READONLY
|
||||||
printf(" ID: %4u DLC: %u\n", rxmsg.cm_hdr.ch_id, rxmsg.cm_hdr.ch_dlc);
|
printf(" ID: %4u DLC: %u\n",
|
||||||
|
rxmsg.cm_hdr.ch_id, rxmsg.cm_hdr.ch_dlc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Check for error reports */
|
||||||
|
|
||||||
|
#ifndef CONFIG_EXAMPLES_CAN_WRITEONLY
|
||||||
|
if (rxmsg.cm_hdr.ch_error != 0)
|
||||||
|
{
|
||||||
|
printf("ERROR: CAN error report: [%04x]\n", rxmsg.cm_hdr.ch_id);
|
||||||
|
if ((rxmsg.cm_hdr.ch_id & CAN_ERROR_SYSTEM) != 0)
|
||||||
|
{
|
||||||
|
printf(" Driver internal error\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((rxmsg.cm_hdr.ch_id & CAN_ERROR_RXLOST) != 0)
|
||||||
|
{
|
||||||
|
printf(" RX Message Lost\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((rxmsg.cm_hdr.ch_id & CAN_ERROR_TXLOST) != 0)
|
||||||
|
{
|
||||||
|
printf(" TX Message Lost\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((rxmsg.cm_hdr.ch_id & CAN_ERROR_ACCESS) != 0)
|
||||||
|
{
|
||||||
|
printf(" RAM Access Failure\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((rxmsg.cm_hdr.ch_id & CAN_ERROR_TIMEOUT) != 0)
|
||||||
|
{
|
||||||
|
printf(" Timeout Occurred\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((rxmsg.cm_hdr.ch_id & CAN_ERROR_PASSIVE) != 0)
|
||||||
|
{
|
||||||
|
printf(" Error Passive\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((rxmsg.cm_hdr.ch_id & CAN_ERROR_CRC) != 0)
|
||||||
|
{
|
||||||
|
printf(" RX CRC Error\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((rxmsg.cm_hdr.ch_id & CAN_ERROR_BIT) != 0)
|
||||||
|
{
|
||||||
|
printf(" Bit Error\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((rxmsg.cm_hdr.ch_id & CAN_ERROR_ACK) != 0)
|
||||||
|
{
|
||||||
|
printf(" Acknowledge Error\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((rxmsg.cm_hdr.ch_id & CAN_ERROR_FORMAT) != 0)
|
||||||
|
{
|
||||||
|
printf(" Format Error\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((rxmsg.cm_hdr.ch_id & CAN_ERROR_STUFF) != 0)
|
||||||
|
{
|
||||||
|
printf(" Stuff Error\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/* Verify that the received messages are the same */
|
/* Verify that the received messages are the same */
|
||||||
|
|
||||||
#ifdef CONFIG_EXAMPLES_CAN_READWRITE
|
#ifdef CONFIG_EXAMPLES_CAN_READWRITE
|
||||||
@ -268,11 +467,14 @@ int can_main(int argc, char *argv[])
|
|||||||
printf("ERROR: Data does not match. DLC=%d\n", msgdlc);
|
printf("ERROR: Data does not match. DLC=%d\n", msgdlc);
|
||||||
for (i = 0; i < msgdlc; i++)
|
for (i = 0; i < msgdlc; i++)
|
||||||
{
|
{
|
||||||
printf(" %d: TX %02x RX %02x\n", i, txmsg.cm_data[i], rxmsg.cm_data[i]);
|
printf(" %d: TX %02x RX %02x\n",
|
||||||
|
i, txmsg.cm_data[i], rxmsg.cm_data[i]);
|
||||||
errval = 5;
|
errval = 5;
|
||||||
goto errout_with_dev;
|
goto errout_with_dev;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Report success */
|
/* Report success */
|
||||||
|
|
||||||
@ -284,9 +486,9 @@ int can_main(int argc, char *argv[])
|
|||||||
#ifndef CONFIG_EXAMPLES_CAN_READONLY
|
#ifndef CONFIG_EXAMPLES_CAN_READONLY
|
||||||
msgdata += msgdlc;
|
msgdata += msgdlc;
|
||||||
|
|
||||||
if (++msgid >= MAX_ID)
|
if (++msgid > maxid)
|
||||||
{
|
{
|
||||||
msgid = 1;
|
msgid = minid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++msgdlc > CAN_MAXDATALEN)
|
if (++msgdlc > CAN_MAXDATALEN)
|
||||||
|
@ -22,7 +22,7 @@ config EXAMPLES_DISCOVER_DHCPC
|
|||||||
default n
|
default n
|
||||||
depends on EXAMPLES_DISCOVER && !NSH_BUILTIN_APPS
|
depends on EXAMPLES_DISCOVER && !NSH_BUILTIN_APPS
|
||||||
select NETUTILS_DHCPC
|
select NETUTILS_DHCPC
|
||||||
select NETUTILS_DNSCLIENT
|
select NETDB_DNSCLIENT
|
||||||
|
|
||||||
config EXAMPLES_DISCOVER_NOMAC
|
config EXAMPLES_DISCOVER_NOMAC
|
||||||
bool "Use Canned MAC Address"
|
bool "Use Canned MAC Address"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* examples/elf/tests/signal/signal.c
|
* examples/elf/tests/signal/signal.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2012, 2015 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
|
||||||
@ -100,6 +100,7 @@ void siguser_action(int signo, siginfo_t *siginfo, void *arg)
|
|||||||
printf("siginfo:\n");
|
printf("siginfo:\n");
|
||||||
printf(" si_signo = %d\n", siginfo->si_signo);
|
printf(" si_signo = %d\n", siginfo->si_signo);
|
||||||
printf(" si_code = %d\n", siginfo->si_code);
|
printf(" si_code = %d\n", siginfo->si_code);
|
||||||
|
printf(" si_errno = %d\n", siginfo->si_errno);
|
||||||
printf(" si_value = %d\n", siginfo->si_value.sival_int);
|
printf(" si_value = %d\n", siginfo->si_value.sival_int);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,30 @@ config EXAMPLES_NETTEST
|
|||||||
|
|
||||||
if EXAMPLES_NETTEST
|
if EXAMPLES_NETTEST
|
||||||
|
|
||||||
|
config EXAMPLES_NETTEST_LOOPBACK
|
||||||
|
bool "Loopback test"
|
||||||
|
default n
|
||||||
|
depends on NET_LOOPBACK
|
||||||
|
---help---
|
||||||
|
Perform the test using the local loopback device. In this case,
|
||||||
|
both the client and the server reside on the target.
|
||||||
|
|
||||||
|
if EXAMPLES_NETTEST_LOOPBACK
|
||||||
|
|
||||||
|
config EXAMPLES_NETTEST_STACKSIZE
|
||||||
|
int "Server stack size"
|
||||||
|
default 2048
|
||||||
|
|
||||||
|
config EXAMPLES_NETTEST_PRIORITY
|
||||||
|
int "Server priority"
|
||||||
|
default 100
|
||||||
|
|
||||||
|
endif # EXAMPLES_NETTEST_LOOPBACK
|
||||||
|
|
||||||
config EXAMPLES_NETTEST_SERVER
|
config EXAMPLES_NETTEST_SERVER
|
||||||
bool "Target is server"
|
bool "Target is server"
|
||||||
default n
|
default n
|
||||||
|
depends on !EXAMPLES_NETTEST_LOOPBACK
|
||||||
---help---
|
---help---
|
||||||
Select to use the host as the client side of the test. Default: The
|
Select to use the host as the client side of the test. Default: The
|
||||||
target is the client side of the test
|
target is the client side of the test
|
||||||
@ -26,10 +47,6 @@ config EXAMPLES_NETTEST_PERFORMANCE
|
|||||||
Configure the example to test for network performance. Default: Test
|
Configure the example to test for network performance. Default: Test
|
||||||
is for network functionality.
|
is for network functionality.
|
||||||
|
|
||||||
config EXAMPLES_NETTEST_NOMAC
|
|
||||||
bool "Use Canned MAC Address"
|
|
||||||
default n
|
|
||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "IP Domain"
|
prompt "IP Domain"
|
||||||
default EXAMPLES_NETTEST_IPv4 if NET_IPv4
|
default EXAMPLES_NETTEST_IPv4 if NET_IPv4
|
||||||
@ -45,10 +62,28 @@ config EXAMPLES_NETTEST_IPv6
|
|||||||
|
|
||||||
endchoice # IP Domain
|
endchoice # IP Domain
|
||||||
|
|
||||||
|
config EXAMPLES_NETTEST_INIT
|
||||||
|
bool "Initialize network"
|
||||||
|
default n if NSH_BUILTIN_APPS
|
||||||
|
default y if !NSH_BUILTIN_APPS
|
||||||
|
depends on !BUILD_KERNEL && !EXAMPLES_NETTEST_LOOPBACK
|
||||||
|
---help---
|
||||||
|
Include logic to initialize the network. This should not be done if
|
||||||
|
the network is already initialized when nettest runs. This is
|
||||||
|
usually the case, for example, when nettest is run as an NSH built-
|
||||||
|
in task.
|
||||||
|
|
||||||
|
config EXAMPLES_NETTEST_NOMAC
|
||||||
|
bool "Use Canned MAC Address"
|
||||||
|
default n
|
||||||
|
depends on EXAMPLES_NETTEST_INIT
|
||||||
|
|
||||||
if EXAMPLES_NETTEST_IPv4
|
if EXAMPLES_NETTEST_IPv4
|
||||||
|
|
||||||
comment "IPv4 addresses"
|
comment "IPv4 addresses"
|
||||||
|
|
||||||
|
if EXAMPLES_NETTEST_INIT
|
||||||
|
|
||||||
config EXAMPLES_NETTEST_IPADDR
|
config EXAMPLES_NETTEST_IPADDR
|
||||||
hex "Target IP address"
|
hex "Target IP address"
|
||||||
default 0x0a000002
|
default 0x0a000002
|
||||||
@ -61,6 +96,10 @@ config EXAMPLES_NETTEST_NETMASK
|
|||||||
hex "Network Mask"
|
hex "Network Mask"
|
||||||
default 0xffffff00
|
default 0xffffff00
|
||||||
|
|
||||||
|
endif # EXAMPLES_NETTEST_INIT
|
||||||
|
|
||||||
|
if !EXAMPLES_NETTEST_LOOPBACK
|
||||||
|
|
||||||
config EXAMPLES_NETTEST_CLIENTIP
|
config EXAMPLES_NETTEST_CLIENTIP
|
||||||
hex "Client IP Address"
|
hex "Client IP Address"
|
||||||
default 0x0a000001 if !EXAMPLES_NETTEST_SERVER
|
default 0x0a000001 if !EXAMPLES_NETTEST_SERVER
|
||||||
@ -73,6 +112,7 @@ config EXAMPLES_NETTEST_CLIENTIP
|
|||||||
host PC IP address (possibly the gateway address,
|
host PC IP address (possibly the gateway address,
|
||||||
EXAMPLES_NETTEST_DRIPADDR?).
|
EXAMPLES_NETTEST_DRIPADDR?).
|
||||||
|
|
||||||
|
endif # !EXAMPLES_NETTEST_LOOPBACK
|
||||||
endif # EXAMPLES_NETTEST_IPv4
|
endif # EXAMPLES_NETTEST_IPv4
|
||||||
|
|
||||||
if EXAMPLES_NETTEST_IPv6
|
if EXAMPLES_NETTEST_IPv6
|
||||||
@ -80,6 +120,8 @@ if !NET_ICMPv6_AUTOCONF
|
|||||||
|
|
||||||
comment "Target IPv6 address"
|
comment "Target IPv6 address"
|
||||||
|
|
||||||
|
if EXAMPLES_NETTEST_INIT
|
||||||
|
|
||||||
config EXAMPLES_NETTEST_IPv6ADDR_1
|
config EXAMPLES_NETTEST_IPv6ADDR_1
|
||||||
hex "[0]"
|
hex "[0]"
|
||||||
default 0xfc00
|
default 0xfc00
|
||||||
@ -325,6 +367,9 @@ config EXAMPLES_NETTEST_IPv6NETMASK_8
|
|||||||
all eight values is fe00::0.
|
all eight values is fe00::0.
|
||||||
|
|
||||||
endif # NET_ICMPv6_AUTOCONF
|
endif # NET_ICMPv6_AUTOCONF
|
||||||
|
endif # EXAMPLES_NETTEST_INIT
|
||||||
|
|
||||||
|
if !EXAMPLES_NETTEST_LOOPBACK
|
||||||
|
|
||||||
comment "Client IPv6 address"
|
comment "Client IPv6 address"
|
||||||
|
|
||||||
@ -457,5 +502,6 @@ config EXAMPLES_NETTEST_CLIENTIPv6ADDR_8
|
|||||||
values forming the full IP address must be specified individually.
|
values forming the full IP address must be specified individually.
|
||||||
This is the last of the 8-values.
|
This is the last of the 8-values.
|
||||||
|
|
||||||
|
endif # !EXAMPLES_NETTEST_LOOPBACK
|
||||||
endif # EXAMPLES_NETTEST_IPv6
|
endif # EXAMPLES_NETTEST_IPv6
|
||||||
endif # EXAMPLES_NETTEST
|
endif # EXAMPLES_NETTEST
|
||||||
|
@ -43,7 +43,9 @@ TARG_ASRCS =
|
|||||||
TARG_AOBJS = $(TARG_ASRCS:.S=$(OBJEXT))
|
TARG_AOBJS = $(TARG_ASRCS:.S=$(OBJEXT))
|
||||||
|
|
||||||
TARG_CSRCS =
|
TARG_CSRCS =
|
||||||
ifeq ($(CONFIG_EXAMPLES_NETTEST_SERVER),y)
|
ifeq ($(CONFIG_EXAMPLES_NETTEST_LOOPBACK),y)
|
||||||
|
TARG_CSRCS += nettest_server.c nettest_client.c
|
||||||
|
else ifeq ($(CONFIG_EXAMPLES_NETTEST_SERVER),y)
|
||||||
TARG_CSRCS += nettest_server.c
|
TARG_CSRCS += nettest_server.c
|
||||||
else
|
else
|
||||||
TARG_CSRCS += nettest_client.c
|
TARG_CSRCS += nettest_client.c
|
||||||
@ -70,6 +72,7 @@ else
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq ($(CONFIG_EXAMPLES_NETTEST_LOOPBACK),y)
|
||||||
HOSTCFLAGS += -DNETTEST_HOST=1
|
HOSTCFLAGS += -DNETTEST_HOST=1
|
||||||
ifeq ($(CONFIG_EXAMPLES_NETTEST_SERVER),y)
|
ifeq ($(CONFIG_EXAMPLES_NETTEST_SERVER),y)
|
||||||
HOSTCFLAGS += -DCONFIG_EXAMPLES_NETTEST_SERVER=1 -DCONFIG_EXAMPLES_NETTEST_CLIENTIP="$(CONFIG_EXAMPLES_NETTEST_CLIENTIP)"
|
HOSTCFLAGS += -DCONFIG_EXAMPLES_NETTEST_SERVER=1 -DCONFIG_EXAMPLES_NETTEST_CLIENTIP="$(CONFIG_EXAMPLES_NETTEST_CLIENTIP)"
|
||||||
@ -88,6 +91,7 @@ endif
|
|||||||
HOSTOBJEXT ?= .hobj
|
HOSTOBJEXT ?= .hobj
|
||||||
HOST_OBJS = $(HOST_SRCS:.c=$(HOSTOBJEXT))
|
HOST_OBJS = $(HOST_SRCS:.c=$(HOSTOBJEXT))
|
||||||
HOST_BIN = host
|
HOST_BIN = host
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(WINTOOL),y)
|
ifeq ($(WINTOOL),y)
|
||||||
INSTALL_DIR = "${shell cygpath -w $(BIN_DIR)}"
|
INSTALL_DIR = "${shell cygpath -w $(BIN_DIR)}"
|
||||||
@ -119,17 +123,21 @@ $(TARG_AOBJS): %$(OBJEXT): %.S
|
|||||||
$(TARG_COBJS) $(TARG_MAINOBJ): %$(OBJEXT): %.c
|
$(TARG_COBJS) $(TARG_MAINOBJ): %$(OBJEXT): %.c
|
||||||
$(call COMPILE, $<, $@)
|
$(call COMPILE, $<, $@)
|
||||||
|
|
||||||
|
ifneq ($(CONFIG_EXAMPLES_NETTEST_LOOPBACK),y)
|
||||||
$(HOST_OBJS): %$(HOSTOBJEXT): %.c
|
$(HOST_OBJS): %$(HOSTOBJEXT): %.c
|
||||||
@echo "CC: $<"
|
@echo "CC: $<"
|
||||||
$(Q) $(HOSTCC) -c $(HOSTCFLAGS) $< -o $@
|
$(Q) $(HOSTCC) -c $(HOSTCFLAGS) $< -o $@
|
||||||
|
endif
|
||||||
|
|
||||||
config.h: $(TOPDIR)/include/nuttx/config.h
|
config.h: $(TOPDIR)/include/nuttx/config.h
|
||||||
@echo "CP: $<"
|
@echo "CP: $<"
|
||||||
$(Q) cp $< $@
|
$(Q) cp $< $@
|
||||||
|
|
||||||
|
ifneq ($(CONFIG_EXAMPLES_NETTEST_LOOPBACK),y)
|
||||||
$(HOST_BIN): config.h $(HOST_OBJS)
|
$(HOST_BIN): config.h $(HOST_OBJS)
|
||||||
@echo "LD: $@"
|
@echo "LD: $@"
|
||||||
$(Q) $(HOSTCC) $(HOSTLDFLAGS) $(HOST_OBJS) -o $@
|
$(Q) $(HOSTCC) $(HOSTLDFLAGS) $(HOST_OBJS) -o $@
|
||||||
|
endif
|
||||||
|
|
||||||
.built: config.h $(TARG_OBJS)
|
.built: config.h $(TARG_OBJS)
|
||||||
$(call ARCHIVE, $(TARG_BIN), $(TARG_OBJS))
|
$(call ARCHIVE, $(TARG_BIN), $(TARG_OBJS))
|
||||||
@ -164,8 +172,10 @@ endif
|
|||||||
depend: .depend
|
depend: .depend
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
ifneq ($(CONFIG_EXAMPLES_NETTEST_LOOPBACK),y)
|
||||||
$(call DELFILE, *$(HOSTOBJEXT))
|
$(call DELFILE, *$(HOSTOBJEXT))
|
||||||
$(call DELFILE, $(HOST_BIN))
|
$(call DELFILE, $(HOST_BIN))
|
||||||
|
endif
|
||||||
$(call DELFILE, .built)
|
$(call DELFILE, .built)
|
||||||
$(call DELFILE, *.dSYM)
|
$(call DELFILE, *.dSYM)
|
||||||
$(call DELFILE, config.h)
|
$(call DELFILE, config.h)
|
||||||
|
@ -40,8 +40,12 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
//#include <nuttx/config.h>
|
//#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <sys/wait.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sched.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
@ -60,7 +64,9 @@
|
|||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_EXAMPLES_NETTEST_IPv6) && !defined(CONFIG_NET_ICMPv6_AUTOCONF)
|
#if defined(CONFIG_EXAMPLES_NETTEST_INIT) && \
|
||||||
|
defined(CONFIG_EXAMPLES_NETTEST_IPv6) && \
|
||||||
|
!defined(CONFIG_NET_ICMPv6_AUTOCONF)
|
||||||
/* Our host IPv6 address */
|
/* Our host IPv6 address */
|
||||||
|
|
||||||
static const uint16_t g_ipv6_hostaddr[8] =
|
static const uint16_t g_ipv6_hostaddr[8] =
|
||||||
@ -102,21 +108,14 @@ static const uint16_t g_ipv6_netmask[8] =
|
|||||||
HTONS(CONFIG_EXAMPLES_NETTEST_IPv6NETMASK_7),
|
HTONS(CONFIG_EXAMPLES_NETTEST_IPv6NETMASK_7),
|
||||||
HTONS(CONFIG_EXAMPLES_NETTEST_IPv6NETMASK_8),
|
HTONS(CONFIG_EXAMPLES_NETTEST_IPv6NETMASK_8),
|
||||||
};
|
};
|
||||||
#endif /* CONFIG_EXAMPLES_NETTEST_IPv6 && !CONFIG_NET_ICMPv6_AUTOCONF */
|
#endif /* CONFIG_EXAMPLES_NETTEST_INIT && CONFIG_EXAMPLES_NETTEST_IPv6 && !CONFIG_NET_ICMPv6_AUTOCONF */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
#ifdef CONFIG_EXAMPLES_NETTEST_INIT
|
||||||
* nettest_main
|
static void netest_initialize(void)
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifdef CONFIG_BUILD_KERNEL
|
|
||||||
int main(int argc, FAR char *argv[])
|
|
||||||
#else
|
|
||||||
int nettest_main(int argc, char *argv[])
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_EXAMPLES_NETTEST_IPv6
|
#ifndef CONFIG_EXAMPLES_NETTEST_IPv6
|
||||||
struct in_addr addr;
|
struct in_addr addr;
|
||||||
@ -179,12 +178,75 @@ int nettest_main(int argc, char *argv[])
|
|||||||
netlib_set_ipv4netmask("eth0", &addr);
|
netlib_set_ipv4netmask("eth0", &addr);
|
||||||
|
|
||||||
#endif /* CONFIG_EXAMPLES_NETTEST_IPv6 */
|
#endif /* CONFIG_EXAMPLES_NETTEST_IPv6 */
|
||||||
|
}
|
||||||
|
#endif /*CONFIG_EXAMPLES_NETTEST_INIT */
|
||||||
|
|
||||||
#ifdef CONFIG_EXAMPLES_NETTEST_SERVER
|
#ifdef CONFIG_EXAMPLES_NETTEST_LOOPBACK
|
||||||
|
static int server_child(int argc, char *argv[])
|
||||||
|
{
|
||||||
recv_server();
|
recv_server();
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* nettest_main
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_BUILD_KERNEL
|
||||||
|
int main(int argc, FAR char *argv[])
|
||||||
#else
|
#else
|
||||||
|
int nettest_main(int argc, char *argv[])
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_EXAMPLES_NETTEST_LOOPBACK
|
||||||
|
pid_t child;
|
||||||
|
#ifdef CONFIG_SCHED_WAITPID
|
||||||
|
int statloc;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_EXAMPLES_NETTEST_INIT
|
||||||
|
/* Initialize the network */
|
||||||
|
|
||||||
|
netest_initialize();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_EXAMPLES_NETTEST_LOOPBACK)
|
||||||
|
/* Then perform the server side of the test on a child task */
|
||||||
|
|
||||||
|
child = task_create("Nettest Child", CONFIG_EXAMPLES_NETTEST_PRIORITY,
|
||||||
|
CONFIG_EXAMPLES_NETTEST_STACKSIZE, server_child,
|
||||||
|
NULL);
|
||||||
|
if (child < 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ERROR: Failed to server daemon\n");
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(500*1000);
|
||||||
|
|
||||||
|
#elif defined(CONFIG_EXAMPLES_NETTEST_SERVER)
|
||||||
|
/* Then perform the server side of the test on this thread */
|
||||||
|
|
||||||
|
recv_server();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_EXAMPLES_NETTEST_SERVER) || \
|
||||||
|
defined(CONFIG_EXAMPLES_NETTEST_LOOPBACK)
|
||||||
|
/* Then perform the client side of the test on this thread */
|
||||||
|
|
||||||
send_client();
|
send_client();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
#if defined(CONFIG_EXAMPLES_NETTEST_LOOPBACK) && defined(CONFIG_SCHED_WAITPID)
|
||||||
|
printf("main: Waiting for the server to exit\n");
|
||||||
|
(void)waitpid(child, &statloc, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -106,6 +106,16 @@ void send_client(void)
|
|||||||
myaddr.sin6_family = AF_INET6;
|
myaddr.sin6_family = AF_INET6;
|
||||||
myaddr.sin6_port = HTONS(PORTNO);
|
myaddr.sin6_port = HTONS(PORTNO);
|
||||||
|
|
||||||
|
#ifdef CONFIG_EXAMPLES_NETTEST_LOOPBACK
|
||||||
|
myaddr.sin6_addr.s6_addr16[0] = 0;
|
||||||
|
myaddr.sin6_addr.s6_addr16[1] = 0;
|
||||||
|
myaddr.sin6_addr.s6_addr16[2] = 0;
|
||||||
|
myaddr.sin6_addr.s6_addr16[3] = 0;
|
||||||
|
myaddr.sin6_addr.s6_addr16[4] = 0;
|
||||||
|
myaddr.sin6_addr.s6_addr16[5] = 0;
|
||||||
|
myaddr.sin6_addr.s6_addr16[6] = 0;
|
||||||
|
myaddr.sin6_addr.s6_addr16[7] = HTONS(1);
|
||||||
|
#else
|
||||||
myaddr.sin6_addr.s6_addr16[0] = HTONS(CONFIG_EXAMPLES_NETTEST_CLIENTIPv6ADDR_1);
|
myaddr.sin6_addr.s6_addr16[0] = HTONS(CONFIG_EXAMPLES_NETTEST_CLIENTIPv6ADDR_1);
|
||||||
myaddr.sin6_addr.s6_addr16[1] = HTONS(CONFIG_EXAMPLES_NETTEST_CLIENTIPv6ADDR_2);
|
myaddr.sin6_addr.s6_addr16[1] = HTONS(CONFIG_EXAMPLES_NETTEST_CLIENTIPv6ADDR_2);
|
||||||
myaddr.sin6_addr.s6_addr16[2] = HTONS(CONFIG_EXAMPLES_NETTEST_CLIENTIPv6ADDR_3);
|
myaddr.sin6_addr.s6_addr16[2] = HTONS(CONFIG_EXAMPLES_NETTEST_CLIENTIPv6ADDR_3);
|
||||||
@ -114,12 +124,18 @@ void send_client(void)
|
|||||||
myaddr.sin6_addr.s6_addr16[5] = HTONS(CONFIG_EXAMPLES_NETTEST_CLIENTIPv6ADDR_6);
|
myaddr.sin6_addr.s6_addr16[5] = HTONS(CONFIG_EXAMPLES_NETTEST_CLIENTIPv6ADDR_6);
|
||||||
myaddr.sin6_addr.s6_addr16[6] = HTONS(CONFIG_EXAMPLES_NETTEST_CLIENTIPv6ADDR_7);
|
myaddr.sin6_addr.s6_addr16[6] = HTONS(CONFIG_EXAMPLES_NETTEST_CLIENTIPv6ADDR_7);
|
||||||
myaddr.sin6_addr.s6_addr16[7] = HTONS(CONFIG_EXAMPLES_NETTEST_CLIENTIPv6ADDR_8);
|
myaddr.sin6_addr.s6_addr16[7] = HTONS(CONFIG_EXAMPLES_NETTEST_CLIENTIPv6ADDR_8);
|
||||||
|
#endif
|
||||||
|
|
||||||
addrlen = sizeof(struct sockaddr_in6);
|
addrlen = sizeof(struct sockaddr_in6);
|
||||||
#else
|
#else
|
||||||
myaddr.sin_family = AF_INET;
|
myaddr.sin_family = AF_INET;
|
||||||
myaddr.sin_port = HTONS(PORTNO);
|
myaddr.sin_port = HTONS(PORTNO);
|
||||||
|
|
||||||
|
#ifdef CONFIG_EXAMPLES_NETTEST_LOOPBACK
|
||||||
|
myaddr.sin_addr.s_addr = HTONL(0x7f000001);
|
||||||
|
#else
|
||||||
myaddr.sin_addr.s_addr = HTONL(CONFIG_EXAMPLES_NETTEST_CLIENTIP);
|
myaddr.sin_addr.s_addr = HTONL(CONFIG_EXAMPLES_NETTEST_CLIENTIP);
|
||||||
|
#endif
|
||||||
|
|
||||||
addrlen = sizeof(struct sockaddr_in);
|
addrlen = sizeof(struct sockaddr_in);
|
||||||
#endif
|
#endif
|
||||||
|
@ -178,6 +178,7 @@ void recv_server(void)
|
|||||||
printf("server: The client broke the connection\n");
|
printf("server: The client broke the connection\n");
|
||||||
goto errout_with_acceptsd;
|
goto errout_with_acceptsd;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Received %d bytes\n", nbytesread);
|
printf("Received %d bytes\n", nbytesread);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -245,9 +246,10 @@ void recv_server(void)
|
|||||||
|
|
||||||
#if 1 /* Do it for all platforms */
|
#if 1 /* Do it for all platforms */
|
||||||
printf("server: Wait before closing\n");
|
printf("server: Wait before closing\n");
|
||||||
sleep(60);
|
sleep(2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
printf("server: Terminating\n");
|
||||||
close(listensd);
|
close(listensd);
|
||||||
close(acceptsd);
|
close(acceptsd);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* examples/nxflat/tests/signal/signal.c
|
* examples/nxflat/tests/signal/signal.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2009, 2012, 2015 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
|
||||||
@ -100,6 +100,7 @@ void siguser_action(int signo, siginfo_t *siginfo, void *arg)
|
|||||||
printf("siginfo:\n");
|
printf("siginfo:\n");
|
||||||
printf(" si_signo = %d\n", siginfo->si_signo);
|
printf(" si_signo = %d\n", siginfo->si_signo);
|
||||||
printf(" si_code = %d\n", siginfo->si_code);
|
printf(" si_code = %d\n", siginfo->si_code);
|
||||||
|
printf(" si_errno = %d\n", siginfo->si_errno);
|
||||||
printf(" si_value = %d\n", siginfo->si_value.sival_int);
|
printf(" si_value = %d\n", siginfo->si_value.sival_int);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,8 +78,10 @@ static void death_of_child(int signo, siginfo_t *info, void *ucontext)
|
|||||||
|
|
||||||
if (info)
|
if (info)
|
||||||
{
|
{
|
||||||
printf("death_of_child: PID %d received signal=%d code=%d pid=%d status=%d\n",
|
printf("death_of_child: PID %d received signal=%d code=%d "
|
||||||
getpid(), signo, info->si_code, info->si_pid, info->si_status);
|
"errno=%d pid=%d status=%d\n",
|
||||||
|
getpid(), signo, info->si_code, info->si_errno,
|
||||||
|
info->si_pid, info->si_status);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@ config EXAMPLES_TCPECHO_DHCPC
|
|||||||
default n
|
default n
|
||||||
depends on EXAMPLES_TCPECHO && !NSH_BUILTIN_APPS
|
depends on EXAMPLES_TCPECHO && !NSH_BUILTIN_APPS
|
||||||
select NETUTILS_DHCPC
|
select NETUTILS_DHCPC
|
||||||
select NETUTILS_DNSCLIENT
|
select NETDB_DNSCLIENT
|
||||||
|
|
||||||
config EXAMPLES_TCPECHO_NOMAC
|
config EXAMPLES_TCPECHO_NOMAC
|
||||||
bool "Use Canned MAC Address"
|
bool "Use Canned MAC Address"
|
||||||
|
@ -11,6 +11,13 @@ config EXAMPLES_USBSERIAL
|
|||||||
|
|
||||||
if EXAMPLES_USBSERIAL
|
if EXAMPLES_USBSERIAL
|
||||||
|
|
||||||
|
config EXAMPLES_USBSERIAL_BUFSIZE
|
||||||
|
int "Target I/O Buffer Size"
|
||||||
|
default 512
|
||||||
|
---help---
|
||||||
|
The size of the array that is used as an I/O buffer for USB serial
|
||||||
|
data transfers.
|
||||||
|
|
||||||
config EXAMPLES_USBSERIAL_TRACEINIT
|
config EXAMPLES_USBSERIAL_TRACEINIT
|
||||||
bool "USB Trace Initialization"
|
bool "USB Trace Initialization"
|
||||||
default n
|
default n
|
||||||
|
@ -37,6 +37,11 @@
|
|||||||
include $(APPDIR)/Make.defs
|
include $(APPDIR)/Make.defs
|
||||||
|
|
||||||
# USB serial device example
|
# USB serial device example
|
||||||
|
# Built-in application info
|
||||||
|
|
||||||
|
APPNAME = usbserial
|
||||||
|
PRIORITY = SCHED_PRIORITY_DEFAULT
|
||||||
|
STACKSIZE = 2048
|
||||||
|
|
||||||
ASRCS =
|
ASRCS =
|
||||||
CSRCS =
|
CSRCS =
|
||||||
@ -104,7 +109,14 @@ install:
|
|||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
|
||||||
|
$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile
|
||||||
|
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
|
||||||
|
|
||||||
|
context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat
|
||||||
|
else
|
||||||
context:
|
context:
|
||||||
|
endif
|
||||||
|
|
||||||
.depend: Makefile $(SRCS)
|
.depend: Makefile $(SRCS)
|
||||||
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
# apps/examples/usbserial/Makefile.host
|
# apps/examples/usbserial/Makefile.host
|
||||||
#
|
#
|
||||||
# Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
|
# Copyright (C) 2008, 2011, 2015 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
|
||||||
@ -53,6 +53,9 @@ endif
|
|||||||
ifeq ($(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG),y)
|
ifeq ($(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG),y)
|
||||||
DEFINES += -DCONFIG_EXAMPLES_USBSERIAL_ONLYBIG=1
|
DEFINES += -DCONFIG_EXAMPLES_USBSERIAL_ONLYBIG=1
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(CONFIG_CDCACM),y)
|
||||||
|
DEFINES += -DCONFIG_CDCACM=1
|
||||||
|
endif
|
||||||
|
|
||||||
all: $(BIN)
|
all: $(BIN)
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_EXAMPLES_USBSERIAL_INONLY) && defined(CONFIG_EXAMPLES_USBSERIAL_OUTONLY)
|
#if defined(CONFIG_EXAMPLES_USBSERIAL_INONLY) && defined(CONFIG_EXAMPLES_USBSERIAL_OUTONLY)
|
||||||
@ -181,6 +181,7 @@ int main(int argc, char **argv, char **envp)
|
|||||||
fprintf(stderr, "Too many arguments on command line\n");
|
fprintf(stderr, "Too many arguments on command line\n");
|
||||||
show_usage(argv[0], 1);
|
show_usage(argv[0], 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_ttydev = argv[1];
|
g_ttydev = argv[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,13 +193,15 @@ int main(int argc, char **argv, char **envp)
|
|||||||
fd = open(g_ttydev, O_RDWR);
|
fd = open(g_ttydev, O_RDWR);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
printf("main: ERROR: Failed to open %s: %s\n", g_ttydev, strerror(errno));
|
printf("main: ERROR: Failed to open %s: %s\n",
|
||||||
|
g_ttydev, strerror(errno));
|
||||||
printf("main: Assume not connected. Wait and try again.\n");
|
printf("main: Assume not connected. Wait and try again.\n");
|
||||||
printf("main: (Control-C to terminate).\n");
|
printf("main: (Control-C to terminate).\n");
|
||||||
sleep(5);
|
sleep(5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (fd < 0);
|
while (fd < 0);
|
||||||
|
|
||||||
printf("main: Successfully opened the serial driver\n");
|
printf("main: Successfully opened the serial driver\n");
|
||||||
|
|
||||||
/* Configure the serial port in raw mode (at least turn off echo) */
|
/* Configure the serial port in raw mode (at least turn off echo) */
|
||||||
@ -206,7 +209,8 @@ int main(int argc, char **argv, char **envp)
|
|||||||
ret = tcgetattr(fd, &tty);
|
ret = tcgetattr(fd, &tty);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
printf("main: ERROR: Failed to get termios for %s: %s\n", g_ttydev, strerror(errno));
|
printf("main: ERROR: Failed to get termios for %s: %s\n",
|
||||||
|
g_ttydev, strerror(errno));
|
||||||
close(fd);
|
close(fd);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -220,7 +224,8 @@ int main(int argc, char **argv, char **envp)
|
|||||||
ret = tcsetattr(fd, TCSANOW, &tty);
|
ret = tcsetattr(fd, TCSANOW, &tty);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
printf("main: ERROR: Failed to set termios for %s: %s\n", g_ttydev, strerror(errno));
|
printf("main: ERROR: Failed to set termios for %s: %s\n",
|
||||||
|
g_ttydev, strerror(errno));
|
||||||
close(fd);
|
close(fd);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -237,7 +242,8 @@ int main(int argc, char **argv, char **envp)
|
|||||||
nbytes = read(fd, g_iobuffer, BUFFER_SIZE-1);
|
nbytes = read(fd, g_iobuffer, BUFFER_SIZE-1);
|
||||||
if (nbytes < 0)
|
if (nbytes < 0)
|
||||||
{
|
{
|
||||||
printf("main: ERROR: Failed to read from %s: %s\n", g_ttydev, strerror(errno));
|
printf("main: ERROR: Failed to read from %s: %s\n",
|
||||||
|
g_ttydev, strerror(errno));
|
||||||
close(fd);
|
close(fd);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
@ -271,9 +277,11 @@ int main(int argc, char **argv, char **envp)
|
|||||||
nbytes = write(fd, g_longmsg, sizeof(g_longmsg));
|
nbytes = write(fd, g_longmsg, sizeof(g_longmsg));
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL)
|
#elif !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL)
|
||||||
printf("main: Sending %d bytes..\n", sizeof(g_longmsg));
|
printf("main: Sending %d bytes..\n", sizeof(g_longmsg));
|
||||||
nbytes = write(fd, g_longmsg, sizeof(g_longmsg));
|
nbytes = write(fd, g_longmsg, sizeof(g_longmsg));
|
||||||
|
|
||||||
#else /* !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) */
|
#else /* !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) */
|
||||||
printf("main: Sending %d bytes..\n", sizeof(g_shortmsg));
|
printf("main: Sending %d bytes..\n", sizeof(g_shortmsg));
|
||||||
nbytes = write(fd, g_shortmsg, sizeof(g_shortmsg));
|
nbytes = write(fd, g_shortmsg, sizeof(g_shortmsg));
|
||||||
@ -287,6 +295,7 @@ int main(int argc, char **argv, char **envp)
|
|||||||
close(fd);
|
close(fd);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("main: %ld bytes sent\n", (long)nbytes);
|
printf("main: %ld bytes sent\n", (long)nbytes);
|
||||||
#endif /* CONFIG_EXAMPLES_USBSERIAL_INONLY */
|
#endif /* CONFIG_EXAMPLES_USBSERIAL_INONLY */
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* examples/usbserial/usbserial_main.c
|
* examples/usbserial/usbserial_main.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2008, 2010-2012, 2015 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
|
||||||
@ -56,7 +56,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_EXAMPLES_USBSERIAL_INONLY) && defined(CONFIG_EXAMPLES_USBSERIAL_OUTONLY)
|
#if defined(CONFIG_EXAMPLES_USBSERIAL_INONLY) && defined(CONFIG_EXAMPLES_USBSERIAL_OUTONLY)
|
||||||
@ -113,7 +113,9 @@
|
|||||||
# define USBSER_DEVNAME "/dev/ttyUSB0"
|
# define USBSER_DEVNAME "/dev/ttyUSB0"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define IOBUFFER_SIZE 256
|
#ifndef CONFIG_EXAMPLES_USBSERIAL_BUFSIZE
|
||||||
|
# define CONFIG_EXAMPLES_USBSERIAL_BUFSIZE 256
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
@ -153,7 +155,7 @@ static const char g_longmsg[] =
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY
|
#ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY
|
||||||
static char g_iobuffer[IOBUFFER_SIZE];
|
static char g_iobuffer[CONFIG_EXAMPLES_USBSERIAL_BUFSIZE];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -214,9 +216,11 @@ int usbserial_main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
printf("usbserial_main: ERROR: Failed to create the USB serial device: %d\n", -ret);
|
printf("usbserial_main: ERROR: Failed to create the USB serial device: %d\n",
|
||||||
|
-ret);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("usbserial_main: Successfully registered the serial driver\n");
|
printf("usbserial_main: Successfully registered the serial driver\n");
|
||||||
|
|
||||||
#if CONFIG_USBDEV_TRACE && CONFIG_USBDEV_TRACE_INITIALIDSET != 0
|
#if CONFIG_USBDEV_TRACE && CONFIG_USBDEV_TRACE_INITIALIDSET != 0
|
||||||
@ -242,7 +246,8 @@ int usbserial_main(int argc, char *argv[])
|
|||||||
if (outfd < 0)
|
if (outfd < 0)
|
||||||
{
|
{
|
||||||
int errcode = errno;
|
int errcode = errno;
|
||||||
printf("usbserial_main: ERROR: Failed to open " USBSER_DEVNAME " for writing: %d\n", errcode);
|
printf("usbserial_main: ERROR: Failed to open " USBSER_DEVNAME
|
||||||
|
" for writing: %d\n", errcode);
|
||||||
|
|
||||||
/* ENOTCONN means that the USB device is not yet connected */
|
/* ENOTCONN means that the USB device is not yet connected */
|
||||||
|
|
||||||
@ -274,7 +279,8 @@ int usbserial_main(int argc, char *argv[])
|
|||||||
infd = open(USBSER_DEVNAME, O_RDONLY|O_NONBLOCK);
|
infd = open(USBSER_DEVNAME, O_RDONLY|O_NONBLOCK);
|
||||||
if (infd < 0)
|
if (infd < 0)
|
||||||
{
|
{
|
||||||
printf("usbserial_main: ERROR: Failed to open " USBSER_DEVNAME " for reading: %d\n", errno);
|
printf("usbserial_main: ERROR: Failed to open " USBSER_DEVNAME
|
||||||
|
" for reading: %d\n", errno);
|
||||||
close(outfd);
|
close(outfd);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
@ -285,7 +291,8 @@ int usbserial_main(int argc, char *argv[])
|
|||||||
if (infd < 0)
|
if (infd < 0)
|
||||||
{
|
{
|
||||||
int errcode = errno;
|
int errcode = errno;
|
||||||
printf("usbserial_main: ERROR: Failed to open " USBSER_DEVNAME " for reading: %d\n", errno);
|
printf("usbserial_main: ERROR: Failed to open " USBSER_DEVNAME
|
||||||
|
" for reading: %d\n", errno);
|
||||||
|
|
||||||
/* ENOTCONN means that the USB device is not yet connected */
|
/* ENOTCONN means that the USB device is not yet connected */
|
||||||
|
|
||||||
@ -333,9 +340,11 @@ int usbserial_main(int argc, char *argv[])
|
|||||||
nbytes = write(outfd, g_longmsg, sizeof(g_longmsg));
|
nbytes = write(outfd, g_longmsg, sizeof(g_longmsg));
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL)
|
#elif !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL)
|
||||||
printf("usbserial_main: Reciting QEI's speech of 1588\n");
|
printf("usbserial_main: Reciting QEI's speech of 1588\n");
|
||||||
nbytes = write(outfd, g_longmsg, sizeof(g_longmsg));
|
nbytes = write(outfd, g_longmsg, sizeof(g_longmsg));
|
||||||
|
|
||||||
#else /* !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) */
|
#else /* !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) */
|
||||||
printf("usbserial_main: Saying hello\n");
|
printf("usbserial_main: Saying hello\n");
|
||||||
nbytes = write(outfd, g_shortmsg, sizeof(g_shortmsg));
|
nbytes = write(outfd, g_shortmsg, sizeof(g_shortmsg));
|
||||||
@ -352,6 +361,7 @@ int usbserial_main(int argc, char *argv[])
|
|||||||
close(outfd);
|
close(outfd);
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("usbserial_main: %ld bytes sent\n", (long)nbytes);
|
printf("usbserial_main: %ld bytes sent\n", (long)nbytes);
|
||||||
#endif /* CONFIG_EXAMPLES_USBSERIAL_OUTONLY */
|
#endif /* CONFIG_EXAMPLES_USBSERIAL_OUTONLY */
|
||||||
|
|
||||||
@ -363,8 +373,8 @@ int usbserial_main(int argc, char *argv[])
|
|||||||
printf("usbserial_main: Polling for OUT messages\n");
|
printf("usbserial_main: Polling for OUT messages\n");
|
||||||
for (i = 0; i < 5; i++)
|
for (i = 0; i < 5; i++)
|
||||||
{
|
{
|
||||||
memset(g_iobuffer, 'X', IOBUFFER_SIZE);
|
memset(g_iobuffer, 'X', CONFIG_EXAMPLES_USBSERIAL_BUFSIZE);
|
||||||
nbytes = read(infd, g_iobuffer, IOBUFFER_SIZE);
|
nbytes = read(infd, g_iobuffer, CONFIG_EXAMPLES_USBSERIAL_BUFSIZE);
|
||||||
if (nbytes < 0)
|
if (nbytes < 0)
|
||||||
{
|
{
|
||||||
int errorcode = errno;
|
int errorcode = errno;
|
||||||
@ -380,7 +390,7 @@ int usbserial_main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("usbserial_main: Received l%d bytes:\n", (long)nbytes);
|
printf("usbserial_main: Received %ld bytes:\n", (long)nbytes);
|
||||||
if (nbytes > 0)
|
if (nbytes > 0)
|
||||||
{
|
{
|
||||||
for (j = 0; j < nbytes; j += 16)
|
for (j = 0; j < nbytes; j += 16)
|
||||||
@ -392,6 +402,7 @@ int usbserial_main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
printf(" ");
|
printf(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (j+k < nbytes)
|
if (j+k < nbytes)
|
||||||
{
|
{
|
||||||
printf("%02x", g_iobuffer[j+k]);
|
printf("%02x", g_iobuffer[j+k]);
|
||||||
@ -401,6 +412,7 @@ int usbserial_main(int argc, char *argv[])
|
|||||||
printf(" ");
|
printf(" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf(" ");
|
printf(" ");
|
||||||
for (k = 0; k < 16; k++)
|
for (k = 0; k < 16; k++)
|
||||||
{
|
{
|
||||||
@ -408,6 +420,7 @@ int usbserial_main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
printf(" ");
|
printf(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (j+k < nbytes)
|
if (j+k < nbytes)
|
||||||
{
|
{
|
||||||
if (g_iobuffer[j+k] >= 0x20 && g_iobuffer[j+k] < 0x7f)
|
if (g_iobuffer[j+k] >= 0x20 && g_iobuffer[j+k] < 0x7f)
|
||||||
@ -424,12 +437,15 @@ int usbserial_main(int argc, char *argv[])
|
|||||||
printf(" ");
|
printf(" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* CONFIG_EXAMPLES_USBSERIAL_INONLY */
|
#else /* CONFIG_EXAMPLES_USBSERIAL_INONLY */
|
||||||
printf("usbserial_main: Waiting\n");
|
printf("usbserial_main: Waiting\n");
|
||||||
sleep(5);
|
sleep(5);
|
||||||
@ -450,4 +466,3 @@ int usbserial_main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ config EXAMPLES_XMLRPC_DHCPC
|
|||||||
default n
|
default n
|
||||||
depends on EXAMPLES_XMLRPC && !NSH_BUILTIN_APPS
|
depends on EXAMPLES_XMLRPC && !NSH_BUILTIN_APPS
|
||||||
select NETUTILS_DHCPC
|
select NETUTILS_DHCPC
|
||||||
select NETUTILS_DNSCLIENT
|
select NETDB_DNSCLIENT
|
||||||
|
|
||||||
config EXAMPLES_XMLRPC_NOMAC
|
config EXAMPLES_XMLRPC_NOMAC
|
||||||
bool "Use Canned MAC Address"
|
bool "Use Canned MAC Address"
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
menu "Graphics Support"
|
||||||
|
|
||||||
config TIFF
|
config TIFF
|
||||||
bool "TIFF file generation library"
|
bool "TIFF file generation library"
|
||||||
default n
|
default n
|
||||||
@ -31,4 +33,4 @@ source "$APPSDIR/graphics/traveler/Kconfig"
|
|||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
endif # GRAPHICS_TRAVELER
|
endif # GRAPHICS_TRAVELER
|
||||||
|
endmenu # Graphics Support
|
||||||
|
102
include/symtab.h
Normal file
102
include/symtab.h
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* apps/include/symtab.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __APPS_INCLUDE_SYMTAB_H
|
||||||
|
#define __APPS_INCLUDE_SYMTAB_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* struct symbtab_s describes one entry in the symbol table. A symbol table
|
||||||
|
* is a fixed size array of struct symtab_s. The information is intentionally
|
||||||
|
* minimal and supports only:
|
||||||
|
*
|
||||||
|
* 1. Function pointers as sym_values. Of other kinds of values need to be
|
||||||
|
* supported, then typing information would also need to be included in
|
||||||
|
* the structure.
|
||||||
|
*
|
||||||
|
* 2. Fixed size arrays. There is no explicit provisional for dynamically
|
||||||
|
* adding or removing entries from the symbol table (realloc might be
|
||||||
|
* used for that purpose if needed). The intention is to support only
|
||||||
|
* fixed size arrays completely defined at compilation or link time.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: symtab_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Setup a user provided symbol table.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void symtab_initialize(void);
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __APPS_INCLUDE_SYMTAB_H */
|
||||||
|
|
@ -3,6 +3,8 @@
|
|||||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
menu "Interpreters"
|
||||||
|
|
||||||
source "$APPSDIR/interpreters/bas/Kconfig"
|
source "$APPSDIR/interpreters/bas/Kconfig"
|
||||||
source "$APPSDIR/interpreters/ficl/Kconfig"
|
source "$APPSDIR/interpreters/ficl/Kconfig"
|
||||||
|
|
||||||
@ -20,3 +22,4 @@ if INTERPRETERS_PCODE
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
source "$APPSDIR/interpreters/micropython/Kconfig"
|
source "$APPSDIR/interpreters/micropython/Kconfig"
|
||||||
|
endmenu # Interpreters
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
menu "FreeModBus"
|
||||||
|
|
||||||
config MODBUS
|
config MODBUS
|
||||||
bool "Modbus support via FreeModBus"
|
bool "Modbus support via FreeModBus"
|
||||||
default n
|
default n
|
||||||
@ -159,3 +161,4 @@ config MB_MASTER_TOTAL_SLAVE_NUM
|
|||||||
|
|
||||||
endif # MB_ASCII_MASTER || MB_RTU_MASTER
|
endif # MB_ASCII_MASTER || MB_RTU_MASTER
|
||||||
endif # MODBUS
|
endif # MODBUS
|
||||||
|
endmenu # FreeModBus
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
#
|
#
|
||||||
|
|
||||||
comment "Networking Utilities"
|
menu "Network Utilities"
|
||||||
|
|
||||||
source "$APPSDIR/netutils/codecs/Kconfig"
|
source "$APPSDIR/netutils/codecs/Kconfig"
|
||||||
source "$APPSDIR/netutils/dhcpc/Kconfig"
|
source "$APPSDIR/netutils/dhcpc/Kconfig"
|
||||||
@ -22,3 +22,5 @@ source "$APPSDIR/netutils/ntpclient/Kconfig"
|
|||||||
source "$APPSDIR/netutils/discover/Kconfig"
|
source "$APPSDIR/netutils/discover/Kconfig"
|
||||||
source "$APPSDIR/netutils/xmlrpc/Kconfig"
|
source "$APPSDIR/netutils/xmlrpc/Kconfig"
|
||||||
source "$APPSDIR/netutils/pppd/Kconfig"
|
source "$APPSDIR/netutils/pppd/Kconfig"
|
||||||
|
|
||||||
|
endmenu # Network Utilities
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
menu "NSH Library"
|
||||||
|
|
||||||
config NSH_LIBRARY
|
config NSH_LIBRARY
|
||||||
bool "NSH Library"
|
bool "NSH Library"
|
||||||
default n
|
default n
|
||||||
@ -1237,7 +1239,7 @@ endmenu # IP Address Configuration
|
|||||||
config NSH_DNS
|
config NSH_DNS
|
||||||
bool "Use DNS"
|
bool "Use DNS"
|
||||||
default n
|
default n
|
||||||
depends on NSH_LIBRARY && NETUTILS_DNSCLIENT
|
depends on NSH_LIBRARY && NETDB_DNSCLIENT
|
||||||
---help---
|
---help---
|
||||||
Configure to use a DNS.
|
Configure to use a DNS.
|
||||||
|
|
||||||
@ -1381,3 +1383,4 @@ endif # NSH_TELNET_LOGIN
|
|||||||
endif # NSH_TELNET
|
endif # NSH_TELNET
|
||||||
endmenu # Telnet Configuration
|
endmenu # Telnet Configuration
|
||||||
endif # NSH_LIBRARY
|
endif # NSH_LIBRARY
|
||||||
|
endmenu # NSH Library
|
||||||
|
@ -155,7 +155,8 @@
|
|||||||
* domain sockets were enable.
|
* domain sockets were enable.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(CONFIG_NET_ETHERNET) && !defined(CONFIG_NET_SLIP) && !defined(CONFIG_NET_TUN)
|
#if !defined(CONFIG_NET_ETHERNET) && !defined(CONFIG_NET_LOOPBACK) && \
|
||||||
|
!defined(CONFIG_NET_SLIP) && !defined(CONFIG_NET_TUN)
|
||||||
/* No link layer protocol is a good indication that there is no network
|
/* No link layer protocol is a good indication that there is no network
|
||||||
* device.
|
* device.
|
||||||
*/
|
*/
|
||||||
|
@ -515,6 +515,12 @@ static int ifconfig_callback(FAR struct net_driver_s *dev, void *arg)
|
|||||||
break;
|
break;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# if defined(CONFIG_NET_LOOPBACK)
|
||||||
|
case NET_LL_LOOPBACK:
|
||||||
|
nsh_output(vtbl, "%s\tLink encap:Local Loopback", dev->d_ifname);
|
||||||
|
break;
|
||||||
|
# endif
|
||||||
|
|
||||||
# if defined(CONFIG_NET_SLIP)
|
# if defined(CONFIG_NET_SLIP)
|
||||||
case NET_LL_SLIP:
|
case NET_LL_SLIP:
|
||||||
nsh_output(vtbl, "%s\tLink encap:SLIP", dev->d_ifname);
|
nsh_output(vtbl, "%s\tLink encap:SLIP", dev->d_ifname);
|
||||||
@ -543,6 +549,9 @@ static int ifconfig_callback(FAR struct net_driver_s *dev, void *arg)
|
|||||||
nsh_output(vtbl, "%s\tLink encap:Ethernet HWaddr %s at %s\n",
|
nsh_output(vtbl, "%s\tLink encap:Ethernet HWaddr %s at %s\n",
|
||||||
dev->d_ifname, ether_ntoa(&dev->d_mac), status);
|
dev->d_ifname, ether_ntoa(&dev->d_mac), status);
|
||||||
|
|
||||||
|
#elif defined(CONFIG_NET_LOOPBACK)
|
||||||
|
nsh_output(vtbl, "%s\tLink encap:Local Loopback at %s\n", dev->d_ifname, status);
|
||||||
|
|
||||||
#elif defined(CONFIG_NET_SLIP)
|
#elif defined(CONFIG_NET_SLIP)
|
||||||
nsh_output(vtbl, "%s\tLink encap:SLIP at %s\n", dev->d_ifname, status);
|
nsh_output(vtbl, "%s\tLink encap:SLIP at %s\n", dev->d_ifname, status);
|
||||||
|
|
||||||
|
@ -103,19 +103,32 @@
|
|||||||
|
|
||||||
#if defined(CONFIG_NET_ETHERNET)
|
#if defined(CONFIG_NET_ETHERNET)
|
||||||
# define NET_DEVNAME "eth0"
|
# define NET_DEVNAME "eth0"
|
||||||
|
# define NSH_HAVE_NETDEV
|
||||||
#elif defined(CONFIG_NET_SLIP)
|
#elif defined(CONFIG_NET_SLIP)
|
||||||
# define NET_DEVNAME "sl0"
|
# define NET_DEVNAME "sl0"
|
||||||
# ifndef CONFIG_NSH_NOMAC
|
# ifndef CONFIG_NSH_NOMAC
|
||||||
# error "CONFIG_NSH_NOMAC must be defined for SLIP"
|
# error "CONFIG_NSH_NOMAC must be defined for SLIP"
|
||||||
# endif
|
# endif
|
||||||
|
# define NSH_HAVE_NETDEV
|
||||||
#elif defined(CONFIG_NET_TUN)
|
#elif defined(CONFIG_NET_TUN)
|
||||||
# define NET_DEVNAME "tun0"
|
# define NET_DEVNAME "tun0"
|
||||||
|
# define NSH_HAVE_NETDEV
|
||||||
#elif defined(CONFIG_NET_LOCAL)
|
#elif defined(CONFIG_NET_LOCAL)
|
||||||
# define NET_DEVNAME "lo"
|
# define NET_DEVNAME "lo"
|
||||||
#else
|
# define NSH_HAVE_NETDEV
|
||||||
|
#elif !defined(CONFIG_NET_LOOPBACK)
|
||||||
# error ERROR: No link layer protocol defined
|
# error ERROR: No link layer protocol defined
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* If we have no network device (only only the local loopback device), then we
|
||||||
|
* cannot support the network monitor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef NSH_HAVE_NETDEV
|
||||||
|
# undef CONFIG_NSH_NETINIT_MONITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* We need a valid IP domain (any domain) to create a socket that we can use
|
/* We need a valid IP domain (any domain) to create a socket that we can use
|
||||||
* to comunicate with the network device.
|
* to comunicate with the network device.
|
||||||
*/
|
*/
|
||||||
@ -208,6 +221,7 @@ static const uint16_t g_ipv6_netmask[8] =
|
|||||||
|
|
||||||
static void nsh_netinit_configure(void)
|
static void nsh_netinit_configure(void)
|
||||||
{
|
{
|
||||||
|
#ifdef NSH_HAVE_NETDEV
|
||||||
#ifdef CONFIG_NET_IPv4
|
#ifdef CONFIG_NET_IPv4
|
||||||
struct in_addr addr;
|
struct in_addr addr;
|
||||||
#endif
|
#endif
|
||||||
@ -328,6 +342,7 @@ static void nsh_netinit_configure(void)
|
|||||||
dhcpc_close(handle);
|
dhcpc_close(handle);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* NSH_HAVE_NETDEV */
|
||||||
|
|
||||||
nvdbg("Exit\n");
|
nvdbg("Exit\n");
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
menu "Platform-specific Support"
|
||||||
|
|
||||||
config PLATFORM_CONFIGDATA
|
config PLATFORM_CONFIGDATA
|
||||||
bool "Platform configuration data"
|
bool "Platform configuration data"
|
||||||
default n
|
default n
|
||||||
@ -15,3 +17,5 @@ config PLATFORM_CONFIGDATA
|
|||||||
FLASH, etc.
|
FLASH, etc.
|
||||||
|
|
||||||
source "$APPSDIR/platform/mikroe-stm32f4/Kconfig"
|
source "$APPSDIR/platform/mikroe-stm32f4/Kconfig"
|
||||||
|
|
||||||
|
endmenu # Platform-specific Support
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
menu "System Libraries and NSH Add-Ons"
|
||||||
|
|
||||||
source "$APPSDIR/system/free/Kconfig"
|
source "$APPSDIR/system/free/Kconfig"
|
||||||
source "$APPSDIR/system/cle/Kconfig"
|
source "$APPSDIR/system/cle/Kconfig"
|
||||||
source "$APPSDIR/system/cu/Kconfig"
|
source "$APPSDIR/system/cu/Kconfig"
|
||||||
@ -23,6 +25,7 @@ source "$APPSDIR/system/sudoku/Kconfig"
|
|||||||
source "$APPSDIR/system/lm75/Kconfig"
|
source "$APPSDIR/system/lm75/Kconfig"
|
||||||
source "$APPSDIR/system/vi/Kconfig"
|
source "$APPSDIR/system/vi/Kconfig"
|
||||||
source "$APPSDIR/system/stackmonitor/Kconfig"
|
source "$APPSDIR/system/stackmonitor/Kconfig"
|
||||||
|
source "$APPSDIR/system/symtab/Kconfig"
|
||||||
source "$APPSDIR/system/cdcacm/Kconfig"
|
source "$APPSDIR/system/cdcacm/Kconfig"
|
||||||
source "$APPSDIR/system/composite/Kconfig"
|
source "$APPSDIR/system/composite/Kconfig"
|
||||||
source "$APPSDIR/system/usbmsc/Kconfig"
|
source "$APPSDIR/system/usbmsc/Kconfig"
|
||||||
@ -30,3 +33,4 @@ source "$APPSDIR/system/usbmonitor/Kconfig"
|
|||||||
source "$APPSDIR/system/zmodem/Kconfig"
|
source "$APPSDIR/system/zmodem/Kconfig"
|
||||||
source "$APPSDIR/system/zoneinfo/Kconfig"
|
source "$APPSDIR/system/zoneinfo/Kconfig"
|
||||||
|
|
||||||
|
endmenu # System Libraries and NSH Add-Ons
|
||||||
|
@ -114,6 +114,10 @@ ifeq ($(CONFIG_SYSTEM_STACKMONITOR),y)
|
|||||||
CONFIGURED_APPS += system/stackmonitor
|
CONFIGURED_APPS += system/stackmonitor
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_SYSTEM_SYMTAB),y)
|
||||||
|
CONFIGURED_APPS += system/symtab
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_SYSTEM_USBMSC),y)
|
ifeq ($(CONFIG_SYSTEM_USBMSC),y)
|
||||||
CONFIGURED_APPS += system/usbmsc
|
CONFIGURED_APPS += system/usbmsc
|
||||||
endif
|
endif
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
SUBDIRS = cdcacm cle composite cu flash_eraseall free i2c hex2bin inifile
|
SUBDIRS = cdcacm cle composite cu flash_eraseall free i2c hex2bin inifile
|
||||||
SUBDIRS += install lm75 mdio netdb nxplayer ramtest ramtron readline sdcard
|
SUBDIRS += install lm75 mdio netdb nxplayer ramtest ramtron readline sdcard
|
||||||
SUBDIRS += stackmonitor sudoku usbmonitor usbmsc vi zmodem zoneinfo
|
SUBDIRS += stackmonitor sudoku symtab usbmonitor usbmsc vi zmodem zoneinfo
|
||||||
|
|
||||||
# Create the list of installed runtime modules (INSTALLED_DIRS)
|
# Create the list of installed runtime modules (INSTALLED_DIRS)
|
||||||
|
|
||||||
|
@ -65,6 +65,15 @@
|
|||||||
# define CONFIG_SYSTEM_NETDB_PRIORITY 50
|
# define CONFIG_SYSTEM_NETDB_PRIORITY 50
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* REVIST: Currently the availability of gethostbyaddr() depends on
|
||||||
|
* CONFIG_NETDB_HOSTFILE. That might not always be true, however.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#undef HAVE_GETHOSTBYADDR
|
||||||
|
#ifdef CONFIG_NETDB_HOSTFILE
|
||||||
|
# define HAVE_GETHOSTBYADDR 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -73,8 +82,10 @@ static void show_usage(FAR const char *progname, int exitcode) noreturn_function
|
|||||||
static void show_usage(FAR const char *progname, int exitcode)
|
static void show_usage(FAR const char *progname, int exitcode)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "USAGE: %s --ipv4 <ipv4-addr>\n", progname);
|
fprintf(stderr, "USAGE: %s --ipv4 <ipv4-addr>\n", progname);
|
||||||
|
#ifdef HAVE_GETHOSTBYADDR
|
||||||
fprintf(stderr, " %s --ipv6 <ipv6-addr>\n", progname);
|
fprintf(stderr, " %s --ipv6 <ipv6-addr>\n", progname);
|
||||||
fprintf(stderr, " %s --host <host-name>\n", progname);
|
fprintf(stderr, " %s --host <host-name>\n", progname);
|
||||||
|
#endif
|
||||||
fprintf(stderr, " %s --help\n", progname);
|
fprintf(stderr, " %s --help\n", progname);
|
||||||
exit(exitcode);
|
exit(exitcode);
|
||||||
}
|
}
|
||||||
@ -110,6 +121,7 @@ int netdb_main(int argc, char **argv)
|
|||||||
show_usage(argv[0], EXIT_FAILURE);
|
show_usage(argv[0], EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_GETHOSTBYADDR
|
||||||
/* Handle: netdb --ipv4 <ipv4-addr> */
|
/* Handle: netdb --ipv4 <ipv4-addr> */
|
||||||
|
|
||||||
else if (strcmp(argv[1], "--ipv4") == 0)
|
else if (strcmp(argv[1], "--ipv4") == 0)
|
||||||
@ -161,6 +173,7 @@ int netdb_main(int argc, char **argv)
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_GETHOSTBYADDR */
|
||||||
|
|
||||||
/* Handle: netdb --host <host-name> */
|
/* Handle: netdb --host <host-name> */
|
||||||
|
|
||||||
|
12
system/symtab/.gitignore
vendored
Normal file
12
system/symtab/.gitignore
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/symtab.inc
|
||||||
|
/Make.dep
|
||||||
|
/.depend
|
||||||
|
/.built
|
||||||
|
/*.asm
|
||||||
|
/*.rel
|
||||||
|
/*.lst
|
||||||
|
/*.sym
|
||||||
|
/*.adb
|
||||||
|
/*.lib
|
||||||
|
/*.src
|
||||||
|
/*.obj
|
15
system/symtab/Kconfig
Normal file
15
system/symtab/Kconfig
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#
|
||||||
|
# For a description of the syntax of this configuration file,
|
||||||
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
|
#
|
||||||
|
|
||||||
|
config SYSTEM_SYMTAB
|
||||||
|
bool "User-provided symbol table"
|
||||||
|
default n
|
||||||
|
depends on EXECFUNCS_HAVE_SYMTAB && LIB_BOARDCTL
|
||||||
|
select BOARDCTL_SYMTAB
|
||||||
|
---help---
|
||||||
|
Build and include default symbol table in the NuttX application.
|
||||||
|
The symbol table is selected by call symtab_initialize(). The
|
||||||
|
table apps/system/symtab/symtab.inc has to be generated using
|
||||||
|
mksymtab manually before this option is selected.
|
104
system/symtab/Makefile
Normal file
104
system/symtab/Makefile
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
############################################################################
|
||||||
|
# apps/system/system/Makefile
|
||||||
|
#
|
||||||
|
# Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||||
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in
|
||||||
|
# the documentation and/or other materials provided with the
|
||||||
|
# distribution.
|
||||||
|
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
# used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
-include $(TOPDIR)/.config
|
||||||
|
-include $(TOPDIR)/Make.defs
|
||||||
|
include $(APPDIR)/Make.defs
|
||||||
|
|
||||||
|
ifeq ($(WINTOOL),y)
|
||||||
|
INCDIROPT = -w
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Symbol table support
|
||||||
|
|
||||||
|
ASRCS =
|
||||||
|
CSRCS = symtab.c
|
||||||
|
|
||||||
|
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||||
|
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||||
|
|
||||||
|
SRCS = $(ASRCS) $(CSRCS)
|
||||||
|
OBJS = $(AOBJS) $(COBJS)
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||||
|
BIN = ..\..\libapps$(LIBEXT)
|
||||||
|
else
|
||||||
|
ifeq ($(WINTOOL),y)
|
||||||
|
BIN = ..\\..\\libapps$(LIBEXT)
|
||||||
|
else
|
||||||
|
BIN = ../../libapps$(LIBEXT)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ROOTDEPPATH = --dep-path .
|
||||||
|
|
||||||
|
# Common build
|
||||||
|
|
||||||
|
VPATH =
|
||||||
|
|
||||||
|
all: .built
|
||||||
|
.PHONY: context depend clean distclean
|
||||||
|
|
||||||
|
$(AOBJS): %$(OBJEXT): %.S
|
||||||
|
$(call ASSEMBLE, $<, $@)
|
||||||
|
|
||||||
|
$(COBJS) $(MAINOBJ): %$(OBJEXT): %.c
|
||||||
|
$(call COMPILE, $<, $@)
|
||||||
|
|
||||||
|
.built: $(OBJS)
|
||||||
|
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||||
|
$(Q) touch .built
|
||||||
|
|
||||||
|
install:
|
||||||
|
|
||||||
|
context:
|
||||||
|
|
||||||
|
# Create dependencies
|
||||||
|
|
||||||
|
.depend: Makefile $(SRCS)
|
||||||
|
$(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||||
|
$(Q) touch $@
|
||||||
|
|
||||||
|
depend: .depend
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(call DELFILE, .built)
|
||||||
|
$(call CLEAN)
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
$(call DELFILE, Make.dep)
|
||||||
|
$(call DELFILE, .depend)
|
||||||
|
|
||||||
|
-include Make.dep
|
61
system/symtab/README.txt
Normal file
61
system/symtab/README.txt
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
symtab
|
||||||
|
======
|
||||||
|
|
||||||
|
Symbol Tables and Build Modes
|
||||||
|
-----------------------------
|
||||||
|
This directory provide support for a symbol table which provides all/most of
|
||||||
|
system and C library services/functions to the application and NSH.
|
||||||
|
|
||||||
|
Symbol tables have differing usefulness in different NuttX build modes:
|
||||||
|
|
||||||
|
1. In the FLAT build (CONFIG_BUILD_FLAT), symbol tables are used to bind
|
||||||
|
addresses in loaded ELF or NxFLAT modules to base code that usually
|
||||||
|
resides in FLASH memory. Both OS interfaces and user/application
|
||||||
|
libraries are made available to the loaded module via symbol tables.
|
||||||
|
|
||||||
|
2. Symbol tables may be of value in a protected build
|
||||||
|
(CONFIG_BUILD_PROTECTED) where the newly started user task must
|
||||||
|
share resources with other user code (but should use system calls to
|
||||||
|
interact with the OS).
|
||||||
|
|
||||||
|
3. But in the kernel build mode (CONFIG_BUILD_KERNEL), only fully linked
|
||||||
|
executables loadable via execl(), execv(), or posix_spawan() can used.
|
||||||
|
There is no use for a symbol table with the kernel build since all
|
||||||
|
memory resources are separate; nothing is share-able with the newly
|
||||||
|
started process.
|
||||||
|
|
||||||
|
Creating the Canned Symbol Table
|
||||||
|
--------------------------------
|
||||||
|
The support is selected by CONFIG_SYSTEM_SYMTAB option and table has to be
|
||||||
|
prepared in advance manually. It can be prepared from NuttX top level
|
||||||
|
directory by using the following commands:
|
||||||
|
|
||||||
|
cd <nuttx-path>
|
||||||
|
cat syscall/syscall.csv libc/libc.csv | sort > <apps-path>/symtab/symtab.csv
|
||||||
|
tools/mksymtab <apps-path>/symtab/symtab.csv <apps-path>/symtab/symtab.inc
|
||||||
|
|
||||||
|
where:
|
||||||
|
<nuttx-path> is the path to the NuttX top level build directory
|
||||||
|
<apps-path> is the path to the top level application directory
|
||||||
|
|
||||||
|
You may want omit syscall/syscall.csv in the above command in the protected
|
||||||
|
mode. It is optional since the system calls are provided through system
|
||||||
|
call traps.
|
||||||
|
|
||||||
|
Your board-level start up code code then needs to select the symbol table
|
||||||
|
by calling the function symtab_initialize():
|
||||||
|
|
||||||
|
#include <apps/symtab.h>
|
||||||
|
...
|
||||||
|
symtab_initialize();
|
||||||
|
|
||||||
|
Code/Text Size Implications
|
||||||
|
---------------------------
|
||||||
|
The option can have substantial effect on system image size, mainly
|
||||||
|
code/text. That is because the instructions to generate symtab.inc
|
||||||
|
above will cause EVERY interface in the NuttX RTOS and the C library to be
|
||||||
|
included into build. Add to that the size of a huge symbol table.
|
||||||
|
|
||||||
|
In order to reduce the code/text size, you may want to manually prune the
|
||||||
|
auto-generated symtab.inc file to remove all interfaces that you do
|
||||||
|
not wish to include into the base FLASH image.
|
79
system/symtab/symtab.c
Normal file
79
system/symtab/symtab.c
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* apps/system/symtab/lib_symtab.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Pavel Pisa <ppisa@pikron.com>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_SYSTEM_SYMTAB
|
||||||
|
|
||||||
|
#include <nuttx/compiler.h>
|
||||||
|
#include <sys/boardctl.h>
|
||||||
|
#include <apps/symtab.h>
|
||||||
|
|
||||||
|
#include "symtab.inc"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: symtab_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Setup a user provided symbol table.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void symtab_initialize(void)
|
||||||
|
{
|
||||||
|
/* We set the symbol table indirectly through the boardctl() */
|
||||||
|
|
||||||
|
struct boardioc_symtab_s symdesc;
|
||||||
|
|
||||||
|
symdesc.symtab = g_symtab;
|
||||||
|
symdesc.nsymbols = NSYMBOLS;
|
||||||
|
(void)boardctl(BOARDIOC_SYMTAB, (uintptr_t)&symdesc);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_SYSTEM_SYMTAB */
|
141
tools/mkkconfig.bat
Executable file
141
tools/mkkconfig.bat
Executable file
@ -0,0 +1,141 @@
|
|||||||
|
@Echo off
|
||||||
|
|
||||||
|
REM apps/tools/mkkconfig.bat
|
||||||
|
REM
|
||||||
|
REM Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||||
|
REM Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
REM
|
||||||
|
REM Redistribution and use in source and binary forms, with or without
|
||||||
|
REM modification, are permitted provided that the following conditions
|
||||||
|
REM are met:
|
||||||
|
REM
|
||||||
|
REM 1. Redistributions of source code must retain the above copyright
|
||||||
|
REM notice, this list of conditions and the following disclaimer.
|
||||||
|
REM 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
REM notice, this list of conditions and the following disclaimer in
|
||||||
|
REM the documentation and/or other materials provided with the
|
||||||
|
REM distribution.
|
||||||
|
REM 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
REM used to endorse or promote products derived from this software
|
||||||
|
REM without specific prior written permission.
|
||||||
|
REM
|
||||||
|
REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
REM "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
REM LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
REM FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
REM COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
REM INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
REM BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
REM OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
REM AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
REM LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
REM ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
REM POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
REM
|
||||||
|
|
||||||
|
REM Parse command line arguments
|
||||||
|
|
||||||
|
SET topdir=
|
||||||
|
SET kconfig=Kconfig
|
||||||
|
|
||||||
|
:ArgLoop
|
||||||
|
IF "%1"=="" GOTO :EndOfLoop
|
||||||
|
IF "%1"=="-t" GOTO :SetTopDir
|
||||||
|
IF "%1"=="-o" GOTO :SetKconfig
|
||||||
|
IF "%1"=="-h" GOTO :ShowUsage
|
||||||
|
|
||||||
|
Echo ERROR: Unrecogized option %1
|
||||||
|
GOTO :ShowUsage
|
||||||
|
|
||||||
|
:SetDebug
|
||||||
|
SET debug=-d
|
||||||
|
GOTO :NextArg
|
||||||
|
|
||||||
|
:SetTopDir
|
||||||
|
SHIFT
|
||||||
|
SET topdir=%1
|
||||||
|
GOTO :NextArg
|
||||||
|
|
||||||
|
:SetKconfig
|
||||||
|
SHIFT
|
||||||
|
SET kconfig=%1
|
||||||
|
|
||||||
|
:NextArg
|
||||||
|
SHIFT
|
||||||
|
GOTO :ArgLoop
|
||||||
|
|
||||||
|
REM Check input Parameters
|
||||||
|
|
||||||
|
:EndOfLoop
|
||||||
|
IF "%topdir%"=="" (
|
||||||
|
IF EXIST tools\mkkconfig.bat (
|
||||||
|
SET topdir=%cd%
|
||||||
|
) ELSE (
|
||||||
|
cd ..
|
||||||
|
IF %ERRORLEVEL% GTR 0 (
|
||||||
|
Echo ERROR: failed cd ..
|
||||||
|
GOTO :End
|
||||||
|
)
|
||||||
|
IF EXIST tools\mkkconfig.bat (
|
||||||
|
SET topdir=%cd%
|
||||||
|
) ELSE (
|
||||||
|
Echo ERROR: Cannot find top directory
|
||||||
|
GOTO :End
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) ELSE (
|
||||||
|
IF NOT EXIST "%topdir%" (
|
||||||
|
Echo ERROR: %topdir% does not EXIST
|
||||||
|
GOTO :End
|
||||||
|
)
|
||||||
|
Cd %topdir%
|
||||||
|
IF %ERRORLEVEL% GTR 0 (
|
||||||
|
Echo ERROR: failed cd %topdir%
|
||||||
|
GOTO :End
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
IF EXIST %kconfig% (
|
||||||
|
Del /f /q %kconfig%
|
||||||
|
REM IF %ERRORLEVEL% GTR 0 (
|
||||||
|
REM Echo ERROR: failed to remove %kconfig%
|
||||||
|
REM GOTO :End
|
||||||
|
REM )
|
||||||
|
)
|
||||||
|
|
||||||
|
Echo # > %kconfig%
|
||||||
|
Echo # For a description of the syntax of this configuration file, >> %kconfig%
|
||||||
|
Echo # see the file kconfig-language.txt in the NuttX tools repository. >> %kconfig%
|
||||||
|
Echo # >> %kconfig%
|
||||||
|
|
||||||
|
DIR /B /A:D >_tmp_.dat
|
||||||
|
|
||||||
|
Echo source "$APPSDIR/builtin/Kconfig" >> %kconfig%
|
||||||
|
FOR /F "tokens=*" %%s IN (_tmp_.dat) do (
|
||||||
|
if "%%s" NEQ "builtin" Echo source "$APPSDIR/%%s/Kconfig" >> %kconfig%
|
||||||
|
)
|
||||||
|
DEL _tmp_.dat
|
||||||
|
|
||||||
|
GOTO :End
|
||||||
|
|
||||||
|
REM Exit showing usage
|
||||||
|
|
||||||
|
:ShowUsage
|
||||||
|
Echo USAGE: %0 [-d] [-t ^<topdir^>] [-o ^<kconfig-file^>]
|
||||||
|
Echo %0 [-h]
|
||||||
|
Echo Where:
|
||||||
|
Echo ^<-d^>:
|
||||||
|
Echo Enables debug output
|
||||||
|
Echo -t ^<topdir^>:
|
||||||
|
Echo Identifies the top applicatino directory
|
||||||
|
Echo -o ^<kconfig-file^>:
|
||||||
|
Echo Identifies the specific configuratin for the selected ^<board-name^>.
|
||||||
|
Echo This must correspond to a sub-directory under the board directory at
|
||||||
|
Echo under nuttx/configs/^<board-name^>/.
|
||||||
|
Echo ^<-h^>:
|
||||||
|
Echo Prints this message and exits.
|
||||||
|
|
||||||
|
REM Exit
|
||||||
|
|
||||||
|
:End
|
||||||
|
|
107
tools/mkkconfig.sh
Executable file
107
tools/mkkconfig.sh
Executable file
@ -0,0 +1,107 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# apps/tools/mkkconfig.sh
|
||||||
|
#
|
||||||
|
# Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||||
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in
|
||||||
|
# the documentation and/or other materials provided with the
|
||||||
|
# distribution.
|
||||||
|
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
# used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Get the input parameter list
|
||||||
|
|
||||||
|
USAGE="USAGE: mkkconfig.sh [-d] [-h] [-t <topdir>] [-o <kconfig-file>]"
|
||||||
|
unset TOPDIR
|
||||||
|
KCONFIG=Kconfig
|
||||||
|
|
||||||
|
while [ ! -z "$1" ]; do
|
||||||
|
case $1 in
|
||||||
|
-d )
|
||||||
|
set -x
|
||||||
|
;;
|
||||||
|
-t )
|
||||||
|
shift
|
||||||
|
TOPDIR=$1
|
||||||
|
;;
|
||||||
|
-o )
|
||||||
|
shift
|
||||||
|
KCONFIG=$1
|
||||||
|
;;
|
||||||
|
-h )
|
||||||
|
echo $USAGE
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
echo "ERROR: Unrecognized argument: $1"
|
||||||
|
echo $USAGE
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
# Check arguments
|
||||||
|
|
||||||
|
if [ -z "$TOPDIR" ]; then
|
||||||
|
if [ -x "tools/mkkconfig.sh" ]; then
|
||||||
|
TOPDIR=$PWD
|
||||||
|
else
|
||||||
|
cd .. || { echo "cd .. failed"; exit 1; }
|
||||||
|
if [ -x "tools/mkkconfig.sh" ]; then
|
||||||
|
TOPDIR=$PWD
|
||||||
|
else
|
||||||
|
echo "ERROR: This script must be executed from a known location"
|
||||||
|
echo " OR you must provide the <topdir> path in the command line"
|
||||||
|
echo $USAGE
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ ! -x "${TOPDIR}/tools/mkkconfig.sh" ]; then
|
||||||
|
echo "ERROR: <topdir> \"${TOPDIR}\" is not correct"
|
||||||
|
echo $USAGE
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
cd ${TOPDIR} || { echo "cd ${TOPDIR} failed"; exit 1; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f ${TOPDIR}/${KCONFIG} ]; then
|
||||||
|
rm ${TOPDIR}/${KCONFIG} || { echo "ERROR: Failed to remove ${TOPDIR}/${KCONFIG}"; exit 1; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
KCONFIG_LIST=`ls -1 */Kconfig`
|
||||||
|
|
||||||
|
echo "#" > ${TOPDIR}/${KCONFIG}
|
||||||
|
echo "# For a description of the syntax of this configuration file," >> ${TOPDIR}/${KCONFIG}
|
||||||
|
echo "# see the file kconfig-language.txt in the NuttX tools repository." >> ${TOPDIR}/${KCONFIG}
|
||||||
|
echo "#" >> ${TOPDIR}/${KCONFIG}
|
||||||
|
echo "" >> ${TOPDIR}/${KCONFIG}
|
||||||
|
|
||||||
|
for FILE in ${KCONFIG_LIST}; do
|
||||||
|
echo "source \"\$APPSDIR/${FILE}\"" >> ${TOPDIR}/${KCONFIG}
|
||||||
|
done
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user