Browse Source

Add nuttx to the system framework from Tang_yiwen

it is Perfect
pull/63/head
xuedongliang 2 weeks ago
parent
commit
4a7f51a5e9
10000 changed files with 3109861 additions and 0 deletions
  1. +235
    -0
      Ubiquitous/Nuttx/apps/Application.mk
  2. +20
    -0
      Ubiquitous/Nuttx/apps/DISCLAIMER-WIP
  3. +72
    -0
      Ubiquitous/Nuttx/apps/Directory.mk
  4. +489
    -0
      Ubiquitous/Nuttx/apps/LICENSE
  5. +120
    -0
      Ubiquitous/Nuttx/apps/Make.defs
  6. +222
    -0
      Ubiquitous/Nuttx/apps/Makefile
  7. +5
    -0
      Ubiquitous/Nuttx/apps/NOTICE
  8. +239
    -0
      Ubiquitous/Nuttx/apps/README.md
  9. +39
    -0
      Ubiquitous/Nuttx/apps/builtin/Make.defs
  10. +81
    -0
      Ubiquitous/Nuttx/apps/builtin/Makefile
  11. +78
    -0
      Ubiquitous/Nuttx/apps/builtin/builtin_list.c
  12. +228
    -0
      Ubiquitous/Nuttx/apps/builtin/exec_builtin.c
  13. +37
    -0
      Ubiquitous/Nuttx/apps/canutils/Make.defs
  14. +38
    -0
      Ubiquitous/Nuttx/apps/canutils/Makefile
  15. +16
    -0
      Ubiquitous/Nuttx/apps/canutils/candump/Kconfig
  16. +24
    -0
      Ubiquitous/Nuttx/apps/canutils/candump/Make.defs
  17. +34
    -0
      Ubiquitous/Nuttx/apps/canutils/candump/Makefile
  18. +810
    -0
      Ubiquitous/Nuttx/apps/canutils/candump/candump.c
  19. +15
    -0
      Ubiquitous/Nuttx/apps/canutils/canlib/Kconfig
  20. +39
    -0
      Ubiquitous/Nuttx/apps/canutils/canlib/Make.defs
  21. +44
    -0
      Ubiquitous/Nuttx/apps/canutils/canlib/Makefile
  22. +82
    -0
      Ubiquitous/Nuttx/apps/canutils/canlib/canlib_getbaud.c
  23. +83
    -0
      Ubiquitous/Nuttx/apps/canutils/canlib/canlib_getloopback.c
  24. +83
    -0
      Ubiquitous/Nuttx/apps/canutils/canlib/canlib_getsilent.c
  25. +88
    -0
      Ubiquitous/Nuttx/apps/canutils/canlib/canlib_setbaud.c
  26. +90
    -0
      Ubiquitous/Nuttx/apps/canutils/canlib/canlib_setloopback.c
  27. +90
    -0
      Ubiquitous/Nuttx/apps/canutils/canlib/canlib_setsilent.c
  28. +16
    -0
      Ubiquitous/Nuttx/apps/canutils/cansend/Kconfig
  29. +24
    -0
      Ubiquitous/Nuttx/apps/canutils/cansend/Make.defs
  30. +34
    -0
      Ubiquitous/Nuttx/apps/canutils/cansend/Makefile
  31. +169
    -0
      Ubiquitous/Nuttx/apps/canutils/cansend/cansend.c
  32. +27
    -0
      Ubiquitous/Nuttx/apps/canutils/libcanard/Kconfig
  33. +39
    -0
      Ubiquitous/Nuttx/apps/canutils/libcanard/Make.defs
  34. +86
    -0
      Ubiquitous/Nuttx/apps/canutils/libcanard/Makefile
  35. +16
    -0
      Ubiquitous/Nuttx/apps/canutils/libcanutils/Kconfig
  36. +23
    -0
      Ubiquitous/Nuttx/apps/canutils/libcanutils/Make.defs
  37. +28
    -0
      Ubiquitous/Nuttx/apps/canutils/libcanutils/Makefile
  38. +609
    -0
      Ubiquitous/Nuttx/apps/canutils/libcanutils/lib.c
  39. +222
    -0
      Ubiquitous/Nuttx/apps/canutils/libcanutils/lib.h
  40. +95
    -0
      Ubiquitous/Nuttx/apps/canutils/libcanutils/terminal.h
  41. +22
    -0
      Ubiquitous/Nuttx/apps/canutils/libobd2/Kconfig
  42. +39
    -0
      Ubiquitous/Nuttx/apps/canutils/libobd2/Make.defs
  43. +42
    -0
      Ubiquitous/Nuttx/apps/canutils/libobd2/Makefile
  44. +126
    -0
      Ubiquitous/Nuttx/apps/canutils/libobd2/obd2.c
  45. +135
    -0
      Ubiquitous/Nuttx/apps/canutils/libobd2/obd_decodepid.c
  46. +151
    -0
      Ubiquitous/Nuttx/apps/canutils/libobd2/obd_sendrequest.c
  47. +160
    -0
      Ubiquitous/Nuttx/apps/canutils/libobd2/obd_waitresponse.c
  48. +21
    -0
      Ubiquitous/Nuttx/apps/canutils/slcan/Kconfig
  49. +24
    -0
      Ubiquitous/Nuttx/apps/canutils/slcan/Make.defs
  50. +34
    -0
      Ubiquitous/Nuttx/apps/canutils/slcan/Makefile
  51. +504
    -0
      Ubiquitous/Nuttx/apps/canutils/slcan/slcan.c
  52. +45
    -0
      Ubiquitous/Nuttx/apps/canutils/slcan/slcan.h
  53. +37
    -0
      Ubiquitous/Nuttx/apps/examples/Make.defs
  54. +38
    -0
      Ubiquitous/Nuttx/apps/examples/Makefile
  55. +2107
    -0
      Ubiquitous/Nuttx/apps/examples/README.md
  56. +30
    -0
      Ubiquitous/Nuttx/apps/examples/abntcodi/Kconfig
  57. +39
    -0
      Ubiquitous/Nuttx/apps/examples/abntcodi/Make.defs
  58. +49
    -0
      Ubiquitous/Nuttx/apps/examples/abntcodi/Makefile
  59. +144
    -0
      Ubiquitous/Nuttx/apps/examples/abntcodi/abntcodi_main.c
  60. +45
    -0
      Ubiquitous/Nuttx/apps/examples/adc/Kconfig
  61. +39
    -0
      Ubiquitous/Nuttx/apps/examples/adc/Make.defs
  62. +49
    -0
      Ubiquitous/Nuttx/apps/examples/adc/Makefile
  63. +90
    -0
      Ubiquitous/Nuttx/apps/examples/adc/adc.h
  64. +358
    -0
      Ubiquitous/Nuttx/apps/examples/adc/adc_main.c
  65. +29
    -0
      Ubiquitous/Nuttx/apps/examples/adxl372_test/Kconfig
  66. +39
    -0
      Ubiquitous/Nuttx/apps/examples/adxl372_test/Make.defs
  67. +47
    -0
      Ubiquitous/Nuttx/apps/examples/adxl372_test/Makefile
  68. +560
    -0
      Ubiquitous/Nuttx/apps/examples/adxl372_test/adxl372_test_main.c
  69. +23
    -0
      Ubiquitous/Nuttx/apps/examples/ajoystick/Kconfig
  70. +39
    -0
      Ubiquitous/Nuttx/apps/examples/ajoystick/Make.defs
  71. +49
    -0
      Ubiquitous/Nuttx/apps/examples/ajoystick/Makefile
  72. +458
    -0
      Ubiquitous/Nuttx/apps/examples/ajoystick/ajoy_main.c
  73. +38
    -0
      Ubiquitous/Nuttx/apps/examples/alarm/Kconfig
  74. +39
    -0
      Ubiquitous/Nuttx/apps/examples/alarm/Make.defs
  75. +49
    -0
      Ubiquitous/Nuttx/apps/examples/alarm/Makefile
  76. +421
    -0
      Ubiquitous/Nuttx/apps/examples/alarm/alarm_main.c
  77. +21
    -0
      Ubiquitous/Nuttx/apps/examples/apa102/Kconfig
  78. +39
    -0
      Ubiquitous/Nuttx/apps/examples/apa102/Make.defs
  79. +49
    -0
      Ubiquitous/Nuttx/apps/examples/apa102/Makefile
  80. +192
    -0
      Ubiquitous/Nuttx/apps/examples/apa102/apa102_main.c
  81. +36
    -0
      Ubiquitous/Nuttx/apps/examples/apds9960/Kconfig
  82. +39
    -0
      Ubiquitous/Nuttx/apps/examples/apds9960/Make.defs
  83. +49
    -0
      Ubiquitous/Nuttx/apps/examples/apds9960/Makefile
  84. +116
    -0
      Ubiquitous/Nuttx/apps/examples/apds9960/apds9960_main.c
  85. +26
    -0
      Ubiquitous/Nuttx/apps/examples/audio_rttl/Kconfig
  86. +38
    -0
      Ubiquitous/Nuttx/apps/examples/audio_rttl/Make.defs
  87. +58
    -0
      Ubiquitous/Nuttx/apps/examples/audio_rttl/Makefile
  88. +374
    -0
      Ubiquitous/Nuttx/apps/examples/audio_rttl/audio_rttl.cxx
  89. +37
    -0
      Ubiquitous/Nuttx/apps/examples/audio_rttl/audio_rttl.h
  90. +39
    -0
      Ubiquitous/Nuttx/apps/examples/bastest/Kconfig
  91. +39
    -0
      Ubiquitous/Nuttx/apps/examples/bastest/Make.defs
  92. +72
    -0
      Ubiquitous/Nuttx/apps/examples/bastest/Makefile
  93. +1876
    -0
      Ubiquitous/Nuttx/apps/examples/bastest/README.md
  94. +121
    -0
      Ubiquitous/Nuttx/apps/examples/bastest/bastest_main.c
  95. +10
    -0
      Ubiquitous/Nuttx/apps/examples/bastest/tests/test01.bas
  96. +7
    -0
      Ubiquitous/Nuttx/apps/examples/bastest/tests/test02.bas
  97. +16
    -0
      Ubiquitous/Nuttx/apps/examples/bastest/tests/test03.bas
  98. +5
    -0
      Ubiquitous/Nuttx/apps/examples/bastest/tests/test04.bas
  99. +7
    -0
      Ubiquitous/Nuttx/apps/examples/bastest/tests/test05.bas
  100. +11
    -0
      Ubiquitous/Nuttx/apps/examples/bastest/tests/test06.bas

+ 235
- 0
Ubiquitous/Nuttx/apps/Application.mk View File

@ -0,0 +1,235 @@
############################################################################
# apps/Application.mk
#
# Copyright (C) 2015 Gregory Nutt. All rights reserved.
# Copyright (C) 2015 Omni Hoverboards Inc. All rights reserved.
# Authors: Gregory Nutt <gnutt@nuttx.org>
# Paul Alexander Patience <paul-a.patience@polymtl.ca>
#
# 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.
#
############################################################################
# If this is an executable program (with MAINSRC), we must build it as a
# loadable module for the KERNEL build (always) or if the tristate module
# has the value "m"
ifneq ($(MAINSRC),)
ifeq ($(MODULE),m)
BUILD_MODULE = y
endif
ifeq ($(CONFIG_BUILD_KERNEL),y)
BUILD_MODULE = y
endif
endif
# The GNU make CURDIR will always be a POSIX-like path with forward slashes
# as path segment separators. If we know that this is a native build, then
# we need to fix up the path so the DELIM will match the actual delimiter.
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
CWD = $(strip ${shell echo %CD% | cut -d: -f2})
else
CWD = $(CURDIR)
endif
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
LDLIBS += "${shell cygpath -w $(BIN)}"
else
LDLIBS += $(BIN)
endif
SUFFIX = $(subst $(DELIM),.,$(CWD))
PROGNAME := $(shell echo $(PROGNAME))
# Object files
RASRCS = $(filter %.s,$(ASRCS))
CASRCS = $(filter %.S,$(ASRCS))
RAOBJS = $(RASRCS:.s=$(SUFFIX)$(OBJEXT))
CAOBJS = $(CASRCS:.S=$(SUFFIX)$(OBJEXT))
COBJS = $(CSRCS:.c=$(SUFFIX)$(OBJEXT))
CXXOBJS = $(CXXSRCS:$(CXXEXT)=$(SUFFIX)$(OBJEXT))
MAINCXXSRCS = $(filter %$(CXXEXT),$(MAINSRC))
MAINCSRCS = $(filter %.c,$(MAINSRC))
MAINCXXOBJ = $(MAINCXXSRCS:$(CXXEXT)=$(SUFFIX)$(OBJEXT))
MAINCOBJ = $(MAINCSRCS:.c=$(SUFFIX)$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS) $(MAINSRC)
OBJS = $(RAOBJS) $(CAOBJS) $(COBJS) $(CXXOBJS)
ifneq ($(BUILD_MODULE),y)
OBJS += $(MAINCOBJ) $(MAINCXXOBJ)
endif
DEPPATH += --dep-path .
DEPPATH += --obj-path .
DEPPATH += --obj-suffix $(SUFFIX)$(OBJEXT)
VPATH += :.
# Targets follow
all:: $(OBJS)
.PHONY: clean depend distclean
.PRECIOUS: $(BIN)
define ELFASSEMBLE
@echo "AS: $1"
$(Q) $(CC) -c $(AELFFLAGS) $($(strip $1)_AELFFLAGS) $1 -o $2
endef
define ELFCOMPILE
@echo "CC: $1"
$(Q) $(CC) -c $(CELFFLAGS) $($(strip $1)_CELFFLAGS) $1 -o $2
endef
define ELFCOMPILEXX
@echo "CXX: $1"
$(Q) $(CXX) -c $(CXXELFFLAGS) $($(strip $1)_CXXELFFLAGS) $1 -o $2
endef
define ELFLD
@echo "LD: $2"
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) $(ARCHCRT0OBJ) $1 $(LDLIBS) -o $2
endef
$(RAOBJS): %$(SUFFIX)$(OBJEXT): %.s
$(if $(and $(CONFIG_BUILD_LOADABLE),$(AELFFLAGS)), \
$(call ELFASSEMBLE, $<, $@), $(call ASSEMBLE, $<, $@))
$(CAOBJS): %$(SUFFIX)$(OBJEXT): %.S
$(if $(and $(CONFIG_BUILD_LOADABLE),$(AELFFLAGS)), \
$(call ELFASSEMBLE, $<, $@), $(call ASSEMBLE, $<, $@))
$(COBJS): %$(SUFFIX)$(OBJEXT): %.c
$(if $(and $(CONFIG_BUILD_LOADABLE),$(CELFFLAGS)), \
$(call ELFCOMPILE, $<, $@), $(call COMPILE, $<, $@))
$(CXXOBJS): %$(SUFFIX)$(OBJEXT): %$(CXXEXT)
$(if $(and $(CONFIG_BUILD_LOADABLE),$(CXXELFFLAGS)), \
$(call ELFCOMPILEXX, $<, $@), $(call COMPILEXX, $<, $@))
archive:
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
$(call ARCHIVE_ADD, "${shell cygpath -w $(BIN)}", $(OBJS))
else
$(call ARCHIVE_ADD, $(BIN), $(OBJS))
endif
ifeq ($(BUILD_MODULE),y)
$(MAINCXXOBJ): %$(SUFFIX)$(OBJEXT): %$(CXXEXT)
$(if $(and $(CONFIG_BUILD_LOADABLE),$(CXXELFFLAGS)), \
$(call ELFCOMPILEXX, $<, $@), $(call COMPILEXX, $<, $@))
$(MAINCOBJ): %$(SUFFIX)$(OBJEXT): %.c
$(if $(and $(CONFIG_BUILD_LOADABLE),$(CELFFLAGS)), \
$(call ELFCOMPILE, $<, $@), $(call COMPILE, $<, $@))
PROGLIST := $(wordlist 1,$(words $(MAINCOBJ) $(MAINCXXOBJ)),$(PROGNAME))
PROGLIST := $(addprefix $(BINDIR)$(DELIM),$(PROGLIST))
PROGOBJ := $(MAINCOBJ) $(MAINCXXOBJ)
$(PROGLIST): $(MAINCOBJ) $(MAINCXXOBJ)
$(Q) mkdir -p $(BINDIR)
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
$(call ELFLD,$(firstword $(PROGOBJ)),"${shell cygpath -w $(firstword $(PROGLIST))}")
else
$(call ELFLD,$(firstword $(PROGOBJ)),$(firstword $(PROGLIST)))
endif
$(Q) chmod +x $(firstword $(PROGLIST))
ifneq ($(CONFIG_DEBUG_SYMBOLS),y)
$(Q) $(STRIP) $(firstword $(PROGLIST))
endif
$(eval PROGLIST=$(filter-out $(firstword $(PROGLIST)),$(PROGLIST)))
$(eval PROGOBJ=$(filter-out $(firstword $(PROGOBJ)),$(PROGOBJ)))
install:: $(PROGLIST)
else
MAINNAME := $(addsuffix _main,$(PROGNAME))
$(MAINCXXOBJ): %$(SUFFIX)$(OBJEXT): %$(CXXEXT)
$(eval $<_CXXFLAGS += ${shell $(DEFINE) "$(CXX)" main=$(firstword $(MAINNAME))})
$(eval $<_CXXELFFLAGS += ${shell $(DEFINE) "$(CXX)" main=$(firstword $(MAINNAME))})
$(eval MAINNAME=$(filter-out $(firstword $(MAINNAME)),$(MAINNAME)))
$(if $(and $(CONFIG_BUILD_LOADABLE),$(CXXELFFLAGS)), \
$(call ELFCOMPILEXX, $<, $@), $(call COMPILEXX, $<, $@))
$(MAINCOBJ): %$(SUFFIX)$(OBJEXT): %.c
$(eval $<_CFLAGS += ${shell $(DEFINE) "$(CC)" main=$(firstword $(MAINNAME))})
$(eval $<_CELFFLAGS += ${shell $(DEFINE) "$(CC)" main=$(firstword $(MAINNAME))})
$(eval MAINNAME=$(filter-out $(firstword $(MAINNAME)),$(MAINNAME)))
$(if $(and $(CONFIG_BUILD_LOADABLE),$(CELFFLAGS)), \
$(call ELFCOMPILE, $<, $@), $(call COMPILE, $<, $@))
install::
endif # BUILD_MODULE
context::
ifneq ($(PROGNAME),)
REGLIST := $(addprefix $(BUILTIN_REGISTRY)$(DELIM),$(addsuffix .bdat,$(PROGNAME)))
APPLIST := $(PROGNAME)
$(REGLIST): $(DEPCONFIG) Makefile
$(call REGISTER,$(firstword $(APPLIST)),$(firstword $(PRIORITY)),$(firstword $(STACKSIZE)),$(if $(BUILD_MODULE),,$(firstword $(APPLIST))_main))
$(eval APPLIST=$(filter-out $(firstword $(APPLIST)),$(APPLIST)))
$(if $(filter-out $(firstword $(PRIORITY)),$(PRIORITY)),$(eval PRIORITY=$(filter-out $(firstword $(PRIORITY)),$(PRIORITY))))
$(if $(filter-out $(firstword $(STACKSIZE)),$(STACKSIZE)),$(eval STACKSIZE=$(filter-out $(firstword $(STACKSIZE)),$(STACKSIZE))))
register:: $(REGLIST)
else
register::
endif
.depend: Makefile $(wildcard $(foreach SRC, $(SRCS), $(addsuffix /$(SRC), $(subst :, ,$(VPATH))))) $(DEPCONFIG)
ifeq ($(filter %$(CXXEXT),$(SRCS)),)
$(Q) $(MKDEP) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(filter-out Makefile,$(filter-out $(DEPCONFIG),$^)) >Make.dep
else
$(Q) $(MKDEP) $(DEPPATH) "$(CXX)" -- $(CXXFLAGS) -- $(filter-out Makefile,$(filter-out $(DEPCONFIG),$^)) >Make.dep
endif
$(Q) touch $@
depend:: .depend
clean::
$(call CLEAN)
distclean:: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
-include Make.dep

+ 20
- 0
Ubiquitous/Nuttx/apps/DISCLAIMER-WIP View File

@ -0,0 +1,20 @@
Apache NuttX is an effort undergoing incubation at The Apache Software Foundation (ASF),
sponsored by the Apache Incubator. Incubation is required of all newly accepted projects
until a further review indicates that the infrastructure, communications, and decision
making process have stabilized in a manner consistent with other successful ASF projects.
While incubation status is not necessarily a reflection of the completeness or stability
of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
Some of the incubating project's releases may not be fully compliant with ASF policy. For
example, releases may have incomplete or un-reviewed licensing conditions. What follows is
a list of known issues the project is currently aware of (note that this list, by definition,
is likely to be incomplete):
* Releases may have incomplete licensing conditions.
* Some ASF files still have BSD headers. Most of the top contributors have signed an ICLA and
we are working on updating the headers and getting approvals from other copyright holders.
If you are planning to incorporate this work into your product/project, please be aware that
you will need to conduct a thorough licensing review to determine the overall implications of
including this work. For the current status of this project through the Apache Incubator
visit: https://incubator.apache.org/projects/nuttx.html

+ 72
- 0
Ubiquitous/Nuttx/apps/Directory.mk View File

@ -0,0 +1,72 @@
############################################################################
# apps/Directory.mk
#
# Copyright (C) 2011-2015, 2018 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 $(APPDIR)/Make.defs
# Sub-directories that have been built or configured.
SUBDIRS := $(dir $(wildcard *$(DELIM)Makefile))
CONFIGSUBDIRS := $(filter-out $(dir $(wildcard *$(DELIM)Kconfig)),$(SUBDIRS))
CLEANSUBDIRS += $(dir $(wildcard *$(DELIM).depend))
CLEANSUBDIRS += $(dir $(wildcard *$(DELIM).kconfig))
CLEANSUBDIRS := $(sort $(CLEANSUBDIRS))
all: nothing
.PHONY: nothing clean distclean
$(foreach SDIR, $(CONFIGSUBDIRS), $(eval $(call SDIR_template,$(SDIR),preconfig)))
$(foreach SDIR, $(CLEANSUBDIRS), $(eval $(call SDIR_template,$(SDIR),clean)))
$(foreach SDIR, $(CLEANSUBDIRS), $(eval $(call SDIR_template,$(SDIR),distclean)))
nothing:
install:
preconfig: $(foreach SDIR, $(CONFIGSUBDIRS), $(SDIR)_preconfig)
ifneq ($(MENUDESC),)
$(Q) $(MKKCONFIG) -m $(MENUDESC)
$(Q) touch .kconfig
endif
clean: $(foreach SDIR, $(CLEANSUBDIRS), $(SDIR)_clean)
distclean: $(foreach SDIR, $(CLEANSUBDIRS), $(SDIR)_distclean)
ifneq ($(MENUDESC),)
$(call DELFILE, Kconfig)
$(call DELFILE, .kconfig)
endif
-include Make.dep

+ 489
- 0
Ubiquitous/Nuttx/apps/LICENSE View File

@ -0,0 +1,489 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
------------------------------------------------------------------------------
uIP
===
Some lower-level networking middle-ware components of NuttX
derive from uIP which has a similar BSD style license:
Copyright (c) 2001-2003, Adam Dunkels.
All rights reserved.
FreeModbus
==========
FreeModbus Library: A portable Modbus implementation for Modbus ASCII/RTU.
Copyright (c) 2006 Christian Walter <wolti@sil.at>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Mini Basic
==========
The Mini Basic implementation at apps/interpreters derives from version 1.0
by Malcolm McLean, Leeds University, and was released under the Creative
Commons Attibution license. I am not legal expert, but this license
appears to be compatible with the NuttX BSD license see:
https://creativecommons.org/licenses/ . I, however, cannot take
responsibility for any actions that you might take based on my
understanding. Please use your own legal judgement.
THTTPD
======
Derived from the original THTTPD package:
Copyright © 1995,1998,1999,2000,2001 by Jef Poskanzer <jef@mail.acme.com>.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
cJSON
=====
Derives from the cJSON Project which has an MIT license:
Copyright (c) 2009 Dave Gamble
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
apps/netutils/pppd
==================
This implementation of PPPD has a license that is mostly compatible the
NuttX 3-clause BSD license, but includes a fourth clause that required
acknowledgement of Mike Johnson/Mycal Labs if it is built into your
product:
Copyright (C) 2000, Mycal Labs www.mycal.com
Copyright (c) 2003, Mike Johnson, Mycal Labs, www.mycal.net
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by Mike Johnson/Mycal Labs
www.mycal.net.
4. The name of the author may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
apps/testing/scanftest/scanftest_main.c
=======================================
Derives from the cc65 Project which has a zlib license:
Copyright (C) 2005-01-26, Greg King (https://github.com/cc65)
Original License:
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from
the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software in
a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
apps/webserver
==============
This has a license that is mostly compatible the NuttX 3-clause BSD license,
but includes a fourth clause that required acknowledgement of Adam Dunkels
if it is built into your product:
Copyright (c) 2001, Adam Dunkels.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by Adam Dunkels.
4. The name of the author may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
apps/examples/lvgldemo
======================
Derives from the lvgl Project which has an MIT license:
Copyright (C) 2019 Gábor Kiss-Vámosi. All rights reserved.
Author: Gábor Kiss-Vámosi <kisvegabor@gmail.com>
Released under the following BSD-compatible MIT license:
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
canutils/candump
================
Includes five dual licensed third part files from Volkswagon with
licensing as follows (Copyright dates vary from file-to-file):
SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
Copyright (c) 2002-2009 Volkswagen Group Electronic Research
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of Volkswagen nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
Alternatively, provided that this notice is retained in full, this
software may be distributed under the terms of the GNU General
Public License ("GPL") version 2, in which case the provisions of the
GPL apply INSTEAD OF those given above.
The provided data structures and external interfaces from this code
are not restricted to be used by modules with a GPL compatible license.
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.
Send feedback to <linux-can@vger.kernel.org>

+ 120
- 0
Ubiquitous/Nuttx/apps/Make.defs View File

@ -0,0 +1,120 @@
############################################################################
# apps/Make.defs
# Common make definitions provided to all applications
#
# Copyright (C) 2011, 2014, 2016, 2018 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.
#
############################################################################
TOPDIR ?= $(APPDIR)/import
include $(TOPDIR)/Make.defs
# The GNU make CURDIR will always be a POSIX-like path with forward slashes
# as path segment separators. This is fine for the above inclusions but
# will cause problems later for the native build. If we know that this is
# a native build, then we need to fix up the APPDIR path for subsequent
# use
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
APPDIR := ${shell echo %CD%}
endif
# Application Directories
# BUILDIRS is the list of top-level directories containing Make.defs files
# CLEANDIRS is the list of all top-level directories containing Makefiles.
# It is used only for cleaning.
BUILDIRS := $(dir $(wildcard $(APPDIR)$(DELIM)*$(DELIM)Make.defs))
BUILDIRS := $(filter-out $(APPDIR)$(DELIM)import$(DELIM),$(BUILDIRS))
CONFIGDIRS := $(filter-out $(APPDIR)$(DELIM)builtin$(DELIM),$(BUILDIRS))
CONFIGDIRS := $(filter-out $(dir $(wildcard $(APPDIR)$(DELIM)*$(DELIM)Kconfig)),$(CONFIGDIRS))
CLEANDIRS := $(dir $(wildcard $(APPDIR)$(DELIM)*$(DELIM)Makefile))
# CONFIGURED_APPS is the application directories that should be built in
# the current configuration.
CONFIGURED_APPS :=
define Add_Application
include $(1)Make.defs
endef
$(foreach BDIR, $(BUILDIRS), $(eval $(call Add_Application,$(BDIR))))
# File extensions
CXXEXT ?= .cxx
# Library path
LIBPATH ?= $(TOPDIR)$(DELIM)staging
# The install path
BINDIR ?= $(APPDIR)$(DELIM)bin
# The final build target
BIN ?= $(APPDIR)$(DELIM)libapps$(LIBEXT)
# Tools
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
MKKCONFIG ?= $(APPDIR)$(DELIM)tools$(DELIM)mkkconfig.bat
else
MKKCONFIG ?= $(APPDIR)$(DELIM)tools$(DELIM)mkkconfig.sh
endif
# Builtin Registration
BUILTIN_REGISTRY = $(APPDIR)$(DELIM)builtin$(DELIM)registry
DEPCONFIG = $(TOPDIR)$(DELIM).config
define REGISTER
$(Q) echo Register: $1
$(Q) echo { \"$1\", $2, $3, $4 }, > "$(BUILTIN_REGISTRY)$(DELIM)$1.bdat"
$(Q) if [ ! -z $4 ]; then \
echo "int $4(int argc, char *argv[]);" > "$(BUILTIN_REGISTRY)$(DELIM)$1.pdat"; \
fi;
$(Q) touch "$(BUILTIN_REGISTRY)$(DELIM).updated"
endef
# Standard include path
CFLAGS += ${shell $(INCDIR) "$(CC)" "$(APPDIR)$(DELIM)include"}
CXXFLAGS += ${shell $(INCDIR) "$(CC)" "$(APPDIR)$(DELIM)include"}
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
NUTTXLIB ?= "${shell cygpath -w $(TOPDIR)$(DELIM)staging}"
else
NUTTXLIB ?= "$(TOPDIR)$(DELIM)staging"
endif

+ 222
- 0
Ubiquitous/Nuttx/apps/Makefile View File

@ -0,0 +1,222 @@
############################################################################
# apps/Makefile
#
# Copyright (C) 2011 Uros Platise. All rights reserved.
# Copyright (C) 2011-2014, 2018-2019 Gregory Nutt. All rights reserved.
# Authors: Uros Platise <uros.platise@isotel.eu>
# 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.
#
############################################################################
export APPDIR = $(CURDIR)
include $(APPDIR)/Make.defs
# Symbol table for loadable apps.
SYMTABSRC = symtab_apps.c
SYMTABOBJ = $(SYMTABSRC:.c=$(OBJEXT))
# Build targets
# We first remove libapps.a before letting the other rules add objects to it
# so that we ensure libapps.a does not contain objects from prior build
all:
$(RM) $(BIN)
$(MAKE) $(BIN)
.PHONY: import install dirlinks export .depdirs preconfig depend clean distclean
.PHONY: context clean_context context_all register register_all
.PRECIOUS: $(BIN)
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),all)))
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),install)))
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),context)))
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),register)))
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),depend)))
$(foreach SDIR, $(CLEANDIRS), $(eval $(call SDIR_template,$(SDIR),clean)))
$(foreach SDIR, $(CLEANDIRS), $(eval $(call SDIR_template,$(SDIR),distclean)))
$(MKDEP): $(TOPDIR)/tools/mkdeps.c
$(HOSTCC) $(HOSTINCLUDES) $(HOSTCFLAGS) $< -o $@
$(INCDIR): $(TOPDIR)/tools/incdir.c
$(HOSTCC) $(HOSTINCLUDES) $(HOSTCFLAGS) $< -o $@
IMPORT_TOOLS = $(MKDEP) $(INCDIR)
# In the KERNEL build, we must build and install all of the modules. No
# symbol table is needed
ifeq ($(CONFIG_BUILD_KERNEL),y)
install: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_install)
.import: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all)
$(Q) $(MAKE) install
import: $(IMPORT_TOOLS)
$(Q) $(MAKE) context TOPDIR="$(APPDIR)$(DELIM)import"
$(Q) $(MAKE) register TOPDIR="$(APPDIR)$(DELIM)import"
$(Q) $(MAKE) depend TOPDIR="$(APPDIR)$(DELIM)import"
$(Q) $(MAKE) .import TOPDIR="$(APPDIR)$(DELIM)import"
else
# In FLAT and protected modes, the modules have already been created. A
# symbol table is required.
ifeq ($(CONFIG_BUILD_LOADABLE),)
$(BIN): $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all)
$(Q) for app in ${CONFIGURED_APPS}; do \
$(MAKE) -C "$${app}" archive ; \
done
else
$(SYMTABSRC): $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all)
$(Q) for app in ${CONFIGURED_APPS}; do \
$(MAKE) -C "$${app}" archive ; \
done
$(Q) $(MAKE) install
$(Q) $(APPDIR)$(DELIM)tools$(DELIM)mksymtab.sh $(BINDIR) >$@.tmp
$(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
$(SYMTABOBJ): %$(OBJEXT): %.c
$(call COMPILE, -fno-lto $<, $@)
$(BIN): $(SYMTABOBJ)
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
$(call ARCHIVE_ADD, "${shell cygpath -w $(BIN)}", $^)
else
$(call ARCHIVE_ADD, $(BIN), $^)
endif
endif # !CONFIG_BUILD_LOADABLE
install: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_install)
# Link nuttx
HEAD_OBJ += $(wildcard $(APPDIR)$(DELIM)import$(DELIM)startup$(DELIM)*$(OBJEXT))
HEAD_OBJ += $(wildcard $(APPDIR)$(DELIM)builtin$(DELIM)*$(OBJEXT))
.import: $(BIN) install
$(Q) echo "LD: nuttx"
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LDLIBPATH) $(EXTRA_LIBPATHS) \
-L$(APPDIR)$(DELIM)import$(DELIM)scripts -T$(LDNAME) \
-o nuttx$(EXEEXT) $(HEAD_OBJ) $(EXTRA_OBJS) $(LDSTARTGROUP) \
$(BIN) $(LDLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
ifeq ($(CONFIG_INTELHEX_BINARY),y)
$(Q) echo "CP: nuttx.hex"
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O ihex nuttx$(EXEEXT) nuttx.hex
endif
ifeq ($(CONFIG_RAW_BINARY),y)
$(Q) echo "CP: nuttx.bin"
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O binary nuttx$(EXEEXT) nuttx.bin
endif
$(call POSTBUILD, $(APPDIR))
import: $(IMPORT_TOOLS)
$(Q) $(MAKE) context TOPDIR="$(APPDIR)$(DELIM)import"
$(Q) $(MAKE) register TOPDIR="$(APPDIR)$(DELIM)import"
$(Q) $(MAKE) depend TOPDIR="$(APPDIR)$(DELIM)import"
$(Q) $(MAKE) .import TOPDIR="$(APPDIR)$(DELIM)import"
endif # CONFIG_BUILD_KERNEL
dirlinks:
$(Q) $(MAKE) -C platform dirlinks
context_all: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_context)
register_all: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_register)
context:
$(Q) $(MAKE) context_all
$(Q) $(MAKE) register_all
Kconfig:
$(foreach SDIR, $(CONFIGDIRS), $(call MAKE_template,$(SDIR),preconfig))
$(Q) $(MKKCONFIG)
preconfig: Kconfig
export:
ifneq ($(EXPORTDIR),)
ifneq ($(BUILTIN_REGISTRY),)
$(Q) mkdir -p "${EXPORTDIR}"/registry || exit 1; \
for f in "${BUILTIN_REGISTRY}"/*.bdat "${BUILTIN_REGISTRY}"/*.pdat ; do \
[ -f "$${f}" ] && cp -f "$${f}" "${EXPORTDIR}"/registry ; \
done
endif
endif
.depdirs: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_depend)
.depend: Makefile .depdirs
$(Q) touch $@
depend: .depend
clean_context:
$(Q) $(MAKE) -C platform clean_context
$(Q) $(MAKE) -C builtin clean_context
clean: $(foreach SDIR, $(CLEANDIRS), $(SDIR)_clean)
$(call DELFILE, $(SYMTABSRC))
$(call DELFILE, $(SYMTABOBJ))
$(call DELFILE, $(BIN))
$(call DELFILE, Kconfig)
$(call DELDIR, $(BINDIR))
$(call CLEAN)
distclean: $(foreach SDIR, $(CLEANDIRS), $(SDIR)_distclean)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
$(Q) ( if exist external ( \
echo ********************************************************" \
echo * The external directory/link must be removed manually *" \
echo ********************************************************" \
)
else
$(Q) ( if [ -e external ]; then \
echo "********************************************************"; \
echo "* The external directory/link must be removed manually *"; \
echo "********************************************************"; \
fi; \
)
endif
$(call DELFILE, .depend)
$(call DELFILE, $(SYMTABSRC))
$(call DELFILE, $(SYMTABOBJ))
$(call DELFILE, $(BIN))
$(call DELFILE, Kconfig)
$(call DELDIR, $(BINDIR))
$(call CLEAN)

+ 5
- 0
Ubiquitous/Nuttx/apps/NOTICE View File

@ -0,0 +1,5 @@
Apache NuttX
Copyright 2020 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).

+ 239
- 0
Ubiquitous/Nuttx/apps/README.md View File

@ -0,0 +1,239 @@
# Application Folder
## Contents
- General
- Directory Location
- Built-In Applications
- NuttShell (NSH) Built-In Commands
- Synchronous Built-In Commands
- Application Configuration File
- Example Built-In Application
- Building NuttX with Board-Specific Pieces Outside the Source Tree
## General
This folder provides various applications found in sub-directories. These
applications are not inherently a part of NuttX but are provided to help you
develop your own applications. The `apps/` directory is a _break away_ part of
the configuration that you may choose to use or not.
## Directory Location
The default application directory used by the NuttX build should be named
`apps/` (or `apps-x.y.z/` where `x.y.z` is the NuttX version number). This
`apps/` directory should appear in the directory tree at the same level as the
NuttX directory. Like:
```
.
|- nuttx
|
`- apps
```
If all of the above conditions are TRUE, then NuttX will be able to find the
application directory. If your application directory has a different name or is
location at a different position, then you will have to inform the NuttX build
system of that location. There are several ways to do that:
1) You can define `CONFIG_APPS_DIR` to be the full path to your application
directory in the NuttX configuration file.
2) You can provide the path to the application directory on the command line
like: `make APPDIR=<path>` or `make CONFIG_APPS_DIR=<path>`
3) When you configure NuttX using `tools/configure.sh`, you can provide that
path to the application directory on the configuration command line like:
`./configure.sh -a <app-dir> <board-name>:<config-name>`
## Built-In Applications
NuttX also supports applications that can be started using a name string. In
this case, application entry points with their requirements are gathered
together in two files:
- `builtin/builtin_proto.h` – Entry points, prototype function
- `builtin/builtin_list.h` – Application specific information and requirements
The build occurs in several phases as different build targets are executed: (1)
context, (2) depend, and (3) default (all). Application information is collected
during the make context build phase.
To execute an application function:
`exec_builtin()` is defined in the `nuttx/include/apps/builtin/builtin.h`.
## NuttShell (NSH) Built-In Commands
One use of builtin applications is to provide a way of invoking your custom
application through the NuttShell (NSH) command line. NSH will support a
seamless method invoking the applications, when the following option is enabled
in the NuttX configuration file:
```conf
CONFIG_NSH_BUILTIN_APPS=y
```
Applications registered in the `apps/builtin/builtin_list.h` file will then be
accessible from the NSH command line. If you type `help` at the NSH prompt, you
will see a list of the registered commands.
## Synchronous Built-In Commands
By default, built-in commands started from the NSH command line will run
asynchronously with NSH. If you want to force NSH to execute commands then wait
for the command to execute, you can enable that feature by adding the following
to the NuttX configuration file:
```conf
CONFIG_SCHED_WAITPID=y
```
The configuration option enables support for the `waitpid()` RTOS interface.
When that interface is enabled, NSH will use it to wait, sleeping until the
built-in command executes to completion.
Of course, even with `CONFIG_SCHED_WAITPID=y` defined, specific commands can
still be forced to run asynchronously by adding the ampersand (`&`) after the
NSH command.
## Application Configuration File
The NuttX configuration uses `kconfig-frontends` tools and the NuttX
configuration file (`.config`) file. For example, the NuttX `.config` may have:
```conf
CONFIG_EXAMPLES_HELLO=y
```
This will select the `apps/examples/hello` in the following way:
- The top-level make will include `examples/Make.defs`
- `examples/Make.defs` will set `CONFIGURED_APPS += $(APPDIR)/examples/hello`
like this:
```makefile
ifneq ($(CONFIG_EXAMPLES_HELLO),)
CONFIGURED_APPS += $(APPDIR)/examples/hello
endif
```
## Example Built-In Application
An example application skeleton can be found under the `examples/hello`
sub-directory. This example shows how a builtin application can be added to the
project. One must:
1. Create sub-directory as: progname
2. In this directory there should be:
- A `Make.defs` file that would be included by the `apps/Makefile`
- A `Kconfig` file that would be used by the configuration tool (see the
file `kconfig-language.txt` in the NuttX tools repository). This `Kconfig`
file should be included by the `apps/Kconfig` file
- A `Makefile`, and
- The application source code.
3. The application source code should provide the entry point:
```c
main()
```
4. Set the requirements in the file: `Makefile`, specially the lines:
```makefile
PROGNAME = progname
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 768
ASRCS = asm source file list as a.asm b.asm ...
CSRCS = C source file list as foo1.c foo2.c ..
```
5. The `Make.defs` file should include a line like:
```makefile
ifneq ($(CONFIG_PROGNAME),)
CONFIGURED_APPS += progname
endif
```
## Building NuttX with Board-Specific Pieces Outside the Source Tree
Q: Has anyone come up with a tidy way to build NuttX with board- specific pieces
outside the source tree?
A: Here are three:
1) There is a make target called `make export`. It will build NuttX, then
bundle all of the header files, libraries, startup objects, and other
build components into a `.zip` file. You can move that `.zip` file into
any build environment you want. You can even build NuttX under a DOS `CMD`
window.
This make target is documented in the top level `nuttx/README.txt`.
2) You can replace the entire `apps/` directory. If there is nothing in the
`apps/` directory that you need, you can define `CONFIG_APPS_DIR` in your
`.config` file so that it points to a different, custom application
directory.
You can copy any pieces that you like from the old apps/directory to your
custom apps directory as necessary.
This is documented in `NuttX/boards/README.txt` and
`nuttx/Documentation/NuttXPortingGuide.html` (Online at
https://bitbucket.org/nuttx/nuttx/src/master/Documentation/NuttXPortingGuide.html#apndxconfigs
under _Build options_). And in the `apps/README.txt` file.
3) If you like the random collection of stuff in the `apps/` directory but
just want to expand the existing components with your own, external
sub-directory then there is an easy way to that too: You just create a
symbolic link in the `apps/` directory that redirects to your application
sub-directory.
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 `Makefile`s for examples),
and (2) a tiny `Make.defs` file that simply adds the custom build
directories to the variable `CONFIGURED_APPS` like:
```makefile
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
`Makefile`s 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 directory:
a) Copy `MyBoard` directory to `boards/MyBoard`.
b) Add a symbolic link to `MyApplication` at `apps/external`.
c) Configure NuttX, usually by:
```bash
tools/configure.sh MyBoard:MyConfiguration
```
Use of the name `apps/external` is suggested because that name is included
in the `.gitignore` file and will save you some nuisance when working with
GIT.

+ 39
- 0
Ubiquitous/Nuttx/apps/builtin/Make.defs View File

@ -0,0 +1,39 @@
############################################################################
# apps/builtin/Make.defs
# Adds selected applications to apps/ build
#
# Copyright (C) 2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
ifeq ($(CONFIG_BUILTIN),y)
CONFIGURED_APPS += $(APPDIR)/builtin
endif

+ 81
- 0
Ubiquitous/Nuttx/apps/builtin/Makefile View File

@ -0,0 +1,81 @@
############################################################################
# apps/builtin/Makefile
#
# Copyright (C) 2011-2012, 2018 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 $(APPDIR)/Make.defs
# Source and object files
CSRCS = builtin_list.c exec_builtin.c
# Registry entry lists
PDATLIST = $(strip $(call RWILDCARD, registry, *.pdat))
BDATLIST = $(strip $(call RWILDCARD, registry, *.bdat))
builtin_list.c: builtin_list.h builtin_proto.h
registry$(DELIM).updated:
$(Q) touch registry$(DELIM).updated
builtin_list.h: registry$(DELIM).updated
ifeq ($(BDATLIST),)
$(call DELFILE, builtin_list.h)
$(Q) touch builtin_list.h
else
$(call CATFILE, builtin_list.h, $(BDATLIST))
endif
builtin_proto.h: registry$(DELIM).updated
ifeq ($(PDATLIST),)
$(call DELFILE, builtin_proto.h)
$(Q) touch builtin_proto.h
else
$(call CATFILE, builtin_proto.h, $(PDATLIST))
endif
depend:: builtin_list.h builtin_proto.h
clean::
$(call DELFILE, builtin_list.h)
$(call DELFILE, builtin_proto.h)
clean_context::
$(call DELFILE, $(PDATLIST))
$(call DELFILE, $(BDATLIST))
distclean:: clean_context clean
$(call DELFILE, registry$(DELIM).updated)
include $(APPDIR)/Application.mk

+ 78
- 0
Ubiquitous/Nuttx/apps/builtin/builtin_list.c View File

@ -0,0 +1,78 @@
/****************************************************************************
* apps/builtin/builtin_list.c
*
* Copyright (C) 2011 Uros Platise. All rights reserved.
* Copyright (C) 2011, 2019 Gregory Nutt. All rights reserved.
* Authors: Uros Platise <uros.platise@isotel.eu>
* 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/lib/builtin.h>
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
#include "builtin_proto.h"
const struct builtin_s g_builtins[] =
{
# include "builtin_list.h"
{ NULL, 0, 0, 0 }
};
const int g_builtin_count = sizeof(g_builtins) / sizeof(g_builtins[0]);
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/

+ 228
- 0
Ubiquitous/Nuttx/apps/builtin/exec_builtin.c View File

@ -0,0 +1,228 @@
/****************************************************************************
* apps/builtin/exec_builtin.c
*
* Originally by:
*
* Copyright (C) 2011 Uros Platise. All rights reserved.
* Author: Uros Platise <uros.platise@isotel.eu>
*
* With subsequent updates, modifications, and general maintenance by:
*
* Copyright (C) 2012-2013 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <spawn.h>
#include <fcntl.h>
#include <errno.h>
#include <debug.h>
#include "builtin/builtin.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: exec_builtin
*
* Description:
* Executes builtin applications registered during 'make context' time.
* New application is run in a separate task context (and thread).
*
* Input Parameter:
* filename - Name of the linked-in binary to be started.
* argv - Argument list
* redirfile - If output if redirected, this parameter will be non-NULL
* and will provide the full path to the file.
* oflags - If output is redirected, this parameter will provide the
* open flags to use. This will support file replacement
* of appending to an existing file.
*
* Returned Value:
* This is an end-user function, so it follows the normal convention:
* Returns the PID of the exec'ed module. On failure, it.returns
* -1 (ERROR) and sets errno appropriately.
*
****************************************************************************/
int exec_builtin(FAR const char *appname, FAR char * const *argv,
FAR const char *redirfile, int oflags)
{
FAR const struct builtin_s *builtin;
posix_spawnattr_t attr;
posix_spawn_file_actions_t file_actions;
struct sched_param param;
pid_t pid;
int index;
int ret;
/* Verify that an application with this name exists */
index = builtin_isavail(appname);
if (index < 0)
{
ret = ENOENT;
goto errout_with_errno;
}
/* Get information about the builtin */
builtin = builtin_for_index(index);
if (builtin == NULL)
{
ret = ENOENT;
goto errout_with_errno;
}
/* Initialize attributes for task_spawn(). */
ret = posix_spawnattr_init(&attr);
if (ret != 0)
{
goto errout_with_errno;
}
ret = posix_spawn_file_actions_init(&file_actions);
if (ret != 0)
{
goto errout_with_attrs;
}
/* Set the correct task size and priority */
param.sched_priority = builtin->priority;
ret = posix_spawnattr_setschedparam(&attr, &param);
if (ret != 0)
{
goto errout_with_actions;
}
ret = task_spawnattr_setstacksize(&attr, builtin->stacksize);
if (ret != 0)
{
goto errout_with_actions;
}
/* If robin robin scheduling is enabled, then set the scheduling policy
* of the new task to SCHED_RR before it has a chance to run.
*/