forked from Archive/PX4-Autopilot
Merge commit '0f2decb70f505b108999fcdb80e89d7aae6760ce' into nuttx-merge-0f2decb
This commit is contained in:
commit
dc50d96b5d
|
@ -0,0 +1,137 @@
|
|||
COPYING -- Describes the terms under which Nuttx is distributed. A
|
||||
copy of the BSD-style licensing is included in this file. In my
|
||||
words -- I believe that you should free to use NuttX in any
|
||||
environment, private, private, commercial, open, closed, etc.
|
||||
provided only that you repect the modest copyright notices as
|
||||
described in license (below). Please feel free to contact me if you
|
||||
have any licensing concerns.
|
||||
|
||||
NuttX
|
||||
^^^^^^
|
||||
|
||||
License for NuttX in general (authorship of individual files may vary):
|
||||
|
||||
Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
|
||||
Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
3. Neither the name NuttX nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
uIP
|
||||
^^^
|
||||
|
||||
Some lower-level networking middle-ware components of NuttX
|
||||
derive from uIP which has a similar BSD style license:
|
||||
|
||||
Copyright (c) 2001-2003, Adam Dunkels.
|
||||
All rights reserved.
|
||||
|
||||
FreeModbus
|
||||
^^^^^^^^^
|
||||
|
||||
FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
|
||||
Copyright (c) 2006 Christian Walter <wolti@sil.at>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
THTTPD
|
||||
^^^^^^
|
||||
|
||||
Derived from the original THTTPD package:
|
||||
|
||||
Copyright © 1995,1998,1999,2000,2001 by Jef Poskanzer <jef@mail.acme.com>.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
cJSON
|
||||
^^^^^
|
||||
|
||||
Derives from the cJSON Project which has an MIT license:
|
||||
|
||||
Copyright (c) 2009 Dave Gamble
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
6.3 2011-05-15 Gregory Nutt <gnutt@nuttx.org>
|
||||
|
||||
* apps/interpreter: Add a directory to hold interpreters. The Pascal add-
|
||||
* apps/interpreter: Add a directory to hold interpreters. The Pascal add-
|
||||
on module now installs and builds under this directory.
|
||||
* apps/interpreter/ficl: Added logic to build Ficl (the "Forth Inspired
|
||||
Command Language"). See http://ficl.sourceforge.net/.
|
||||
|
@ -349,7 +349,7 @@
|
|||
* apps/NxWidgets/Kconfig: Add option to turn on the memory monitor
|
||||
feature of the NxWidgets/NxWM unit tests.
|
||||
|
||||
6.23 2012-xx-xx Gregory Nutt <gnutt@nuttx.org>
|
||||
6.23 2012-11-05 Gregory Nutt <gnutt@nuttx.org>
|
||||
|
||||
* vsn: Moved all NSH commands from vsn/ to system/. Deleted the vsn/
|
||||
directory.
|
||||
|
@ -368,3 +368,70 @@
|
|||
recent check-ins (Darcy Gong).
|
||||
* apps/netutils/webclient/webclient.c: Fix another but that I introduced
|
||||
when I was trying to add correct handling for loss of connection (Darcy Gong)
|
||||
* apps/nshlib/nsh_telnetd.c: Add support for login to Telnet session via
|
||||
username and password (Darcy Gong).
|
||||
* apps/netutils/resolv/resolv.c (and files using the DNS resolver): Various
|
||||
DNS address resolution improvements from Darcy Gong.
|
||||
* apps/nshlib/nsh_netcmds.c: The ping command now passes a maximum round
|
||||
trip time to uip_icmpping(). This allows pinging of hosts on complex
|
||||
networks where the ICMP ECHO round trip time may exceed the ping interval.
|
||||
* apps/examples/nxtext/nxtext_main.c: Fix bad conditional compilation
|
||||
when CONFIG_NX_KBD is not defined. Submitted by Petteri Aimonen.
|
||||
* apps/examples/nximage/nximage_main.c: Add a 5 second delay after the
|
||||
NX logo is presented so that there is time for the image to be verified.
|
||||
Suggested by Petteri Aimonen.
|
||||
* apps/Makefile: Small change that reduces the number of shell invocations
|
||||
by one (Mike Smith).
|
||||
* apps/examples/elf: Test example for the ELF loader.
|
||||
* apps/examples/elf: The ELF module test example appears fully functional.
|
||||
* apps/netutils/json: Add a snapshot of the cJSON project. Contributed by
|
||||
Darcy Gong.
|
||||
* apps/examples/json: Test example for cJSON from Darcy Gong
|
||||
* apps/nshlib/nsh_netinit.c: Fix static IP DNS problem (Darcy Gong)
|
||||
* apps/netutils/resolv/resolv.c: DNS fixes from Darcy Gong.
|
||||
* COPYING: Licensing information added.
|
||||
* apps/netutils/codec and include/netutils/urldecode.h, base64.h, and md5.h:
|
||||
A port of the BASE46, MD5 and URL CODEC library from Darcy Gong.
|
||||
* nsnlib/nsh_codeccmd.c: NSH commands to use the CODEC library.
|
||||
Contributed by Darcy Gong.
|
||||
* apps/examples/wgetjson: Test example contributed by Darcy Gong
|
||||
* apps/examples/cxxtest: A test for the uClibc++ library provided by
|
||||
Qiang Yu and the RGMP team.
|
||||
* apps/netutils/webclient, apps/netutils.codes, and apps/examples/wgetjson:
|
||||
Add support for wget POST interface. Contributed by Darcy Gong.
|
||||
* apps/examples/relays: A relay example contributed by Darcy Gong.
|
||||
* apps/nshlib/nsh_netcmds: Add ifup and ifdown commands (from Darcy
|
||||
Gong).
|
||||
* apps/nshlib/nsh_netcmds: Extend the ifconfig command so that it
|
||||
supports setting IP addresses, network masks, name server addresses,
|
||||
and hardware address (from Darcy Gong).
|
||||
|
||||
6.24 2012-12-20 Gregory Nutt <gnutt@nuttx.org>
|
||||
|
||||
* apps/examples/ostest/roundrobin.c: Replace large tables with
|
||||
algorithmic prime number generation. This allows the roundrobin
|
||||
test to run on platforms with minimal SRAM (Freddie Chopin).
|
||||
* apps/nshlib/nsh_dbgcmds.c: Add hexdump command to dump the contents
|
||||
of a file (or character device) to the console Contributed by Petteri
|
||||
Aimonen.
|
||||
* apps/examples/modbus: Fixes from Freddie Chopin
|
||||
* apps/examples/modbus/Kconfig: Kconfig logic for FreeModBus contributed
|
||||
by Freddie Chopin.
|
||||
* Makefile, */Makefile: Various fixes for Windows native build. Now uses
|
||||
make foreach loops instead of shell loops.
|
||||
* apps/examples/elf/test/*/Makefile: OSX doesn't support install -D, use
|
||||
mkdir -p then install without the -D. From Mike Smith.
|
||||
* apps/examples/relays/Makefile: Reduced stack requirement (Darcy Gong).
|
||||
* apps/nshlib and apps/netutils/dhcpc: Extend the NSH ifconfig command plus
|
||||
various DHCPC improvements(Darcy Gong).
|
||||
* apps/nshlib/nsh_apps.c: Fix compilation errors when CONFIG_NSH_DISABLEBG=y.
|
||||
From Freddie Chopin.
|
||||
* Rename CONFIG_PCODE and CONFIG_FICL as CONFIG_INTERPRETERS_PCODE and
|
||||
CONFIG_INTERPRETERS_FICL for consistency with other configuration naming.
|
||||
* apps/examples/keypadtest: A keypad test example contributed by Denis
|
||||
Carikli.
|
||||
* apps/examples/elf and nxflat: If CONFIG_BINFMT_EXEPATH is defined, these
|
||||
tests will now use a relative path to the program and expect the binfmt/
|
||||
logic to find the absolute path to the program using the PATH variable.
|
||||
|
||||
6.25 2013-xx-xx Gregory Nutt <gnutt@nuttx.org>
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
############################################################################
|
||||
|
||||
-include $(TOPDIR)/Make.defs
|
||||
-include $(TOPDIR)/.config
|
||||
|
||||
APPDIR = ${shell pwd}
|
||||
|
||||
|
@ -107,7 +106,7 @@ endif
|
|||
# Create the list of available applications (INSTALLED_APPS)
|
||||
|
||||
define ADD_BUILTIN
|
||||
INSTALLED_APPS += ${shell if [ -r $1/Makefile ]; then echo "$1"; fi}
|
||||
INSTALLED_APPS += $(if $(wildcard $1$(DELIM)Makefile),$1,)
|
||||
endef
|
||||
|
||||
$(foreach BUILTIN, $(CONFIGURED_APPS), $(eval $(call ADD_BUILTIN,$(BUILTIN))))
|
||||
|
@ -117,8 +116,10 @@ $(foreach BUILTIN, $(CONFIGURED_APPS), $(eval $(call ADD_BUILTIN,$(BUILTIN))))
|
|||
# provided by the user (possibly as a symbolic link) to add libraries and
|
||||
# applications to the standard build from the repository.
|
||||
|
||||
INSTALLED_APPS += ${shell if [ -r external/Makefile ]; then echo "external"; fi}
|
||||
SUBDIRS += ${shell if [ -r external/Makefile ]; then echo "external"; fi}
|
||||
EXTERNAL_DIR := $(dir $(wildcard external$(DELIM)Makefile))
|
||||
|
||||
INSTALLED_APPS += $(EXTERNAL_DIR)
|
||||
SUBDIRS += $(EXTERNAL_DIR)
|
||||
|
||||
# The final build target
|
||||
|
||||
|
@ -130,48 +131,81 @@ all: $(BIN)
|
|||
.PHONY: $(INSTALLED_APPS) context depend clean distclean
|
||||
|
||||
$(INSTALLED_APPS):
|
||||
@$(MAKE) -C $@ TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)";
|
||||
$(Q) $(MAKE) -C $@ TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"
|
||||
|
||||
$(BIN): $(INSTALLED_APPS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $@, $${obj}); \
|
||||
done ; )
|
||||
|
||||
.context:
|
||||
@for dir in $(INSTALLED_APPS) ; do \
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
$(Q) for %%G in ($(INSTALLED_APPS)) do ( \
|
||||
if exist %%G\.context del /f /q %%G\.context \
|
||||
$(MAKE) -C %%G TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" context \
|
||||
)
|
||||
else
|
||||
$(Q) for dir in $(INSTALLED_APPS) ; do \
|
||||
rm -f $$dir/.context ; \
|
||||
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" context ; \
|
||||
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" context ; \
|
||||
done
|
||||
@touch $@
|
||||
endif
|
||||
$(Q) touch $@
|
||||
|
||||
context: .context
|
||||
|
||||
.depend: context Makefile $(SRCS)
|
||||
@for dir in $(INSTALLED_APPS) ; do \
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
$(Q) for %%G in ($(INSTALLED_APPS)) do ( \
|
||||
if exist %%G\.depend del /f /q %%G\.depend \
|
||||
$(MAKE) -C %%G TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" depend \
|
||||
)
|
||||
else
|
||||
$(Q) for dir in $(INSTALLED_APPS) ; do \
|
||||
rm -f $$dir/.depend ; \
|
||||
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" depend ; \
|
||||
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" depend ; \
|
||||
done
|
||||
@touch $@
|
||||
endif
|
||||
$(Q) touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@for dir in $(SUBDIRS) ; do \
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
$(Q) for %%G in ($(SUBDIRS)) do ( \
|
||||
$(MAKE) -C %%G clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" \
|
||||
)
|
||||
else
|
||||
$(Q) for dir in $(SUBDIRS) ; do \
|
||||
$(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
|
||||
done
|
||||
@rm -f $(BIN) *~ .*.swp *.o
|
||||
endif
|
||||
$(call DELFILE, $(BIN))
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: # clean
|
||||
@for dir in $(SUBDIRS) ; do \
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
$(Q) for %%G in ($(SUBDIRS)) do ( \
|
||||
$(MAKE) -C %%G distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" \
|
||||
)
|
||||
$(call DELFILE, .config)
|
||||
$(call DELFILE, .context)
|
||||
$(call DELFILE, .depend)
|
||||
$(Q) ( if exist external ( \
|
||||
echo ********************************************************" \
|
||||
echo * The external directory/link must be removed manually *" \
|
||||
echo ********************************************************" \
|
||||
)
|
||||
else
|
||||
$(Q) for dir in $(SUBDIRS) ; do \
|
||||
$(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
|
||||
done
|
||||
@rm -f .config .context .depend
|
||||
@( if [ -e external ]; then \
|
||||
$(call DELFILE, .config)
|
||||
$(call DELFILE, .context)
|
||||
$(call DELFILE, .depend)
|
||||
$(Q) ( if [ -e external ]; then \
|
||||
echo "********************************************************"; \
|
||||
echo "* The external directory/link must be removed manually *"; \
|
||||
echo "********************************************************"; \
|
||||
fi; \
|
||||
)
|
||||
endif
|
||||
|
||||
|
||||
|
|
|
@ -3,206 +3,60 @@
|
|||
# see misc/tools/kconfig-language.txt.
|
||||
#
|
||||
|
||||
menu "ADC Example"
|
||||
source "$APPSDIR/examples/adc/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "Buttons Example"
|
||||
source "$APPSDIR/examples/buttons/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "CAN Example"
|
||||
source "$APPSDIR/examples/can/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "USB CDC/ACM Class Driver Example"
|
||||
source "$APPSDIR/examples/cdcacm/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "USB composite Class Driver Example"
|
||||
source "$APPSDIR/examples/composite/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "DHCP Server Example"
|
||||
source "$APPSDIR/examples/cxxtest/Kconfig"
|
||||
source "$APPSDIR/examples/dhcpd/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "FTP Client Example"
|
||||
source "$APPSDIR/examples/elf/Kconfig"
|
||||
source "$APPSDIR/examples/ftpc/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "FTP Server Example"
|
||||
source "$APPSDIR/examples/ftpd/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "\"Hello, World!\" Example"
|
||||
source "$APPSDIR/examples/hello/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "\"Hello, World!\" C++ Example"
|
||||
source "$APPSDIR/examples/helloxx/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "USB HID Keyboard Example"
|
||||
source "$APPSDIR/examples/json/Kconfig"
|
||||
source "$APPSDIR/examples/hidkbd/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "IGMP Example"
|
||||
source "$APPSDIR/examples/keypadtest/Kconfig"
|
||||
source "$APPSDIR/examples/igmp/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "LCD Read/Write Example"
|
||||
source "$APPSDIR/examples/lcdrw/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "Memory Management Example"
|
||||
source "$APPSDIR/examples/mm/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "File System Mount Example"
|
||||
source "$APPSDIR/examples/mount/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "FreeModBus Example"
|
||||
source "$APPSDIR/examples/modbus/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "Network Test Example"
|
||||
source "$APPSDIR/examples/nettest/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "NuttShell (NSH) Example"
|
||||
source "$APPSDIR/examples/nsh/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "NULL Example"
|
||||
source "$APPSDIR/examples/null/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "NX Graphics Example"
|
||||
source "$APPSDIR/examples/nx/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "NxConsole Example"
|
||||
source "$APPSDIR/examples/nxconsole/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "NXFFS File System Example"
|
||||
source "$APPSDIR/examples/nxffs/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "NXFLAT Example"
|
||||
source "$APPSDIR/examples/nxflat/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "NX Graphics \"Hello, World!\" Example"
|
||||
source "$APPSDIR/examples/nxhello/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "NX Graphics image Example"
|
||||
source "$APPSDIR/examples/nximage/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "NX Graphics lines Example"
|
||||
source "$APPSDIR/examples/nxlines/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "NX Graphics Text Example"
|
||||
source "$APPSDIR/examples/nxtext/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "OS Test Example"
|
||||
source "$APPSDIR/examples/ostest/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "Pascal \"Hello, World!\"example"
|
||||
source "$APPSDIR/examples/pashello/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "Pipe Example"
|
||||
source "$APPSDIR/examples/pipe/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "Poll Example"
|
||||
source "$APPSDIR/examples/poll/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "Pulse Width Modulation (PWM) Example"
|
||||
source "$APPSDIR/examples/pwm/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "Quadrature Encoder Example"
|
||||
source "$APPSDIR/examples/qencoder/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "RGMP Example"
|
||||
source "$APPSDIR/examples/relays/Kconfig"
|
||||
source "$APPSDIR/examples/rgmp/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "ROMFS Example"
|
||||
source "$APPSDIR/examples/romfs/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "sendmail Example"
|
||||
source "$APPSDIR/examples/sendmail/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "Serial Loopback Example"
|
||||
source "$APPSDIR/examples/serloop/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "Telnet Daemon Example"
|
||||
source "$APPSDIR/examples/telnetd/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "THTTPD Web Server Example"
|
||||
source "$APPSDIR/examples/thttpd/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "TIFF Generation Example"
|
||||
source "$APPSDIR/examples/tiff/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "Touchscreen Example"
|
||||
source "$APPSDIR/examples/touchscreen/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "UDP Example"
|
||||
source "$APPSDIR/examples/udp/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "UDP Discovery Daemon Example"
|
||||
source "$APPSDIR/examples/discover/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "uIP Web Server Example"
|
||||
source "$APPSDIR/examples/uip/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "USB Serial Test Example"
|
||||
source "$APPSDIR/examples/usbserial/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "USB Mass Storage Class Example"
|
||||
source "$APPSDIR/examples/usbstorage/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "USB Serial Terminal Example"
|
||||
source "$APPSDIR/examples/usbterm/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "Watchdog timer Example"
|
||||
source "$APPSDIR/examples/watchdog/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "wget Example"
|
||||
source "$APPSDIR/examples/wget/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "WLAN Example"
|
||||
source "$APPSDIR/examples/wgetjson/Kconfig"
|
||||
source "$APPSDIR/examples/wlan/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "XML RPC Example"
|
||||
source "$APPSDIR/examples/xmlrpc/Kconfig"
|
||||
endmenu
|
||||
|
|
|
@ -54,6 +54,10 @@ ifeq ($(CONFIG_EXAMPLES_COMPOSITE),y)
|
|||
CONFIGURED_APPS += examples/composite
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_CXXTEST),y)
|
||||
CONFIGURED_APPS += examples/cxxtest
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_DHCPD),y)
|
||||
CONFIGURED_APPS += examples/dhcpd
|
||||
endif
|
||||
|
@ -62,6 +66,10 @@ ifeq ($(CONFIG_EXAMPLES_DISCOVER),y)
|
|||
CONFIGURED_APPS += examples/discover
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_ELF),y)
|
||||
CONFIGURED_APPS += examples/elf
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_FTPC),y)
|
||||
CONFIGURED_APPS += examples/ftpc
|
||||
endif
|
||||
|
@ -86,6 +94,14 @@ ifeq ($(CONFIG_EXAMPLES_IGMP),y)
|
|||
CONFIGURED_APPS += examples/igmp
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_JSON),y)
|
||||
CONFIGURED_APPS += examples/json
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_KEYPADTEST),y)
|
||||
CONFIGURED_APPS += examples/keypadtest
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_LCDRW),y)
|
||||
CONFIGURED_APPS += examples/lcdrw
|
||||
endif
|
||||
|
@ -94,6 +110,10 @@ ifeq ($(CONFIG_EXAMPLES_MM),y)
|
|||
CONFIGURED_APPS += examples/mm
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_MODBUS),y)
|
||||
CONFIGURED_APPS += examples/modbus
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_MOUNT),y)
|
||||
CONFIGURED_APPS += examples/mount
|
||||
endif
|
||||
|
@ -166,6 +186,10 @@ ifeq ($(CONFIG_EXAMPLES_QENCODER),y)
|
|||
CONFIGURED_APPS += examples/qencoder
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_RELAYS),y)
|
||||
CONFIGURED_APPS += examples/relays
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_RGMP),y)
|
||||
CONFIGURED_APPS += examples/rgmp
|
||||
endif
|
||||
|
@ -226,6 +250,10 @@ ifeq ($(CONFIG_EXAMPLES_WGET),y)
|
|||
CONFIGURED_APPS += examples/wget
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_WGETJSON),y)
|
||||
CONFIGURED_APPS += examples/wgetjson
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_WLAN),y)
|
||||
CONFIGURED_APPS += examples/wlan
|
||||
endif
|
||||
|
|
|
@ -37,12 +37,12 @@
|
|||
|
||||
# Sub-directories
|
||||
|
||||
SUBDIRS = adc buttons can cdcacm composite dhcpd discover ftpc ftpd hello
|
||||
SUBDIRS += helloxx hidkbd igmp lcdrw mm modbus mount nettest nsh null nx
|
||||
SUBDIRS += nxconsole nxffs nxflat nxhello nximage nxlines nxtext ostest
|
||||
SUBDIRS += pashello pipe poll pwm qencoder rgmp romfs serloop telnetd
|
||||
SUBDIRS += thttpd tiff touchscreen udp uip usbserial sendmail usbstorage
|
||||
SUBDIRS += usbterm watchdog wget wlan
|
||||
SUBDIRS = adc buttons can cdcacm composite cxxtest dhcpd discover elf ftpc
|
||||
SUBDIRS += ftpd hello helloxx hidkbd igmp json keypadtest lcdrw mm modbus mount
|
||||
SUBDIRS += nettest nsh null nx nxconsole nxffs nxflat nxhello nximage
|
||||
SUBDIRS += nxlines nxtext ostest pashello pipe poll pwm qencoder relays
|
||||
SUBDIRS += rgmp romfs serloop telnetd thttpd tiff touchscreen udp uip
|
||||
SUBDIRS += usbserial sendmail usbstorage usbterm watchdog wget wgetjson wlan
|
||||
|
||||
# Sub-directories that might need context setup. Directories may need
|
||||
# context setup for a variety of reasons, but the most common is because
|
||||
|
@ -57,8 +57,8 @@ SUBDIRS += usbterm watchdog wget wlan
|
|||
CNTXTDIRS = pwm
|
||||
|
||||
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
|
||||
CNTXTDIRS += adc can cdcacm composite discover ftpd dhcpd modbus nettest
|
||||
CNTXTDIRS += qencoder telnetd watchdog
|
||||
CNTXTDIRS += adc can cdcacm composite cxxtest dhcpd discover ftpd json keypadtest
|
||||
CNTXTDIRS += modbus nettest nxlines relays qencoder telnetd watchdog wgetjson
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_HELLO_BUILTIN),y)
|
||||
|
@ -79,9 +79,6 @@ endif
|
|||
ifeq ($(CONFIG_EXAMPLES_NXIMAGE_BUILTIN),y)
|
||||
CNTXTDIRS += nximage
|
||||
endif
|
||||
ifeq ($(CONFIG_EXAMPLES_LINES_BUILTIN),y)
|
||||
CNTXTDIRS += nxlines
|
||||
endif
|
||||
ifeq ($(CONFIG_EXAMPLES_NXTEXT_BUILTIN),y)
|
||||
CNTXTDIRS += nxtext
|
||||
endif
|
||||
|
@ -105,27 +102,25 @@ all: nothing
|
|||
|
||||
.PHONY: nothing context depend clean distclean
|
||||
|
||||
define SDIR_template
|
||||
$(1)_$(2):
|
||||
$(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"
|
||||
endef
|
||||
|
||||
$(foreach SDIR, $(CNTXTDIRS), $(eval $(call SDIR_template,$(SDIR),context)))
|
||||
$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),depend)))
|
||||
$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),clean)))
|
||||
$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),distclean)))
|
||||
|
||||
nothing:
|
||||
|
||||
context:
|
||||
@for dir in $(CNTXTDIRS) ; do \
|
||||
$(MAKE) -C $$dir context TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
|
||||
done
|
||||
context: $(foreach SDIR, $(CNTXTDIRS), $(SDIR)_context)
|
||||
|
||||
depend:
|
||||
@for dir in $(SUBDIRS) ; do \
|
||||
$(MAKE) -C $$dir depend TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
|
||||
done
|
||||
depend: $(foreach SDIR, $(SUBDIRS), $(SDIR)_depend)
|
||||
|
||||
clean:
|
||||
@for dir in $(SUBDIRS) ; do \
|
||||
$(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
|
||||
done
|
||||
clean: $(foreach SDIR, $(SUBDIRS), $(SDIR)_clean)
|
||||
|
||||
distclean: clean
|
||||
@for dir in $(SUBDIRS) ; do \
|
||||
$(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
|
||||
done
|
||||
distclean: clean $(foreach SDIR, $(SUBDIRS), $(SDIR)_distclean)
|
||||
|
||||
-include Make.dep
|
||||
|
||||
|
|
|
@ -239,6 +239,29 @@ examples/composite
|
|||
CONFIG_EXAMPLES_COMPOSITE_TRACEINTERRUPTS
|
||||
Show interrupt-related events.
|
||||
|
||||
examples/cxxtest
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This is a test of the C++ standard library. At present a port of the uClibc++
|
||||
C++ library is available. Due to licensinging issues, the uClibc++ C++ library
|
||||
is not included in the NuttX source tree by default, but must be installed
|
||||
(see misc/uClibc++/README.txt for installation).
|
||||
|
||||
The NuttX setting that are required include:
|
||||
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
CONFIG_UCLIBCXX=y
|
||||
|
||||
Additional uClibc++ settings may be required in your build environment.
|
||||
|
||||
The uClibc++ test includes simple test of:
|
||||
|
||||
- iostreams,
|
||||
- STL,
|
||||
- RTTI, and
|
||||
- Exceptions
|
||||
|
||||
examples/dhcpd
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
|
@ -297,6 +320,68 @@ examples/discover
|
|||
CONFIG_EXAMPLES_DISCOVER_DRIPADDR - Router IP address
|
||||
CONFIG_EXAMPLES_DISCOVER_NETMASK - Network Mask
|
||||
|
||||
examples/elf
|
||||
^^^^^^^^^^^^
|
||||
|
||||
This example builds a small ELF loader test case. This includes several
|
||||
test programs under examples/elf tests. These tests are build using
|
||||
the relocatable ELF format and installed in a ROMFS file system. At run time,
|
||||
each program in the ROMFS file system is executed. Requires CONFIG_ELF.
|
||||
Other configuration options:
|
||||
|
||||
CONFIG_EXAMPLES_ELF_DEVMINOR - The minor device number of the ROMFS block.
|
||||
For example, the N in /dev/ramN. Used for registering the RAM block driver
|
||||
that will hold the ROMFS file system containing the ELF executables to be
|
||||
tested. Default: 0
|
||||
|
||||
CONFIG_EXAMPLES_ELF_DEVPATH - The path to the ROMFS block driver device. This
|
||||
must match EXAMPLES_ELF_DEVMINOR. Used for registering the RAM block driver
|
||||
that will hold the ROMFS file system containing the ELF executables to be
|
||||
tested. Default: "/dev/ram0"
|
||||
|
||||
NOTES:
|
||||
|
||||
1. CFLAGS should be provided in CELFFLAGS. RAM and FLASH memory regions
|
||||
may require long allcs. For ARM, this might be:
|
||||
|
||||
CELFFLAGS = $(CFLAGS) -mlong-calls
|
||||
|
||||
Similarly for C++ flags which must be provided in CXXELFFLAGS.
|
||||
|
||||
2. Your top-level nuttx/Make.defs file must alos include an approproate definition,
|
||||
LDELFFLAGS, to generate a relocatable ELF object. With GNU LD, this should
|
||||
include '-r' and '-e main' (or _main on some platforms).
|
||||
|
||||
LDELFFLAGS = -r -e main
|
||||
|
||||
If you use GCC to link, you make also need to include '-nostdlib' or
|
||||
'-nostartfiles' and '-nodefaultlibs'.
|
||||
|
||||
3. This example also requires genromfs. genromfs can be build as part of the
|
||||
nuttx toolchain. Or can built from the genromfs sources that can be found
|
||||
at misc/tools/genromfs-0.5.2.tar.gz. In any event, the PATH variable must
|
||||
include the path to the genromfs executable.
|
||||
|
||||
4. ELF size: The ELF files in this example are, be default, quite large
|
||||
because they include a lot of "build garbage". You can greatly reduce the
|
||||
size of the ELF binaries are using the 'objcopy --strip-unneeded' command to
|
||||
remove un-necessary information from the ELF files.
|
||||
|
||||
5. Simulator. You cannot use this example with the the NuttX simulator on
|
||||
Cygwin. That is because the Cygwin GCC does not generate ELF file but
|
||||
rather some Windows-native binary format.
|
||||
|
||||
If you really want to do this, you can create a NuttX x86 buildroot toolchain
|
||||
and use that be build the ELF executables for the ROMFS file system.
|
||||
|
||||
6. Linker scripts. You might also want to use a linker scripts to combine
|
||||
sections better. An example linker script is at nuttx/binfmt/libelf/gnu-elf.ld.
|
||||
That example might have to be tuned for your particular linker output to
|
||||
position additional sections correctly. The GNU LD LDELFFLAGS then might
|
||||
be:
|
||||
|
||||
LDELFFLAGS = -r -e main -T$(TOPDIR)/binfmt/libelf/gnu-elf.ld
|
||||
|
||||
examples/ftpc
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
|
@ -482,6 +567,32 @@ examples/igmp
|
|||
|
||||
CONFIGURED_APPS += uiplib
|
||||
|
||||
examples/json
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
This example exercises the cJSON implementation at apps/netutils/json.
|
||||
This example contains logic taken from the cJSON project:
|
||||
|
||||
http://sourceforge.net/projects/cjson/
|
||||
|
||||
The example corresponds to SVN revision r42 (with lots of changes for
|
||||
NuttX coding standards). As of r42, the SVN repository was last updated
|
||||
on 2011-10-10 so I presume that the code is stable and there is no risk
|
||||
of maintaining duplicate logic in the NuttX repository.
|
||||
|
||||
examples/keypadtest
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This is a generic keypad test example. It is similar to the USB hidkbd
|
||||
example, but makes no assumptions about the underlying keyboard interface.
|
||||
It uses the interfaces of include/nuttx/input/keypad.h.
|
||||
|
||||
CONFIG_EXAMPLES_KEYPADTEST - Selects the keypadtest example (only need
|
||||
if the mconf/Kconfig tool is used.
|
||||
|
||||
CONFIG_EXAMPLES_KEYPAD_DEVNAME - The name of the keypad device that will
|
||||
be opened in order to perform the keypad test. Default: "/dev/keypad"
|
||||
|
||||
examples/lcdrw
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
|
@ -496,6 +607,11 @@ examples/lcdrw
|
|||
* CONFIG_EXAMPLES_LDCRW_YRES
|
||||
LCD Y resolution. Default: 320
|
||||
|
||||
NOTE: This test exercises internal lcd driver interfaces. As such, it
|
||||
relies on internal OS interfaces that are not normally available to a
|
||||
user-space program. As a result, this example cannot be used if a
|
||||
NuttX is built as a protected, supervisor kernel (CONFIG_NUTTX_KERNEL).
|
||||
|
||||
examples/mm
|
||||
^^^^^^^^^^^
|
||||
|
||||
|
@ -838,8 +954,6 @@ examplex/nxlines
|
|||
|
||||
The following configuration options can be selected:
|
||||
|
||||
CONFIG_EXAMPLES_NXLINES_BUILTIN -- Build the NXLINES example as a "built-in"
|
||||
that can be executed from the NSH command line
|
||||
CONFIG_EXAMPLES_NXLINES_VPLANE -- The plane to select from the frame-
|
||||
buffer driver for use in the test. Default: 0
|
||||
CONFIG_EXAMPLES_NXLINES_DEVNO - The LCD device to select from the LCD
|
||||
|
@ -877,6 +991,9 @@ examplex/nxlines
|
|||
FAR struct fb_vtable_s *up_nxdrvinit(unsigned int devno);
|
||||
#endif
|
||||
|
||||
CONFIG_NSH_BUILTIN_APPS - Build the NX lines examples as an NSH built-in
|
||||
function.
|
||||
|
||||
examples/nxtext
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
|
@ -984,6 +1101,17 @@ examples/ostest
|
|||
Specifies the number of threads to create in the barrier
|
||||
test. The default is 8 but a smaller number may be needed on
|
||||
systems without sufficient memory to start so many threads.
|
||||
* CONFIG_EXAMPLES_OSTEST_RR_RANGE
|
||||
During round-robin scheduling test two threads are created. Each of the threads
|
||||
searches for prime numbers in the configurable range, doing that configurable
|
||||
number of times.
|
||||
This value specifies the end of search range and together with number of runs
|
||||
allows to configure the length of this test - it should last at least a few
|
||||
tens of seconds. Allowed values [1; 32767], default 10000
|
||||
* CONFIG_EXAMPLES_OSTEST_RR_RUNS
|
||||
During round-robin scheduling test two threads are created. Each of the threads
|
||||
searches for prime numbers in the configurable range, doing that configurable
|
||||
number of times.
|
||||
|
||||
examples/pashello
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
@ -1110,17 +1238,28 @@ examples/qencoder
|
|||
|
||||
Specific configuration options for this example include:
|
||||
|
||||
CONFIG_EXAMPLES_QENCODER_DEVPATH - The path to the QE device. Default:
|
||||
/dev/qe0
|
||||
CONFIG_EXAMPLES_QENCODER_NSAMPLES - If CONFIG_NSH_BUILTIN_APPS
|
||||
is defined, then the number of samples is provided on the command line
|
||||
and this value is ignored. Otherwise, this number of samples is
|
||||
collected and the program terminates. Default: Samples are collected
|
||||
indefinitely.
|
||||
CONFIG_EXAMPLES_QENCODER_DELAY - This value provides the delay (in
|
||||
milliseonds) between each sample. If CONFIG_NSH_BUILTIN_APPS
|
||||
is defined, then this value is the default delay if no other delay is
|
||||
provided on the command line. Default: 100 milliseconds
|
||||
CONFIG_EXAMPLES_QENCODER_DEVPATH - The path to the QE device. Default:
|
||||
/dev/qe0
|
||||
CONFIG_EXAMPLES_QENCODER_NSAMPLES - If CONFIG_NSH_BUILTIN_APPS
|
||||
is defined, then the number of samples is provided on the command line
|
||||
and this value is ignored. Otherwise, this number of samples is
|
||||
collected and the program terminates. Default: Samples are collected
|
||||
indefinitely.
|
||||
CONFIG_EXAMPLES_QENCODER_DELAY - This value provides the delay (in
|
||||
milliseonds) between each sample. If CONFIG_NSH_BUILTIN_APPS
|
||||
is defined, then this value is the default delay if no other delay is
|
||||
provided on the command line. Default: 100 milliseconds
|
||||
|
||||
examples/relays
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
Requires CONFIG_ARCH_RELAYS.
|
||||
Contributed by Darcy Gong.
|
||||
|
||||
NOTE: This test exercises internal relay driver interfaces. As such, it
|
||||
relies on internal OS interfaces that are not normally available to a
|
||||
user-space program. As a result, this example cannot be used if a
|
||||
NuttX is built as a protected, supervisor kernel (CONFIG_NUTTX_KERNEL).
|
||||
|
||||
examples/rgmp
|
||||
^^^^^^^^^^^^^
|
||||
|
@ -1672,7 +1811,16 @@ examples/wget
|
|||
CONFIGURED_APPS += resolv
|
||||
CONFIGURED_APPS += webclient
|
||||
|
||||
examples/wget
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
Uses wget to get a JSON encoded file, then decodes the file.
|
||||
|
||||
CONFIG_EXAMPLES_WDGETJSON_MAXSIZE - Max. JSON Buffer Size
|
||||
CONFIG_EXAMPLES_EXAMPLES_WGETJSON_URL - wget URL
|
||||
|
||||
examples/xmlrpc
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
This example exercises the "Embeddable Lightweight XML-RPC Server" which
|
||||
is discussed at:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
############################################################################
|
||||
# apps/examples/adc/Makefile
|
||||
#
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -76,9 +80,7 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
@touch .built
|
||||
|
||||
.context:
|
||||
|
@ -90,16 +92,17 @@ endif
|
|||
context: .context
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
|
|
@ -289,7 +289,7 @@ int adc_main(int argc, char *argv[])
|
|||
{
|
||||
message("adc_main: open %s failed: %d\n", g_adcstate.devpath, errno);
|
||||
errval = 2;
|
||||
goto errout_with_dev;
|
||||
goto errout;
|
||||
}
|
||||
|
||||
/* Now loop the appropriate number of times, displaying the collected
|
||||
|
@ -357,6 +357,11 @@ int adc_main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
close(fd);
|
||||
return OK;
|
||||
|
||||
/* Error exits */
|
||||
|
||||
errout_with_dev:
|
||||
close(fd);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
############################################################################
|
||||
# apps/examples/buttons/Makefile
|
||||
#
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -76,9 +80,7 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
@touch .built
|
||||
|
||||
.context:
|
||||
|
@ -90,16 +92,17 @@ endif
|
|||
context: .context
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
############################################################################
|
||||
# apps/examples/can/Makefile
|
||||
#
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -76,9 +80,7 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
@touch .built
|
||||
|
||||
.context:
|
||||
|
@ -90,16 +92,17 @@ endif
|
|||
context: .context
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
|
|
@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -80,9 +84,7 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
@touch .built
|
||||
|
||||
.context:
|
||||
|
@ -93,17 +95,18 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
context: .context
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see misc/tools/kconfig-language.txt.
|
||||
#
|
||||
|
||||
config EXAMPLES_CXXTEST
|
||||
bool "C++ test program"
|
||||
default n
|
||||
depends on HAVE_CXX
|
||||
---help---
|
||||
Enable the C++ test program
|
||||
|
||||
if EXAMPLES_CXXTEST
|
||||
endif
|
|
@ -0,0 +1,125 @@
|
|||
############################################################################
|
||||
# apps/examples/cxxtest/Makefile
|
||||
#
|
||||
# Copyright (C) 2009-2012 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
-include $(TOPDIR)/.config
|
||||
-include $(TOPDIR)/Make.defs
|
||||
include $(APPDIR)/Make.defs
|
||||
|
||||
# CXX test program
|
||||
|
||||
ASRCS =
|
||||
CSRCS =
|
||||
CXXSRCS = cxxtest_main.cxx
|
||||
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
|
||||
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
||||
# cxxtest built-in application info
|
||||
|
||||
APPNAME = cxxtest
|
||||
PRIORITY = SCHED_PRIORITY_DEFAULT
|
||||
STACKSIZE = 4096
|
||||
|
||||
# Common build
|
||||
|
||||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: clean depend distclean chkcxx
|
||||
|
||||
chkcxx:
|
||||
ifneq ($(CONFIG_HAVE_CXX),y)
|
||||
@echo ""
|
||||
@echo "In order to use this example, you toolchain must support must"
|
||||
@echo ""
|
||||
@echo " (1) Explicitly select CONFIG_HAVE_CXX to build in C++ support"
|
||||
@echo " (2) Define CXX, CXXFLAGS, and COMPILEXX in the Make.defs file"
|
||||
@echo " of the configuration that you are using."
|
||||
@echo ""
|
||||
@exit 1
|
||||
endif
|
||||
|
||||
$(AOBJS): %$(OBJEXT): %.S
|
||||
$(call ASSEMBLE, $<, $@)
|
||||
|
||||
$(COBJS): %$(OBJEXT): %.c
|
||||
$(call COMPILE, $<, $@)
|
||||
|
||||
$(CXXOBJS): %$(OBJEXT): %.cxx
|
||||
$(call COMPILEXX, $<, $@)
|
||||
|
||||
.built: chkcxx $(OBJS)
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
@touch .built
|
||||
|
||||
.context:
|
||||
ifeq ($(CONFIG_EXAMPLES_HELLOXX_BUILTIN),y)
|
||||
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
|
||||
@touch $@
|
||||
endif
|
||||
|
||||
context: .context
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) "$(CXX)" -- $(CXXFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
|
@ -0,0 +1,227 @@
|
|||
//***************************************************************************
|
||||
// examples/cxxtest/main.cxx
|
||||
//
|
||||
// Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
// Author: Qiang Yu, http://rgmp.sourceforge.net/wiki/index.php/Main_Page
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in
|
||||
// the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// 3. Neither the name NuttX nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//***************************************************************************
|
||||
|
||||
//***************************************************************************
|
||||
// Included Files
|
||||
//***************************************************************************
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/init.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <stdexcept>
|
||||
#include <cassert>
|
||||
|
||||
using namespace std;
|
||||
|
||||
//***************************************************************************
|
||||
// Definitions
|
||||
//***************************************************************************
|
||||
|
||||
//***************************************************************************
|
||||
// Private Classes
|
||||
//***************************************************************************
|
||||
|
||||
class Base
|
||||
{
|
||||
public:
|
||||
virtual void printBase(void) {};
|
||||
};
|
||||
|
||||
class Extend : public Base
|
||||
{
|
||||
public:
|
||||
void printExtend(void)
|
||||
{
|
||||
cout << "extend" << endl;
|
||||
}
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
// Private Data
|
||||
//***************************************************************************
|
||||
|
||||
//***************************************************************************
|
||||
// Public Functions
|
||||
//***************************************************************************
|
||||
|
||||
//***************************************************************************
|
||||
// Name: test_iostream
|
||||
//***************************************************************************/
|
||||
|
||||
static void test_iostream(void)
|
||||
{
|
||||
cout << "test iostream===========================" << endl;
|
||||
cout << "Hello, this is only a test" << endl;
|
||||
cout << "Print an int: " << 190 << endl;
|
||||
cout << "Print a char: " << 'd' << endl;
|
||||
|
||||
#if 0
|
||||
int a;
|
||||
string s;
|
||||
|
||||
cout << "Please type in an int:" << endl;
|
||||
cin >> a;
|
||||
cout << "You type in: " << a << endl;
|
||||
cout << "Please type in a string:" << endl;
|
||||
cin >> s;
|
||||
cout << "You type in: " << s << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
// Name: test_stl
|
||||
//***************************************************************************/
|
||||
|
||||
static void test_stl(void)
|
||||
{
|
||||
cout << "test vector=============================" << endl;
|
||||
|
||||
vector<int> v1;
|
||||
assert(v1.empty());
|
||||
|
||||
v1.push_back(1);
|
||||
assert(!v1.empty());
|
||||
|
||||
v1.push_back(2);
|
||||
v1.push_back(3);
|
||||
v1.push_back(4);
|
||||
assert(v1.size() == 4);
|
||||
|
||||
v1.pop_back();
|
||||
assert(v1.size() == 3);
|
||||
|
||||
cout << "v1=" << v1[0] << ' ' << v1[1] << ' ' << v1[2] << endl;
|
||||
assert(v1[2] == 3);
|
||||
|
||||
vector<int> v2 = v1;
|
||||
assert(v2 == v1);
|
||||
|
||||
string words[4] = {"Hello", "World", "Good", "Luck"};
|
||||
vector<string> v3(words, words + 4);
|
||||
vector<string>::iterator it;
|
||||
for (it = v3.begin(); it != v3.end(); it++)
|
||||
{
|
||||
cout << *it << ' ';
|
||||
}
|
||||
|
||||
cout << endl;
|
||||
assert(v3[1] == "World");
|
||||
|
||||
cout << "test map================================" << endl;
|
||||
|
||||
map<int,string> m1;
|
||||
m1[12] = "Hello";
|
||||
m1[24] = "World";
|
||||
assert(m1.size() == 2);
|
||||
assert(m1[24] == "World");
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
// Name: test_rtti
|
||||
//***************************************************************************/
|
||||
|
||||
static void test_rtti(void)
|
||||
{
|
||||
cout << "test rtti===============================" << endl;
|
||||
Base *a = new Base();
|
||||
Base *b = new Extend();
|
||||
assert(a);
|
||||
assert(b);
|
||||
|
||||
Extend *t = dynamic_cast<Extend *>(a);
|
||||
assert(t == NULL);
|
||||
|
||||
t = dynamic_cast<Extend *>(b);
|
||||
assert(t);
|
||||
t->printExtend();
|
||||
|
||||
delete a;
|
||||
delete b;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
// Name: test_exception
|
||||
//***************************************************************************/
|
||||
|
||||
#ifdef CONFIG_UCLIBCXX_EXCEPTION
|
||||
static void test_exception(void)
|
||||
{
|
||||
cout << "test exception==========================" << endl;
|
||||
try
|
||||
{
|
||||
throw runtime_error("runtime error");
|
||||
}
|
||||
|
||||
catch (runtime_error &e)
|
||||
{
|
||||
cout << "Catch exception: " << e.what() << endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//***************************************************************************
|
||||
// Public Functions
|
||||
//***************************************************************************
|
||||
|
||||
//***************************************************************************
|
||||
// Name: cxxtest_main
|
||||
//***************************************************************************/
|
||||
|
||||
extern "C"
|
||||
{
|
||||
int cxxtest_main(int argc, char *argv[])
|
||||
{
|
||||
// If C++ initialization for static constructors is supported, then do
|
||||
// that first
|
||||
|
||||
#ifdef CONFIG_HAVE_CXXINITIALIZE
|
||||
up_cxxinitialize();
|
||||
#endif
|
||||
|
||||
test_iostream();
|
||||
test_stl();
|
||||
test_rtti();
|
||||
#ifdef CONFIG_UCLIBCXX_EXCEPTION
|
||||
test_exception();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -54,10 +54,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -76,9 +80,7 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
@touch .built
|
||||
|
||||
.context:
|
||||
|
@ -90,16 +92,17 @@ endif
|
|||
context: .context
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
############################################################################
|
||||
# apps/examples/helloxx/Makefile
|
||||
#
|
||||
# Copyright (C) 2009-2011 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2009-2012 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -50,10 +50,14 @@ CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -69,7 +73,7 @@ STACKSIZE = 2048
|
|||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: clean depend disclean chkcxx
|
||||
.PHONY: clean depend distclean chkcxx
|
||||
|
||||
chkcxx:
|
||||
ifneq ($(CONFIG_HAVE_CXX),y)
|
||||
|
@ -93,9 +97,7 @@ $(CXXOBJS): %$(OBJEXT): %.cxx
|
|||
$(call COMPILEXX, $<, $@)
|
||||
|
||||
.built: chkcxx $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
@touch .built
|
||||
|
||||
.context:
|
||||
|
@ -107,16 +109,17 @@ endif
|
|||
context: .context
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
############################################################################
|
||||
# apps/examples/mm/Makefile
|
||||
#
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -70,24 +74,23 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
@touch .built
|
||||
|
||||
context:
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
############################################################################
|
||||
# apps/Makefile
|
||||
#
|
||||
# Copyright (C) 2007-2008, 2010-2010 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2007-2008, 2010-2010, 2012 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -70,24 +74,23 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
@touch .built
|
||||
|
||||
context:
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
############################################################################
|
||||
# apps/examples/nsh/Makefile
|
||||
#
|
||||
# Copyright (C) 2007-2008, 2010-2011 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2007-2008, 2010-2012 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -70,24 +74,23 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
@touch .built
|
||||
|
||||
context:
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
############################################################################
|
||||
# examples/null/Makefile
|
||||
#
|
||||
# Copyright (C) 2007-2008, 2010-2011 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2007-2008, 2010-2012 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -70,24 +74,23 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
@touch .built
|
||||
|
||||
context:
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
|
|
@ -39,4 +39,31 @@ config EXAMPLES_OSTEST_NBARRIER_THREADS
|
|||
is 8 but a smaller number may be needed on systems without sufficient memory
|
||||
to start so many threads.
|
||||
|
||||
config EXAMPLES_OSTEST_RR_RANGE
|
||||
int "Round-robin test - end of search range"
|
||||
default 10000
|
||||
range 1 32767
|
||||
---help---
|
||||
During round-robin scheduling test two threads are created. Each of the threads
|
||||
searches for prime numbers in the configurable range, doing that configurable
|
||||
number of times.
|
||||
|
||||
This value specifies the end of search range and together with number of runs
|
||||
allows to configure the length of this test - it should last at least a few
|
||||
tens of seconds. Allowed values [1; 32767], default 10000
|
||||
|
||||
config EXAMPLES_OSTEST_RR_RUNS
|
||||
int "Round-robin test - number of runs"
|
||||
default 10
|
||||
range 1 32767
|
||||
---help---
|
||||
During round-robin scheduling test two threads are created. Each of the threads
|
||||
searches for prime numbers in the configurable range, doing that configurable
|
||||
number of times.
|
||||
|
||||
This value specifies the number of times the thread searches the range for
|
||||
prime numbers and together with end of search range allows to configure the
|
||||
length of this test - it should last at least a few tens of seconds. Allowed
|
||||
values [1; 32767], default 10
|
||||
|
||||
endif
|
||||
|
|
|
@ -98,10 +98,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -120,9 +124,7 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
@touch .built
|
||||
|
||||
.context:
|
||||
|
@ -134,16 +136,17 @@ endif
|
|||
context: .context
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/********************************************************************************
|
||||
* examples/ostest/roundrobin.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008, 2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include <nuttx/config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include "ostest.h"
|
||||
|
||||
#if CONFIG_RR_INTERVAL > 0
|
||||
|
@ -47,115 +48,87 @@
|
|||
* Definitions
|
||||
********************************************************************************/
|
||||
|
||||
/* This number may need to be tuned for different processor speeds. Since these
|
||||
* arrays must be large to very correct SCHED_RR behavior, this test may require
|
||||
* too much memory on many targets.
|
||||
*/
|
||||
/* This numbers should be tuned for different processor speeds via .config file.
|
||||
* With default values the test takes about 30s on Cortex-M3 @ 24MHz. With 32767
|
||||
* range and 10 runs it takes ~320s. */
|
||||
|
||||
/* #define CONFIG_NINTEGERS 32768 Takes forever on 60Mhz ARM7 */
|
||||
#ifndef CONFIG_EXAMPLES_OSTEST_RR_RANGE
|
||||
# define CONFIG_EXAMPLES_OSTEST_RR_RANGE 10000
|
||||
# warning "CONFIG_EXAMPLES_OSTEST_RR_RANGE undefined, using default value = 10000"
|
||||
#elif (CONFIG_EXAMPLES_OSTEST_RR_RANGE < 1) || (CONFIG_EXAMPLES_OSTEST_RR_RANGE > 32767)
|
||||
# define CONFIG_EXAMPLES_OSTEST_RR_RANGE 10000
|
||||
# warning "Invalid value of CONFIG_EXAMPLES_OSTEST_RR_RANGE, using default value = 10000"
|
||||
#endif
|
||||
|
||||
#define CONFIG_NINTEGERS 2048
|
||||
|
||||
/********************************************************************************
|
||||
* Private Data
|
||||
********************************************************************************/
|
||||
|
||||
static int prime1[CONFIG_NINTEGERS];
|
||||
static int prime2[CONFIG_NINTEGERS];
|
||||
#ifndef CONFIG_EXAMPLES_OSTEST_RR_RUNS
|
||||
# define CONFIG_EXAMPLES_OSTEST_RR_RUNS 10
|
||||
# warning "CONFIG_EXAMPLES_OSTEST_RR_RUNS undefined, using default value = 10"
|
||||
#elif (CONFIG_EXAMPLES_OSTEST_RR_RUNS < 1) || (CONFIG_EXAMPLES_OSTEST_RR_RUNS > 32767)
|
||||
# define CONFIG_EXAMPLES_OSTEST_RR_RUNS 10
|
||||
# warning "Invalid value of CONFIG_EXAMPLES_OSTEST_RR_RUNS, using default value = 10"
|
||||
#endif
|
||||
|
||||
/********************************************************************************
|
||||
* Private Functions
|
||||
********************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
* Name: dosieve
|
||||
* Name: get_primes
|
||||
*
|
||||
* Description
|
||||
* This implements a "sieve of aristophanes" algorithm for finding prime number.
|
||||
* Credit for this belongs to someone, but I am not sure who anymore. Anyway,
|
||||
* the only purpose here is that we need some algorithm that takes a long period
|
||||
* of time to execute.
|
||||
*
|
||||
* This function searches for prime numbers in the most primitive way possible.
|
||||
********************************************************************************/
|
||||
|
||||
static void dosieve(int *prime)
|
||||
static void get_primes(int *count, int *last)
|
||||
{
|
||||
int a,d;
|
||||
int i;
|
||||
int j;
|
||||
int number;
|
||||
int local_count = 0;
|
||||
*last = 0; // to make compiler happy
|
||||
|
||||
a = 2;
|
||||
d = a;
|
||||
for (number = 1; number < CONFIG_EXAMPLES_OSTEST_RR_RANGE; number++)
|
||||
{
|
||||
int div;
|
||||
bool is_prime = true;
|
||||
|
||||
for (i = 0; i < CONFIG_NINTEGERS; i++)
|
||||
for (div = 2; div <= number / 2; div++)
|
||||
if (number % div == 0)
|
||||
{
|
||||
is_prime = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (is_prime)
|
||||
{
|
||||
prime[i] = i+2;
|
||||
}
|
||||
|
||||
for (i = 1; i < 10; i++)
|
||||
{
|
||||
for (j = 0; j < CONFIG_NINTEGERS; j++)
|
||||
{
|
||||
d = a + d;
|
||||
if (d < CONFIG_NINTEGERS)
|
||||
{
|
||||
prime[d]=0;
|
||||
}
|
||||
}
|
||||
a++;
|
||||
d = a;
|
||||
i++;
|
||||
}
|
||||
|
||||
local_count++;
|
||||
*last = number;
|
||||
#if 0 /* We don't really care what the numbers are */
|
||||
for (i = 0, j= 0; i < CONFIG_NINTEGERS; i++)
|
||||
{
|
||||
if (prime[i] != 0)
|
||||
{
|
||||
printf(" Prime %d: %d\n", j, prime[i]);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
printf(" Prime %d: %d\n", local_count, number);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
*count = local_count;
|
||||
}
|
||||
|
||||
/********************************************************************************
|
||||
* Name: sieve1
|
||||
* Name: get_primes_thread
|
||||
********************************************************************************/
|
||||
|
||||
static void *sieve1(void *parameter)
|
||||
static void *get_primes_thread(void *parameter)
|
||||
{
|
||||
int i;
|
||||
int id = (int)parameter;
|
||||
int i, count, last;
|
||||
|
||||
printf("sieve1 started\n");
|
||||
printf("get_primes_thread id=%d started, looking for primes < %d, doing %d run(s)\n",
|
||||
id, CONFIG_EXAMPLES_OSTEST_RR_RANGE, CONFIG_EXAMPLES_OSTEST_RR_RUNS);
|
||||
|
||||
for (i = 0; i < 1000; i++)
|
||||
for (i = 0; i < CONFIG_EXAMPLES_OSTEST_RR_RUNS; i++)
|
||||
{
|
||||
dosieve(prime1);
|
||||
get_primes(&count, &last);
|
||||
}
|
||||
|
||||
printf("sieve1 finished\n");
|
||||
|
||||
pthread_exit(NULL);
|
||||
return NULL; /* To keep some compilers happy */
|
||||
}
|
||||
|
||||
/********************************************************************************
|
||||
* Name: sieve2
|
||||
********************************************************************************/
|
||||
|
||||
static void *sieve2(void *parameter)
|
||||
{
|
||||
int i;
|
||||
|
||||
printf("sieve2 started\n");
|
||||
|
||||
for (i = 0; i < 1000; i++)
|
||||
{
|
||||
dosieve(prime2);
|
||||
}
|
||||
|
||||
printf("sieve2 finished\n");
|
||||
printf("get_primes_thread id=%d finished, found %d primes, last one was %d\n",
|
||||
id, count, last);
|
||||
|
||||
pthread_exit(NULL);
|
||||
return NULL; /* To keep some compilers happy */
|
||||
|
@ -171,14 +144,13 @@ static void *sieve2(void *parameter)
|
|||
|
||||
void rr_test(void)
|
||||
{
|
||||
pthread_t sieve1_thread;
|
||||
pthread_t sieve2_thread;
|
||||
pthread_t get_primes1_thread;
|
||||
pthread_t get_primes2_thread;
|
||||
struct sched_param sparam;
|
||||
pthread_attr_t attr;
|
||||
pthread_addr_t result;
|
||||
int status;
|
||||
|
||||
printf("rr_test: Starting sieve1 thread \n");
|
||||
status = pthread_attr_init(&attr);
|
||||
if (status != OK)
|
||||
{
|
||||
|
@ -203,29 +175,31 @@ void rr_test(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
printf("rr_test: Set thread policty to SCHED_RR\n");
|
||||
printf("rr_test: Set thread policy to SCHED_RR\n");
|
||||
}
|
||||
|
||||
status = pthread_create(&sieve1_thread, &attr, sieve1, NULL);
|
||||
printf("rr_test: Starting first get_primes_thread\n");
|
||||
|
||||
status = pthread_create(&get_primes1_thread, &attr, get_primes_thread, (void*)1);
|
||||
if (status != 0)
|
||||
{
|
||||
printf("rr_test: Error in thread 1 creation, status=%d\n", status);
|
||||
}
|
||||
|
||||
printf("rr_test: Starting sieve1 thread \n");
|
||||
printf("rr_test: Starting second get_primes_thread\n");
|
||||
|
||||
status = pthread_create(&sieve2_thread, &attr, sieve2, NULL);
|
||||
status = pthread_create(&get_primes2_thread, &attr, get_primes_thread, (void*)2);
|
||||
if (status != 0)
|
||||
{
|
||||
printf("rr_test: Error in thread 2 creation, status=%d\n", status);
|
||||
}
|
||||
|
||||
printf("rr_test: Waiting for sieves to complete -- this should take awhile\n");
|
||||
printf("rr_test: Waiting for threads to complete -- this should take awhile\n");
|
||||
printf("rr_test: If RR scheduling is working, they should start and complete at\n");
|
||||
printf("rr_test: about the same time\n");
|
||||
|
||||
pthread_join(sieve2_thread, &result);
|
||||
pthread_join(sieve1_thread, &result);
|
||||
pthread_join(get_primes2_thread, &result);
|
||||
pthread_join(get_primes1_thread, &result);
|
||||
printf("rr_test: Done\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
############################################################################
|
||||
# apps/examples/pipe/Makefile
|
||||
#
|
||||
# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -70,24 +74,23 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
@touch .built
|
||||
|
||||
context:
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
############################################################################
|
||||
# apps/examples/poll/Makefile
|
||||
#
|
||||
# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -70,25 +74,25 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
@touch .built
|
||||
|
||||
context:
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
# Register application
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend host
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
$(call DELFILE, host$(HOSTEXEEXT))
|
||||
|
||||
-include Make.dep
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
############################################################################
|
||||
# apps/examples/pwm/Makefile
|
||||
#
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -76,9 +80,7 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
@touch .built
|
||||
|
||||
.context:
|
||||
|
@ -88,16 +90,17 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
context: .context
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <nuttx/pwm.h>
|
||||
|
||||
|
|
|
@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -76,9 +80,7 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
@touch .built
|
||||
|
||||
.context:
|
||||
|
@ -90,16 +92,17 @@ endif
|
|||
context: .context
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
############################################################################
|
||||
# apps/examples/romfs/Makefile
|
||||
#
|
||||
# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -61,7 +65,7 @@ ROOTDEPPATH = --dep-path .
|
|||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: checkgenromfs clean depend disclean
|
||||
.PHONY: checkgenromfs clean depend distclean
|
||||
|
||||
$(AOBJS): %$(OBJEXT): %.S
|
||||
$(call ASSEMBLE, $<, $@)
|
||||
|
@ -86,26 +90,26 @@ romfs_testdir.h : testdir.img
|
|||
@xxd -i $< >$@ || { echo "xxd of $< failed" ; exit 1 ; }
|
||||
|
||||
.built: romfs_testdir.h $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
@touch .built
|
||||
|
||||
context:
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
# Register application
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend testdir.img
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
$(call DELFILE, testdir.img)
|
||||
|
||||
-include Make.dep
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
############################################################################
|
||||
# apps/examples/serloop/Makefile
|
||||
#
|
||||
# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -70,26 +74,25 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
@touch .built
|
||||
|
||||
context:
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
# Register application
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
||||
|
|
|
@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -76,9 +80,7 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
@touch .built
|
||||
|
||||
.context:
|
||||
|
@ -88,16 +90,17 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
context: .context
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
|
|
@ -7,7 +7,7 @@ comment "Interpreters"
|
|||
|
||||
source "$APPSDIR/interpreters/ficl/Kconfig"
|
||||
|
||||
config PCODE
|
||||
config INTERPRETERS_PCODE
|
||||
bool "Pascal p-code interpreter"
|
||||
default n
|
||||
---help---
|
||||
|
@ -16,6 +16,6 @@ config PCODE
|
|||
configuration implies that you have performed the required installation of the
|
||||
Pascal run-time code.
|
||||
|
||||
if PCODE
|
||||
if INTERPRETERS_PCODE
|
||||
endif
|
||||
|
||||
|
|
|
@ -34,10 +34,10 @@
|
|||
#
|
||||
############################################################################
|
||||
|
||||
ifeq ($(CONFIG_PCODE),y)
|
||||
ifeq ($(CONFIG_INTERPRETERS_PCODE),y)
|
||||
CONFIGURED_APPS += interpreters/pcode
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_FICL),y)
|
||||
ifeq ($(CONFIG_INTERPRETERS_FICL),y)
|
||||
CONFIGURED_APPS += interpreters/ficl
|
||||
endif
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#
|
||||
############################################################################
|
||||
|
||||
-include $(TOPDIR)/.config # Current configuration
|
||||
-include $(TOPDIR)/.config
|
||||
|
||||
# Sub-directories containing interpreter runtime
|
||||
|
||||
|
@ -41,30 +41,36 @@ SUBDIRS = pcode ficl
|
|||
|
||||
# Create the list of installed runtime modules (INSTALLED_DIRS)
|
||||
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
define ADD_DIRECTORY
|
||||
INSTALLED_DIRS += ${shell if exist $1\Makefile (echo $1)}
|
||||
endef
|
||||
else
|
||||
define ADD_DIRECTORY
|
||||
INSTALLED_DIRS += ${shell if [ -r $1/Makefile ]; then echo "$1"; fi}
|
||||
endef
|
||||
endif
|
||||
|
||||
$(foreach DIR, $(SUBDIRS), $(eval $(call ADD_DIRECTORY,$(DIR))))
|
||||
|
||||
all: nothing
|
||||
.PHONY: nothing context depend clean distclean
|
||||
|
||||
define SDIR_template
|
||||
$(1)_$(2):
|
||||
$(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"
|
||||
endef
|
||||
|
||||
$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),depend)))
|
||||
$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),clean)))
|
||||
$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),distclean)))
|
||||
|
||||
nothing:
|
||||
|
||||
context:
|
||||
|
||||
depend:
|
||||
@for dir in $(INSTALLED_DIRS) ; do \
|
||||
$(MAKE) -C $$dir depend TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
|
||||
done
|
||||
depend: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_depend)
|
||||
|
||||
clean:
|
||||
@for dir in $(INSTALLED_DIRS) ; do \
|
||||
$(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
|
||||
done
|
||||
clean: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_clean)
|
||||
|
||||
distclean: clean
|
||||
@for dir in $(INSTALLED_DIRS) ; do \
|
||||
$(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
|
||||
done
|
||||
distclean: clean $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_distclean)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# see misc/tools/kconfig-language.txt.
|
||||
#
|
||||
|
||||
config FICL
|
||||
config INTERPRETERS_FICL
|
||||
bool "Ficl Forth interpreter"
|
||||
default n
|
||||
---help---
|
||||
|
@ -11,6 +11,6 @@ config FICL
|
|||
apps/interpreters/ficl directory. Use of this configuration assumes
|
||||
that you have performed the required installation of the Ficl run-time code.
|
||||
|
||||
if FICL
|
||||
if INTERPRETERS_FICL
|
||||
endif
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
############################################################################
|
||||
# apps/interpreters/ficl/Makefile
|
||||
#
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -35,14 +35,11 @@
|
|||
|
||||
BUILDDIR := ${shell pwd | sed -e 's/ /\\ /g'}
|
||||
|
||||
-include $(TOPDIR)/.config
|
||||
-include $(TOPDIR)/Make.defs
|
||||
include $(APPDIR)/Make.defs
|
||||
|
||||
# Tools
|
||||
|
||||
INCDIR = $(TOPDIR)/tools/incdir.sh
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
INCDIROPT = -w
|
||||
endif
|
||||
|
@ -69,10 +66,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOT_DEPPATH = --dep-path .
|
||||
|
@ -95,24 +96,24 @@ debug:
|
|||
@#echo "CFLAGS: $(CFLAGS)"
|
||||
|
||||
.built: debug $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
@touch .built
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
$(Q) touch .built
|
||||
|
||||
context:
|
||||
|
||||
.depend: debug Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOT_DEPPATH) $(SRC_DEPPATH) $(FICL_DEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
$(Q) $(MKDEP) $(ROOT_DEPPATH) $(SRC_DEPPATH) $(FICL_DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
$(Q) touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .context)
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
############################################################################
|
||||
# apps/nshlib/Makefile
|
||||
#
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -54,10 +54,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -75,32 +79,32 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
@touch .built
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
$(Q) touch .built
|
||||
|
||||
.context:
|
||||
@echo "/* List of application requirements, generated during make context. */" > namedapp_list.h
|
||||
@echo "/* List of application entry points, generated during make context. */" > namedapp_proto.h
|
||||
@touch $@
|
||||
$(Q) touch $@
|
||||
|
||||
context: .context
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
$(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
$(Q) touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f .context Make.dep .depend
|
||||
@rm -f namedapp_list.h
|
||||
@rm -f namedapp_proto.h
|
||||
$(call DELFILE, .context)
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
$(call DELFILE, namedapp_list.h)
|
||||
$(call DELFILE, namedapp_proto.h)
|
||||
|
||||
-include Make.dep
|
||||
|
||||
|
|
|
@ -23,122 +23,194 @@ config NSH_BUILTIN_APPS
|
|||
(NAMEDAPP).
|
||||
|
||||
menu "Disable Individual commands"
|
||||
|
||||
config NSH_DISABLE_BASE64DEC
|
||||
bool "Disable base64dec"
|
||||
default n
|
||||
depends on NETUTILS_CODECS && CODECS_BASE64
|
||||
|
||||
config NSH_DISABLE_BASE64ENC
|
||||
bool "Disable base64enc"
|
||||
default n
|
||||
depends on NETUTILS_CODECS && CODECS_BASE64
|
||||
|
||||
config NSH_DISABLE_CAT
|
||||
bool "Disable cat"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_CD
|
||||
bool "Disable cd"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_CP
|
||||
bool "Disable cp"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_DD
|
||||
bool "Disable dd"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_ECHO
|
||||
bool "Disable echo"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_EXEC
|
||||
bool "Disable exec"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_EXIT
|
||||
bool "Disable exit"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_FREE
|
||||
bool "Disable free"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_GET
|
||||
bool "Disable get"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_HELP
|
||||
bool "Disable help"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_HEXDUMP
|
||||
bool "Disable hexdump"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_IFCONFIG
|
||||
bool "Disable ifconfig"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_KILL
|
||||
bool "Disable kill"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_LOSETUP
|
||||
bool "Disable losetup"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_LS
|
||||
bool "Disable ls"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_MB
|
||||
bool "Disable mb"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_MD5
|
||||
bool "Disable md5"
|
||||
default n
|
||||
depends on NETUTILS_CODECS && CODECS_HASH_MD5
|
||||
|
||||
config NSH_DISABLE_MKDIR
|
||||
bool "Disable mkdir"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_MKFATFS
|
||||
bool "Disable mkfatfs"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_MKFIFO
|
||||
bool "Disable mkfifo"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_MKRD
|
||||
bool "Disable mkrd"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_MH
|
||||
bool "Disable mh"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_MOUNT
|
||||
bool "Disable mount"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_MW
|
||||
bool "Disable mw"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_NSFMOUNT
|
||||
bool "Disable nfsmount"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_PS
|
||||
bool "Disable ps"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_PING
|
||||
bool "Disable ping"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_PUT
|
||||
bool "Disable put"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_PWD
|
||||
bool "Disable pwd"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_RM
|
||||
bool "Disable rm"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_RMDIR
|
||||
bool "Disable rmdir"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_SET
|
||||
bool "Disable set"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_SH
|
||||
bool "Disable sh"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_SLEEP
|
||||
bool "Disable sleep"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_TEST
|
||||
bool "Disable test"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_UMOUNT
|
||||
bool "Disable umount"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_UNSET
|
||||
bool "Disable unset"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_URLDECODE
|
||||
bool "Disable urldecode"
|
||||
default n
|
||||
depends on NETUTILS_CODECS && CODECS_URLCODE
|
||||
|
||||
config NSH_DISABLE_URLENCODE
|
||||
bool "Disable urlencode"
|
||||
default n
|
||||
depends on NETUTILS_CODECS && CODECS_URLCODE
|
||||
|
||||
config NSH_DISABLE_USLEEP
|
||||
bool "Disable usleep"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_WGET
|
||||
bool "Disable wget"
|
||||
default n
|
||||
|
||||
config NSH_DISABLE_XD
|
||||
bool "Disable xd"
|
||||
default n
|
||||
|
||||
endmenu
|
||||
|
||||
config NSH_CODECS_BUFSIZE
|
||||
int "File buffer size used by CODEC commands"
|
||||
default 128
|
||||
|
||||
config NSH_FILEIOSIZE
|
||||
int "NSH I/O buffer size"
|
||||
default 1024
|
||||
|
@ -490,7 +562,7 @@ config NSH_DHCPC
|
|||
|
||||
config NSH_IPADDR
|
||||
hex "Target IP address"
|
||||
default 0x10000002
|
||||
default 0xa0000002
|
||||
depends on NSH_LIBRARY && NET && !NSH_DHCPC
|
||||
---help---
|
||||
If NSH_DHCPC is NOT set, then the static IP address must be provided.
|
||||
|
@ -499,7 +571,7 @@ config NSH_IPADDR
|
|||
|
||||
config NSH_DRIPADDR
|
||||
hex "Router IP address"
|
||||
default 0x10000001
|
||||
default 0xa0000001
|
||||
depends on NSH_LIBRARY && NET && !NSH_DHCPC
|
||||
---help---
|
||||
Default router IP address (aka, Gateway). This is a 32-bit integer
|
||||
|
@ -513,6 +585,21 @@ config NSH_NETMASK
|
|||
Network mask. This is a 32-bit integer value in host order. So, as
|
||||
an example, 0xffffff00 would be 255.255.255.0.
|
||||
|
||||
config NSH_DNS
|
||||
bool "Use DNS"
|
||||
default n
|
||||
depends on NSH_LIBRARY && NET && NET_UDP && NET_BROADCAST
|
||||
---help---
|
||||
Configure to use a DNS.
|
||||
|
||||
config NSH_DNSIPADDR
|
||||
hex "DNS IP address"
|
||||
default 0xa0000001
|
||||
depends on NSH_DNS
|
||||
---help---
|
||||
Configure the DNS address. This is a 32-bit integer value in host
|
||||
order. So, as an example, 0xa0000001 would be 10.0.0.1.
|
||||
|
||||
config NSH_NOMAC
|
||||
bool "Hardware has no MAC address"
|
||||
default n
|
||||
|
@ -520,3 +607,12 @@ config NSH_NOMAC
|
|||
---help---
|
||||
Set if your ethernet hardware has no built-in MAC address.
|
||||
If set, a bogus MAC will be assigned.
|
||||
|
||||
config NSH_MAX_ROUNDTRIP
|
||||
int "Max Ping Round-Trip (DSEC)"
|
||||
default 20
|
||||
depends on NSH_LIBRARY && NET && !NSH_DISABLE_PING
|
||||
---help---
|
||||
This is the maximum round trip for a response to a ICMP ECHO request.
|
||||
It is in units of deciseconds. The default is 20 (2 seconds).
|
||||
|
||||
|
|
|
@ -39,64 +39,72 @@ include $(APPDIR)/Make.defs
|
|||
|
||||
# NSH Library
|
||||
|
||||
ASRCS =
|
||||
CSRCS = nsh_init.c nsh_parse.c nsh_console.c nsh_fscmds.c nsh_ddcmd.c \
|
||||
ASRCS =
|
||||
CSRCS = nsh_init.c nsh_parse.c nsh_console.c nsh_fscmds.c nsh_ddcmd.c \
|
||||
nsh_proccmds.c nsh_mmcmds.c nsh_envcmds.c nsh_dbgcmds.c
|
||||
|
||||
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
|
||||
CSRCS += nsh_apps.c
|
||||
CSRCS += nsh_apps.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NSH_ROMFSETC),y)
|
||||
CSRCS += nsh_romfsetc.c
|
||||
CSRCS += nsh_romfsetc.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
CSRCS += nsh_netinit.c nsh_netcmds.c
|
||||
CSRCS += nsh_netinit.c nsh_netcmds.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RTC),y)
|
||||
CSRCS += nsh_timcmds.c
|
||||
CSRCS += nsh_timcmds.c
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y)
|
||||
CSRCS += nsh_mntcmds.c
|
||||
CSRCS += nsh_mntcmds.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NSH_CONSOLE),y)
|
||||
CSRCS += nsh_consolemain.c
|
||||
CSRCS += nsh_consolemain.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NSH_TELNET),y)
|
||||
CSRCS += nsh_telnetd.c
|
||||
CSRCS += nsh_telnetd.c
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_NSH_DISABLESCRIPT),y)
|
||||
CSRCS += nsh_test.c
|
||||
CSRCS += nsh_test.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_USBDEV),y)
|
||||
CSRCS += nsh_usbdev.c
|
||||
CSRCS += nsh_usbdev.c
|
||||
endif
|
||||
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
ifeq ($(CONFIG_NETUTILS_CODECS),y)
|
||||
CSRCS += nsh_codeccmd.c
|
||||
endif
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
VPATH =
|
||||
ROOTDEPPATH = --dep-path .
|
||||
VPATH =
|
||||
|
||||
# Build targets
|
||||
|
||||
all: .built
|
||||
all: .built
|
||||
.PHONY: context .depend depend clean distclean
|
||||
|
||||
$(AOBJS): %$(OBJEXT): %.S
|
||||
|
@ -106,26 +114,25 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
@touch .built
|
||||
|
||||
context:
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) \
|
||||
$(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
$(call DELFILE, .context)
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
||||
|
|
|
@ -235,6 +235,10 @@ o test <expression>
|
|||
integer -gt integer | integer -le integer |
|
||||
integer -lt integer | integer -ne integer
|
||||
|
||||
o base64dec [-w] [-f] <string or filepath>
|
||||
|
||||
o base64dec [-w] [-f] <string or filepath>
|
||||
|
||||
o cat <path> [<path> [<path> ...]]
|
||||
|
||||
This command copies and concatentates all of the files at <path>
|
||||
|
@ -381,7 +385,11 @@ o help [-v] [<cmd>]
|
|||
<cmd>
|
||||
Show full command usage only for this command
|
||||
|
||||
o ifconfig
|
||||
o hexdump <file or device>
|
||||
|
||||
Dump data in hexadecimal format from a file or character device.
|
||||
|
||||
o ifconfig [nic_name [<ip-address>|dhcp]] [dr|gw|gateway <dr-address>] [netmask <net-mask>] [dns <dns-address>] [hw <hw-mac>]
|
||||
|
||||
Show the current configuration of the network, for example:
|
||||
|
||||
|
@ -392,6 +400,22 @@ o ifconfig
|
|||
if uIP statistics are enabled (CONFIG_NET_STATISTICS), then
|
||||
this command will also show the detailed state of uIP.
|
||||
|
||||
o ifdown <nic-name>
|
||||
|
||||
Take down the interface identified by the name <nic-name>.
|
||||
|
||||
Example:
|
||||
|
||||
ifdown eth0
|
||||
|
||||
o ifup <nic-name>
|
||||
|
||||
Bring up down the interface identified by the name <nic-name>.
|
||||
|
||||
Example:
|
||||
|
||||
ifup eth0
|
||||
|
||||
o kill -<signal> <pid>
|
||||
|
||||
Send the <signal> to the task identified by <pid>.
|
||||
|
@ -449,6 +473,8 @@ o ls [-lRs] <dir-path>
|
|||
-l Show size and mode information along with the filenames
|
||||
in the listing.
|
||||
|
||||
o md5 [-f] <string or filepath>
|
||||
|
||||
o mb <hex-address>[=<hex-value>][ <hex-byte-count>]
|
||||
o mh <hex-address>[=<hex-value>][ <hex-byte-count>]
|
||||
o mw <hex-address>[=<hex-value>][ <hex-byte-count>]
|
||||
|
@ -781,6 +807,10 @@ o unset <name>
|
|||
|
||||
nsh>
|
||||
|
||||
o urldecode [-f] <string or filepath>
|
||||
|
||||
o urlencode [-f] <string or filepath>
|
||||
|
||||
o usleep <usec>
|
||||
|
||||
Pause execution (sleep) of <usec> microseconds.
|
||||
|
@ -826,6 +856,8 @@ Command Dependencies on Configuration Settings
|
|||
Command Depends on Configuration
|
||||
---------- --------------------------
|
||||
[ !CONFIG_NSH_DISABLESCRIPT
|
||||
base64dec CONFIG_NETUTILS_CODECS && CONFIG_CODECS_BASE64
|
||||
base64enc CONFIG_NETUTILS_CODECS && CONFIG_CODECS_BASE64
|
||||
cat CONFIG_NFILE_DESCRIPTORS > 0
|
||||
cd !CONFIG_DISABLE_ENVIRON && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
cp CONFIG_NFILE_DESCRIPTORS > 0
|
||||
|
@ -837,10 +869,14 @@ Command Dependencies on Configuration Settings
|
|||
free --
|
||||
get CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NET_BUFSIZE >= 558 (see note 1)
|
||||
help --
|
||||
hexdump CONFIG_NFILE_DESCRIPTORS > 0
|
||||
ifconfig CONFIG_NET
|
||||
ifdown CONFIG_NET
|
||||
ifup CONFIG_NET
|
||||
kill !CONFIG_DISABLE_SIGNALS
|
||||
losetup !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
ls CONFIG_NFILE_DESCRIPTORS > 0
|
||||
md5 CONFIG_NETUTILS_CODECS && CONFIG_CODECS_HASH_MD5
|
||||
mb,mh,mw ---
|
||||
mkdir !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE (see note 4)
|
||||
mkfatfs !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_FAT
|
||||
|
@ -861,6 +897,8 @@ Command Dependencies on Configuration Settings
|
|||
test !CONFIG_NSH_DISABLESCRIPT
|
||||
umount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_READABLE
|
||||
unset !CONFIG_DISABLE_ENVIRON
|
||||
urldecode CONFIG_NETUTILS_CODECS && CONFIG_CODECS_URLCODE
|
||||
urlencode CONFIG_NETUTILS_CODECS && CONFIG_CODECS_URLCODE
|
||||
usleep !CONFIG_DISABLE_SIGNALS
|
||||
get CONFIG_NET && CONFIG_NET_TCP && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
xd ---
|
||||
|
@ -880,20 +918,22 @@ In addition, each NSH command can be individually disabled via one of the follow
|
|||
settings. All of these settings make the configuration of NSH potentially complex but
|
||||
also allow it to squeeze into very small memory footprints.
|
||||
|
||||
CONFIG_NSH_DISABLE_CAT, CONFIG_NSH_DISABLE_CD, CONFIG_NSH_DISABLE_CP,
|
||||
CONFIG_NSH_DISABLE_DD, CONFIG_NSH_DISABLE_DF, CONFIG_NSH_DISABLE_ECHO,
|
||||
CONFIG_NSH_DISABLE_EXEC, CONFIG_NSH_DISABLE_EXIT, CONFIG_NSH_DISABLE_FREE,
|
||||
CONFIG_NSH_DISABLE_GET, CONFIG_NSH_DISABLE_HELP, CONFIG_NSH_DISABLE_IFCONFIG,
|
||||
CONFIG_NSH_DISABLE_KILL, CONFIG_NSH_DISABLE_LOSETUP, CONFIG_NSH_DISABLE_LS,
|
||||
CONFIG_NSH_DISABLE_MB, CONFIG_NSH_DISABLE_MKDIR, CONFIG_NSH_DISABLE_MKFATFS,
|
||||
CONFIG_NSH_DISABLE_MKFIFO, CONFIG_NSH_DISABLE_MKRD, CONFIG_NSH_DISABLE_MH,
|
||||
CONFIG_NSH_DISABLE_MOUNT, CONFIG_NSH_DISABLE_MW, CONFIG_NSH_DISABLE_MV,
|
||||
CONFIG_NSH_DISABLE_NFSMOUNT, CONFIG_NSH_DISABLE_PS, CONFIG_NSH_DISABLE_PING,
|
||||
CONFIG_NSH_DISABLE_PUT, CONFIG_NSH_DISABLE_PWD, CONFIG_NSH_DISABLE_RM,
|
||||
CONFIG_NSH_DISABLE_RMDIR, CONFIG_NSH_DISABLE_SET, CONFIG_NSH_DISABLE_SH,
|
||||
CONFIG_NSH_DISABLE_SLEEP, CONFIG_NSH_DISABLE_TEST, CONFIG_NSH_DISABLE_UMOUNT,
|
||||
CONFIG_NSH_DISABLE_UNSET, CONFIG_NSH_DISABLE_USLEEP, CONFIG_NSH_DISABLE_WGET,
|
||||
CONFIG_NSH_DISABLE_XD
|
||||
CONFIG_NSH_DISABLE_BASE64DEC, CONFIG_NSH_DISABLE_BASE64ENC, CONFIG_NSH_DISABLE_CAT,
|
||||
CONFIG_NSH_DISABLE_CD, CONFIG_NSH_DISABLE_CP, CONFIG_NSH_DISABLE_DD,
|
||||
CONFIG_NSH_DISABLE_DF, CONFIG_NSH_DISABLE_ECHO, CONFIG_NSH_DISABLE_EXEC,
|
||||
CONFIG_NSH_DISABLE_EXIT, CONFIG_NSH_DISABLE_FREE, CONFIG_NSH_DISABLE_GET,
|
||||
CONFIG_NSH_DISABLE_HELP, CONFIG_NSH_DISABLE_HEXDUMP, CONFIG_NSH_DISABLE_IFCONFIG,
|
||||
CONFIG_NSH_DISABLE_IFUPDOWN, CONFIG_NSH_DISABLE_KILL, CONFIG_NSH_DISABLE_LOSETUP,
|
||||
CONFIG_NSH_DISABLE_LS, CONFIG_NSH_DISABLE_MD5 CONFIG_NSH_DISABLE_MB,
|
||||
CONFIG_NSH_DISABLE_MKDIR, CONFIG_NSH_DISABLE_MKFATFS, CONFIG_NSH_DISABLE_MKFIFO,
|
||||
CONFIG_NSH_DISABLE_MKRD, CONFIG_NSH_DISABLE_MH, CONFIG_NSH_DISABLE_MOUNT,
|
||||
CONFIG_NSH_DISABLE_MW, CONFIG_NSH_DISABLE_MV, CONFIG_NSH_DISABLE_NFSMOUNT,
|
||||
CONFIG_NSH_DISABLE_PS, CONFIG_NSH_DISABLE_PING, CONFIG_NSH_DISABLE_PUT,
|
||||
CONFIG_NSH_DISABLE_PWD, CONFIG_NSH_DISABLE_RM, CONFIG_NSH_DISABLE_RMDIR,
|
||||
CONFIG_NSH_DISABLE_SET, CONFIG_NSH_DISABLE_SH, CONFIG_NSH_DISABLE_SLEEP,
|
||||
CONFIG_NSH_DISABLE_TEST, CONFIG_NSH_DISABLE_UMOUNT, CONFIG_NSH_DISABLE_UNSET,
|
||||
CONFIG_NSH_DISABLE_URLDECODE, CONFIG_NSH_DISABLE_URLENCODE, CONFIG_NSH_DISABLE_USLEEP,
|
||||
CONFIG_NSH_DISABLE_WGET, CONFIG_NSH_DISABLE_XD
|
||||
|
||||
Verbose help output can be suppressed by defining CONFIG_NSH_HELP_TERSE. In that
|
||||
case, the help command is still available but will be slightly smaller.
|
||||
|
@ -1084,6 +1124,10 @@ NSH-Specific Configuration Settings
|
|||
Set if your ethernet hardware has no built-in MAC address.
|
||||
If set, a bogus MAC will be assigned.
|
||||
|
||||
* CONFIG_NSH_MAX_ROUNDTRIP
|
||||
This is the maximum round trip for a response to a ICMP ECHO request.
|
||||
It is in units of deciseconds. The default is 20 (2 seconds).
|
||||
|
||||
If you use DHCPC, then some special configuration network options are
|
||||
required. These include:
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/usb/usbdev_trace.h>
|
||||
|
@ -215,6 +216,15 @@
|
|||
|
||||
#endif /* CONFIG_NSH_TELNET_LOGIN */
|
||||
|
||||
/* CONFIG_NSH_MAX_ROUNDTRIP - This is the maximum round trip for a response to
|
||||
* a ICMP ECHO request. It is in units of deciseconds. The default is 20
|
||||
* (2 seconds).
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NSH_MAX_ROUNDTRIP
|
||||
# define CONFIG_NSH_MAX_ROUNDTRIP 20
|
||||
#endif
|
||||
|
||||
/* Verify support for ROMFS /etc directory support options */
|
||||
|
||||
#ifdef CONFIG_NSH_ROMFSETC
|
||||
|
@ -258,12 +268,36 @@
|
|||
# undef CONFIG_NSH_ROMFSSECTSIZE
|
||||
#endif
|
||||
|
||||
/* This is the maximum number of arguments that will be accepted for a command */
|
||||
#ifdef CONFIG_NSH_MAX_ARGUMENTS
|
||||
# define NSH_MAX_ARGUMENTS CONFIG_NSH_MAX_ARGUMENTS
|
||||
#else
|
||||
# define NSH_MAX_ARGUMENTS 10
|
||||
/* This is the maximum number of arguments that will be accepted for a
|
||||
* command. Here we attempt to select the smallest number possible depending
|
||||
* upon the of commands that are available. Most commands use six or fewer
|
||||
* arguments, but there are a few that require more.
|
||||
*
|
||||
* This value is also configurable with CONFIG_NSH_MAXARGUMENTS. This
|
||||
* configurability is necessary since there may also be external, "built-in"
|
||||
* commands that require more commands than NSH is aware of.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NSH_MAXARGUMENTS
|
||||
# define CONFIG_NSH_MAXARGUMENTS 6
|
||||
#endif
|
||||
|
||||
#if CONFIG_NSH_MAXARGUMENTS < 11
|
||||
# if defined(CONFIG_NET) && !defined(CONFIG_NSH_DISABLE_IFCONFIG)
|
||||
# undef CONFIG_NSH_MAXARGUMENTS
|
||||
# define CONFIG_NSH_MAXARGUMENTS 11
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if CONFIG_NSH_MAXARGUMENTS < 7
|
||||
# if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
# if !defined(CONFIG_NSH_DISABLE_GET) || !defined(CONFIG_NSH_DISABLE_PUT)
|
||||
# undef CONFIG_NSH_MAXARGUMENTS
|
||||
# define CONFIG_NSH_MAXARGUMENTS 7
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* strerror() produces much nicer output but is, however, quite large and
|
||||
* will only be used if CONFIG_NSH_STRERROR is defined. Note that the strerror
|
||||
* interface must also have been enabled with CONFIG_LIBC_STRERROR.
|
||||
|
@ -507,7 +541,7 @@ void nsh_usbtrace(void);
|
|||
#ifndef CONFIG_NSH_DISABLE_XD
|
||||
int cmd_xd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(CONFIG_NSH_DISABLESCRIPT) && !defined(CONFIG_NSH_DISABLE_TEST)
|
||||
int cmd_test(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
int cmd_lbracket(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
|
@ -529,6 +563,9 @@ void nsh_usbtrace(void);
|
|||
# ifndef CONFIG_NSH_DISABLE_DD
|
||||
int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifndef CONFIG_NSH_DISABLE_HEXDUMP
|
||||
int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifndef CONFIG_NSH_DISABLE_LS
|
||||
int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
|
@ -595,6 +632,10 @@ void nsh_usbtrace(void);
|
|||
# ifndef CONFIG_NSH_DISABLE_IFCONFIG
|
||||
int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifndef CONFIG_NSH_DISABLE_IFUPDOWN
|
||||
int cmd_ifup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
int cmd_ifdown(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
#if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
# ifndef CONFIG_NSH_DISABLE_GET
|
||||
int cmd_get(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
|
@ -643,4 +684,28 @@ void nsh_usbtrace(void);
|
|||
# endif
|
||||
#endif /* CONFIG_DISABLE_SIGNALS */
|
||||
|
||||
#if defined(CONFIG_NETUTILS_CODECS) && defined(CONFIG_CODECS_BASE64)
|
||||
# ifndef CONFIG_NSH_DISABLE_BASE64DEC
|
||||
int cmd_base64decode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifndef CONFIG_NSH_DISABLE_BASE64ENC
|
||||
int cmd_base64encode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NETUTILS_CODECS) && defined(CONFIG_CODECS_HASH_MD5)
|
||||
# ifndef CONFIG_NSH_DISABLE_MD5
|
||||
int cmd_md5(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NETUTILS_CODECS) && defined(CONFIG_CODECS_URLCODE)
|
||||
# ifndef CONFIG_NSH_DISABLE_URLDECODE
|
||||
int cmd_urlencode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifndef CONFIG_NSH_DISABLE_URLENCODE
|
||||
int cmd_urldecode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* __APPS_NSHLIB_NSH_H */
|
||||
|
|
|
@ -122,13 +122,28 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
|||
ret = exec_namedapp(cmd, (FAR const char **)argv);
|
||||
if (ret >= 0)
|
||||
{
|
||||
/* The application was successfully started (but still blocked because the
|
||||
* scheduler is locked). If the application was not backgrounded, then we
|
||||
* need to wait here for the application to exit.
|
||||
/* The application was successfully started (but still blocked because
|
||||
* the scheduler is locked). If the application was not backgrounded,
|
||||
* then we need to wait here for the application to exit. These really
|
||||
* only works works with the following options:
|
||||
*
|
||||
* - CONFIG_NSH_DISABLEBG - Do not run commands in background
|
||||
* - CONFIG_SCHED_WAITPID - Required to run external commands in
|
||||
* foreground
|
||||
*
|
||||
* These concepts do not apply cleanly to the external applications.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SCHED_WAITPID
|
||||
|
||||
/* CONFIG_SCHED_WAITPID is selected, so we may run the command in
|
||||
* foreground unless we were specifically requested to run the command
|
||||
* in background (and running commands in background is enabled).
|
||||
*/
|
||||
|
||||
# ifndef CONFIG_NSH_DISABLEBG
|
||||
if (vtbl->np.np_bg == false)
|
||||
# endif /* CONFIG_NSH_DISABLEBG */
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
|
@ -155,8 +170,25 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
|||
*/
|
||||
}
|
||||
}
|
||||
# ifndef CONFIG_NSH_DISABLEBG
|
||||
else
|
||||
#endif
|
||||
# endif /* CONFIG_NSH_DISABLEBG */
|
||||
#endif /* CONFIG_SCHED_WAITPID */
|
||||
|
||||
/* We get here if either:
|
||||
*
|
||||
* - CONFIG_SCHED_WAITPID is not selected meaning that all commands
|
||||
* have to be run in background, or
|
||||
* - CONFIG_SCHED_WAITPID and CONFIG_NSH_DISABLEBG are both selected, but the
|
||||
* user requested to run the command in background.
|
||||
*
|
||||
* NOTE that the case of a) CONFIG_SCHED_WAITPID is not selected and
|
||||
* b) CONFIG_NSH_DISABLEBG selected cannot be supported. In that event, all
|
||||
* commands will have to run in background. The waitpid() API must be
|
||||
* available to support running the command in foreground.
|
||||
*/
|
||||
|
||||
#if !defined(CONFIG_SCHED_WAITPID) || !defined(CONFIG_NSH_DISABLEBG)
|
||||
{
|
||||
struct sched_param param;
|
||||
sched_getparam(0, ¶m);
|
||||
|
@ -168,6 +200,7 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
|||
|
||||
ret = OK;
|
||||
}
|
||||
#endif /* !CONFIG_SCHED_WAITPID || !CONFIG_NSH_DISABLEBG */
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
|
|
|
@ -0,0 +1,538 @@
|
|||
/****************************************************************************
|
||||
* apps/nshlib/nsh_apps.c
|
||||
*
|
||||
* This file is part of NuttX, contributed by Darcy Gong
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Darcy Gong 2012-10-30
|
||||
*
|
||||
* 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_NETUTILS_CODECS
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sched.h>
|
||||
#include <fcntl.h>
|
||||
#include <libgen.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#if defined(CONFIG_NSH_DISABLE_URLENCODE) && defined(CONFIG_NSH_DISABLE_URLDECODE)
|
||||
# undef CONFIG_CODECS_URLCODE
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CODECS_URLCODE
|
||||
#include <apps/netutils/urldecode.h>
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NSH_DISABLE_BASE64ENC) && defined(CONFIG_NSH_DISABLE_BASE64ENC)
|
||||
# undef CONFIG_CODECS_BASE64
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CODECS_BASE64
|
||||
#include <apps/netutils/base64.h>
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5)
|
||||
#include <apps/netutils/md5.h>
|
||||
#endif
|
||||
|
||||
#include "nsh.h"
|
||||
#include "nsh_console.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_NSH_CODECS_BUFSIZE
|
||||
# define CONFIG_NSH_CODECS_BUFSIZE 128
|
||||
#endif
|
||||
|
||||
#define CODEC_MODE_URLENCODE 1
|
||||
#define CODEC_MODE_URLDECODE 2
|
||||
#define CODEC_MODE_BASE64ENC 3
|
||||
#define CODEC_MODE_BASE64DEC 4
|
||||
#define CODEC_MODE_HASH_MD5 5
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
typedef void (*codec_callback_t)(FAR char *src_buff, int src_buff_len,
|
||||
FAR char *dst_buff, FAR int *dst_buff_len,
|
||||
int mode);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: urlencode_cb
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_CODECS_URLCODE) && !defined(CONFIG_NSH_DISABLE_URLENCODE)
|
||||
static void urlencode_cb(FAR char *src_buff, int src_buff_len,
|
||||
FAR char *dst_buff, FAR int *dst_buff_len, int mode)
|
||||
{
|
||||
urlencode(src_buff,src_buff_len,dst_buff,dst_buff_len);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: urldecode_cb
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_CODECS_URLCODE) && !defined(CONFIG_NSH_DISABLE_URLDECODE)
|
||||
static void urldecode_cb(FAR char *src_buff, int src_buff_len, FAR char *dst_buff,
|
||||
FAR int *dst_buff_len, int mode)
|
||||
{
|
||||
urldecode(src_buff,src_buff_len,dst_buff,dst_buff_len);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: b64enc_cb
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_CODECS_BASE64) && !defined(CONFIG_NSH_DISABLE_BASE64ENC)
|
||||
static void b64enc_cb(FAR char *src_buff, int src_buff_len, FAR char *dst_buff,
|
||||
FAR int *dst_buff_len, int mode)
|
||||
{
|
||||
if (mode == 0)
|
||||
{
|
||||
//dst_buff =
|
||||
base64_encode((unsigned char *)src_buff, src_buff_len,
|
||||
(unsigned char *)dst_buff, (size_t *)dst_buff_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
//dst_buff =
|
||||
base64w_encode((unsigned char *)src_buff, src_buff_len,
|
||||
(unsigned char *)dst_buff, (size_t *)dst_buff_len);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: b64dec_cb
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_CODECS_BASE64) && !defined(CONFIG_NSH_DISABLE_BASE64DEC)
|
||||
static void b64dec_cb(FAR char *src_buff, int src_buff_len, FAR char *dst_buff,
|
||||
FAR int *dst_buff_len, int mode)
|
||||
{
|
||||
if (mode == 0)
|
||||
{
|
||||
//dst_buff =
|
||||
base64_decode((unsigned char *)src_buff, src_buff_len,
|
||||
(unsigned char *)dst_buff, (size_t *)dst_buff_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
//dst_buff =
|
||||
base64w_decode((unsigned char *)src_buff, src_buff_len,
|
||||
(unsigned char *)dst_buff,(size_t *)dst_buff_len);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: md5_cb
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5)
|
||||
static void md5_cb(FAR char *src_buff, int src_buff_len, FAR char *dst_buff,
|
||||
FAR int *dst_buff_len, int mode)
|
||||
{
|
||||
MD5Update((MD5_CTX *)dst_buff, (unsigned char *)src_buff, src_buff_len);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: calc_codec_buffsize
|
||||
****************************************************************************/
|
||||
|
||||
static int calc_codec_buffsize(int src_buffsize, uint8_t mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case CODEC_MODE_URLENCODE:
|
||||
return src_buffsize*3+1;
|
||||
case CODEC_MODE_URLDECODE:
|
||||
return src_buffsize+1;
|
||||
case CODEC_MODE_BASE64ENC:
|
||||
return ((src_buffsize + 2)/ 3 * 4)+1;
|
||||
case CODEC_MODE_BASE64DEC:
|
||||
return (src_buffsize / 4 * 3 + 2)+1;
|
||||
case CODEC_MODE_HASH_MD5:
|
||||
return 32+1;
|
||||
default:
|
||||
return src_buffsize+1;
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cmd_codecs_proc
|
||||
****************************************************************************/
|
||||
|
||||
static int cmd_codecs_proc(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
|
||||
uint8_t mode, codec_callback_t func)
|
||||
{
|
||||
#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5)
|
||||
static const unsigned char hex_chars[] = "0123456789abcdef";
|
||||
MD5_CTX ctx;
|
||||
unsigned char mac[16];
|
||||
char *pSrc;
|
||||
char *pDest;
|
||||
#endif
|
||||
|
||||
char *localfile = NULL;
|
||||
char *src_buffer = NULL;
|
||||
char *buffer = NULL;
|
||||
char *fullpath = NULL;
|
||||
const char *fmt;
|
||||
char *s_data;
|
||||
bool badarg = false;
|
||||
bool is_file = false;
|
||||
bool is_websafe=false;
|
||||
int option;
|
||||
int fd = -1;
|
||||
int buff_len = 0;
|
||||
int src_buff_len = 0;
|
||||
int i = 0;
|
||||
int ret = OK;
|
||||
|
||||
/* Get the command options */
|
||||
|
||||
while ((option = getopt(argc, argv, ":fw")) != ERROR)
|
||||
{
|
||||
switch (option)
|
||||
{
|
||||
case 'f':
|
||||
is_file = true;
|
||||
break;
|
||||
|
||||
#ifdef CONFIG_CODECS_BASE64
|
||||
case 'w':
|
||||
is_websafe = true;
|
||||
|
||||
if (!(mode == CODEC_MODE_BASE64ENC || mode == CODEC_MODE_BASE64DEC))
|
||||
{
|
||||
badarg = true;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case ':':
|
||||
nsh_output(vtbl, g_fmtargrequired, argv[0]);
|
||||
badarg = true;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
default:
|
||||
nsh_output(vtbl, g_fmtarginvalid, argv[0]);
|
||||
badarg = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If a bad argument was encountered, then return without processing the command */
|
||||
|
||||
if (badarg)
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* There should be exactly on parameter left on the command-line */
|
||||
|
||||
if (optind == argc-1)
|
||||
{
|
||||
s_data = argv[optind];
|
||||
}
|
||||
else if (optind >= argc)
|
||||
{
|
||||
fmt = g_fmttoomanyargs;
|
||||
goto errout;
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt = g_fmtargrequired;
|
||||
goto errout;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5)
|
||||
if (mode == CODEC_MODE_HASH_MD5)
|
||||
{
|
||||
MD5Init(&ctx);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (is_file)
|
||||
{
|
||||
/* Get the local file name */
|
||||
|
||||
localfile = s_data;
|
||||
|
||||
/* Get the full path to the local file */
|
||||
|
||||
fullpath = nsh_getfullpath(vtbl, localfile);
|
||||
|
||||
/* Open the local file for writing */
|
||||
|
||||
fd = open(fullpath, O_RDONLY|O_TRUNC, 0644);
|
||||
if (fd < 0)
|
||||
{
|
||||
nsh_output(vtbl, g_fmtcmdfailed, argv[0], "open", NSH_ERRNO);
|
||||
ret = ERROR;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
src_buffer = malloc(CONFIG_NSH_CODECS_BUFSIZE+2);
|
||||
#if defined(CONFIG_CODECS_BASE64) && !defined(CONFIG_NSH_DISABLE_BASE64ENC)
|
||||
if (mode == CODEC_MODE_BASE64ENC)
|
||||
{
|
||||
src_buff_len = CONFIG_NSH_CODECS_BUFSIZE / 3 * 3;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
src_buff_len = CONFIG_NSH_CODECS_BUFSIZE;
|
||||
}
|
||||
|
||||
buff_len = calc_codec_buffsize(src_buff_len+2, mode);
|
||||
buffer = malloc(buff_len);
|
||||
while(true)
|
||||
{
|
||||
memset(src_buffer, 0, src_buff_len+2);
|
||||
ret=read(fd, src_buffer, src_buff_len);
|
||||
if (ret < 0)
|
||||
{
|
||||
nsh_output(vtbl, g_fmtcmdfailed, argv[0], "read", NSH_ERRNO);
|
||||
ret = ERROR;
|
||||
goto exit;
|
||||
}
|
||||
else if(ret==0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_CODECS_URLCODE) && !defined(CONFIG_NSH_DISABLE_URLDECODE)
|
||||
if (mode == CODEC_MODE_URLDECODE)
|
||||
{
|
||||
if (src_buffer[src_buff_len-1]=='%')
|
||||
{
|
||||
ret += read(fd,&src_buffer[src_buff_len],2);
|
||||
}
|
||||
else if (src_buffer[src_buff_len-2]=='%')
|
||||
{
|
||||
ret += read(fd,&src_buffer[src_buff_len],1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
memset(buffer, 0, buff_len);
|
||||
if (func)
|
||||
{
|
||||
#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5)
|
||||
if (mode == CODEC_MODE_HASH_MD5)
|
||||
{
|
||||
func(src_buffer, ret, (char *)&ctx, &buff_len,0);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
func(src_buffer, ret, buffer, &buff_len,(is_websafe)?1:0);
|
||||
nsh_output(vtbl, "%s", buffer);
|
||||
}
|
||||
}
|
||||
|
||||
buff_len = calc_codec_buffsize(src_buff_len+2, mode);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5)
|
||||
if (mode == CODEC_MODE_HASH_MD5)
|
||||
{
|
||||
MD5Final(mac, &ctx);
|
||||
pSrc = (char *)&mac;
|
||||
pDest = buffer;
|
||||
for(i=0;i<16;i++,pSrc++)
|
||||
{
|
||||
*pDest++ = hex_chars[(*pSrc) >> 4];
|
||||
*pDest++ = hex_chars[(*pSrc) & 0x0f];
|
||||
}
|
||||
|
||||
*pDest='\0';
|
||||
nsh_output(vtbl, "%s\n", buffer);
|
||||
}
|
||||
#endif
|
||||
ret = OK;
|
||||
goto exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
src_buffer = s_data;
|
||||
src_buff_len = strlen(s_data);
|
||||
buff_len = calc_codec_buffsize(src_buff_len, mode);
|
||||
buffer = malloc(buff_len);
|
||||
buffer[0]=0;
|
||||
if (!buffer)
|
||||
{
|
||||
fmt = g_fmtcmdoutofmemory;
|
||||
goto errout;
|
||||
}
|
||||
|
||||
memset(buffer, 0, buff_len);
|
||||
if (func)
|
||||
{
|
||||
#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5)
|
||||
if (mode == CODEC_MODE_HASH_MD5)
|
||||
{
|
||||
func(src_buffer, src_buff_len, (char *)&ctx, &buff_len, 0);
|
||||
MD5Final(mac, &ctx);
|
||||
pSrc = (char *)&mac;
|
||||
pDest = buffer;
|
||||
for(i=0;i<16;i++,pSrc++)
|
||||
{
|
||||
*pDest++ = hex_chars[(*pSrc) >> 4];
|
||||
*pDest++ = hex_chars[(*pSrc) & 0x0f];
|
||||
}
|
||||
|
||||
*pDest='\0';
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
func(src_buffer, src_buff_len, buffer, &buff_len,(is_websafe)?1:0);
|
||||
}
|
||||
}
|
||||
|
||||
nsh_output(vtbl, "%s\n",buffer);
|
||||
src_buffer = NULL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
exit:
|
||||
if (fd >= 0)
|
||||
{
|
||||
close(fd);
|
||||
}
|
||||
|
||||
if (fullpath)
|
||||
{
|
||||
free(fullpath);
|
||||
}
|
||||
|
||||
if (src_buffer)
|
||||
{
|
||||
free(src_buffer);
|
||||
}
|
||||
|
||||
if (buffer)
|
||||
{
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
errout:
|
||||
nsh_output(vtbl, fmt, argv[0]);
|
||||
ret = ERROR;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cmd_urlencode
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_CODECS_URLCODE) && !defined(CONFIG_NSH_DISABLE_URLENCODE)
|
||||
int cmd_urlencode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
return cmd_codecs_proc(vtbl, argc, argv, CODEC_MODE_URLENCODE, urlencode_cb);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cmd_urldecode
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_CODECS_URLCODE) && !defined(CONFIG_NSH_DISABLE_URLDECODE)
|
||||
int cmd_urldecode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
return cmd_codecs_proc(vtbl, argc, argv, CODEC_MODE_URLDECODE, urldecode_cb);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cmd_base64encode
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_CODECS_BASE64) && !defined(CONFIG_NSH_DISABLE_BASE64ENC)
|
||||
int cmd_base64encode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
return cmd_codecs_proc(vtbl, argc, argv, CODEC_MODE_BASE64ENC, b64enc_cb);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cmd_base64decode
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_CODECS_BASE64) && !defined(CONFIG_NSH_DISABLE_BASE64DEC)
|
||||
int cmd_base64decode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
return cmd_codecs_proc(vtbl, argc, argv, CODEC_MODE_BASE64DEC, b64dec_cb);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cmd_md5
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5)
|
||||
int cmd_md5(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
return cmd_codecs_proc(vtbl,argc,argv,CODEC_MODE_HASH_MD5,md5_cb);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_NETUTILS_CODECS */
|
|
@ -160,11 +160,11 @@ int nsh_consolemain(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
/* Clean up */
|
||||
/* Clean up. We do not get here, but this is necessary to keep some
|
||||
* compilers happy. But others will complain that this code is not
|
||||
* reachable.
|
||||
*/
|
||||
|
||||
nsh_exit(&pstate->cn_vtbl, 0);
|
||||
|
||||
/* We do not get here, but this is necessary to keep some compilers happy */
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,10 @@
|
|||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
# include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#include "nsh.h"
|
||||
#include "nsh_console.h"
|
||||
|
||||
|
@ -99,7 +103,7 @@ int mem_parse(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
|
|||
pcvalue++;
|
||||
|
||||
lvalue = (unsigned long)strtol(pcvalue, NULL, 16);
|
||||
if (lvalue > 0xffffffff)
|
||||
if (lvalue > 0xffffffffL)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -127,6 +131,7 @@ int mem_parse(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
|
|||
{
|
||||
mem->dm_count = 1;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -327,7 +332,7 @@ void nsh_dumpbuffer(FAR struct nsh_vtbl_s *vtbl, const char *msg,
|
|||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cmd_xd
|
||||
* Name: cmd_xd, hex dump of memory
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_NSH_DISABLE_XD
|
||||
|
@ -353,3 +358,58 @@ int cmd_xd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
|||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cmd_hexdump, hex dump of files
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
#ifndef CONFIG_NSH_DISABLE_HEXDUMP
|
||||
int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
uint8_t buffer[IOBUFFERSIZE];
|
||||
char msg[32];
|
||||
int position;
|
||||
int fd;
|
||||
int ret = OK;
|
||||
|
||||
/* Open the file for reading */
|
||||
|
||||
fd = open(argv[1], O_RDONLY);
|
||||
if (fd < 0)
|
||||
{
|
||||
nsh_output(vtbl, g_fmtcmdfailed, "hexdump", "open", NSH_ERRNO);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
position = 0;
|
||||
for (;;)
|
||||
{
|
||||
int nbytesread = read(fd, buffer, IOBUFFERSIZE);
|
||||
|
||||
/* Check for read errors */
|
||||
|
||||
if (nbytesread < 0)
|
||||
{
|
||||
int errval = errno;
|
||||
nsh_output(vtbl, g_fmtcmdfailed, "hexdump", "read", NSH_ERRNO_OF(errval));
|
||||
ret = ERROR;
|
||||
break;
|
||||
}
|
||||
else if (nbytesread > 0)
|
||||
{
|
||||
snprintf(msg, sizeof(msg), "%s at %08x", argv[1], position);
|
||||
nsh_dumpbuffer(vtbl, msg, buffer, nbytesread);
|
||||
position += nbytesread;
|
||||
}
|
||||
else
|
||||
{
|
||||
break; // EOF
|
||||
}
|
||||
}
|
||||
|
||||
(void)close(fd);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include <fcntl.h> /* Needed for open */
|
||||
#include <libgen.h> /* Needed for basename */
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/clock.h>
|
||||
|
@ -80,6 +81,15 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS)
|
||||
# ifdef CONFIG_HAVE_GETHOSTBYNAME
|
||||
# include <netdb.h>
|
||||
# else
|
||||
# include <apps/netutils/resolv.h>
|
||||
# endif
|
||||
# include <apps/netutils/dhcpc.h>
|
||||
#endif
|
||||
|
||||
#include "nsh.h"
|
||||
#include "nsh_console.h"
|
||||
|
||||
|
@ -87,8 +97,16 @@
|
|||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Size of the ECHO data */
|
||||
|
||||
#define DEFAULT_PING_DATALEN 56
|
||||
|
||||
/* Get the larger value */
|
||||
|
||||
#ifndef MAX
|
||||
# define MAX(a,b) (a > b ? a : b)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
@ -262,14 +280,34 @@ int ifconfig_callback(FAR struct uip_driver_s *dev, void *arg)
|
|||
{
|
||||
struct nsh_vtbl_s *vtbl = (struct nsh_vtbl_s*)arg;
|
||||
struct in_addr addr;
|
||||
bool is_running = false;
|
||||
int ret;
|
||||
|
||||
ret = uip_getifstatus(dev->d_ifname,&is_running);
|
||||
if (ret != OK)
|
||||
{
|
||||
nsh_output(vtbl, "\tGet %s interface flags error: %d\n",
|
||||
dev->d_ifname, ret);
|
||||
}
|
||||
|
||||
nsh_output(vtbl, "%s\tHWaddr %s at %s\n",
|
||||
dev->d_ifname, ether_ntoa(&dev->d_mac), (is_running)?"UP":"DOWN");
|
||||
|
||||
nsh_output(vtbl, "%s\tHWaddr %s\n", dev->d_ifname, ether_ntoa(&dev->d_mac));
|
||||
addr.s_addr = dev->d_ipaddr;
|
||||
nsh_output(vtbl, "\tIPaddr:%s ", inet_ntoa(addr));
|
||||
|
||||
addr.s_addr = dev->d_draddr;
|
||||
nsh_output(vtbl, "DRaddr:%s ", inet_ntoa(addr));
|
||||
|
||||
addr.s_addr = dev->d_netmask;
|
||||
nsh_output(vtbl, "Mask:%s\n\n", inet_ntoa(addr));
|
||||
nsh_output(vtbl, "Mask:%s\n", inet_ntoa(addr));
|
||||
|
||||
#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS)
|
||||
resolv_getserver(&addr);
|
||||
nsh_output(vtbl, "\tDNSaddr:%s\n", inet_ntoa(addr));
|
||||
#endif
|
||||
|
||||
nsh_output(vtbl, "\n");
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -468,6 +506,54 @@ int cmd_get(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cmd_ifup
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_NSH_DISABLE_IFUPDOWN
|
||||
int cmd_ifup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
FAR char *intf = NULL;
|
||||
int ret;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
nsh_output(vtbl, "Please select nic_name:\n");
|
||||
netdev_foreach(ifconfig_callback, vtbl);
|
||||
return OK;
|
||||
}
|
||||
|
||||
intf = argv[1];
|
||||
ret = uip_ifup(intf);
|
||||
nsh_output(vtbl, "ifup %s...%s\n", intf, (ret == OK) ? "OK" : "Failed");
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cmd_ifdown
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_NSH_DISABLE_IFUPDOWN
|
||||
int cmd_ifdown(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
FAR char *intf = NULL;
|
||||
int ret;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
nsh_output(vtbl, "Please select nic_name:\n");
|
||||
netdev_foreach(ifconfig_callback, vtbl);
|
||||
return OK;
|
||||
}
|
||||
|
||||
intf = argv[1];
|
||||
ret = uip_ifdown(intf);
|
||||
nsh_output(vtbl, "ifdown %s...%s\n", intf, (ret == OK) ? "OK" : "Failed");
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cmd_ifconfig
|
||||
****************************************************************************/
|
||||
|
@ -476,7 +562,20 @@ int cmd_get(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
|||
int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
struct in_addr addr;
|
||||
in_addr_t ip;
|
||||
in_addr_t gip;
|
||||
int i;
|
||||
FAR char *intf = NULL;
|
||||
FAR char *hostip = NULL;
|
||||
FAR char *gwip = NULL;
|
||||
FAR char *mask = NULL;
|
||||
FAR char *tmp = NULL;
|
||||
FAR char *hw = NULL;
|
||||
FAR char *dns = NULL;
|
||||
bool badarg = false;
|
||||
uint8_t mac[IFHWADDRLEN];
|
||||
#if defined(CONFIG_NSH_DHCPC)
|
||||
FAR void *handle;
|
||||
#endif
|
||||
|
||||
/* With one or no arguments, ifconfig simply shows the status of ethernet
|
||||
* device:
|
||||
|
@ -498,24 +597,201 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
|||
* ifconfig nic_name ip_address
|
||||
*/
|
||||
|
||||
/* Set host ip address */
|
||||
if (argc > 2)
|
||||
{
|
||||
for(i = 0; i < argc; i++)
|
||||
{
|
||||
if (i == 1)
|
||||
{
|
||||
intf = argv[i];
|
||||
}
|
||||
else if (i == 2)
|
||||
{
|
||||
hostip = argv[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = argv[i];
|
||||
if (!strcmp(tmp, "dr") || !strcmp(tmp, "gw") || !strcmp(tmp, "gateway"))
|
||||
{
|
||||
if (argc-1 >= i+1)
|
||||
{
|
||||
gwip = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
badarg = true;
|
||||
}
|
||||
}
|
||||
else if(!strcmp(tmp, "netmask"))
|
||||
{
|
||||
if (argc-1 >= i+1)
|
||||
{
|
||||
mask = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
badarg = true;
|
||||
}
|
||||
}
|
||||
else if(!strcmp(tmp, "hw"))
|
||||
{
|
||||
if (argc-1>=i+1)
|
||||
{
|
||||
hw = argv[i+1];
|
||||
i++;
|
||||
badarg = !uiplib_hwmacconv(hw, mac);
|
||||
}
|
||||
else
|
||||
{
|
||||
badarg = true;
|
||||
}
|
||||
}
|
||||
else if(!strcmp(tmp, "dns"))
|
||||
{
|
||||
if (argc-1 >= i+1)
|
||||
{
|
||||
dns = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
badarg = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ip = addr.s_addr = inet_addr(argv[2]);
|
||||
uip_sethostaddr(argv[1], &addr);
|
||||
if (badarg)
|
||||
{
|
||||
nsh_output(vtbl, g_fmtargrequired, argv[0]);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* Set Hardware ethernet MAC addr */
|
||||
|
||||
if (hw)
|
||||
{
|
||||
ndbg("HW MAC: %s\n", hw);
|
||||
uip_setmacaddr(intf, mac);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_NSH_DHCPC)
|
||||
if (!strcmp(hostip, "dhcp"))
|
||||
{
|
||||
/* Set DHCP addr */
|
||||
|
||||
ndbg("DHCPC Mode\n");
|
||||
gip = addr.s_addr = 0;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* Set host IP address */
|
||||
|
||||
ndbg("Host IP: %s\n", hostip);
|
||||
gip = addr.s_addr = inet_addr(hostip);
|
||||
}
|
||||
|
||||
uip_sethostaddr(intf, &addr);
|
||||
|
||||
/* Set gateway */
|
||||
|
||||
ip = NTOHL(ip);
|
||||
ip &= ~0x000000ff;
|
||||
ip |= 0x00000001;
|
||||
if (gwip)
|
||||
{
|
||||
ndbg("Gateway: %s\n", gwip);
|
||||
gip = addr.s_addr = inet_addr(gwip);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gip)
|
||||
{
|
||||
ndbg("Gateway: default\n");
|
||||
gip = NTOHL(gip);
|
||||
gip &= ~0x000000ff;
|
||||
gip |= 0x00000001;
|
||||
gip = HTONL(gip);
|
||||
}
|
||||
|
||||
addr.s_addr = HTONL(ip);
|
||||
uip_setdraddr(argv[1], &addr);
|
||||
addr.s_addr = gip;
|
||||
}
|
||||
|
||||
/* Set netmask */
|
||||
uip_setdraddr(intf, &addr);
|
||||
|
||||
addr.s_addr = inet_addr("255.255.255.0");
|
||||
uip_setnetmask(argv[1], &addr);
|
||||
/* Set network mask */
|
||||
|
||||
if (mask)
|
||||
{
|
||||
ndbg("Netmask: %s\n",mask);
|
||||
addr.s_addr = inet_addr(mask);
|
||||
}
|
||||
else
|
||||
{
|
||||
ndbg("Netmask: Default\n");
|
||||
addr.s_addr = inet_addr("255.255.255.0");
|
||||
}
|
||||
|
||||
uip_setnetmask(intf, &addr);
|
||||
|
||||
#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS)
|
||||
if (dns)
|
||||
{
|
||||
ndbg("DNS: %s\n", dns);
|
||||
addr.s_addr = inet_addr(dns);
|
||||
}
|
||||
else
|
||||
{
|
||||
ndbg("DNS: Default\n");
|
||||
addr.s_addr = gip;
|
||||
}
|
||||
|
||||
resolv_conf(&addr);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NSH_DHCPC)
|
||||
/* Get the MAC address of the NIC */
|
||||
|
||||
if (!gip)
|
||||
{
|
||||
uip_getmacaddr("eth0", mac);
|
||||
|
||||
/* Set up the DHCPC modules */
|
||||
|
||||
handle = dhcpc_open(&mac, IFHWADDRLEN);
|
||||
|
||||
/* Get an IP address. Note that there is no logic for renewing the IP address in this
|
||||
* example. The address should be renewed in ds.lease_time/2 seconds.
|
||||
*/
|
||||
|
||||
if (handle)
|
||||
{
|
||||
struct dhcpc_state ds;
|
||||
|
||||
(void)dhcpc_request(handle, &ds);
|
||||
uip_sethostaddr("eth0", &ds.ipaddr);
|
||||
|
||||
if (ds.netmask.s_addr != 0)
|
||||
{
|
||||
uip_setnetmask("eth0", &ds.netmask);
|
||||
}
|
||||
|
||||
if (ds.default_router.s_addr != 0)
|
||||
{
|
||||
uip_setdraddr("eth0", &ds.default_router);
|
||||
}
|
||||
|
||||
if (ds.dnsaddr.s_addr != 0)
|
||||
{
|
||||
resolv_conf(&ds.dnsaddr);
|
||||
}
|
||||
|
||||
dhcpc_close(handle);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
@ -536,6 +812,7 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
|||
uint32_t start;
|
||||
uint32_t next;
|
||||
uint32_t dsec = 10;
|
||||
uint32_t maxwait;
|
||||
uint16_t id;
|
||||
bool badarg = false;
|
||||
int count = 10;
|
||||
|
@ -599,7 +876,7 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
|||
if (optind == argc-1)
|
||||
{
|
||||
staddr = argv[optind];
|
||||
if (!uiplib_ipaddrconv(staddr, (FAR unsigned char*)&ipaddr))
|
||||
if (dns_gethostip(staddr, &ipaddr) < 0)
|
||||
{
|
||||
goto errout;
|
||||
}
|
||||
|
@ -619,16 +896,26 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
|||
|
||||
id = ping_newid();
|
||||
|
||||
/* The maximum wait for a response will be the larger of the inter-ping time and
|
||||
* the configured maximum round-trip time.
|
||||
*/
|
||||
|
||||
maxwait = MAX(dsec, CONFIG_NSH_MAX_ROUNDTRIP);
|
||||
|
||||
/* Loop for the specified count */
|
||||
|
||||
nsh_output(vtbl, "PING %s %d bytes of data\n", staddr, DEFAULT_PING_DATALEN);
|
||||
nsh_output(vtbl, "PING %d.%d.%d.%d %d bytes of data\n",
|
||||
(ipaddr ) & 0xff, (ipaddr >> 8 ) & 0xff,
|
||||
(ipaddr >> 16 ) & 0xff, (ipaddr >> 24 ) & 0xff,
|
||||
DEFAULT_PING_DATALEN);
|
||||
|
||||
start = g_system_timer;
|
||||
for (i = 1; i <= count; i++)
|
||||
{
|
||||
/* Send the ECHO request and wait for the response */
|
||||
|
||||
next = g_system_timer;
|
||||
seqno = uip_ping(ipaddr, id, i, DEFAULT_PING_DATALEN, dsec);
|
||||
seqno = uip_ping(ipaddr, id, i, DEFAULT_PING_DATALEN, maxwait);
|
||||
|
||||
/* Was any response returned? We can tell if a non-negative sequence
|
||||
* number was returned.
|
||||
|
@ -636,7 +923,7 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
|||
|
||||
if (seqno >= 0 && seqno <= i)
|
||||
{
|
||||
/* Get the elpased time from the time that the request was
|
||||
/* Get the elapsed time from the time that the request was
|
||||
* sent until the response was received. If we got a response
|
||||
* to an earlier request, then fudge the elpased time.
|
||||
*/
|
||||
|
@ -644,7 +931,7 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
|||
elapsed = TICK2MSEC(g_system_timer - next);
|
||||
if (seqno < i)
|
||||
{
|
||||
elapsed += 100*dsec*(i - seqno);
|
||||
elapsed += 100 * dsec * (i - seqno);
|
||||
}
|
||||
|
||||
/* Report the receipt of the reply */
|
||||
|
@ -662,7 +949,7 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
|||
elapsed = TICK2DSEC(g_system_timer - next);
|
||||
if (elapsed < dsec)
|
||||
{
|
||||
usleep(100000*dsec);
|
||||
usleep(100000 * (dsec - elapsed));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include <net/if.h>
|
||||
|
||||
#include <apps/netutils/uiplib.h>
|
||||
#if defined(CONFIG_NSH_DHCPC)
|
||||
#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS)
|
||||
# include <apps/netutils/resolv.h>
|
||||
# include <apps/netutils/dhcpc.h>
|
||||
#endif
|
||||
|
@ -60,6 +60,10 @@
|
|||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_NSH_DRIPADDR) && !defined(CONFIG_NSH_DNSIPADDR)
|
||||
# define CONFIG_NSH_DNSIPADDR CONFIG_NSH_DRIPADDR
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
@ -125,10 +129,14 @@ int nsh_netinit(void)
|
|||
addr.s_addr = HTONL(CONFIG_NSH_NETMASK);
|
||||
uip_setnetmask("eth0", &addr);
|
||||
|
||||
#if defined(CONFIG_NSH_DHCPC)
|
||||
#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS)
|
||||
/* Set up the resolver */
|
||||
|
||||
resolv_init();
|
||||
#if defined(CONFIG_NSH_DNS)
|
||||
addr.s_addr = HTONL(CONFIG_NSH_DNSIPADDR);
|
||||
resolv_conf(&addr);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NSH_DHCPC)
|
||||
|
@ -148,7 +156,7 @@ int nsh_netinit(void)
|
|||
{
|
||||
struct dhcpc_state ds;
|
||||
(void)dhcpc_request(handle, &ds);
|
||||
uip_sethostaddr("eth1", &ds.ipaddr);
|
||||
uip_sethostaddr("eth0", &ds.ipaddr);
|
||||
if (ds.netmask.s_addr != 0)
|
||||
{
|
||||
uip_setnetmask("eth0", &ds.netmask);
|
||||
|
|
|
@ -73,19 +73,19 @@
|
|||
/* Argument list size
|
||||
*
|
||||
* argv[0]: The command name.
|
||||
* argv[1]: The beginning of argument (up to NSH_MAX_ARGUMENTS)
|
||||
* argv[1]: The beginning of argument (up to CONFIG_NSH_MAXARGUMENTS)
|
||||
* argv[argc-3]: Possibly '>' or '>>'
|
||||
* argv[argc-2]: Possibly <file>
|
||||
* argv[argc-1]: Possibly '&' (if pthreads are enabled)
|
||||
* argv[argc]: NULL terminating pointer
|
||||
*
|
||||
* Maximum size is NSH_MAX_ARGUMENTS+5
|
||||
* Maximum size is CONFIG_NSH_MAXARGUMENTS+5
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
# define MAX_ARGV_ENTRIES (NSH_MAX_ARGUMENTS+5)
|
||||
# define MAX_ARGV_ENTRIES (CONFIG_NSH_MAXARGUMENTS+5)
|
||||
#else
|
||||
# define MAX_ARGV_ENTRIES (NSH_MAX_ARGUMENTS+4)
|
||||
# define MAX_ARGV_ENTRIES (CONFIG_NSH_MAXARGUMENTS+4)
|
||||
#endif
|
||||
|
||||
/* Help command summary layout */
|
||||
|
@ -146,16 +146,25 @@ static const char g_failure[] = "1";
|
|||
static const struct cmdmap_s g_cmdmap[] =
|
||||
{
|
||||
#if !defined(CONFIG_NSH_DISABLESCRIPT) && !defined(CONFIG_NSH_DISABLE_TEST)
|
||||
{ "[", cmd_lbracket, 4, NSH_MAX_ARGUMENTS, "<expression> ]" },
|
||||
{ "[", cmd_lbracket, 4, CONFIG_NSH_MAXARGUMENTS, "<expression> ]" },
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_NSH_DISABLE_HELP
|
||||
{ "?", cmd_help, 1, 1, NULL },
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NETUTILS_CODECS) && defined(CONFIG_CODECS_BASE64)
|
||||
# ifndef CONFIG_NSH_DISABLE_BASE64DEC
|
||||
{ "base64dec", cmd_base64decode, 2, 4, "[-w] [-f] <string or filepath>" },
|
||||
# endif
|
||||
# ifndef CONFIG_NSH_DISABLE_BASE64ENC
|
||||
{ "base64enc", cmd_base64encode, 2, 4, "[-w] [-f] <string or filepath>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
# ifndef CONFIG_NSH_DISABLE_CAT
|
||||
{ "cat", cmd_cat, 2, NSH_MAX_ARGUMENTS, "<path> [<path> [<path> ...]]" },
|
||||
{ "cat", cmd_cat, 2, CONFIG_NSH_MAXARGUMENTS, "<path> [<path> [<path> ...]]" },
|
||||
# endif
|
||||
#ifndef CONFIG_DISABLE_ENVIRON
|
||||
# ifndef CONFIG_NSH_DISABLE_CD
|
||||
|
@ -187,9 +196,9 @@ static const struct cmdmap_s g_cmdmap[] =
|
|||
|
||||
#ifndef CONFIG_NSH_DISABLE_ECHO
|
||||
# ifndef CONFIG_DISABLE_ENVIRON
|
||||
{ "echo", cmd_echo, 0, NSH_MAX_ARGUMENTS, "[<string|$name> [<string|$name>...]]" },
|
||||
{ "echo", cmd_echo, 0, CONFIG_NSH_MAXARGUMENTS, "[<string|$name> [<string|$name>...]]" },
|
||||
# else
|
||||
{ "echo", cmd_echo, 0, NSH_MAX_ARGUMENTS, "[<string> [<string>...]]" },
|
||||
{ "echo", cmd_echo, 0, CONFIG_NSH_MAXARGUMENTS, "[<string> [<string>...]]" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@ -217,10 +226,20 @@ static const struct cmdmap_s g_cmdmap[] =
|
|||
{ "help", cmd_help, 1, 3, "[-v] [<cmd>]" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
#ifndef CONFIG_NSH_DISABLE_HEXDUMP
|
||||
{ "hexdump", cmd_hexdump, 2, 2, "<file or device>" },
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET
|
||||
# ifndef CONFIG_NSH_DISABLE_IFCONFIG
|
||||
{ "ifconfig", cmd_ifconfig, 1, 3, "[nic_name [ip]]" },
|
||||
{ "ifconfig", cmd_ifconfig, 1, 11, "[nic_name [<ip-address>|dhcp]] [dr|gw|gateway <dr-address>] [netmask <net-mask>] [dns <dns-address>] [hw <hw-mac>]" },
|
||||
# endif
|
||||
# ifndef CONFIG_NSH_DISABLE_IFUPDOWN
|
||||
{ "ifdown", cmd_ifdown, 2, 2, "<nic_name>" },
|
||||
{ "ifup", cmd_ifup, 2, 2, "<nic_name>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@ -246,6 +265,12 @@ static const struct cmdmap_s g_cmdmap[] =
|
|||
{ "mb", cmd_mb, 2, 3, "<hex-address>[=<hex-value>][ <hex-byte-count>]" },
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NETUTILS_CODECS) && defined(CONFIG_CODECS_HASH_MD5)
|
||||
# ifndef CONFIG_NSH_DISABLE_MD5
|
||||
{ "md5", cmd_md5, 2, 3, "[-f] <string or filepath>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE)
|
||||
# ifndef CONFIG_NSH_DISABLE_MKDIR
|
||||
{ "mkdir", cmd_mkdir, 2, 2, "<path>" },
|
||||
|
@ -348,7 +373,7 @@ static const struct cmdmap_s g_cmdmap[] =
|
|||
#endif
|
||||
|
||||
#if !defined(CONFIG_NSH_DISABLESCRIPT) && !defined(CONFIG_NSH_DISABLE_TEST)
|
||||
{ "test", cmd_test, 3, NSH_MAX_ARGUMENTS, "<expression>" },
|
||||
{ "test", cmd_test, 3, CONFIG_NSH_MAXARGUMENTS, "<expression>" },
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE)
|
||||
|
@ -363,6 +388,15 @@ static const struct cmdmap_s g_cmdmap[] =
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NETUTILS_CODECS) && defined(CONFIG_CODECS_URLCODE)
|
||||
# ifndef CONFIG_NSH_DISABLE_URLDECODE
|
||||
{ "urldecode", cmd_urldecode, 2, 3, "[-f] <string or filepath>" },
|
||||
# endif
|
||||
# ifndef CONFIG_NSH_DISABLE_URLENCODE
|
||||
{ "urlencode", cmd_urlencode, 2, 3, "[-f] <string or filepath>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
# ifndef CONFIG_NSH_DISABLE_USLEEP
|
||||
{ "usleep", cmd_usleep, 2, 2, "<usec>" },
|
||||
|
@ -378,6 +412,7 @@ static const struct cmdmap_s g_cmdmap[] =
|
|||
#ifndef CONFIG_NSH_DISABLE_XD
|
||||
{ "xd", cmd_xd, 3, 3, "<hex-address> <byte-count>" },
|
||||
#endif
|
||||
|
||||
{ NULL, NULL, 1, 1, NULL }
|
||||
};
|
||||
|
||||
|
@ -711,7 +746,7 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl, int argc, char *argv[])
|
|||
*
|
||||
* argv[0]: The command name. This is argv[0] when the arguments
|
||||
* are, finally, received by the command vtblr
|
||||
* argv[1]: The beginning of argument (up to NSH_MAX_ARGUMENTS)
|
||||
* argv[1]: The beginning of argument (up to CONFIG_NSH_MAXARGUMENTS)
|
||||
* argv[argc]: NULL terminating pointer
|
||||
*/
|
||||
|
||||
|
@ -1318,13 +1353,13 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
|
|||
* of argv is:
|
||||
*
|
||||
* argv[0]: The command name.
|
||||
* argv[1]: The beginning of argument (up to NSH_MAX_ARGUMENTS)
|
||||
* argv[1]: The beginning of argument (up to CONFIG_NSH_MAXARGUMENTS)
|
||||
* argv[argc-3]: Possibly '>' or '>>'
|
||||
* argv[argc-2]: Possibly <file>
|
||||
* argv[argc-1]: Possibly '&'
|
||||
* argv[argc]: NULL terminating pointer
|
||||
*
|
||||
* Maximum size is NSH_MAX_ARGUMENTS+5
|
||||
* Maximum size is CONFIG_NSH_MAXARGUMENTS+5
|
||||
*/
|
||||
|
||||
argv[0] = cmd;
|
||||
|
@ -1398,7 +1433,7 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
|
|||
|
||||
/* Check if the maximum number of arguments was exceeded */
|
||||
|
||||
if (argc > NSH_MAX_ARGUMENTS)
|
||||
if (argc > CONFIG_NSH_MAXARGUMENTS)
|
||||
{
|
||||
nsh_output(vtbl, g_fmttoomanyargs, cmd);
|
||||
}
|
||||
|
|
|
@ -41,31 +41,36 @@ SUBDIRS = free i2c install readline poweroff ramtron sdcard sysinfo
|
|||
|
||||
# Create the list of installed runtime modules (INSTALLED_DIRS)
|
||||
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
define ADD_DIRECTORY
|
||||
INSTALLED_DIRS += ${shell if [ -r $1/Makefile ]; then echo "$1"; fi}
|
||||
INSTALLED_DIRS += $(if $(wildcard .\$1\Makefile),$1,)
|
||||
endef
|
||||
else
|
||||
define ADD_DIRECTORY
|
||||
INSTALLED_DIRS += $(if $(wildcard ./$1/Makefile),$1,)
|
||||
endef
|
||||
endif
|
||||
|
||||
$(foreach DIR, $(SUBDIRS), $(eval $(call ADD_DIRECTORY,$(DIR))))
|
||||
|
||||
all: nothing
|
||||
.PHONY: nothing context depend clean distclean
|
||||
|
||||
define SDIR_template
|
||||
$(1)_$(2):
|
||||
$(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"
|
||||
endef
|
||||
|
||||
$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),depend)))
|
||||
$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),clean)))
|
||||
$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),distclean)))
|
||||
|
||||
nothing:
|
||||
|
||||
context:
|
||||
|
||||
depend:
|
||||
@for dir in $(INSTALLED_DIRS) ; do \
|
||||
$(MAKE) -C $$dir depend TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
|
||||
done
|
||||
depend: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_depend)
|
||||
|
||||
clean:
|
||||
@for dir in $(INSTALLED_DIRS) ; do \
|
||||
$(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
|
||||
done
|
||||
|
||||
distclean: clean
|
||||
@for dir in $(INSTALLED_DIRS) ; do \
|
||||
$(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
|
||||
done
|
||||
clean: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_clean)
|
||||
|
||||
distclean: clean $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_distclean)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
############################################################################
|
||||
# apps/system/free/Makefile
|
||||
#
|
||||
# Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||
# Copyright (C) 2011-2012 Uros Platise. All rights reserved.
|
||||
# Author: Uros Platise <uros.platise@isotel.eu>
|
||||
# Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
|
@ -61,10 +61,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -83,32 +87,32 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
@touch .built
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
$(Q) touch .built
|
||||
|
||||
# Register application
|
||||
|
||||
.context:
|
||||
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
|
||||
@touch $@
|
||||
$(Q) touch $@
|
||||
|
||||
context: .context
|
||||
|
||||
# Create dependencies
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
$(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
$(Q) touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f .context Make.dep .depend
|
||||
$(call DELFILE, .context)
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
|
|
@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -73,30 +77,29 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
@touch .built
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
$(Q) touch .built
|
||||
|
||||
.context:
|
||||
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
|
||||
@touch $@
|
||||
$(Q) touch $@
|
||||
|
||||
context: .context
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) \
|
||||
$(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
$(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
$(Q) touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
$(call DELFILE, .context)
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
# apps/system/install/Makefile
|
||||
#
|
||||
# Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||
# Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
# Author: Uros Platise <uros.platise@isotel.eu>
|
||||
# Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
|
@ -61,10 +62,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -83,32 +88,32 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
@touch .built
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
$(Q) touch .built
|
||||
|
||||
# Register application
|
||||
|
||||
.context:
|
||||
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
|
||||
@touch $@
|
||||
$(Q) touch $@
|
||||
|
||||
context: .context
|
||||
|
||||
# Create dependencies
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
$(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
$(Q) touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f .context Make.dep .depend
|
||||
$(call DELFILE, .context)
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
|
|
@ -52,10 +52,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = "$(APPDIR)/libapps$(LIBEXT)"
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
@ -74,10 +78,8 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
@touch .built
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
$(Q) touch .built
|
||||
|
||||
# Context build phase target
|
||||
|
||||
|
@ -86,18 +88,20 @@ context:
|
|||
# Dependency build phase target
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
$(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
$(Q) touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
# Housekeeping targets
|
||||
|
||||
clean:
|
||||
@rm -f *.o *~ .*.swp .built
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f .context Make.dep .depend
|
||||
$(call DELFILE, .context)
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
|
|
@ -163,6 +163,57 @@ dtoa():
|
|||
"This product includes software developed by the University of
|
||||
California, Berkeley and its contributors."
|
||||
|
||||
libc/string/lib_vikmemcpy.c
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
If you enable CONFIG_MEMCPY_VIK, then you will build with the optimized
|
||||
version of memcpy from Daniel Vik. Licensing information for that version
|
||||
of memcpy() follows:
|
||||
|
||||
Copyright (C) 1999-2010 Daniel Vik
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
libc/math
|
||||
^^^^^^^^^
|
||||
|
||||
If you enable CONFIG_LIB, you will build the math library at libc/math.
|
||||
This library was taken from the math library developed for the Rhombus
|
||||
OS by Nick Johnson (https://github.com/nickbjohnson4224/rhombus). This
|
||||
port was contributed by Darcy Gong. The Rhombus math library has this
|
||||
compatible MIT license:
|
||||
|
||||
Copyright (C) 2009-2011 Nick Johnson <nickbjohnson4224 at gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
|
||||
Documents/rss.gif
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
332
nuttx/ChangeLog
332
nuttx/ChangeLog
|
@ -3453,7 +3453,7 @@
|
|||
* net/uip/uip_icmpping.c: Fix problem that prevented ping from
|
||||
going outside of local network. Submitted by Darcy Gong
|
||||
|
||||
6.23 2012-09-29 Gregory Nutt <gnutt@nuttx.org>
|
||||
6.23 2012-11-05 Gregory Nutt <gnutt@nuttx.org>
|
||||
|
||||
* arch/arm/src/stm32/stm32_rng.c, chip/stm32_rng.h, and other files:
|
||||
Implementation of /dev/random using the STM32 Random Number
|
||||
|
@ -3470,4 +3470,334 @@
|
|||
* configs/shenzhou/*/Make.defs: Now uses the new buildroot 4.6.3
|
||||
EABI toolchain.
|
||||
* lib/stdio/lib_libdtoa.c: Another dtoa() fix from Mike Smith.
|
||||
* configs/shenzhou/src/up_adc.c: Add ADC support for the Shenzhou
|
||||
board (Darcy Gong).
|
||||
* configs/shenzhou/thttpd: Add a THTTPD configuration for the
|
||||
Shenzhou board (Darcy Gong).
|
||||
* include/termios.h and lib/termios/libcf*speed.c: The non-standard,
|
||||
"hidden" c_speed cannot be type const or else static instantiations
|
||||
of termios will be required to initialize it (Mike Smith).
|
||||
* drivers/input/max11802.c/h, and include/nuttx/input max11802.h: Adds
|
||||
support for the Maxim MAX11802 touchscreen controller (contributed by
|
||||
Petteri Aimonen).
|
||||
* graphics/nxtk/nxtk_events.c: Missing implementation of the blocked
|
||||
method. This is a critical bugfix for graphics support (contributed
|
||||
by Petteri Aimonen).
|
||||
* drivers/usbdev/pl2303.c, drivers/usbdev/usbmsc.h, and
|
||||
include/nuttx/usb/cdcacm.h: USB_CONFIG_ATTR_SELFPOWER vs.
|
||||
USB_CONFIG_ATT_SELFPOWER (contributed by Petteri Aimonen).
|
||||
* arch/arm/src/armv7-m/up_memcpy.S: An optimized memcpy() function for
|
||||
the ARMv7-M family contributed by Mike Smith.
|
||||
* lib/strings/lib_vikmemcpy.c: As an option, the larger but faster
|
||||
implemementation of memcpy from Daniel Vik is now available (this is
|
||||
from http://www.danielvik.com/2010/02/fast-memcpy-in-c.html).
|
||||
* lib/strings/lib_memset.c: CONFIG_MEMSET_OPTSPEED will select a
|
||||
version of memset() optimized for speed. By default, memset() is
|
||||
optimized for size.
|
||||
* lib/strings/lib_memset.c: CONFIG_MEMSET_64BIT will perform 64-bit
|
||||
aligned memset() operations.
|
||||
* arch/arm/src/stm32/stm32_adc.c: Need to put the ADC back into the
|
||||
initial reset in the open/setup logic. Opening the ADC driver works
|
||||
the first time, but not the second because the device is left in a
|
||||
powered down state on the last close.
|
||||
* configs/olimex-lpc1766stck/scripts: Replace all of the identical
|
||||
ld.script files with the common one in this directory.
|
||||
* configs/stm3220g-eval/scripts: Replace all of the identical
|
||||
ld.script files with the common one in this directory.
|
||||
* configs/hymini-stm32v/scripts: Replace all of the identical
|
||||
ld.script files with the common one in this directory.
|
||||
* configs/lpcxpresso-lpc1768/scripts: Replace all of the identical
|
||||
ld.script files with the common one in this directory.
|
||||
* binfmt/elf.c, binfmt/libelf, include/elf.h, include/nuttx/elf.h: Add
|
||||
basic framework for loadable ELF module support. The initial check-
|
||||
in is non-functional and is simply the framework for ELF support.
|
||||
* include/nuttx/binfmt.h, nxflat.h, elf.h, and symtab.h: Moved to
|
||||
include/nuttx/binfmt/.
|
||||
* arch/sim/src/up_elf.c and arch/x86/src/common/up_elf.c: Add
|
||||
for ELF modules.
|
||||
* arch/arm/include/elf.h: Added ARM ELF header file.
|
||||
* include/elf32.h: Renamed elf.h to elf32.h.
|
||||
* configs/stm32f4discovery/ostest: Converted to use the new
|
||||
Kconfig-based configuration system.
|
||||
* configs/stm32f4discovery/elf and configs/stm32f4discovery/scripts/gnu-elf.ld
|
||||
Add a configuration for testing the ARM ELF loader.
|
||||
* binfmt/libelf: Can't use fstat(). NuttX does not yet support it. Damn!
|
||||
* binfmt/libelf: The basic ELF module execution appears fully functional.
|
||||
* configs/shenzhou/src/up_relays.c: Add support for relays from the
|
||||
Shenzhou board. Contributed by Darcy Gong.
|
||||
* lib/fixedmath: Moved the old lib/math to lib/fixedmath to make room for
|
||||
the math library from the Rhombus OS
|
||||
* lib/math: Now contains the math library from the Rhombus OS by Nick Johnson
|
||||
(submitted by Darcy Gong).
|
||||
* include/float.h: Add a first cut at the float.h header file. This
|
||||
really should be an architecture/toolchain-specific header file. It
|
||||
is only used if CONFIG_ARCH_FLOAT_H is defined.
|
||||
* lib/math: Files now conform to coding standards. Separated float,
|
||||
double, and long double versions of code into separate files so that
|
||||
they don't draw in so much un-necessary code when doing a dumb link.
|
||||
* binfmt/libelf: The ELF loader is working correctly with C++ static
|
||||
constructors and destructors and all.
|
||||
* Documentation/NuttXBinfmt.html: Add documentation of the binary loader.
|
||||
* configs/sim/ostest: Converted to use the mconf configuration tool.
|
||||
* configs/sim/cxxtest: New test that will be used to verify the uClibc++
|
||||
port (eventually).
|
||||
* include/nuttx/fs/fs.h, lib/stdio/lib_libfread.c, lib_ferror.c,
|
||||
lib_feof.c, and lib_clearerr.c: Add support for ferror(), feof(),
|
||||
and clearerror(). ferror() support is bogus at the moment (it
|
||||
is equivalent to !feof()); the others should be good.
|
||||
* configs/stm32f4discovery/include/board.h: Correct timer 2-7
|
||||
base frequency (provided by Freddie Chopin).
|
||||
* include/nuttx/sched.h, sched/atexit.c, and sched/task_deletehook.c:
|
||||
If both atexit() and on_exit() are enabled, then implement atexit()
|
||||
as just a special caseof on_exit(). This assumes that the ABI can
|
||||
handle receipt of more call parameters than the receiving function
|
||||
expects. That is usually the case if parameters are passed in
|
||||
registers.
|
||||
* libxx/libxx_cxa_atexit(): Implements __cxa_atexit()
|
||||
* configs/stm32f4discovery/cxxtest: New test that will be used to
|
||||
verify the uClibc++ port (eventually). The sim platform turned not
|
||||
to be a good platform for testing uClibc++. The sim example will not
|
||||
run because the simulator will attempt to execute the static
|
||||
constructors before main() starts. BUT... NuttX is not initialized
|
||||
and this results in a crash. On the STM324Discovery, I will have
|
||||
better control over when the static constructors run.
|
||||
* RGMP 4.0 updated from Qiany Yu.
|
||||
* configs/*/Make.defs and configs/*/ld.script: Massive clean-up
|
||||
and standardization of linker scripts from Freddie Chopin.
|
||||
* net/netdev_ioctl.c: Add interface state flags and ioctl calls
|
||||
to bring network interfaces up and down (from Darcy Gong).
|
||||
* config/stm32f4discovery: Enable C++ exceptions. Now the entire
|
||||
apps/examples/cxxtest works -- meaning the the uClibc++ is
|
||||
complete and verified for the STM32 platform.
|
||||
|
||||
6.24 2012-12-20 Gregory Nutt <gnutt@nuttx.org>
|
||||
|
||||
* arch/arm/src/stm32: Support for STM32F100 high density chips
|
||||
added by Freddie Chopin.
|
||||
* configs/stm32f100_generic: Support for generic STM32F100RC board
|
||||
contributed by Freddie Chopin.
|
||||
* arch/arm/src/stm32_otgfsdev.c: Partial fix from Petteri Aimonen.
|
||||
* drivers/lcd/ug-2864ambag01.c and include/nuttx/lcd/ug_2864ambag01.h:
|
||||
LCD driver for the Univision OLED of the same name (untested on
|
||||
initial check-in).
|
||||
* configs/stm32f4discovery/nxlines: Configure to use mconf/Kconfig
|
||||
tool.
|
||||
* configs/stm32f4discovery/src/up_ug2864ambag01.c: Board-specific
|
||||
initialization for UG-2864AMBAG01 OLED connecte to STM32F4Disovery.
|
||||
* libxx/libxx_stdthrow.cxx: Exception stubs from Petteri Aimonen.
|
||||
* configs/stm32f4discovery/src/up_ug2864ambag01.c: Driver has been
|
||||
verified on the STM32F4Discovery platform. Some tuning of the
|
||||
configuration could improve the presentation. Lower resolution displays
|
||||
are also more subject to the "fat, flat line bug" that I need to fix
|
||||
someday. See http://www.nuttx.org/doku.php?id=wiki:graphics:nxgraphics
|
||||
for a description of the fat, flat line bug.
|
||||
* libc: Renamed nuttx/lib to nuttx/libc to make space for a true lib/
|
||||
directory that will be forthcoming. Also rename libraries: liblib.a -> libc.a,
|
||||
libulib.a -> libuc.a, libklib.a -> libkc.a, liblibxx.a ->libcxx.a.
|
||||
(I will probably, eventually rename libxx to libcxx for consistency)
|
||||
* Makefile, lib/: A new, empty directory that will hold generated libraries.
|
||||
This simplifies the library patch calculations and lets me get rid of some
|
||||
bash logic. The change is functional, but only partially complete;
|
||||
additional logic is needed in the arch/*/src/Makefile's as well. Right
|
||||
now that logic generate multiple library paths, all pointing to the lib/
|
||||
directory.
|
||||
* arch/*/src/Makefile: Now uses only the libraries in lib/
|
||||
Replace bash fragments that test for board/Makefile.
|
||||
* Makefile.win: The beginnings of a Windows-native build. This is just
|
||||
the beginning and not yet ready for prime time use.
|
||||
* configs/stm32f4discovery/winbuild: This is a version of the standard
|
||||
NuttX OS test, but configured to build natively on Windows. Its only
|
||||
real purpose is to very the native Windows build logic.
|
||||
* tools/mkdeps.bat and tools/mkdeps.c: mkdeps.bat is a failed attempt
|
||||
to leverage mkdeps.sh to CMD.exe. It fails because the are certain
|
||||
critical CFLAG values that cannot be passed on the CMD.exe command line
|
||||
(like '='). mkdeps.c is a work in progress that will, hopefully,
|
||||
replace both mkdeps.sh and mkdeps.bat.
|
||||
* tools/Config.mk: Centralize the definition of the script that will be
|
||||
used to generated header file include paths for the compiler. This
|
||||
needs to be centralized in order to support the Windows native build.
|
||||
* tools/incdir.bat: A replacement for tools/incdir.sh for use with the
|
||||
the Windows native build.
|
||||
* Makefile.unix: The existing top-level Makefile has been renamed
|
||||
Makefile.unix.
|
||||
* Makefile: This is a new top-level Makefile that just includes
|
||||
either Makefile.unix or Makefile.win
|
||||
* configs/stm3240g-eval/src: Qencoder fixes from Ryan Sundberg.
|
||||
* arch/arm/src/stm32/stm32_qencoder.c: TIM3 bug fix from Ryan Sundberg.
|
||||
* tools/mkromfsimg.sh: Correct typo in an error message (Ryan Sundberg)
|
||||
* arch/*/src/Makefile: Remove tftboot install and creation of System.map
|
||||
for Windows native build. The first is a necessary change, the second
|
||||
just needs re-implemented.
|
||||
* configs/mirtoo: Update Mirtoo pin definitions for Release 2. Provided
|
||||
by Konstantin Dimitrov.
|
||||
* Fixed an uninitialized variable in the file system that can cause
|
||||
assertions if DEBUG on (contributed by Lorenz Meier).
|
||||
* Config.mk: Defined DELIM to be either / or \, depending upon
|
||||
CONFIG_WINDOWS_NATIVE. This will allow me to eliminate a lot of
|
||||
conditional logic elsewhere.
|
||||
* nuttx/graphics: One a mouse button is pressed, continue to report all
|
||||
mouse button events to the first window that received the the initial
|
||||
button down event, even if the mouse attempts to drag outside the
|
||||
window. From Petteri Aimonen.
|
||||
* nuttx/graphics/nxmu/nx_block.c: One more fix to the NX block message
|
||||
logic from Petteri Aimonen.
|
||||
* include/nuttx/wqueue.h: Some basic definitions to support a user-
|
||||
space work queue (someday in the future).
|
||||
* graphics/nxmu: Add semaphores so buffers messages that send buffers
|
||||
will block until the buffer data has been acted upon.
|
||||
* graphics/nxmw: Extended the blocked messages to cover mouse movement
|
||||
and redraw events. These will also cause problems if sent to a window
|
||||
while it is closing.
|
||||
* arch/several: Change UARTs are enabled for i.MX, LM3S, ez80, and M16C to
|
||||
match how they are enabled for other architectures.
|
||||
* configs/ez80f910200kitg: Convert to use mconf configuration.
|
||||
* sched/pause.c: Implements the POSIX pause() function.
|
||||
* ez80: Lots of changes to ez80 configurations and build logic as I
|
||||
struggle to get a clean Windows build (still not working).
|
||||
* configs/cloudctrl: Darcy Gong's CloudController board. This is a
|
||||
small network relay development board. Based on the Shenzhou IV development
|
||||
board design. It is based on the STM32F107VC MCU.
|
||||
* arch/arm/src/stm32_serial.c and stm32_lowputc.c: Added optional RS-485
|
||||
direction bit control. From Freddie Chopin.
|
||||
* Lots of build files: ARMv7-M and MIPS32 Make.defs now include a common
|
||||
Toolchain.defs file that can be used to manage toolchains in a more
|
||||
configurable way. Contributed by Mike Smith
|
||||
* configs/stm32f4discovery/winbuild and configs/cloudctrl: Adapted to use
|
||||
Mike's Toolchain.defs.
|
||||
* tools/configure.sh: Adapted to handle paths and setenv.bat files correctly
|
||||
for native Windows builds.
|
||||
* More of build files: AVR and AVR32 Make.defs now include a common
|
||||
Toolchain.defs file that can be used to manage toolchains in a more
|
||||
configurable way. Contributed by Mike Smith
|
||||
* tools/incdir.sh and incdir.bat: Add -s option to generate system header
|
||||
file paths.
|
||||
* nuttx/arch/arm/src/arm/Toolchain.defs: Add support for more ARM toolchains
|
||||
(from Mike Smith).
|
||||
* arch/arm/src/stm32/stm32f40xxx_rcc.c: Enabled FLASH prefetch (from Petteri
|
||||
Aimonen).
|
||||
* graphics/nxtk/nxtk_filltrapwindow.c: Correct an offset problem (from
|
||||
Peterri Aimonen).
|
||||
* graphics/nxglib/nxglib_splitline.c: Fix error in drawing of near horizontal
|
||||
lines (from Peterri Aimonen).
|
||||
* sched/task_exithook.c: Missing right bracket with certain conditional
|
||||
compilation (thanks James Goppert).
|
||||
* arch/arm/srch/stm32/stm32_otgfshost.c: Replace timeout handling; use
|
||||
system tick instead of frame counter. The frame counter gets reset to
|
||||
zero at 0x3fff making it error prone.
|
||||
* arch/arm/src/stm32/stm32f20xx_rcc.c and stm32f40xx_rcc.c: Added option
|
||||
CONFIG_STM32_FLASH_PREFETCH. FLASH prefetch will now only be enabled
|
||||
if this option is selected.
|
||||
* confgs/ez80f910200zco/ostest: Now uses Kconfig/mconf configuration
|
||||
tool. Updated to build in native Windows environment. Other ez80f910200zco
|
||||
build scripts also updated.
|
||||
* configs/z8f64200100kit/ostest: Update to same level as ez80 configurations.
|
||||
* nuttx/configs/z8f64200100kit/scripts/setenv.bat: Add support for native
|
||||
Windows build.
|
||||
* nuttx/arch/arm/src/lpc17xx/lpc17_i2c.c: Resources not being released when
|
||||
I2C is uninitialized.
|
||||
* cloudctrl/src/up_chipid.c and shenzhou/src/up_chipid.c: Add functions to
|
||||
get chip ID. Contributed by Darcy Gong. These should not be board-dependent,
|
||||
but should be in arch/arm/src/stm32 where they can be used from any board.
|
||||
* sched/work_thread.c: Fix backward conditional compilation. This might
|
||||
has caused a memory leak. From Freddie Chopin.
|
||||
* configs/<many>/Make.defs: Fix typo -wstrict-prototypes should be
|
||||
-Wstrict-prototypes (From Denis Carilki).
|
||||
* arch/arm/src/calapyso/calypso_keypad.c: Add Calypso keypad driver. From
|
||||
Denis Carilki.
|
||||
* z8encore000zco/ostest and z8f64200100kit/ostest: Converted to use Kconfig/
|
||||
mconf configuration tool.
|
||||
* arch/arm/src/armv7-m/up_exception.S: missing curly braces for push/pop
|
||||
From Freddie Chopin.
|
||||
* z8encore000zco/ostest and z8f64200100kit/ostest: Can now be modified to
|
||||
support the Windows native builds (see corresponding README.txt files).
|
||||
* configs/z16f2800100zcog - All configurations updated to use the ZDS-II
|
||||
5.0.1 toolchain.
|
||||
* configs/z16f2800100zcog - All configurations updated to use Kconfig/mconf
|
||||
configuration tools.
|
||||
* configs/z16f2800100zcog/ostest - Now supports a native Windows build
|
||||
(other ZNEO configs may also support the native build, but this has not
|
||||
been verfiied).
|
||||
* include/nuttx/input/keypad.h, arch/arm/src/calypso/calypso_keypad.c, and
|
||||
configs/compal_e99/nsh_highram: First cut at a standard keypad interface
|
||||
definition. Contributed by Denis Carikli.
|
||||
* libc/stdlib/lib_rand.c: Always add one to result congruential generators
|
||||
to avoid the value zero. Suggested by Freddie Chopin.
|
||||
* tools/b16.c: Fixed precision math conversion utility.
|
||||
* graphics/nxglib/nxglib_splitline.c: Fix the "fat, flat line bug"
|
||||
* arch/z80/src/*/Toolchain.defs: Add dummy Toolchain.defs files for the
|
||||
z80 family.
|
||||
* configs/z80sim/ostest: Converted to build with the Kconfig/mconf tool.
|
||||
Current configuration failed to build for me (Ubuntu 12.10, SDCC 3.2.0
|
||||
pre-built for Linux) due to a glibc memory corruptionerror in SDCC.
|
||||
* configs/z80sim/ostest: Default is now the Windows native build. See
|
||||
configs/z80sim/README.txt for instructions to convert back to a Linux or
|
||||
or Cygwin build.
|
||||
* arch/z80/src/Makefile.sdccw: Renamed makefiles with extensions zdiil,
|
||||
zdiiw, sdccl, and sdccw for the ZDS-II vs SDCC compilers and for the
|
||||
POSIX vs Windows native builds.
|
||||
* nuttx/drivers/mtd/ftl.c: Fix for the flash translation layer. Short
|
||||
unaligned writes were buggy. From Petteri Aimonen.
|
||||
* nuttx/libc/math/lib_round*.c: Add rounding functions to the math
|
||||
library. Contributed by Petteri Aimonen.
|
||||
* include/cxx/cstdlib: Add stroul(). From Petteri Aimonen.
|
||||
* arch/*/include/limits.h: Change signed minimum values from, for example,
|
||||
(-128) to (-127 - 1) to avoid overflows under certain conditions. From
|
||||
Peterri Aimonen.
|
||||
* graphics/nxtk/nxtk_subwindowmove.c: Previously it was very difficult to
|
||||
do e.g. "scroll by dx, dy". When given the full window area, nxtk_subwindowmove
|
||||
would clip the offset always to 0,0. It makes more sense for it to clip the
|
||||
source area and not modify the offset. From Petteri Aimonen.
|
||||
* graphics/nxtk/nxtk_getwindow.c: Clipping would change the offset of returned
|
||||
data, and caller has no way to know what the new offset would be. This messes
|
||||
up font drawing when the text is partially out of window, e.g. when scrolling.
|
||||
Also from Petteri Aimonen.
|
||||
* include/stdbool.h: Can now be disabled for C++ files if CONFIG_C99_BOOL8 is
|
||||
defined. CONFIG_C99_BOOL8 indicates (1) that the sizeof(_Bool) is one in both
|
||||
C and C++, and (2) the the C compiler is C99 and supports the _Bool intrinsic
|
||||
type. Requested by Freddie Chopin.
|
||||
* include/stdlib/lib_rand.c: Various additional changes so that the integer
|
||||
value zero can be returned. Requested by Freddie Chopin.
|
||||
* arch/z80/src/Makefile.sdcc*, z80/up_mem.h: Redesign Z80 build so that it
|
||||
no longer depends on Bash scripts.
|
||||
* configs/z80sim/nsh and pashello: Converted to (1) use the kconfig-frontends
|
||||
configuration tool, and (2) to build natively under Windows. The NSH
|
||||
configuration is verified; the pashello configuration needs a more TLC.
|
||||
* tools/copydir.sh: Rename tools/winlink.sh to tools/copydir.sh
|
||||
* tools/link.bat, unlink.bat, and copydir.bat: Add Windows counterparts
|
||||
to the link.sh, unlink.sh, and copydir.sh Bash scripts.
|
||||
* configs/z80sim/pashello: Now builds correctly.
|
||||
* configs/xtrs/ostest, nsh, and pashello: Converted to (1) use the kconfig-
|
||||
frontends configuration tool, and (2) to build natively under Windows.
|
||||
* drivers/serial/Kconfig and sched/Kconfig: Two names for same configuration:
|
||||
CONFIG_LOWLEVEL_CONSOLE is bogus and CONFIG_DEV_LOWCONSOLE is in the wrong
|
||||
Kconfig file. Moved to drivers/serial/Kconfig replacing CONFIG_LOWLEVEL_CONSOLE.
|
||||
* arch/z80/include/z180: Add header files for z180 chips. Initial versions
|
||||
are just clones of z80 header files.
|
||||
* arch/z80/src/z180: Add source files for z180 chips. Initial versions
|
||||
are just clones of z80 source files.
|
||||
* include/nuttx/arch.h: Add address environment control interfaces (for use
|
||||
with CPUs the provide MCUs and support process-like address environments).
|
||||
* arch/z80/src/z180/z180_mmu.*: Add MMU support for z180 tasks.
|
||||
* configs/p112: Add very basic board support and an examples/ostest
|
||||
configuration for the venerable P112 board.
|
||||
* sched/os_bringup.c: If CONFIG_PATH_INITIAL is defined, then the initial
|
||||
environment of the task started by os_bringup() will have the PATH
|
||||
environment variable defined to be that string.
|
||||
* binfmt/binfmt_exepath.c: If CONFIG_BINFMT_EXEPATH is defined, then this
|
||||
file will be built. It contains logic to search for regular files at
|
||||
the absolutes paths found in the current PATH environment variable
|
||||
setting. This is untested and not yet hooked into the binfmt exec()
|
||||
logic on initial check-in
|
||||
* binfmt/binfmt_loadmodule.c: load_module() will now traverse the PATH
|
||||
variable to locate files from their relative path.
|
||||
* include/nuttx/arch.h and arch/z80/src/z180/z180_mmu.c: Restructure the
|
||||
address environment interfaces so that they will better integrate with
|
||||
binfmt/.
|
||||
* binfmt/libelf/*, binfmt/libnxflat/* and other files: Integrate the
|
||||
address environment interfaces. If CONFIG_ADDRENV=y, then binfmt/
|
||||
will now create an address environment for new tasks (instead of
|
||||
just malloc'ing the task memory).
|
||||
* configs/stm32f4discovery/elf: Enable support/test of the PATH
|
||||
to find executables using a relative path.
|
||||
|
||||
6.25 2013-xx-xx Gregory Nutt <gnutt@nuttx.org>
|
||||
|
|
112
nuttx/Kconfig
112
nuttx/Kconfig
|
@ -20,10 +20,75 @@ menu "Build Setup"
|
|||
config EXPERIMENTAL
|
||||
bool "Prompt for development and/or incomplete code/drivers"
|
||||
|
||||
choice
|
||||
prompt "Build Host Platform"
|
||||
default HOST_LINUX
|
||||
|
||||
config HOST_LINUX
|
||||
bool "Linux"
|
||||
|
||||
config HOST_OSX
|
||||
bool "OSX"
|
||||
|
||||
config HOST_WINDOWS
|
||||
bool "Windows"
|
||||
|
||||
config HOST_OTHER
|
||||
bool "Other"
|
||||
|
||||
endchoice
|
||||
|
||||
choice
|
||||
prompt "Windows Build Environment"
|
||||
default WINDOWS_CYGWIN
|
||||
depends on HOST_WINDOWS
|
||||
|
||||
config WINDOWS_NATIVE
|
||||
bool "Windows Native"
|
||||
---help---
|
||||
Build natively in a CMD.exe environment with Windows style paths (like C:\cgywin\home)
|
||||
|
||||
config WINDOWS_CYGWIN
|
||||
bool "Cygwin"
|
||||
- --help---
|
||||
Build natively in a Cygwin environment with POSIX style paths (like /cygdrive/c/cgywin/home)
|
||||
|
||||
config WINDOWS_MSYS
|
||||
bool "MSYS"
|
||||
---help---
|
||||
Build natively in a Cygwin environment with POSIX style paths (like /cygdrive/c/cgywin/home)
|
||||
|
||||
config WINDOWS_OTHER
|
||||
bool "Windows POSIX-like environment"
|
||||
---help---
|
||||
Build natively in another POSIX-like environment. Additional support may be necessary
|
||||
|
||||
endchoice
|
||||
|
||||
config WINDOWS_MKLINK
|
||||
bool "Use mklink"
|
||||
default n
|
||||
depends on WINDOWS_NATIVE
|
||||
---help---
|
||||
Use the mklink command to set up symbolic links when NuttX is
|
||||
configured. Otherwise, configuration directories will be copied to
|
||||
establish the configuration.
|
||||
|
||||
If directories are copied, then some confusion can result ("Which
|
||||
version of the file did I modify?"). In that case, it is recommended
|
||||
that you re-build using 'make clean_context all'. That will cause the
|
||||
configured directories to be recopied on each build.
|
||||
|
||||
NOTE: This option also (1) that you have administrator privileges, (2)
|
||||
that you are using Windows 2000 or better, and (3) that you are using
|
||||
the NTFS file system. Select 'n' is that is not the case.
|
||||
|
||||
menu "Build Configuration"
|
||||
|
||||
config APPS_DIR
|
||||
string "Application directory"
|
||||
default "../apps"
|
||||
default "../apps" if !WINDOWS_NATIVE
|
||||
default "..\apps" if WINDOWS_NATIVE
|
||||
---help---
|
||||
Identifies the directory that builds the
|
||||
application to link with NuttX. Default: ../apps This symbol must be assigned
|
||||
|
@ -192,6 +257,17 @@ config ARCH_MATH_H
|
|||
that don't select ARCH_MATH_H, the redirecting math.h header file
|
||||
will stay out-of-the-way in include/nuttx/.
|
||||
|
||||
config ARCH_FLOAT_H
|
||||
bool "float.h"
|
||||
default n
|
||||
---help---
|
||||
The float.h header file defines the properties of your floating
|
||||
point implementation. It would always be best to use your
|
||||
toolchain's float.h header file but if none is avaiable, a default
|
||||
float.h header file will provided if this option is selected. However
|
||||
there is no assurance that the settings in this float.h are actually
|
||||
correct for your platform!
|
||||
|
||||
config ARCH_STDARG_H
|
||||
bool "stdarg.h"
|
||||
default n
|
||||
|
@ -244,17 +320,24 @@ config DEBUG_ENABLE
|
|||
|
||||
comment "Subsystem Debug Options"
|
||||
|
||||
config DEBUG_MM
|
||||
bool "Enable Memory Manager Debug Output"
|
||||
default n
|
||||
---help---
|
||||
Enable memory management debug output (disabled by default)
|
||||
|
||||
config DEBUG_SCHED
|
||||
bool "Enable Scheduler Debug Output"
|
||||
default n
|
||||
---help---
|
||||
Enable OS debug output (disabled by default)
|
||||
|
||||
config DEBUG_MM
|
||||
bool "Enable Memory Manager Debug Output"
|
||||
config DEBUG_PAGING
|
||||
bool "Enable Demand Paging Debug Output"
|
||||
default n
|
||||
depends on PAGING
|
||||
---help---
|
||||
Enable memory management debug output (disabled by default)
|
||||
Enable demand paging debug output (disabled by default)
|
||||
|
||||
config DEBUG_NET
|
||||
bool "Enable Network Debug Output"
|
||||
|
@ -311,6 +394,13 @@ config DEBUG_INPUT
|
|||
Enable low level debug output from the input device drivers such as
|
||||
mice and touchscreens (disabled by default)
|
||||
|
||||
config DEBUG_ANALOG
|
||||
bool "Enable Analog Device Debug Output"
|
||||
default n
|
||||
---help---
|
||||
Enable low level debug output from the analog device drivers such as
|
||||
A/D and D/A converters (disabled by default)
|
||||
|
||||
config DEBUG_I2C
|
||||
bool "Enable I2C Debug Output"
|
||||
default n
|
||||
|
@ -325,12 +415,18 @@ config DEBUG_SPI
|
|||
---help---
|
||||
Enable I2C driver debug output (disabled by default)
|
||||
|
||||
config DEBUG_DMA
|
||||
bool "Enable DMA Debug Output"
|
||||
default n
|
||||
---help---
|
||||
Enable DMA-releated debug output (disabled by default)
|
||||
|
||||
config DEBUG_WATCHDOG
|
||||
bool "Enable Watchdog Timer Debug Output"
|
||||
default n
|
||||
depends on WATCHDOG
|
||||
---help---
|
||||
Enable watchdog timer debug output (disabled by default)
|
||||
Enable watchdog timer debug output (disabled by default)
|
||||
|
||||
endif
|
||||
|
||||
|
@ -375,8 +471,12 @@ menu "Memory Management"
|
|||
source mm/Kconfig
|
||||
endmenu
|
||||
|
||||
menu "Binary Formats"
|
||||
source binfmt/Kconfig
|
||||
endmenu
|
||||
|
||||
menu "Library Routines"
|
||||
source lib/Kconfig
|
||||
source libc/Kconfig
|
||||
source libxx/Kconfig
|
||||
endmenu
|
||||
|
||||
|
|
626
nuttx/Makefile
626
nuttx/Makefile
|
@ -1,7 +1,7 @@
|
|||
############################################################################
|
||||
# Makefile
|
||||
#
|
||||
# Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
|
||||
# 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
|
||||
|
@ -33,619 +33,17 @@
|
|||
#
|
||||
############################################################################
|
||||
|
||||
TOPDIR := ${shell pwd | sed -e 's/ /\\ /g'}
|
||||
-include ${TOPDIR}/.config
|
||||
-include ${TOPDIR}/tools/Config.mk
|
||||
-include ${TOPDIR}/Make.defs
|
||||
# This is a top-level "kludge" Makefile that just includes the correct
|
||||
# Makefile. If you already know the Makefile that you want, you can skip
|
||||
# this nonsense using:
|
||||
#
|
||||
# make -f Makefile.unix, OR
|
||||
# make -f Makefile.win
|
||||
#
|
||||
|
||||
# Control build verbosity
|
||||
|
||||
ifeq ($(V),1)
|
||||
export Q :=
|
||||
-include .config
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
include Makefile.win
|
||||
else
|
||||
export Q := @
|
||||
include Makefile.unix
|
||||
endif
|
||||
|
||||
# Default tools
|
||||
|
||||
ifeq ($(DIRLINK),)
|
||||
DIRLINK = $(TOPDIR)/tools/link.sh
|
||||
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
|
||||
endif
|
||||
|
||||
# This define is passed as EXTRADEFINES for kernel-mode builds. It is also passed
|
||||
# during PASS1 (but not PASS2) context and depend targets.
|
||||
|
||||
KDEFINE = ${shell $(TOPDIR)/tools/define.sh $(CC) __KERNEL__}
|
||||
|
||||
# Process architecture and board-specific directories
|
||||
|
||||
ARCH_DIR = arch/$(CONFIG_ARCH)
|
||||
ARCH_SRC = $(ARCH_DIR)/src
|
||||
ARCH_INC = $(ARCH_DIR)/include
|
||||
BOARD_DIR = configs/$(CONFIG_ARCH_BOARD)
|
||||
|
||||
# Add-on directories. These may or may not be in place in the
|
||||
# NuttX source tree (they must be specifically installed)
|
||||
#
|
||||
# CONFIG_APPS_DIR can be over-ridden from the command line or in the .config file.
|
||||
# The default value of CONFIG_APPS_DIR is ../apps. Ultimately, the application
|
||||
# will be built if APPDIR is defined. APPDIR will be defined if a directory containing
|
||||
# a Makefile is found at the path provided by CONFIG_APPS_DIR
|
||||
|
||||
ifeq ($(CONFIG_APPS_DIR),)
|
||||
CONFIG_APPS_DIR = ../apps
|
||||
endif
|
||||
APPDIR := ${shell if [ -r $(CONFIG_APPS_DIR)/Makefile ]; then echo "$(CONFIG_APPS_DIR)"; fi}
|
||||
|
||||
# All add-on directories.
|
||||
#
|
||||
# NUTTX_ADDONS is the list of directories built into the NuttX kernel.
|
||||
# USER_ADDONS is the list of directories that will be built into the user application
|
||||
|
||||
NUTTX_ADDONS := $(NX_DIR)
|
||||
USER_ADDONS :=
|
||||
|
||||
ifeq ($(CONFIG_NUTTX_KERNEL),y)
|
||||
USER_ADDONS += $(APPDIR)
|
||||
else
|
||||
NUTTX_ADDONS += $(APPDIR)
|
||||
endif
|
||||
|
||||
# Lists of build directories.
|
||||
#
|
||||
# FSDIRS depend on file descriptor support; NONFSDIRS do not (except for parts
|
||||
# of FSDIRS). We will exclude FSDIRS from the build if file descriptor
|
||||
# support is disabled
|
||||
# CONTEXTDIRS include directories that have special, one-time pre-build
|
||||
# requirements. Normally this includes things like auto-generation of
|
||||
# configuration specific files or creation of configurable symbolic links
|
||||
# USERDIRS - When NuttX is build is a monolithic kernel, this provides the
|
||||
# list of directories that must be built
|
||||
# OTHERDIRS - These are directories that are not built but probably should
|
||||
# be cleaned to prevent garbarge from collecting in them when changing
|
||||
# configurations.
|
||||
|
||||
NONFSDIRS = sched $(ARCH_SRC) $(NUTTX_ADDONS)
|
||||
FSDIRS = fs drivers binfmt
|
||||
CONTEXTDIRS = $(APPDIR)
|
||||
USERDIRS =
|
||||
|
||||
ifeq ($(CONFIG_NUTTX_KERNEL),y)
|
||||
|
||||
NONFSDIRS += syscall
|
||||
CONTEXTDIRS += syscall
|
||||
USERDIRS += syscall lib mm $(USER_ADDONS)
|
||||
ifeq ($(CONFIG_HAVE_CXX),y)
|
||||
USERDIRS += libxx
|
||||
endif
|
||||
|
||||
else
|
||||
|
||||
NONFSDIRS += lib mm
|
||||
OTHERDIRS += syscall $(USER_ADDONS)
|
||||
ifeq ($(CONFIG_HAVE_CXX),y)
|
||||
NONFSDIRS += libxx
|
||||
else
|
||||
OTHERDIRS += libxx
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NX),y)
|
||||
NONFSDIRS += graphics
|
||||
CONTEXTDIRS += graphics
|
||||
else
|
||||
OTHERDIRS += graphics
|
||||
endif
|
||||
|
||||
# CLEANDIRS are the directories that will clean in. These are
|
||||
# all directories that we know about.
|
||||
# KERNDEPDIRS are the directories in which we will build target dependencies.
|
||||
# If NuttX and applications are built separately (CONFIG_NUTTX_KERNEL),
|
||||
# then this holds only the directories containing kernel files.
|
||||
# USERDEPDIRS. If NuttX and applications are built separately (CONFIG_NUTTX_KERNEL),
|
||||
# then this holds only the directories containing user files.
|
||||
|
||||
CLEANDIRS = $(NONFSDIRS) $(FSDIRS) $(USERDIRS) $(OTHERDIRS)
|
||||
KERNDEPDIRS = $(NONFSDIRS)
|
||||
USERDEPDIRS = $(USERDIRS)
|
||||
|
||||
# Add file system directories to KERNDEPDIRS (they are already in CLEANDIRS)
|
||||
|
||||
ifeq ($(CONFIG_NFILE_DESCRIPTORS),0)
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
ifneq ($(CONFIG_NSOCKET_DESCRIPTORS),0)
|
||||
KERNDEPDIRS += fs
|
||||
endif
|
||||
KERNDEPDIRS += drivers
|
||||
endif
|
||||
else
|
||||
KERNDEPDIRS += $(FSDIRS)
|
||||
endif
|
||||
|
||||
# Add networking directories to KERNDEPDIRS and CLEANDIRS
|
||||
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
KERNDEPDIRS += net
|
||||
endif
|
||||
CLEANDIRS += net
|
||||
|
||||
#
|
||||
# Extra objects used in the final link.
|
||||
#
|
||||
# Pass 1 1ncremental (relative) link objects should be put into the
|
||||
# processor-specific source directory (where other link objects will
|
||||
# be created). If the pass1 obect is an archive, it could go anywhere.
|
||||
|
||||
ifeq ($(CONFIG_BUILD_2PASS),y)
|
||||
EXTRA_OBJS += $(CONFIG_PASS1_OBJECT)
|
||||
endif
|
||||
|
||||
# NUTTXLIBS is the list of NuttX libraries that is passed to the
|
||||
# processor-specific Makefile to build the final NuttX target.
|
||||
# Libraries in FSDIRS are excluded if file descriptor support
|
||||
# is disabled.
|
||||
# USERLIBS is the list of libraries used to build the final user-space
|
||||
# application
|
||||
|
||||
NUTTXLIBS = sched/libsched$(LIBEXT) $(ARCH_SRC)/libarch$(LIBEXT)
|
||||
USERLIBS =
|
||||
|
||||
# Add libraries for syscall support. The C library will be needed by
|
||||
# both the kernel- and user-space builds. For now, the memory manager (mm)
|
||||
# is placed in user space (only).
|
||||
|
||||
ifeq ($(CONFIG_NUTTX_KERNEL),y)
|
||||
NUTTXLIBS += syscall/libstubs$(LIBEXT) lib/libklib$(LIBEXT)
|
||||
USERLIBS += syscall/libproxies$(LIBEXT) lib/libulib$(LIBEXT) mm/libmm$(LIBEXT)
|
||||
else
|
||||
NUTTXLIBS += mm/libmm$(LIBEXT) lib/liblib$(LIBEXT)
|
||||
endif
|
||||
|
||||
# Add libraries for C++ support. CXX, CXXFLAGS, and COMPILEXX must
|
||||
# be defined in Make.defs for this to work!
|
||||
|
||||
ifeq ($(CONFIG_HAVE_CXX),y)
|
||||
ifeq ($(CONFIG_NUTTX_KERNEL),y)
|
||||
USERLIBS += libxx/liblibxx$(LIBEXT)
|
||||
else
|
||||
NUTTXLIBS += libxx/liblibxx$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Add library for application support.
|
||||
|
||||
ifneq ($(APPDIR),)
|
||||
ifeq ($(CONFIG_NUTTX_KERNEL),y)
|
||||
USERLIBS += $(APPDIR)/libapps$(LIBEXT)
|
||||
else
|
||||
NUTTXLIBS += $(APPDIR)/libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Add libraries for network support
|
||||
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
NUTTXLIBS += net/libnet$(LIBEXT)
|
||||
endif
|
||||
|
||||
# Add libraries for file system support
|
||||
|
||||
ifeq ($(CONFIG_NFILE_DESCRIPTORS),0)
|
||||
ifneq ($(CONFIG_NSOCKET_DESCRIPTORS),0)
|
||||
NUTTXLIBS += fs/libfs$(LIBEXT)
|
||||
endif
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
NUTTXLIBS += drivers/libdrivers$(LIBEXT)
|
||||
endif
|
||||
else
|
||||
NUTTXLIBS += fs/libfs$(LIBEXT) drivers/libdrivers$(LIBEXT) binfmt/libbinfmt$(LIBEXT)
|
||||
endif
|
||||
|
||||
# Add libraries for the NX graphics sub-system
|
||||
|
||||
ifneq ($(NX_DIR),)
|
||||
NUTTXLIBS += $(NX_DIR)/libnx$(LIBEXT)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NX),y)
|
||||
NUTTXLIBS += graphics/libgraphics$(LIBEXT)
|
||||
endif
|
||||
|
||||
# This is the name of the final target (relative to the top level directorty)
|
||||
|
||||
BIN = nuttx$(EXEEXT)
|
||||
|
||||
all: $(BIN)
|
||||
.PHONY: context clean_context check_context export subdir_clean clean subdir_distclean distclean apps_clean apps_distclean
|
||||
|
||||
# Target used to copy include/nuttx/math.h. If CONFIG_ARCH_MATH_H is
|
||||
# defined, then there is an architecture specific math.h header file
|
||||
# that will be included indirectly from include/math.h. But first, we
|
||||
# have to copy math.h from include/nuttx/. to include/.
|
||||
|
||||
ifeq ($(CONFIG_ARCH_MATH_H),y)
|
||||
include/math.h: include/nuttx/math.h
|
||||
@cp -f include/nuttx/math.h include/math.h
|
||||
else
|
||||
include/math.h:
|
||||
endif
|
||||
|
||||
# Target used to copy include/nuttx/stdarg.h. If CONFIG_ARCH_STDARG_H is
|
||||
# defined, then there is an architecture specific stdarg.h header file
|
||||
# that will be included indirectly from include/stdarg.h. But first, we
|
||||
# have to copy stdarg.h from include/nuttx/. to include/.
|
||||
|
||||
ifeq ($(CONFIG_ARCH_STDARG_H),y)
|
||||
include/stdarg.h: include/nuttx/stdarg.h
|
||||
@cp -f include/nuttx/stdarg.h include/stdarg.h
|
||||
else
|
||||
include/stdarg.h:
|
||||
endif
|
||||
|
||||
# Targets used to build include/nuttx/version.h. Creation of version.h is
|
||||
# part of the overall NuttX configuration sequence. Notice that the
|
||||
# tools/mkversion tool is built and used to create include/nuttx/version.h
|
||||
|
||||
tools/mkversion:
|
||||
@$(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkversion
|
||||
|
||||
$(TOPDIR)/.version:
|
||||
@if [ ! -f .version ]; then \
|
||||
echo "No .version file found, creating one"; \
|
||||
tools/version.sh -v 0.0 -b 0 .version; \
|
||||
chmod 755 .version; \
|
||||
fi
|
||||
|
||||
include/nuttx/version.h: $(TOPDIR)/.version tools/mkversion
|
||||
@tools/mkversion $(TOPDIR) > include/nuttx/version.h
|
||||
|
||||
# Targets used to build include/nuttx/config.h. Creation of config.h is
|
||||
# part of the overall NuttX configuration sequence. Notice that the
|
||||
# tools/mkconfig tool is built and used to create include/nuttx/config.h
|
||||
|
||||
tools/mkconfig:
|
||||
@$(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkconfig
|
||||
|
||||
include/nuttx/config.h: $(TOPDIR)/.config tools/mkconfig
|
||||
@tools/mkconfig $(TOPDIR) > include/nuttx/config.h
|
||||
|
||||
# dirlinks, and helpers
|
||||
#
|
||||
# Directories links. Most of establishing the NuttX configuration involves
|
||||
# setting up symbolic links with 'generic' directory names to specific,
|
||||
# configured directories.
|
||||
#
|
||||
# Link the apps/include directory to include/apps
|
||||
|
||||
include/apps: Make.defs
|
||||
ifneq ($(APPDIR),)
|
||||
@if [ -d $(TOPDIR)/$(APPDIR)/include ]; then \
|
||||
$(DIRLINK) $(TOPDIR)/$(APPDIR)/include include/apps; \
|
||||
fi
|
||||
endif
|
||||
|
||||
# Link the arch/<arch-name>/include directory to include/arch
|
||||
|
||||
include/arch: Make.defs
|
||||
@$(DIRLINK) $(TOPDIR)/$(ARCH_DIR)/include include/arch
|
||||
|
||||
# Link the configs/<board-name>/include directory to include/arch/board
|
||||
|
||||
include/arch/board: include/arch Make.defs include/arch
|
||||
@$(DIRLINK) $(TOPDIR)/$(BOARD_DIR)/include include/arch/board
|
||||
|
||||
# Link the configs/<board-name>/src dir to arch/<arch-name>/src/board
|
||||
|
||||
$(ARCH_SRC)/board: Make.defs
|
||||
@$(DIRLINK) $(TOPDIR)/$(BOARD_DIR)/src $(ARCH_SRC)/board
|
||||
|
||||
# Link arch/<arch-name>/include/<chip-name> to arch/<arch-name>/include/chip
|
||||
|
||||
$(ARCH_SRC)/chip: Make.defs
|
||||
ifneq ($(CONFIG_ARCH_CHIP),)
|
||||
@$(DIRLINK) $(TOPDIR)/$(ARCH_SRC)/$(CONFIG_ARCH_CHIP) $(ARCH_SRC)/chip
|
||||
endif
|
||||
|
||||
# Link arch/<arch-name>/src/<chip-name> to arch/<arch-name>/src/chip
|
||||
|
||||
include/arch/chip: include/arch Make.defs
|
||||
ifneq ($(CONFIG_ARCH_CHIP),)
|
||||
@$(DIRLINK) $(TOPDIR)/$(ARCH_INC)/$(CONFIG_ARCH_CHIP) include/arch/chip
|
||||
endif
|
||||
|
||||
dirlinks: include/arch include/arch/board include/arch/chip $(ARCH_SRC)/board $(ARCH_SRC)/chip include/apps
|
||||
|
||||
# context
|
||||
#
|
||||
# The context target is invoked on each target build to assure that NuttX is
|
||||
# properly configured. The basic configuration steps include creation of the
|
||||
# the config.h and version.h header files in the include/nuttx directory and
|
||||
# the establishment of symbolic links to configured directories.
|
||||
|
||||
context: check_context include/nuttx/config.h include/nuttx/version.h include/math.h include/stdarg.h dirlinks
|
||||
@for dir in $(CONTEXTDIRS) ; do \
|
||||
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" context; \
|
||||
done
|
||||
|
||||
# clean_context
|
||||
#
|
||||
# This is part of the distclean target. It removes all of the header files
|
||||
# and symbolic links created by the context target.
|
||||
|
||||
clean_context:
|
||||
@rm -f include/nuttx/config.h
|
||||
@rm -f include/nuttx/version.h
|
||||
@rm -f include/math.h
|
||||
@rm -f include/stdarg.h
|
||||
@$(DIRUNLINK) include/arch/board
|
||||
@$(DIRUNLINK) include/arch/chip
|
||||
@$(DIRUNLINK) include/arch
|
||||
@$(DIRUNLINK) $(ARCH_SRC)/board
|
||||
@$(DIRUNLINK) $(ARCH_SRC)/chip
|
||||
@$(DIRUNLINK) include/apps
|
||||
|
||||
# check_context
|
||||
#
|
||||
# This target checks if NuttX has been configured. NuttX is configured using
|
||||
# the script tools/configure.sh. That script will install certain files in
|
||||
# the top-level NuttX build directory. This target verifies that those
|
||||
# configuration files have been installed and that NuttX is ready to be built.
|
||||
|
||||
check_context:
|
||||
@if [ ! -e ${TOPDIR}/.config -o ! -e ${TOPDIR}/Make.defs ]; then \
|
||||
echo "" ; echo "Nuttx has not been configured:" ; \
|
||||
echo " cd tools; ./configure.sh <target>" ; echo "" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
|
||||
# Archive targets. The target build sequency will first create a series of
|
||||
# libraries, one per configured source file directory. The final NuttX
|
||||
# execution will then be built from those libraries. The following targets
|
||||
# built those libraries.
|
||||
#
|
||||
# Possible kernel-mode builds
|
||||
|
||||
lib/libklib$(LIBEXT): context
|
||||
@$(MAKE) -C lib TOPDIR="$(TOPDIR)" libklib$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
sched/libsched$(LIBEXT): context
|
||||
@$(MAKE) -C sched TOPDIR="$(TOPDIR)" libsched$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
$(ARCH_SRC)/libarch$(LIBEXT): context
|
||||
@$(MAKE) -C $(ARCH_SRC) TOPDIR="$(TOPDIR)" libarch$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
net/libnet$(LIBEXT): context
|
||||
@$(MAKE) -C net TOPDIR="$(TOPDIR)" libnet$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
fs/libfs$(LIBEXT): context
|
||||
@$(MAKE) -C fs TOPDIR="$(TOPDIR)" libfs$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
drivers/libdrivers$(LIBEXT): context
|
||||
@$(MAKE) -C drivers TOPDIR="$(TOPDIR)" libdrivers$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
binfmt/libbinfmt$(LIBEXT): context
|
||||
@$(MAKE) -C binfmt TOPDIR="$(TOPDIR)" libbinfmt$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
graphics/libgraphics$(LIBEXT): context
|
||||
@$(MAKE) -C graphics TOPDIR="$(TOPDIR)" libgraphics$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
syscall/libstubs$(LIBEXT): context
|
||||
@$(MAKE) -C syscall TOPDIR="$(TOPDIR)" libstubs$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
# Possible user-mode builds
|
||||
|
||||
lib/libulib$(LIBEXT): context
|
||||
@$(MAKE) -C lib TOPDIR="$(TOPDIR)" libulib$(LIBEXT)
|
||||
|
||||
libxx/liblibxx$(LIBEXT): context
|
||||
@$(MAKE) -C libxx TOPDIR="$(TOPDIR)" liblibxx$(LIBEXT)
|
||||
|
||||
mm/libmm$(LIBEXT): context
|
||||
@$(MAKE) -C mm TOPDIR="$(TOPDIR)" libmm$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
$(APPDIR)/libapps$(LIBEXT): context
|
||||
@$(MAKE) -C $(APPDIR) TOPDIR="$(TOPDIR)" libapps$(LIBEXT)
|
||||
|
||||
syscall/libproxies$(LIBEXT): context
|
||||
@$(MAKE) -C syscall TOPDIR="$(TOPDIR)" libproxies$(LIBEXT)
|
||||
|
||||
# Possible non-kernel builds
|
||||
|
||||
lib/liblib$(LIBEXT): context
|
||||
@$(MAKE) -C lib TOPDIR="$(TOPDIR)" liblib$(LIBEXT)
|
||||
|
||||
# pass1 and pass2
|
||||
#
|
||||
# If the 2 pass build option is selected, then this pass1 target is
|
||||
# configured to built before the pass2 target. This pass1 target may, as an
|
||||
# example, build an extra link object (CONFIG_PASS1_OBJECT) which may be an
|
||||
# incremental (relative) link object, but could be a static library (archive);
|
||||
# some modification to this Makefile would be required if CONFIG_PASS1_OBJECT
|
||||
# is an archive. Exactly what is performed during pass1 or what it generates
|
||||
# is unknown to this makefule unless CONFIG_PASS1_OBJECT is defined.
|
||||
|
||||
pass1deps: context pass1dep $(USERLIBS)
|
||||
|
||||
pass1: pass1deps
|
||||
ifeq ($(CONFIG_BUILD_2PASS),y)
|
||||
@if [ -z "$(CONFIG_PASS1_BUILDIR)" ]; then \
|
||||
echo "ERROR: CONFIG_PASS1_BUILDIR not defined"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@if [ ! -d "$(CONFIG_PASS1_BUILDIR)" ]; then \
|
||||
echo "ERROR: CONFIG_PASS1_BUILDIR does not exist"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@if [ ! -f "$(CONFIG_PASS1_BUILDIR)/Makefile" ]; then \
|
||||
echo "ERROR: No Makefile in CONFIG_PASS1_BUILDIR"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@$(MAKE) -C $(CONFIG_PASS1_BUILDIR) TOPDIR="$(TOPDIR)" LINKLIBS="$(NUTTXLIBS)" USERLIBS="$(USERLIBS)" "$(CONFIG_PASS1_TARGET)"
|
||||
endif
|
||||
|
||||
pass2deps: context pass2dep $(NUTTXLIBS)
|
||||
|
||||
pass2: pass2deps
|
||||
@$(MAKE) -C $(ARCH_SRC) TOPDIR="$(TOPDIR)" EXTRA_OBJS="$(EXTRA_OBJS)" LINKLIBS="$(NUTTXLIBS)" EXTRADEFINES=$(KDEFINE) $(BIN)
|
||||
@if [ -w /tftpboot ] ; then \
|
||||
cp -f $(BIN) /tftpboot/$(BIN).${CONFIG_ARCH}; \
|
||||
fi
|
||||
ifeq ($(CONFIG_RRLOAD_BINARY),y)
|
||||
@echo "MK: $(BIN).rr"
|
||||
@$(TOPDIR)/tools/mkimage.sh --Prefix $(CROSSDEV) $(BIN) $(BIN).rr
|
||||
@if [ -w /tftpboot ] ; then \
|
||||
cp -f $(BIN).rr /tftpboot/$\(BIN).rr.$(CONFIG_ARCH); \
|
||||
fi
|
||||
endif
|
||||
ifeq ($(CONFIG_INTELHEX_BINARY),y)
|
||||
@echo "CP: $(BIN).hex"
|
||||
@$(OBJCOPY) $(OBJCOPYARGS) -O ihex $(BIN) $(BIN).hex
|
||||
endif
|
||||
ifeq ($(CONFIG_MOTOROLA_SREC),y)
|
||||
@echo "CP: $(BIN).srec"
|
||||
@$(OBJCOPY) $(OBJCOPYARGS) -O srec $(BIN) $(BIN).srec
|
||||
endif
|
||||
ifeq ($(CONFIG_RAW_BINARY),y)
|
||||
@echo "CP: $(BIN).bin"
|
||||
@$(OBJCOPY) $(OBJCOPYARGS) -O binary $(BIN) $(BIN).bin
|
||||
endif
|
||||
|
||||
# $(BIN)
|
||||
#
|
||||
# Create the final NuttX executable in a two pass build process. In the
|
||||
# normal case, all pass1 and pass2 dependencies are created then pass1
|
||||
# and pass2 targets are built. However, in some cases, you may need to build
|
||||
# pass1 depenencies and pass1 first, then build pass2 dependencies and pass2.
|
||||
# in that case, execute 'make pass1 pass2' from the command line.
|
||||
|
||||
$(BIN): pass1deps pass2deps pass1 pass2
|
||||
|
||||
# download
|
||||
#
|
||||
# This is a helper target that will rebuild NuttX and download it to the target
|
||||
# system in one step. The operation of this target depends completely upon
|
||||
# implementation of the DOWNLOAD command in the user Make.defs file. It will
|
||||
# generate an error an error if the DOWNLOAD command is not defined.
|
||||
|
||||
download: $(BIN)
|
||||
$(call DOWNLOAD, $<)
|
||||
|
||||
# pass1dep: Create pass1 build dependencies
|
||||
# pass2dep: Create pass2 build dependencies
|
||||
|
||||
pass1dep: context
|
||||
@for dir in $(USERDEPDIRS) ; do \
|
||||
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" depend ; \
|
||||
done
|
||||
|
||||
pass2dep: context
|
||||
@for dir in $(KERNDEPDIRS) ; do \
|
||||
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" EXTRADEFINES=$(KDEFINE) depend; \
|
||||
done
|
||||
|
||||
# Configuration targets
|
||||
#
|
||||
# These targets depend on the kconfig-frontends packages. To use these, you
|
||||
# must first download and install the kconfig-frontends package from this
|
||||
# location: http://ymorin.is-a-geek.org/projects/kconfig-frontends. See
|
||||
# misc/tools/README.txt for additional information.
|
||||
|
||||
config:
|
||||
@APPSDIR=${CONFIG_APPS_DIR} conf Kconfig
|
||||
|
||||
oldconfig:
|
||||
@APPSDIR=${CONFIG_APPS_DIR} conf --oldconfig Kconfig
|
||||
|
||||
menuconfig:
|
||||
@APPSDIR=${CONFIG_APPS_DIR} mconf Kconfig
|
||||
|
||||
# export
|
||||
#
|
||||
# The export target will package the NuttX libraries and header files into
|
||||
# an exportable package. Caveats: (1) These needs some extension for the KERNEL
|
||||
# build; it needs to receive USERLIBS and create a libuser.a). (2) The logic
|
||||
# in tools/mkexport.sh only supports GCC and, for example, explicitly assumes
|
||||
# that the archiver is 'ar'
|
||||
|
||||
export: pass2deps
|
||||
@tools/mkexport.sh -w$(WINTOOL) -t "$(TOPDIR)" -l "$(NUTTXLIBS)"
|
||||
|
||||
# General housekeeping targets: dependencies, cleaning, etc.
|
||||
#
|
||||
# depend: Create both PASS1 and PASS2 dependencies
|
||||
# clean: Removes derived object files, archives, executables, and
|
||||
# temporary files, but retains the configuration and context
|
||||
# files and directories.
|
||||
# distclean: Does 'clean' then also removes all configuration and context
|
||||
# files. This essentially restores the directory structure
|
||||
# to its original, unconfigured stated.
|
||||
|
||||
depend: pass1dep pass2dep
|
||||
|
||||
subdir_clean:
|
||||
@for dir in $(CLEANDIRS) ; do \
|
||||
if [ -e $$dir/Makefile ]; then \
|
||||
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" clean ; \
|
||||
fi \
|
||||
done
|
||||
@$(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" clean
|
||||
@$(MAKE) -C mm -f Makefile.test TOPDIR="$(TOPDIR)" clean
|
||||
ifeq ($(CONFIG_BUILD_2PASS),y)
|
||||
@$(MAKE) -C $(CONFIG_PASS1_BUILDIR) TOPDIR="$(TOPDIR)" clean
|
||||
endif
|
||||
|
||||
clean: subdir_clean
|
||||
@rm -f $(BIN) nuttx.* mm_test *.map _SAVED_APPS_config *~
|
||||
@rm -f nuttx-export*
|
||||
|
||||
subdir_distclean:
|
||||
@for dir in $(CLEANDIRS) ; do \
|
||||
if [ -e $$dir/Makefile ]; then \
|
||||
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" distclean ; \
|
||||
fi \
|
||||
done
|
||||
|
||||
distclean: clean subdir_distclean clean_context
|
||||
ifeq ($(CONFIG_BUILD_2PASS),y)
|
||||
@$(MAKE) -C $(CONFIG_PASS1_BUILDIR) TOPDIR="$(TOPDIR)" distclean
|
||||
endif
|
||||
@rm -f Make.defs setenv.sh .config .config.old
|
||||
|
||||
# Application housekeeping targets. The APPDIR variable refers to the user
|
||||
# application directory. A sample apps/ directory is included with NuttX,
|
||||
# however, this is not treated as part of NuttX and may be replaced with a
|
||||
# different application directory. For the most part, the application
|
||||
# directory is treated like any other build directory in this script. However,
|
||||
# as a convenience, the following targets are included to support housekeeping
|
||||
# functions in the user application directory from the NuttX build directory.
|
||||
#
|
||||
# apps_clean: Perform the clean operation only in the user application
|
||||
# directory
|
||||
# apps_distclean: Perform the distclean operation only in the user application
|
||||
# directory. Note that the apps/.config file (inf any) is
|
||||
# preserved so that this is not a "full" distclean but more of a
|
||||
# configuration "reset." (There willnot be an apps/.config
|
||||
# file if the configuration was generated via make menuconfig).
|
||||
|
||||
apps_clean:
|
||||
ifneq ($(APPDIR),)
|
||||
@$(MAKE) -C "$(TOPDIR)/$(APPDIR)" TOPDIR="$(TOPDIR)" clean
|
||||
endif
|
||||
|
||||
apps_distclean:
|
||||
ifneq ($(APPDIR),)
|
||||
@if [ -r "$(TOPDIR)/$(APPDIR)/.config" ]; then \
|
||||
cp "$(TOPDIR)/$(APPDIR)/.config" _SAVED_APPS_config || \
|
||||
{ echo "Copy of $(APPDIR)/.config failed" ; exit 1 ; } \
|
||||
else \
|
||||
rm -f _SAVED_APPS_config; \
|
||||
fi
|
||||
@$(MAKE) -C "$(TOPDIR)/$(APPDIR)" TOPDIR="$(TOPDIR)" distclean
|
||||
@if [ -r _SAVED_APPS_config ]; then \
|
||||
@mv _SAVED_APPS_config "$(TOPDIR)/$(APPDIR)/.config" || \
|
||||
{ echo "Copy of _SAVED_APPS_config failed" ; exit 1 ; } \
|
||||
fi
|
||||
endif
|
||||
|
||||
|
|
|
@ -0,0 +1,749 @@
|
|||
############################################################################
|
||||
# Makefile.unix
|
||||
#
|
||||
# Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
TOPDIR := ${shell pwd | sed -e 's/ /\\ /g'}
|
||||
-include $(TOPDIR)/.config
|
||||
include $(TOPDIR)/tools/Config.mk
|
||||
-include $(TOPDIR)/Make.defs
|
||||
|
||||
# Control build verbosity
|
||||
|
||||
ifeq ($(V),1)
|
||||
export Q :=
|
||||
else
|
||||
export Q := @
|
||||
endif
|
||||
|
||||
# Default tools
|
||||
|
||||
ifeq ($(DIRLINK),)
|
||||
DIRLINK = $(TOPDIR)/tools/link.sh
|
||||
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
|
||||
endif
|
||||
|
||||
# This define is passed as EXTRADEFINES for kernel-mode builds. It is also passed
|
||||
# during PASS1 (but not PASS2) context and depend targets.
|
||||
|
||||
KDEFINE = ${shell $(TOPDIR)/tools/define.sh "$(CC)" __KERNEL__}
|
||||
|
||||
# Process architecture and board-specific directories
|
||||
|
||||
ARCH_DIR = arch/$(CONFIG_ARCH)
|
||||
ARCH_SRC = $(ARCH_DIR)/src
|
||||
ARCH_INC = $(ARCH_DIR)/include
|
||||
BOARD_DIR = configs/$(CONFIG_ARCH_BOARD)
|
||||
|
||||
# Add-on directories. These may or may not be in place in the
|
||||
# NuttX source tree (they must be specifically installed)
|
||||
#
|
||||
# CONFIG_APPS_DIR can be over-ridden from the command line or in the .config file.
|
||||
# The default value of CONFIG_APPS_DIR is ../apps. Ultimately, the application
|
||||
# will be built if APPDIR is defined. APPDIR will be defined if a directory containing
|
||||
# a Makefile is found at the path provided by CONFIG_APPS_DIR
|
||||
|
||||
ifeq ($(CONFIG_APPS_DIR),)
|
||||
CONFIG_APPS_DIR = ../apps
|
||||
endif
|
||||
APPDIR := ${shell if [ -r $(CONFIG_APPS_DIR)/Makefile ]; then echo "$(CONFIG_APPS_DIR)"; fi}
|
||||
|
||||
# All add-on directories.
|
||||
#
|
||||
# NUTTX_ADDONS is the list of directories built into the NuttX kernel.
|
||||
# USER_ADDONS is the list of directories that will be built into the user application
|
||||
|
||||
NUTTX_ADDONS :=
|
||||
USER_ADDONS :=
|
||||
|
||||
ifeq ($(CONFIG_NUTTX_KERNEL),y)
|
||||
USER_ADDONS += $(APPDIR)
|
||||
else
|
||||
NUTTX_ADDONS += $(APPDIR)
|
||||
endif
|
||||
|
||||
# Lists of build directories.
|
||||
#
|
||||
# FSDIRS depend on file descriptor support; NONFSDIRS do not (except for parts
|
||||
# of FSDIRS). We will exclude FSDIRS from the build if file descriptor
|
||||
# support is disabled
|
||||
# CONTEXTDIRS include directories that have special, one-time pre-build
|
||||
# requirements. Normally this includes things like auto-generation of
|
||||
# configuration specific files or creation of configurable symbolic links
|
||||
# USERDIRS - When NuttX is build is a monolithic kernel, this provides the
|
||||
# list of directories that must be built
|
||||
# OTHERDIRS - These are directories that are not built but probably should
|
||||
# be cleaned to prevent garbarge from collecting in them when changing
|
||||
# configurations.
|
||||
|
||||
NONFSDIRS = sched $(ARCH_SRC) $(NUTTX_ADDONS)
|
||||
FSDIRS = fs drivers binfmt
|
||||
CONTEXTDIRS = $(APPDIR)
|
||||
USERDIRS =
|
||||
OTHERDIRS = lib
|
||||
|
||||
ifeq ($(CONFIG_NUTTX_KERNEL),y)
|
||||
|
||||
NONFSDIRS += syscall
|
||||
CONTEXTDIRS += syscall
|
||||
USERDIRS += syscall libc mm $(USER_ADDONS)
|
||||
ifeq ($(CONFIG_HAVE_CXX),y)
|
||||
USERDIRS += libxx
|
||||
endif
|
||||
|
||||
else
|
||||
|
||||
NONFSDIRS += libc mm
|
||||
OTHERDIRS += syscall $(USER_ADDONS)
|
||||
ifeq ($(CONFIG_HAVE_CXX),y)
|
||||
NONFSDIRS += libxx
|
||||
else
|
||||
OTHERDIRS += libxx
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NX),y)
|
||||
NONFSDIRS += graphics
|
||||
CONTEXTDIRS += graphics
|
||||
else
|
||||
OTHERDIRS += graphics
|
||||
endif
|
||||
|
||||
# CLEANDIRS are the directories that will clean in. These are
|
||||
# all directories that we know about.
|
||||
# KERNDEPDIRS are the directories in which we will build target dependencies.
|
||||
# If NuttX and applications are built separately (CONFIG_NUTTX_KERNEL),
|
||||
# then this holds only the directories containing kernel files.
|
||||
# USERDEPDIRS. If NuttX and applications are built separately (CONFIG_NUTTX_KERNEL),
|
||||
# then this holds only the directories containing user files.
|
||||
|
||||
CLEANDIRS = $(NONFSDIRS) $(FSDIRS) $(USERDIRS) $(OTHERDIRS)
|
||||
KERNDEPDIRS = $(NONFSDIRS)
|
||||
USERDEPDIRS = $(USERDIRS)
|
||||
|
||||
# Add file system directories to KERNDEPDIRS (they are already in CLEANDIRS)
|
||||
|
||||
ifeq ($(CONFIG_NFILE_DESCRIPTORS),0)
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
ifneq ($(CONFIG_NSOCKET_DESCRIPTORS),0)
|
||||
KERNDEPDIRS += fs
|
||||
endif
|
||||
KERNDEPDIRS += drivers
|
||||
endif
|
||||
else
|
||||
KERNDEPDIRS += $(FSDIRS)
|
||||
endif
|
||||
|
||||
# Add networking directories to KERNDEPDIRS and CLEANDIRS
|
||||
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
KERNDEPDIRS += net
|
||||
endif
|
||||
CLEANDIRS += net
|
||||
|
||||
#
|
||||
# Extra objects used in the final link.
|
||||
#
|
||||
# Pass 1 1ncremental (relative) link objects should be put into the
|
||||
# processor-specific source directory (where other link objects will
|
||||
# be created). If the pass1 obect is an archive, it could go anywhere.
|
||||
|
||||
ifeq ($(CONFIG_BUILD_2PASS),y)
|
||||
EXTRA_OBJS += $(CONFIG_PASS1_OBJECT)
|
||||
endif
|
||||
|
||||
# NUTTXLIBS is the list of NuttX libraries that is passed to the
|
||||
# processor-specific Makefile to build the final NuttX target.
|
||||
# Libraries in FSDIRS are excluded if file descriptor support
|
||||
# is disabled.
|
||||
# USERLIBS is the list of libraries used to build the final user-space
|
||||
# application
|
||||
|
||||
NUTTXLIBS = lib/libsched$(LIBEXT) lib/libarch$(LIBEXT)
|
||||
USERLIBS =
|
||||
|
||||
# Add libraries for syscall support. The C library will be needed by
|
||||
# both the kernel- and user-space builds. For now, the memory manager (mm)
|
||||
# is placed in user space (only).
|
||||
|
||||
ifeq ($(CONFIG_NUTTX_KERNEL),y)
|
||||
NUTTXLIBS += lib/libstubs$(LIBEXT) lib/libkc$(LIBEXT)
|
||||
USERLIBS += lib/libproxies$(LIBEXT) lib/libuc$(LIBEXT) lib/libmm$(LIBEXT)
|
||||
else
|
||||
NUTTXLIBS += lib/libmm$(LIBEXT) lib/libc$(LIBEXT)
|
||||
endif
|
||||
|
||||
# Add libraries for C++ support. CXX, CXXFLAGS, and COMPILEXX must
|
||||
# be defined in Make.defs for this to work!
|
||||
|
||||
ifeq ($(CONFIG_HAVE_CXX),y)
|
||||
ifeq ($(CONFIG_NUTTX_KERNEL),y)
|
||||
USERLIBS += lib/libcxx$(LIBEXT)
|
||||
else
|
||||
NUTTXLIBS += lib/libcxx$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Add library for application support.
|
||||
|
||||
ifneq ($(APPDIR),)
|
||||
ifeq ($(CONFIG_NUTTX_KERNEL),y)
|
||||
USERLIBS += lib/libapps$(LIBEXT)
|
||||
else
|
||||
NUTTXLIBS += lib/libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Add libraries for network support
|
||||
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
NUTTXLIBS += lib/libnet$(LIBEXT)
|
||||
endif
|
||||
|
||||
# Add libraries for file system support
|
||||
|
||||
ifeq ($(CONFIG_NFILE_DESCRIPTORS),0)
|
||||
ifneq ($(CONFIG_NSOCKET_DESCRIPTORS),0)
|
||||
NUTTXLIBS += lib/libfs$(LIBEXT)
|
||||
endif
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
NUTTXLIBS += lib/libdrivers$(LIBEXT)
|
||||
endif
|
||||
else
|
||||
NUTTXLIBS += lib/libfs$(LIBEXT) lib/libdrivers$(LIBEXT) lib/libbinfmt$(LIBEXT)
|
||||
endif
|
||||
|
||||
# Add libraries for the NX graphics sub-system
|
||||
|
||||
ifeq ($(CONFIG_NX),y)
|
||||
NUTTXLIBS += lib/libgraphics$(LIBEXT)
|
||||
endif
|
||||
|
||||
# LINKLIBS derives from NUTTXLIBS and is simply the same list with the subdirectory removed
|
||||
|
||||
LINKLIBS = $(patsubst lib/%,%,$(NUTTXLIBS))
|
||||
|
||||
# This is the name of the final target (relative to the top level directorty)
|
||||
|
||||
BIN = nuttx$(EXEEXT)
|
||||
|
||||
all: $(BIN)
|
||||
.PHONY: context clean_context check_context export subdir_clean clean subdir_distclean distclean apps_clean apps_distclean
|
||||
|
||||
# Target used to copy include/nuttx/math.h. If CONFIG_ARCH_MATH_H is
|
||||
# defined, then there is an architecture specific math.h header file
|
||||
# that will be included indirectly from include/math.h. But first, we
|
||||
# have to copy math.h from include/nuttx/. to include/. Logic within
|
||||
# include/nuttx/math.h will hand the redirection to the architecture-
|
||||
# specific math.h header file.
|
||||
#
|
||||
# If the CONFIG_LIBM is defined, the Rhombus libm will be built at libc/math.
|
||||
# Definitions and prototypes for the Rhombus libm are also contained in
|
||||
# include/nuttx/math.h and so the file must also be copied in that case.
|
||||
#
|
||||
# If neither CONFIG_ARCH_MATH_H nor CONFIG_LIBM is defined, then no math.h
|
||||
# header file will be provided. You would want that behavior if (1) you
|
||||
# don't use libm, or (2) you want to use the math.h and libm provided
|
||||
# within your toolchain.
|
||||
|
||||
ifeq ($(CONFIG_ARCH_MATH_H),y)
|
||||
NEED_MATH_H = y
|
||||
else
|
||||
ifeq ($(CONFIG_LIBM),y)
|
||||
NEED_MATH_H = y
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(NEED_MATH_H),y)
|
||||
include/math.h: include/nuttx/math.h
|
||||
$(Q) cp -f include/nuttx/math.h include/math.h
|
||||
else
|
||||
include/math.h:
|
||||
endif
|
||||
|
||||
# The float.h header file defines the properties of your floating point
|
||||
# implementation. It would always be best to use your toolchain's float.h
|
||||
# header file but if none is avaiable, a default float.h header file will
|
||||
# provided if this option is selected. However there is no assurance that
|
||||
# the settings in this float.h are actually correct for your platform!
|
||||
|
||||
ifeq ($(CONFIG_ARCH_FLOAT_H),y)
|
||||
include/float.h: include/nuttx/float.h
|
||||
$(Q) cp -f include/nuttx/float.h include/float.h
|
||||
else
|
||||
include/float.h:
|
||||
endif
|
||||
|
||||
# Target used to copy include/nuttx/stdarg.h. If CONFIG_ARCH_STDARG_H is
|
||||
# defined, then there is an architecture specific stdarg.h header file
|
||||
# that will be included indirectly from include/stdarg.h. But first, we
|
||||
# have to copy stdarg.h from include/nuttx/. to include/.
|
||||
|
||||
ifeq ($(CONFIG_ARCH_STDARG_H),y)
|
||||
include/stdarg.h: include/nuttx/stdarg.h
|
||||
$(Q) cp -f include/nuttx/stdarg.h include/stdarg.h
|
||||
else
|
||||
include/stdarg.h:
|
||||
endif
|
||||
|
||||
# Targets used to build include/nuttx/version.h. Creation of version.h is
|
||||
# part of the overall NuttX configuration sequence. Notice that the
|
||||
# tools/mkversion tool is built and used to create include/nuttx/version.h
|
||||
|
||||
tools/mkversion$(HOSTEXEEXT):
|
||||
$(Q) $(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkversion$(HOSTEXEEXT)
|
||||
|
||||
$(TOPDIR)/.version:
|
||||
$(Q) if [ ! -f .version ]; then \
|
||||
echo "No .version file found, creating one"; \
|
||||
tools/version.sh -v 0.0 -b 0 .version; \
|
||||
chmod 755 .version; \
|
||||
fi
|
||||
|
||||
include/nuttx/version.h: $(TOPDIR)/.version tools/mkversion$(HOSTEXEEXT)
|
||||
$(Q) tools/mkversion $(TOPDIR) > include/nuttx/version.h
|
||||
|
||||
# Targets used to build include/nuttx/config.h. Creation of config.h is
|
||||
# part of the overall NuttX configuration sequence. Notice that the
|
||||
# tools/mkconfig tool is built and used to create include/nuttx/config.h
|
||||
|
||||
tools/mkconfig$(HOSTEXEEXT):
|
||||
$(Q) $(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkconfig$(HOSTEXEEXT)
|
||||
|
||||
include/nuttx/config.h: $(TOPDIR)/.config tools/mkconfig$(HOSTEXEEXT)
|
||||
$(Q) tools/mkconfig $(TOPDIR) > include/nuttx/config.h
|
||||
|
||||
# Targets used to create dependencies
|
||||
|
||||
tools/mkdeps$(HOSTEXEEXT):
|
||||
$(Q) $(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkdeps$(HOSTEXEEXT)
|
||||
|
||||
# dirlinks, and helpers
|
||||
#
|
||||
# Directories links. Most of establishing the NuttX configuration involves
|
||||
# setting up symbolic links with 'generic' directory names to specific,
|
||||
# configured directories.
|
||||
#
|
||||
# Link the apps/include directory to include/apps
|
||||
|
||||
include/apps: Make.defs
|
||||
ifneq ($(APPDIR),)
|
||||
@echo "LN: include/apps to $(APPDIR)/include"
|
||||
$(Q) if [ -d $(TOPDIR)/$(APPDIR)/include ]; then \
|
||||
$(DIRLINK) $(TOPDIR)/$(APPDIR)/include include/apps; \
|
||||
fi
|
||||
endif
|
||||
|
||||
# Link the arch/<arch-name>/include directory to include/arch
|
||||
|
||||
include/arch: Make.defs
|
||||
@echo "LN: include/arch to $(ARCH_DIR)/include"
|
||||
$(Q) $(DIRLINK) $(TOPDIR)/$(ARCH_DIR)/include include/arch
|
||||
|
||||
# Link the configs/<board-name>/include directory to include/arch/board
|
||||
|
||||
include/arch/board: include/arch Make.defs include/arch
|
||||
@echo "LN: include/arch/board to $(BOARD_DIR)/include"
|
||||
$(Q) $(DIRLINK) $(TOPDIR)/$(BOARD_DIR)/include include/arch/board
|
||||
|
||||
# Link the configs/<board-name>/src dir to arch/<arch-name>/src/board
|
||||
|
||||
$(ARCH_SRC)/board: Make.defs
|
||||
@echo "LN: $(ARCH_SRC)/board to $(BOARD_DIR)/src"
|
||||
$(Q) $(DIRLINK) $(TOPDIR)/$(BOARD_DIR)/src $(ARCH_SRC)/board
|
||||
|
||||
# Link arch/<arch-name>/include/<chip-name> to arch/<arch-name>/include/chip
|
||||
|
||||
$(ARCH_SRC)/chip: Make.defs
|
||||
ifneq ($(CONFIG_ARCH_CHIP),)
|
||||
@echo "LN: $(ARCH_SRC)/chip to $(ARCH_SRC)/$(CONFIG_ARCH_CHIP)"
|
||||
$(Q) $(DIRLINK) $(TOPDIR)/$(ARCH_SRC)/$(CONFIG_ARCH_CHIP) $(ARCH_SRC)/chip
|
||||
endif
|
||||
|
||||
# Link arch/<arch-name>/src/<chip-name> to arch/<arch-name>/src/chip
|
||||
|
||||
include/arch/chip: include/arch Make.defs
|
||||
ifneq ($(CONFIG_ARCH_CHIP),)
|
||||
@echo "LN: include/arch/chip to $(ARCH_INC)/$(CONFIG_ARCH_CHIP)"
|
||||
$(Q) $(DIRLINK) $(TOPDIR)/$(ARCH_INC)/$(CONFIG_ARCH_CHIP) include/arch/chip
|
||||
endif
|
||||
|
||||
dirlinks: include/arch include/arch/board include/arch/chip $(ARCH_SRC)/board $(ARCH_SRC)/chip include/apps
|
||||
|
||||
# context
|
||||
#
|
||||
# The context target is invoked on each target build to assure that NuttX is
|
||||
# properly configured. The basic configuration steps include creation of the
|
||||
# the config.h and version.h header files in the include/nuttx directory and
|
||||
# the establishment of symbolic links to configured directories.
|
||||
|
||||
context: check_context include/nuttx/config.h include/nuttx/version.h include/math.h include/float.h include/stdarg.h dirlinks
|
||||
$(Q) for dir in $(CONTEXTDIRS) ; do \
|
||||
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" context; \
|
||||
done
|
||||
|
||||
# clean_context
|
||||
#
|
||||
# This is part of the distclean target. It removes all of the header files
|
||||
# and symbolic links created by the context target.
|
||||
|
||||
clean_context:
|
||||
$(call DELFILE, include/nuttx/config.h)
|
||||
$(call DELFILE, include/nuttx/version.h)
|
||||
$(call DELFILE, include/math.h)
|
||||
$(call DELFILE, include/stdarg.h)
|
||||
$(Q) $(DIRUNLINK) include/arch/board
|
||||
$(Q) $(DIRUNLINK) include/arch/chip
|
||||
$(Q) $(DIRUNLINK) include/arch
|
||||
$(Q) $(DIRUNLINK) $(ARCH_SRC)/board
|
||||
$(Q) $(DIRUNLINK) $(ARCH_SRC)/chip
|
||||
$(Q) $(DIRUNLINK) include/apps
|
||||
|
||||
# check_context
|
||||
#
|
||||
# This target checks if NuttX has been configured. NuttX is configured using
|
||||
# the script tools/configure.sh. That script will install certain files in
|
||||
# the top-level NuttX build directory. This target verifies that those
|
||||
# configuration files have been installed and that NuttX is ready to be built.
|
||||
|
||||
check_context:
|
||||
$(Q) if [ ! -e ${TOPDIR}/.config -o ! -e ${TOPDIR}/Make.defs ]; then \
|
||||
echo "" ; echo "Nuttx has not been configured:" ; \
|
||||
echo " cd tools; ./configure.sh <target>" ; echo "" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
|
||||
# Archive targets. The target build sequency will first create a series of
|
||||
# libraries, one per configured source file directory. The final NuttX
|
||||
# execution will then be built from those libraries. The following targets
|
||||
# build those libraries.
|
||||
#
|
||||
# Possible kernel-mode builds
|
||||
|
||||
libc/libkc$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C libc TOPDIR="$(TOPDIR)" libkc$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
lib/libkc$(LIBEXT): libc/libkc$(LIBEXT)
|
||||
$(Q) install libc/libkc$(LIBEXT) lib/libkc$(LIBEXT)
|
||||
|
||||
sched/libsched$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C sched TOPDIR="$(TOPDIR)" libsched$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
lib/libsched$(LIBEXT): sched/libsched$(LIBEXT)
|
||||
$(Q) install sched/libsched$(LIBEXT) lib/libsched$(LIBEXT)
|
||||
|
||||
$(ARCH_SRC)/libarch$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C $(ARCH_SRC) TOPDIR="$(TOPDIR)" libarch$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
lib/libarch$(LIBEXT): $(ARCH_SRC)/libarch$(LIBEXT)
|
||||
$(Q) install $(ARCH_SRC)/libarch$(LIBEXT) lib/libarch$(LIBEXT)
|
||||
|
||||
net/libnet$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C net TOPDIR="$(TOPDIR)" libnet$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
lib/libnet$(LIBEXT): net/libnet$(LIBEXT)
|
||||
$(Q) install net/libnet$(LIBEXT) lib/libnet$(LIBEXT)
|
||||
|
||||
fs/libfs$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C fs TOPDIR="$(TOPDIR)" libfs$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
lib/libfs$(LIBEXT): fs/libfs$(LIBEXT)
|
||||
$(Q) install fs/libfs$(LIBEXT) lib/libfs$(LIBEXT)
|
||||
|
||||
drivers/libdrivers$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C drivers TOPDIR="$(TOPDIR)" libdrivers$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
lib/libdrivers$(LIBEXT): drivers/libdrivers$(LIBEXT)
|
||||
$(Q) install drivers/libdrivers$(LIBEXT) lib/libdrivers$(LIBEXT)
|
||||
|
||||
binfmt/libbinfmt$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C binfmt TOPDIR="$(TOPDIR)" libbinfmt$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
lib/libbinfmt$(LIBEXT): binfmt/libbinfmt$(LIBEXT)
|
||||
$(Q) install binfmt/libbinfmt$(LIBEXT) lib/libbinfmt$(LIBEXT)
|
||||
|
||||
graphics/libgraphics$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C graphics TOPDIR="$(TOPDIR)" libgraphics$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
lib/libgraphics$(LIBEXT): graphics/libgraphics$(LIBEXT)
|
||||
$(Q) install graphics/libgraphics$(LIBEXT) lib/libgraphics$(LIBEXT)
|
||||
|
||||
syscall/libstubs$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C syscall TOPDIR="$(TOPDIR)" libstubs$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
lib/libstubs$(LIBEXT): syscall/libstubs$(LIBEXT)
|
||||
$(Q) install syscall/libstubs$(LIBEXT) lib/libstubs$(LIBEXT)
|
||||
|
||||
# Possible user-mode builds
|
||||
|
||||
libc/libuc$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C libc TOPDIR="$(TOPDIR)" libuc$(LIBEXT)
|
||||
|
||||
lib/libuc$(LIBEXT): libc/libuc$(LIBEXT)
|
||||
$(Q) install libc/libuc$(LIBEXT) lib/libuc$(LIBEXT)
|
||||
|
||||
libxx/libcxx$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C libxx TOPDIR="$(TOPDIR)" libcxx$(LIBEXT)
|
||||
|
||||
lib/libcxx$(LIBEXT): libxx/libcxx$(LIBEXT)
|
||||
$(Q) install libxx/libcxx$(LIBEXT) lib/libcxx$(LIBEXT)
|
||||
|
||||
mm/libmm$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C mm TOPDIR="$(TOPDIR)" libmm$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
lib/libmm$(LIBEXT): mm/libmm$(LIBEXT)
|
||||
$(Q) install mm/libmm$(LIBEXT) lib/libmm$(LIBEXT)
|
||||
|
||||
$(APPDIR)/libapps$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C $(APPDIR) TOPDIR="$(TOPDIR)" libapps$(LIBEXT)
|
||||
|
||||
lib/libapps$(LIBEXT): $(APPDIR)/libapps$(LIBEXT)
|
||||
$(Q) install $(APPDIR)/libapps$(LIBEXT) lib/libapps$(LIBEXT)
|
||||
|
||||
syscall/libproxies$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C syscall TOPDIR="$(TOPDIR)" libproxies$(LIBEXT)
|
||||
|
||||
lib/libproxies$(LIBEXT): syscall/libproxies$(LIBEXT)
|
||||
$(Q) install syscall/libproxies$(LIBEXT) lib/libproxies$(LIBEXT)
|
||||
|
||||
# Possible non-kernel builds
|
||||
|
||||
libc/libc$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C libc TOPDIR="$(TOPDIR)" libc$(LIBEXT)
|
||||
|
||||
lib/libc$(LIBEXT): libc/libc$(LIBEXT)
|
||||
$(Q) install libc/libc$(LIBEXT) lib/libc$(LIBEXT)
|
||||
|
||||
# pass1 and pass2
|
||||
#
|
||||
# If the 2 pass build option is selected, then this pass1 target is
|
||||
# configured to built before the pass2 target. This pass1 target may, as an
|
||||
# example, build an extra link object (CONFIG_PASS1_OBJECT) which may be an
|
||||
# incremental (relative) link object, but could be a static library (archive);
|
||||
# some modification to this Makefile would be required if CONFIG_PASS1_OBJECT
|
||||
# is an archive. Exactly what is performed during pass1 or what it generates
|
||||
# is unknown to this makefule unless CONFIG_PASS1_OBJECT is defined.
|
||||
|
||||
pass1deps: pass1dep $(USERLIBS)
|
||||
|
||||
pass1: pass1deps
|
||||
ifeq ($(CONFIG_BUILD_2PASS),y)
|
||||
$(Q) if [ -z "$(CONFIG_PASS1_BUILDIR)" ]; then \
|
||||
echo "ERROR: CONFIG_PASS1_BUILDIR not defined"; \
|
||||
exit 1; \
|
||||
fi
|
||||
$(Q) if [ ! -d "$(CONFIG_PASS1_BUILDIR)" ]; then \
|
||||
echo "ERROR: CONFIG_PASS1_BUILDIR does not exist"; \
|
||||
exit 1; \
|
||||
fi
|
||||
$(Q) if [ ! -f "$(CONFIG_PASS1_BUILDIR)/Makefile" ]; then \
|
||||
echo "ERROR: No Makefile in CONFIG_PASS1_BUILDIR"; \
|
||||
exit 1; \
|
||||
fi
|
||||
$(Q) $(MAKE) -C $(CONFIG_PASS1_BUILDIR) TOPDIR="$(TOPDIR)" LINKLIBS="$(LINKLIBS)" USERLIBS="$(USERLIBS)" "$(CONFIG_PASS1_TARGET)"
|
||||
endif
|
||||
|
||||
pass2deps: pass2dep $(NUTTXLIBS)
|
||||
|
||||
pass2: pass2deps
|
||||
$(Q) $(MAKE) -C $(ARCH_SRC) TOPDIR="$(TOPDIR)" EXTRA_OBJS="$(EXTRA_OBJS)" LINKLIBS="$(LINKLIBS)" EXTRADEFINES=$(KDEFINE) $(BIN)
|
||||
$(Q) if [ -w /tftpboot ] ; then \
|
||||
cp -f $(BIN) /tftpboot/$(BIN).${CONFIG_ARCH}; \
|
||||
fi
|
||||
ifeq ($(CONFIG_RRLOAD_BINARY),y)
|
||||
@echo "MK: $(BIN).rr"
|
||||
$(Q) $(TOPDIR)/tools/mkimage.sh --Prefix $(CROSSDEV) $(BIN) $(BIN).rr
|
||||
$(Q) if [ -w /tftpboot ] ; then \
|
||||
cp -f $(BIN).rr /tftpboot/$\(BIN).rr.$(CONFIG_ARCH); \
|
||||
fi
|
||||
endif
|
||||
ifeq ($(CONFIG_INTELHEX_BINARY),y)
|
||||
@echo "CP: $(BIN).hex"
|
||||
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O ihex $(BIN) $(BIN).hex
|
||||
endif
|
||||
ifeq ($(CONFIG_MOTOROLA_SREC),y)
|
||||
@echo "CP: $(BIN).srec"
|
||||
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O srec $(BIN) $(BIN).srec
|
||||
endif
|
||||
ifeq ($(CONFIG_RAW_BINARY),y)
|
||||
@echo "CP: $(BIN).bin"
|
||||
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O binary $(BIN) $(BIN).bin
|
||||
endif
|
||||
|
||||
# $(BIN)
|
||||
#
|
||||
# Create the final NuttX executable in a two pass build process. In the
|
||||
# normal case, all pass1 and pass2 dependencies are created then pass1
|
||||
# and pass2 targets are built. However, in some cases, you may need to build
|
||||
# pass1 depenencies and pass1 first, then build pass2 dependencies and pass2.
|
||||
# in that case, execute 'make pass1 pass2' from the command line.
|
||||
|
||||
$(BIN): pass1deps pass2deps pass1 pass2
|
||||
|
||||
# download
|
||||
#
|
||||
# This is a helper target that will rebuild NuttX and download it to the target
|
||||
# system in one step. The operation of this target depends completely upon
|
||||
# implementation of the DOWNLOAD command in the user Make.defs file. It will
|
||||
# generate an error an error if the DOWNLOAD command is not defined.
|
||||
|
||||
download: $(BIN)
|
||||
$(call DOWNLOAD, $<)
|
||||
|
||||
# pass1dep: Create pass1 build dependencies
|
||||
# pass2dep: Create pass2 build dependencies
|
||||
|
||||
pass1dep: context tools/mkdeps$(HOSTEXEEXT)
|
||||
$(Q) for dir in $(USERDEPDIRS) ; do \
|
||||
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" depend ; \
|
||||
done
|
||||
|
||||
pass2dep: context tools/mkdeps$(HOSTEXEEXT)
|
||||
$(Q) for dir in $(KERNDEPDIRS) ; do \
|
||||
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" EXTRADEFINES=$(KDEFINE) depend; \
|
||||
done
|
||||
|
||||
# Configuration targets
|
||||
#
|
||||
# These targets depend on the kconfig-frontends packages. To use these, you
|
||||
# must first download and install the kconfig-frontends package from this
|
||||
# location: http://ymorin.is-a-geek.org/projects/kconfig-frontends. See
|
||||
# misc/tools/README.txt for additional information.
|
||||
|
||||
config:
|
||||
$(Q) APPSDIR=${CONFIG_APPS_DIR} conf Kconfig
|
||||
|
||||
oldconfig:
|
||||
$(Q) APPSDIR=${CONFIG_APPS_DIR} conf --oldconfig Kconfig
|
||||
|
||||
menuconfig:
|
||||
$(Q) APPSDIR=${CONFIG_APPS_DIR} mconf Kconfig
|
||||
|
||||
# export
|
||||
#
|
||||
# The export target will package the NuttX libraries and header files into
|
||||
# an exportable package. Caveats: (1) These needs some extension for the KERNEL
|
||||
# build; it needs to receive USERLIBS and create a libuser.a). (2) The logic
|
||||
# in tools/mkexport.sh only supports GCC and, for example, explicitly assumes
|
||||
# that the archiver is 'ar'
|
||||
|
||||
export: pass2deps
|
||||
$(Q) tools/mkexport.sh -w$(WINTOOL) -t "$(TOPDIR)" -l "$(NUTTXLIBS)"
|
||||
|
||||
# General housekeeping targets: dependencies, cleaning, etc.
|
||||
#
|
||||
# depend: Create both PASS1 and PASS2 dependencies
|
||||
# clean: Removes derived object files, archives, executables, and
|
||||
# temporary files, but retains the configuration and context
|
||||
# files and directories.
|
||||
# distclean: Does 'clean' then also removes all configuration and context
|
||||
# files. This essentially restores the directory structure
|
||||
# to its original, unconfigured stated.
|
||||
|
||||
depend: pass1dep pass2dep
|
||||
|
||||
subdir_clean:
|
||||
$(Q) for dir in $(CLEANDIRS) ; do \
|
||||
if [ -e $$dir/Makefile ]; then \
|
||||
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" clean ; \
|
||||
fi \
|
||||
done
|
||||
$(Q) $(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" clean
|
||||
$(Q) $(MAKE) -C mm -f Makefile.test TOPDIR="$(TOPDIR)" clean
|
||||
ifeq ($(CONFIG_BUILD_2PASS),y)
|
||||
$(Q) $(MAKE) -C $(CONFIG_PASS1_BUILDIR) TOPDIR="$(TOPDIR)" clean
|
||||
endif
|
||||
|
||||
clean: subdir_clean
|
||||
$(call DELFILE, $(BIN))
|
||||
$(call DELFILE, nuttx.*)
|
||||
$(call DELFILE, mm_test)
|
||||
$(call DELFILE, *.map)
|
||||
$(call DELFILE, _SAVED_APPS_config)
|
||||
$(call DELFILE, nuttx-export*)
|
||||
$(call CLEAN)
|
||||
|
||||
subdir_distclean:
|
||||
$(Q) for dir in $(CLEANDIRS) ; do \
|
||||
if [ -e $$dir/Makefile ]; then \
|
||||
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" distclean ; \
|
||||
fi \
|
||||
done
|
||||
|
||||
distclean: clean subdir_distclean clean_context
|
||||
ifeq ($(CONFIG_BUILD_2PASS),y)
|
||||
$(Q) $(MAKE) -C $(CONFIG_PASS1_BUILDIR) TOPDIR="$(TOPDIR)" distclean
|
||||
endif
|
||||
$(call DELFILE, Make.defs)
|
||||
$(call DELFILE, setenv.sh)
|
||||
$(call DELFILE, setenv.bat)
|
||||
$(call DELFILE, .config)
|
||||
$(call DELFILE, .config.old)
|
||||
|
||||
# Application housekeeping targets. The APPDIR variable refers to the user
|
||||
# application directory. A sample apps/ directory is included with NuttX,
|
||||
# however, this is not treated as part of NuttX and may be replaced with a
|
||||
# different application directory. For the most part, the application
|
||||
# directory is treated like any other build directory in this script. However,
|
||||
# as a convenience, the following targets are included to support housekeeping
|
||||
# functions in the user application directory from the NuttX build directory.
|
||||
#
|
||||
# apps_clean: Perform the clean operation only in the user application
|
||||
# directory
|
||||
# apps_distclean: Perform the distclean operation only in the user application
|
||||
# directory. Note that the apps/.config file (inf any) is
|
||||
# preserved so that this is not a "full" distclean but more of a
|
||||
# configuration "reset." (There willnot be an apps/.config
|
||||
# file if the configuration was generated via make menuconfig).
|
||||
|
||||
apps_clean:
|
||||
ifneq ($(APPDIR),)
|
||||
$(Q) $(MAKE) -C "$(TOPDIR)/$(APPDIR)" TOPDIR="$(TOPDIR)" clean
|
||||
endif
|
||||
|
||||
apps_distclean:
|
||||
ifneq ($(APPDIR),)
|
||||
$(Q) if [ -r "$(TOPDIR)/$(APPDIR)/.config" ]; then \
|
||||
cp "$(TOPDIR)/$(APPDIR)/.config" _SAVED_APPS_config || \
|
||||
{ echo "Copy of $(APPDIR)/.config failed" ; exit 1 ; } \
|
||||
else \
|
||||
rm -f _SAVED_APPS_config; \
|
||||
fi
|
||||
$(Q) $(MAKE) -C "$(TOPDIR)/$(APPDIR)" TOPDIR="$(TOPDIR)" distclean
|
||||
$(Q) if [ -r _SAVED_APPS_config ]; then \
|
||||
mv _SAVED_APPS_config "$(TOPDIR)/$(APPDIR)/.config" || \
|
||||
{ echo "Copy of _SAVED_APPS_config failed" ; exit 1 ; } \
|
||||
fi
|
||||
endif
|
||||
|
|
@ -0,0 +1,740 @@
|
|||
############################################################################
|
||||
# Makefile.win
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
TOPDIR := ${shell echo %CD%}
|
||||
-include $(TOPDIR)\.config
|
||||
-include $(TOPDIR)\tools\Config.mk
|
||||
-include $(TOPDIR)\Make.defs
|
||||
|
||||
# Control build verbosity
|
||||
|
||||
ifeq ($(V),1)
|
||||
export Q :=
|
||||
else
|
||||
export Q := @
|
||||
endif
|
||||
|
||||
# This define is passed as EXTRADEFINES for kernel-mode builds. It is also passed
|
||||
# during PASS1 (but not PASS2) context and depend targets.
|
||||
|
||||
KDEFINE = ${shell $(TOPDIR)\tools\define.bat "$(CC)" __KERNEL__}
|
||||
|
||||
# Process architecture and board-specific directories
|
||||
|
||||
ARCH_DIR = arch\$(CONFIG_ARCH)
|
||||
ARCH_SRC = $(ARCH_DIR)\src
|
||||
ARCH_INC = $(ARCH_DIR)\include
|
||||
BOARD_DIR = configs\$(CONFIG_ARCH_BOARD)
|
||||
|
||||
# Add-on directories. These may or may not be in place in the
|
||||
# NuttX source tree (they must be specifically installed)
|
||||
#
|
||||
# CONFIG_APPS_DIR can be over-ridden from the command line or in the .config file.
|
||||
# The default value of CONFIG_APPS_DIR is ..\apps. Ultimately, the application
|
||||
# will be built if APPDIR is defined. APPDIR will be defined if a directory containing
|
||||
# a Makefile is found at the path provided by CONFIG_APPS_DIR
|
||||
|
||||
ifeq ($(CONFIG_APPS_DIR),)
|
||||
CONFIG_APPS_DIR = ..\apps
|
||||
endif
|
||||
APPDIR := ${shell if exist "$(CONFIG_APPS_DIR)\Makefile" echo $(CONFIG_APPS_DIR)}
|
||||
|
||||
# All add-on directories.
|
||||
#
|
||||
# NUTTX_ADDONS is the list of directories built into the NuttX kernel.
|
||||
# USER_ADDONS is the list of directories that will be built into the user application
|
||||
|
||||
NUTTX_ADDONS :=
|
||||
USER_ADDONS :=
|
||||
|
||||
ifeq ($(CONFIG_NUTTX_KERNEL),y)
|
||||
USER_ADDONS += $(APPDIR)
|
||||
else
|
||||
NUTTX_ADDONS += $(APPDIR)
|
||||
endif
|
||||
|
||||
# Lists of build directories.
|
||||
#
|
||||
# FSDIRS depend on file descriptor support; NONFSDIRS do not (except for parts
|
||||
# of FSDIRS). We will exclude FSDIRS from the build if file descriptor
|
||||
# support is disabled
|
||||
# CONTEXTDIRS include directories that have special, one-time pre-build
|
||||
# requirements. Normally this includes things like auto-generation of
|
||||
# configuration specific files or creation of configurable symbolic links
|
||||
# USERDIRS - When NuttX is build is a monolithic kernel, this provides the
|
||||
# list of directories that must be built
|
||||
# OTHERDIRS - These are directories that are not built but probably should
|
||||
# be cleaned to prevent garbarge from collecting in them when changing
|
||||
# configurations.
|
||||
|
||||
NONFSDIRS = sched $(ARCH_SRC) $(NUTTX_ADDONS)
|
||||
FSDIRS = fs drivers binfmt
|
||||
CONTEXTDIRS = $(APPDIR)
|
||||
USERDIRS =
|
||||
OTHERDIRS = lib
|
||||
|
||||
ifeq ($(CONFIG_NUTTX_KERNEL),y)
|
||||
|
||||
NONFSDIRS += syscall
|
||||
CONTEXTDIRS += syscall
|
||||
USERDIRS += syscall libc mm $(USER_ADDONS)
|
||||
ifeq ($(CONFIG_HAVE_CXX),y)
|
||||
USERDIRS += libxx
|
||||
endif
|
||||
|
||||
else
|
||||
|
||||
NONFSDIRS += libc mm
|
||||
OTHERDIRS += syscall $(USER_ADDONS)
|
||||
ifeq ($(CONFIG_HAVE_CXX),y)
|
||||
NONFSDIRS += libxx
|
||||
else
|
||||
OTHERDIRS += libxx
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NX),y)
|
||||
NONFSDIRS += graphics
|
||||
CONTEXTDIRS += graphics
|
||||
else
|
||||
OTHERDIRS += graphics
|
||||
endif
|
||||
|
||||
# CLEANDIRS are the directories that will clean in. These are
|
||||
# all directories that we know about.
|
||||
# KERNDEPDIRS are the directories in which we will build target dependencies.
|
||||
# If NuttX and applications are built separately (CONFIG_NUTTX_KERNEL),
|
||||
# then this holds only the directories containing kernel files.
|
||||
# USERDEPDIRS. If NuttX and applications are built separately (CONFIG_NUTTX_KERNEL),
|
||||
# then this holds only the directories containing user files.
|
||||
|
||||
CLEANDIRS = $(NONFSDIRS) $(FSDIRS) $(USERDIRS) $(OTHERDIRS)
|
||||
KERNDEPDIRS = $(NONFSDIRS)
|
||||
USERDEPDIRS = $(USERDIRS)
|
||||
|
||||
# Add file system directories to KERNDEPDIRS (they are already in CLEANDIRS)
|
||||
|
||||
ifeq ($(CONFIG_NFILE_DESCRIPTORS),0)
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
ifneq ($(CONFIG_NSOCKET_DESCRIPTORS),0)
|
||||
KERNDEPDIRS += fs
|
||||
endif
|
||||
KERNDEPDIRS += drivers
|
||||
endif
|
||||
else
|
||||
KERNDEPDIRS += $(FSDIRS)
|
||||
endif
|
||||
|
||||
# Add networking directories to KERNDEPDIRS and CLEANDIRS
|
||||
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
KERNDEPDIRS += net
|
||||
endif
|
||||
CLEANDIRS += net
|
||||
|
||||
#
|
||||
# Extra objects used in the final link.
|
||||
#
|
||||
# Pass 1 1ncremental (relative) link objects should be put into the
|
||||
# processor-specific source directory (where other link objects will
|
||||
# be created). If the pass1 obect is an archive, it could go anywhere.
|
||||
|
||||
ifeq ($(CONFIG_BUILD_2PASS),y)
|
||||
EXTRA_OBJS += $(CONFIG_PASS1_OBJECT)
|
||||
endif
|
||||
|
||||
# NUTTXLIBS is the list of NuttX libraries that is passed to the
|
||||
# processor-specific Makefile to build the final NuttX target.
|
||||
# Libraries in FSDIRS are excluded if file descriptor support
|
||||
# is disabled.
|
||||
# USERLIBS is the list of libraries used to build the final user-space
|
||||
# application
|
||||
|
||||
NUTTXLIBS = lib\libsched$(LIBEXT) lib\libarch$(LIBEXT)
|
||||
USERLIBS =
|
||||
|
||||
# Add libraries for syscall support. The C library will be needed by
|
||||
# both the kernel- and user-space builds. For now, the memory manager (mm)
|
||||
# is placed in user space (only).
|
||||
|
||||
ifeq ($(CONFIG_NUTTX_KERNEL),y)
|
||||
NUTTXLIBS += lib\libstubs$(LIBEXT) lib\libkc$(LIBEXT)
|
||||
USERLIBS += lib\libproxies$(LIBEXT) lib\libuc$(LIBEXT) lib\libmm$(LIBEXT)
|
||||
else
|
||||
NUTTXLIBS += lib\libmm$(LIBEXT) lib\libc$(LIBEXT)
|
||||
endif
|
||||
|
||||
# Add libraries for C++ support. CXX, CXXFLAGS, and COMPILEXX must
|
||||
# be defined in Make.defs for this to work!
|
||||
|
||||
ifeq ($(CONFIG_HAVE_CXX),y)
|
||||
ifeq ($(CONFIG_NUTTX_KERNEL),y)
|
||||
USERLIBS += lib\libcxx$(LIBEXT)
|
||||
else
|
||||
NUTTXLIBS += lib\libcxx$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Add library for application support.
|
||||
|
||||
ifneq ($(APPDIR),)
|
||||
ifeq ($(CONFIG_NUTTX_KERNEL),y)
|
||||
USERLIBS += lib\libapps$(LIBEXT)
|
||||
else
|
||||
NUTTXLIBS += lib\libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Add libraries for network support
|
||||
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
NUTTXLIBS += lib\libnet$(LIBEXT)
|
||||
endif
|
||||
|
||||
# Add libraries for file system support
|
||||
|
||||
ifeq ($(CONFIG_NFILE_DESCRIPTORS),0)
|
||||
ifneq ($(CONFIG_NSOCKET_DESCRIPTORS),0)
|
||||
NUTTXLIBS += lib\libfs$(LIBEXT)
|
||||
endif
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
NUTTXLIBS += lib\libdrivers$(LIBEXT)
|
||||
endif
|
||||
else
|
||||
NUTTXLIBS += lib\libfs$(LIBEXT) lib\libdrivers$(LIBEXT) lib\libbinfmt$(LIBEXT)
|
||||
endif
|
||||
|
||||
# Add libraries for the NX graphics sub-system
|
||||
|
||||
ifeq ($(CONFIG_NX),y)
|
||||
NUTTXLIBS += lib\libgraphics$(LIBEXT)
|
||||
endif
|
||||
|
||||
# LINKLIBS derives from NUTTXLIBS and is simply the same list with the subdirectory removed
|
||||
|
||||
LINKLIBS = $(patsubst lib\\%,%,$(NUTTXLIBS))
|
||||
|
||||
# This is the name of the final target (relative to the top level directorty)
|
||||
|
||||
BIN = nuttx$(EXEEXT)
|
||||
|
||||
all: $(BIN)
|
||||
.PHONY: context clean_context check_context export subdir_clean clean subdir_distclean distclean apps_clean apps_distclean
|
||||
|
||||
# Target used to copy include\nuttx\math.h. If CONFIG_ARCH_MATH_H is
|
||||
# defined, then there is an architecture specific math.h header file
|
||||
# that will be included indirectly from include\math.h. But first, we
|
||||
# have to copy math.h from include\nuttx\. to include\. Logic within
|
||||
# include\nuttx\math.h will hand the redirection to the architecture-
|
||||
# specific math.h header file.
|
||||
#
|
||||
# If the CONFIG_LIBM is defined, the Rhombus libm will be built at libc\math.
|
||||
# Definitions and prototypes for the Rhombus libm are also contained in
|
||||
# include\nuttx\math.h and so the file must also be copied in that case.
|
||||
#
|
||||
# If neither CONFIG_ARCH_MATH_H nor CONFIG_LIBM is defined, then no math.h
|
||||
# header file will be provided. You would want that behavior if (1) you
|
||||
# don't use libm, or (2) you want to use the math.h and libm provided
|
||||
# within your toolchain.
|
||||
|
||||
ifeq ($(CONFIG_ARCH_MATH_H),y)
|
||||
NEED_MATH_H = y
|
||||
else
|
||||
ifeq ($(CONFIG_LIBM),y)
|
||||
NEED_MATH_H = y
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(NEED_MATH_H),y)
|
||||
include\math.h: include\nuttx\math.h
|
||||
$(Q) cp -f include\nuttx\math.h include\math.h
|
||||
else
|
||||
include\math.h:
|
||||
endif
|
||||
|
||||
# The float.h header file defines the properties of your floating point
|
||||
# implementation. It would always be best to use your toolchain's float.h
|
||||
# header file but if none is avaiable, a default float.h header file will
|
||||
# provided if this option is selected. However there is no assurance that
|
||||
# the settings in this float.h are actually correct for your platform!
|
||||
|
||||
ifeq ($(CONFIG_ARCH_FLOAT_H),y)
|
||||
include\float.h: include\nuttx\float.h
|
||||
$(Q) cp -f include\nuttx\float.h include\float.h
|
||||
else
|
||||
include\float.h:
|
||||
endif
|
||||
|
||||
# Target used to copy include\nuttx\stdarg.h. If CONFIG_ARCH_STDARG_H is
|
||||
# defined, then there is an architecture specific stdarg.h header file
|
||||
# that will be included indirectly from include\stdarg.h. But first, we
|
||||
# have to copy stdarg.h from include\nuttx\. to include\.
|
||||
|
||||
ifeq ($(CONFIG_ARCH_STDARG_H),y)
|
||||
include\stdarg.h: include\nuttx\stdarg.h
|
||||
$(Q) cp -f include\nuttx\stdarg.h include\stdarg.h
|
||||
else
|
||||
include\stdarg.h:
|
||||
endif
|
||||
|
||||
# Targets used to build include\nuttx\version.h. Creation of version.h is
|
||||
# part of the overall NuttX configuration sequence. Notice that the
|
||||
# tools\mkversion tool is built and used to create include\nuttx\version.h
|
||||
|
||||
tools\mkversion$(HOSTEXEEXT):
|
||||
$(Q) $(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkversion$(HOSTEXEEXT)
|
||||
|
||||
$(TOPDIR)\.version:
|
||||
$(Q) if [ ! -f .version ]; then \
|
||||
echo "No .version file found, creating one"; \
|
||||
tools\version.sh -v 0.0 -b 0 .version; \
|
||||
chmod 755 .version; \
|
||||
fi
|
||||
|
||||
include\nuttx\version.h: $(TOPDIR)\.version tools\mkversion$(HOSTEXEEXT)
|
||||
$(Q) tools\mkversion$(HOSTEXEEXT) $(TOPDIR) > include\nuttx\version.h
|
||||
|
||||
# Targets used to build include\nuttx\config.h. Creation of config.h is
|
||||
# part of the overall NuttX configuration sequence. Notice that the
|
||||
# tools\mkconfig tool is built and used to create include\nuttx\config.h
|
||||
|
||||
tools\mkconfig$(HOSTEXEEXT):
|
||||
$(Q) $(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkconfig$(HOSTEXEEXT)
|
||||
|
||||
include\nuttx\config.h: $(TOPDIR)\.config tools\mkconfig$(HOSTEXEEXT)
|
||||
$(Q) tools\mkconfig$(HOSTEXEEXT) $(TOPDIR) > include\nuttx\config.h
|
||||
|
||||
# Targets used to create dependencies
|
||||
|
||||
tools\mkdeps$(HOSTEXEEXT):
|
||||
$(Q) $(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkdeps$(HOSTEXEEXT)
|
||||
|
||||
# dirlinks, and helpers
|
||||
#
|
||||
# Directories links. Most of establishing the NuttX configuration involves
|
||||
# setting up symbolic links with 'generic' directory names to specific,
|
||||
# configured directories.
|
||||
#
|
||||
# Link the apps\include directory to include\apps
|
||||
|
||||
include\apps: Make.defs
|
||||
ifneq ($(APPDIR),)
|
||||
@echo LN: include\apps $(APPDIR)\include
|
||||
ifeq ($(CONFIG_WINDOWS_MKLINK),y)
|
||||
$(Q) /user:administrator mklink /d include\apps $(APPDIR)\include
|
||||
else
|
||||
$(Q) xcopy $(APPDIR)\include include\apps /c /q /s /e /y /i
|
||||
$(Q) echo FAKELNK > include\apps\.fakelnk
|
||||
endif
|
||||
endif
|
||||
|
||||
# Link the arch\<arch-name>\include directory to include\arch
|
||||
|
||||
include\arch: Make.defs
|
||||
@echo LN: include\arch to $(ARCH_DIR)\include
|
||||
ifeq ($(CONFIG_WINDOWS_MKLINK),y)
|
||||
$(Q) /user:administrator mklink /d include\arch $(TOPDIR)\$(ARCH_DIR)\include
|
||||
else
|
||||
$(Q) xcopy $(TOPDIR)\$(ARCH_DIR)\include include\arch /c /q /s /e /y /i
|
||||
$(Q) echo FAKELNK > include\arch\.fakelnk
|
||||
endif
|
||||
|
||||
# Link the configs\<board-name>\include directory to include\arch\board
|
||||
|
||||
include\arch\board: include\arch Make.defs include\arch
|
||||
@echo LN: include\arch\board to $(BOARD_DIR)\include
|
||||
ifeq ($(CONFIG_WINDOWS_MKLINK),y)
|
||||
$(Q) /user:administrator mklink /d include\arch\board $(TOPDIR)\$(BOARD_DIR)\include
|
||||
else
|
||||
$(Q) xcopy $(TOPDIR)\$(BOARD_DIR)\include include\arch\board /c /q /s /e /y /i
|
||||
$(Q) echo FAKELNK > include\arch\board\.fakelnk
|
||||
endif
|
||||
|
||||
# Link the configs\<board-name>\src dir to arch\<arch-name>\src\board
|
||||
|
||||
$(ARCH_SRC)\board: Make.defs
|
||||
@echo LN: $(ARCH_SRC)\board to $(BOARD_DIR)\src
|
||||
ifeq ($(CONFIG_WINDOWS_MKLINK),y)
|
||||
$(Q) /user:administrator mklink /d $(ARCH_SRC)\board $(TOPDIR)\$(BOARD_DIR)\src
|
||||
else
|
||||
$(Q) xcopy $(TOPDIR)\$(BOARD_DIR)\src $(ARCH_SRC)\board /c /q /s /e /y /i
|
||||
$(Q) echo FAKELNK > $(ARCH_SRC)\board\.fakelnk
|
||||
endif
|
||||
|
||||
# Link arch\<arch-name>\include\<chip-name> to arch\<arch-name>\include\chip
|
||||
|
||||
$(ARCH_SRC)\chip: Make.defs
|
||||
ifneq ($(CONFIG_ARCH_CHIP),)
|
||||
@echo LN: $(ARCH_SRC)\chip to $(ARCH_SRC)\$(CONFIG_ARCH_CHIP)
|
||||
ifeq ($(CONFIG_WINDOWS_MKLINK),y)
|
||||
$(Q) /user:administrator mklink /d $(ARCH_SRC)\chip $(TOPDIR)\$(ARCH_SRC)\$(CONFIG_ARCH_CHIP)
|
||||
else
|
||||
$(Q) xcopy $(TOPDIR)\$(ARCH_SRC)\$(CONFIG_ARCH_CHIP) $(ARCH_SRC)\chip /c /q /s /e /y /i
|
||||
$(Q) echo FAKELNK > $(ARCH_SRC)\chip\.fakelnk
|
||||
endif
|
||||
endif
|
||||
|
||||
# Link arch\<arch-name>\src\<chip-name> to arch\<arch-name>\src\chip
|
||||
|
||||
include\arch\chip: include\arch Make.defs
|
||||
ifneq ($(CONFIG_ARCH_CHIP),)
|
||||
@echo LN: include\arch\chip to $(ARCH_INC)\$(CONFIG_ARCH_CHIP)
|
||||
ifeq ($(CONFIG_WINDOWS_MKLINK),y)
|
||||
$(Q) /user:administrator mklink /d include\arch\chip $(TOPDIR)\$(ARCH_INC)\$(CONFIG_ARCH_CHIP)
|
||||
else
|
||||
$(Q) xcopy $(TOPDIR)\$(ARCH_INC)\$(CONFIG_ARCH_CHIP) include\arch\chip /c /q /s /e /y /i
|
||||
$(Q) echo FAKELNK > include\arch\chip\.fakelnk
|
||||
endif
|
||||
endif
|
||||
|
||||
dirlinks: include\arch include\arch\board include\arch\chip $(ARCH_SRC)\board $(ARCH_SRC)\chip include\apps
|
||||
|
||||
# context
|
||||
#
|
||||
# The context target is invoked on each target build to assure that NuttX is
|
||||
# properly configured. The basic configuration steps include creation of the
|
||||
# the config.h and version.h header files in the include\nuttx directory and
|
||||
# the establishment of symbolic links to configured directories.
|
||||
|
||||
context: check_context include\nuttx\config.h include\nuttx\version.h include\math.h include\float.h include\stdarg.h dirlinks
|
||||
$(Q) for %%G in ($(CONTEXTDIRS)) do ( $(MAKE) -C %%G TOPDIR="$(TOPDIR)" context )
|
||||
|
||||
# clean_context
|
||||
#
|
||||
# This is part of the distclean target. It removes all of the header files
|
||||
# and symbolic links created by the context target.
|
||||
|
||||
clean_context:
|
||||
$(call DELFILE, include\nuttx\config.h)
|
||||
$(call DELFILE, include\nuttx\version.h)
|
||||
$(call DELFILE, include\math.h)
|
||||
$(call DELFILE, include\stdarg.h)
|
||||
$(call DELDIR, include\arch\board)
|
||||
$(call DELDIR, include\arch\chip)
|
||||
$(call DELDIR, include\arch)
|
||||
$(call DELDIR, $(ARCH_SRC)\board)
|
||||
$(call DELDIR, $(ARCH_SRC)\chip)
|
||||
$(call DELDIR, include\apps)
|
||||
|
||||
# check_context
|
||||
#
|
||||
# This target checks if NuttX has been configured. NuttX is configured using
|
||||
# the script tools\configure.sh. That script will install certain files in
|
||||
# the top-level NuttX build directory. This target verifies that those
|
||||
# configuration files have been installed and that NuttX is ready to be built.
|
||||
|
||||
check_context:
|
||||
$(Q) if not exist $(TOPDIR)\.config echo "$(TOPDIR)\.config does not exist"
|
||||
$(Q) if not exist $(TOPDIR)\Make.defs echo "$(TOPDIR)\Make.defs does not exist"
|
||||
|
||||
# Archive targets. The target build sequency will first create a series of
|
||||
# libraries, one per configured source file directory. The final NuttX
|
||||
# execution will then be built from those libraries. The following targets
|
||||
# build those libraries.
|
||||
#
|
||||
# Possible kernel-mode builds
|
||||
|
||||
libc\libkc$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C libc TOPDIR="$(TOPDIR)" libkc$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
lib\libkc$(LIBEXT): libc\libkc$(LIBEXT)
|
||||
$(Q) install libc\libkc$(LIBEXT) lib\libkc$(LIBEXT)
|
||||
|
||||
sched\libsched$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C sched TOPDIR="$(TOPDIR)" libsched$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
lib\libsched$(LIBEXT): sched\libsched$(LIBEXT)
|
||||
$(Q) install sched\libsched$(LIBEXT) lib\libsched$(LIBEXT)
|
||||
|
||||
$(ARCH_SRC)\libarch$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C $(ARCH_SRC) TOPDIR="$(TOPDIR)" libarch$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
lib\libarch$(LIBEXT): $(ARCH_SRC)\libarch$(LIBEXT)
|
||||
$(Q) install $(ARCH_SRC)\libarch$(LIBEXT) lib\libarch$(LIBEXT)
|
||||
|
||||
net\libnet$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C net TOPDIR="$(TOPDIR)" libnet$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
lib\libnet$(LIBEXT): net\libnet$(LIBEXT)
|
||||
$(Q) install net\libnet$(LIBEXT) lib\libnet$(LIBEXT)
|
||||
|
||||
fs\libfs$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C fs TOPDIR="$(TOPDIR)" libfs$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
lib\libfs$(LIBEXT): fs\libfs$(LIBEXT)
|
||||
$(Q) install fs\libfs$(LIBEXT) lib\libfs$(LIBEXT)
|
||||
|
||||
drivers\libdrivers$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C drivers TOPDIR="$(TOPDIR)" libdrivers$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
lib\libdrivers$(LIBEXT): drivers\libdrivers$(LIBEXT)
|
||||
$(Q) install drivers\libdrivers$(LIBEXT) lib\libdrivers$(LIBEXT)
|
||||
|
||||
binfmt\libbinfmt$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C binfmt TOPDIR="$(TOPDIR)" libbinfmt$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
lib\libbinfmt$(LIBEXT): binfmt\libbinfmt$(LIBEXT)
|
||||
$(Q) install binfmt\libbinfmt$(LIBEXT) lib\libbinfmt$(LIBEXT)
|
||||
|
||||
graphics\libgraphics$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C graphics TOPDIR="$(TOPDIR)" libgraphics$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
lib\libgraphics$(LIBEXT): graphics\libgraphics$(LIBEXT)
|
||||
$(Q) install graphics\libgraphics$(LIBEXT) lib\libgraphics$(LIBEXT)
|
||||
|
||||
syscall\libstubs$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C syscall TOPDIR="$(TOPDIR)" libstubs$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
lib\libstubs$(LIBEXT): syscall\libstubs$(LIBEXT)
|
||||
$(Q) install syscall\libstubs$(LIBEXT) lib\libstubs$(LIBEXT)
|
||||
|
||||
# Possible user-mode builds
|
||||
|
||||
libc\libuc$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C libc TOPDIR="$(TOPDIR)" libuc$(LIBEXT)
|
||||
|
||||
lib\libuc$(LIBEXT): libc\libuc$(LIBEXT)
|
||||
$(Q) install libc\libuc$(LIBEXT) lib\libuc$(LIBEXT)
|
||||
|
||||
libxx\libcxx$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C libxx TOPDIR="$(TOPDIR)" libcxx$(LIBEXT)
|
||||
|
||||
lib\libcxx$(LIBEXT): libxx\libcxx$(LIBEXT)
|
||||
$(Q) install libxx\libcxx$(LIBEXT) lib\libcxx$(LIBEXT)
|
||||
|
||||
mm\libmm$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C mm TOPDIR="$(TOPDIR)" libmm$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
lib\libmm$(LIBEXT): mm\libmm$(LIBEXT)
|
||||
$(Q) install mm\libmm$(LIBEXT) lib\libmm$(LIBEXT)
|
||||
|
||||
$(APPDIR)\libapps$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C $(APPDIR) TOPDIR="$(TOPDIR)" libapps$(LIBEXT)
|
||||
|
||||
lib\libapps$(LIBEXT): $(APPDIR)\libapps$(LIBEXT)
|
||||
$(Q) install $(APPDIR)\libapps$(LIBEXT) lib\libapps$(LIBEXT)
|
||||
|
||||
syscall\libproxies$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C syscall TOPDIR="$(TOPDIR)" libproxies$(LIBEXT)
|
||||
|
||||
lib\libproxies$(LIBEXT): syscall\libproxies$(LIBEXT)
|
||||
$(Q) install syscall\libproxies$(LIBEXT) lib\libproxies$(LIBEXT)
|
||||
|
||||
# Possible non-kernel builds
|
||||
|
||||
libc\libc$(LIBEXT): context
|
||||
$(Q) $(MAKE) -C libc TOPDIR="$(TOPDIR)" libc$(LIBEXT)
|
||||
|
||||
lib\libc$(LIBEXT): libc\libc$(LIBEXT)
|
||||
$(Q) install libc\libc$(LIBEXT) lib\libc$(LIBEXT)
|
||||
|
||||
# pass1 and pass2
|
||||
#
|
||||
# If the 2 pass build option is selected, then this pass1 target is
|
||||
# configured to built before the pass2 target. This pass1 target may, as an
|
||||
# example, build an extra link object (CONFIG_PASS1_OBJECT) which may be an
|
||||
# incremental (relative) link object, but could be a static library (archive);
|
||||
# some modification to this Makefile would be required if CONFIG_PASS1_OBJECT
|
||||
# is an archive. Exactly what is performed during pass1 or what it generates
|
||||
# is unknown to this makefule unless CONFIG_PASS1_OBJECT is defined.
|
||||
|
||||
pass1deps: pass1dep $(USERLIBS)
|
||||
|
||||
pass1: pass1deps
|
||||
ifeq ($(CONFIG_BUILD_2PASS),y)
|
||||
$(Q) if [ -z "$(CONFIG_PASS1_BUILDIR)" ]; then \
|
||||
echo "ERROR: CONFIG_PASS1_BUILDIR not defined"; \
|
||||
exit 1; \
|
||||
fi
|
||||
$(Q) if [ ! -d "$(CONFIG_PASS1_BUILDIR)" ]; then \
|
||||
echo "ERROR: CONFIG_PASS1_BUILDIR does not exist"; \
|
||||
exit 1; \
|
||||
fi
|
||||
$(Q) if [ ! -f "$(CONFIG_PASS1_BUILDIR)\Makefile" ]; then \
|
||||
echo "ERROR: No Makefile in CONFIG_PASS1_BUILDIR"; \
|
||||
exit 1; \
|
||||
fi
|
||||
$(Q) $(MAKE) -C $(CONFIG_PASS1_BUILDIR) TOPDIR="$(TOPDIR)" LINKLIBS="$(LINKLIBS)" USERLIBS="$(USERLIBS)" "$(CONFIG_PASS1_TARGET)"
|
||||
endif
|
||||
|
||||
pass2deps: pass2dep $(NUTTXLIBS)
|
||||
|
||||
pass2: pass2deps
|
||||
$(Q) $(MAKE) -C $(ARCH_SRC) TOPDIR="$(TOPDIR)" EXTRA_OBJS="$(EXTRA_OBJS)" LINKLIBS="$(LINKLIBS)" EXTRADEFINES=$(KDEFINE) $(BIN)
|
||||
ifeq ($(CONFIG_RRLOAD_BINARY),y)
|
||||
@echo "MK: $(BIN).rr"
|
||||
$(Q) $(TOPDIR)\tools\mkimage.sh --Prefix $(CROSSDEV) $(BIN) $(BIN).rr
|
||||
endif
|
||||
ifeq ($(CONFIG_INTELHEX_BINARY),y)
|
||||
@echo "CP: $(BIN).hex"
|
||||
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O ihex $(BIN) $(BIN).hex
|
||||
endif
|
||||
ifeq ($(CONFIG_MOTOROLA_SREC),y)
|
||||
@echo "CP: $(BIN).srec"
|
||||
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O srec $(BIN) $(BIN).srec
|
||||
endif
|
||||
ifeq ($(CONFIG_RAW_BINARY),y)
|
||||
@echo "CP: $(BIN).bin"
|
||||
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O binary $(BIN) $(BIN).bin
|
||||
endif
|
||||
|
||||
# $(BIN)
|
||||
#
|
||||
# Create the final NuttX executable in a two pass build process. In the
|
||||
# normal case, all pass1 and pass2 dependencies are created then pass1
|
||||
# and pass2 targets are built. However, in some cases, you may need to build
|
||||
# pass1 depenencies and pass1 first, then build pass2 dependencies and pass2.
|
||||
# in that case, execute 'make pass1 pass2' from the command line.
|
||||
|
||||
$(BIN): pass1deps pass2deps pass1 pass2
|
||||
|
||||
# download
|
||||
#
|
||||
# This is a helper target that will rebuild NuttX and download it to the target
|
||||
# system in one step. The operation of this target depends completely upon
|
||||
# implementation of the DOWNLOAD command in the user Make.defs file. It will
|
||||
# generate an error an error if the DOWNLOAD command is not defined.
|
||||
|
||||
download: $(BIN)
|
||||
$(call DOWNLOAD, $<)
|
||||
|
||||
# pass1dep: Create pass1 build dependencies
|
||||
# pass2dep: Create pass2 build dependencies
|
||||
|
||||
pass1dep: context tools\mkdeps$(HOSTEXEEXT)
|
||||
$(Q) for %%G in ($(USERDEPDIRS)) do ( $(MAKE) -C %%G TOPDIR="$(TOPDIR)" depend )
|
||||
|
||||
pass2dep: context tools\mkdeps$(HOSTEXEEXT)
|
||||
$(Q) for %%G in ($(KERNDEPDIRS)) do ( $(MAKE) -C %%G TOPDIR="$(TOPDIR)" EXTRADEFINES=$(KDEFINE) depend )
|
||||
|
||||
# Configuration targets
|
||||
#
|
||||
# These targets depend on the kconfig-frontends packages. To use these, you
|
||||
# must first download and install the kconfig-frontends package from this
|
||||
# location: http://ymorin.is-a-geek.org/projects/kconfig-frontends. See
|
||||
# misc\tools\README.txt for additional information.
|
||||
|
||||
config:
|
||||
$(Q) APPSDIR=${CONFIG_APPS_DIR} conf Kconfig
|
||||
|
||||
oldconfig:
|
||||
$(Q) APPSDIR=${CONFIG_APPS_DIR} conf --oldconfig Kconfig
|
||||
|
||||
menuconfig:
|
||||
$(Q) APPSDIR=${CONFIG_APPS_DIR} mconf Kconfig
|
||||
|
||||
# export
|
||||
#
|
||||
# The export target will package the NuttX libraries and header files into
|
||||
# an exportable package. Caveats: (1) These needs some extension for the KERNEL
|
||||
# build; it needs to receive USERLIBS and create a libuser.a). (2) The logic
|
||||
# in tools\mkexport.sh only supports GCC and, for example, explicitly assumes
|
||||
# that the archiver is 'ar'
|
||||
|
||||
export: pass2deps
|
||||
$(Q) tools\mkexport.sh -w$(WINTOOL) -t "$(TOPDIR)" -l "$(NUTTXLIBS)"
|
||||
|
||||
# General housekeeping targets: dependencies, cleaning, etc.
|
||||
#
|
||||
# depend: Create both PASS1 and PASS2 dependencies
|
||||
# clean: Removes derived object files, archives, executables, and
|
||||
# temporary files, but retains the configuration and context
|
||||
# files and directories.
|
||||
# distclean: Does 'clean' then also removes all configuration and context
|
||||
# files. This essentially restores the directory structure
|
||||
# to its original, unconfigured stated.
|
||||
|
||||
depend: pass1dep pass2dep
|
||||
|
||||
subdir_clean:
|
||||
$(Q) for %%G in ($(CLEANDIRS)) do ( if exist %%G\Makefile $(MAKE) -C %%G TOPDIR="$(TOPDIR)" clean )
|
||||
$(Q) $(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" clean
|
||||
$(Q) $(MAKE) -C mm -f Makefile.test TOPDIR="$(TOPDIR)" clean
|
||||
ifeq ($(CONFIG_BUILD_2PASS),y)
|
||||
$(Q) $(MAKE) -C $(CONFIG_PASS1_BUILDIR) TOPDIR="$(TOPDIR)" clean
|
||||
endif
|
||||
|
||||
clean: subdir_clean
|
||||
$(call DELFILE, $(BIN))
|
||||
$(call DELFILE, nuttx.*)
|
||||
$(call DELFILE, mm_test)
|
||||
$(call DELFILE, *.map)
|
||||
$(call DELFILE, _SAVED_APPS_config)
|
||||
$(call DELFILE, nuttx-export*)
|
||||
$(call CLEAN)
|
||||
|
||||
subdir_distclean:
|
||||
$(Q) for %%G in ($(CLEANDIRS)) do ( if exist %%G\Makefile $(MAKE) -C %%G TOPDIR="$(TOPDIR)" distclean )
|
||||
|
||||
distclean: clean subdir_distclean clean_context
|
||||
ifeq ($(CONFIG_BUILD_2PASS),y)
|
||||
$(Q) $(MAKE) -C $(CONFIG_PASS1_BUILDIR) TOPDIR="$(TOPDIR)" distclean
|
||||
endif
|
||||
$(call DELFILE, Make.defs)
|
||||
$(call DELFILE, setenv.sh)
|
||||
$(call DELFILE, setenv.bat)
|
||||
$(call DELFILE, .config)
|
||||
$(call DELFILE, .config.old)
|
||||
|
||||
# Application housekeeping targets. The APPDIR variable refers to the user
|
||||
# application directory. A sample apps\ directory is included with NuttX,
|
||||
# however, this is not treated as part of NuttX and may be replaced with a
|
||||
# different application directory. For the most part, the application
|
||||
# directory is treated like any other build directory in this script. However,
|
||||
# as a convenience, the following targets are included to support housekeeping
|
||||
# functions in the user application directory from the NuttX build directory.
|
||||
#
|
||||
# apps_clean: Perform the clean operation only in the user application
|
||||
# directory
|
||||
# apps_distclean: Perform the distclean operation only in the user application
|
||||
# directory. Note that the apps\.config file (inf any) is
|
||||
# preserved so that this is not a "full" distclean but more of a
|
||||
# configuration "reset." (There willnot be an apps\.config
|
||||
# file if the configuration was generated via make menuconfig).
|
||||
|
||||
apps_clean:
|
||||
ifneq ($(APPDIR),)
|
||||
$(Q) $(MAKE) -C "$(TOPDIR)\$(APPDIR)" TOPDIR="$(TOPDIR)" clean
|
||||
endif
|
||||
|
||||
apps_distclean:
|
||||
ifneq ($(APPDIR),)
|
||||
$(call DELFILE, _SAVED_APPS_config
|
||||
$(Q) if exist "$(TOPDIR)\$(APPDIR)\.config" ( cp "$(TOPDIR)\$(APPDIR)\.config" _SAVED_APPS_config )
|
||||
$(Q) $(MAKE) -C "$(TOPDIR)\$(APPDIR)" TOPDIR="$(TOPDIR)" distclean
|
||||
$(Q) if exist _SAVED_APPS_config ( mv _SAVED_APPS_config "$(TOPDIR)\$(APPDIR)\.config" )
|
||||
endif
|
||||
|
163
nuttx/README.txt
163
nuttx/README.txt
|
@ -18,6 +18,8 @@ README
|
|||
- Building
|
||||
- Re-building
|
||||
- Build Targets and Options
|
||||
- Native Windows Build
|
||||
- Installing GNUWin32
|
||||
o Cygwin Build Problems
|
||||
- Strange Path Problems
|
||||
- Window Native Toolchain Issues
|
||||
|
@ -154,9 +156,15 @@ Notes about Header Files
|
|||
|
||||
Even though you should not use a foreign C-Library, you may still need
|
||||
to use other, external libraries with NuttX. In particular, you may
|
||||
need to use the math library, libm.a. The math libary header file,
|
||||
math.h, is a special case. If you do nothing, the standard math.h
|
||||
header file that is provided with your toolchain will be used.
|
||||
need to use the math library, libm.a. NuttX supports a generic, built-in
|
||||
math library that can be enabled using CONFIG_LIBM=y. However, you may
|
||||
still want to use a higher performance external math library that has
|
||||
been tuned for your CPU. Sometimes such such tuned math libraries are
|
||||
bundled with your toolchain.
|
||||
|
||||
The math libary header file, math.h, is a then special case. If you do
|
||||
nothing, the standard math.h header file that is provided with your
|
||||
toolchain will be used.
|
||||
|
||||
If you have a custom, architecture specific math.h header file, then
|
||||
that header file should be placed at arch/<cpu>/include/math.h. There
|
||||
|
@ -171,6 +179,16 @@ Notes about Header Files
|
|||
than to include that archicture-specific math.h header file as the
|
||||
system math.h header file.
|
||||
|
||||
float.h
|
||||
|
||||
If you enable the generic, built-in math library, then that math library
|
||||
will expect your toolchain to provide the standard float.h header file.
|
||||
The float.h header file defines the properties of your floating point
|
||||
implementation. It would always be best to use your toolchain's float.h
|
||||
header file but if none is avaiable, a default float.h header file will
|
||||
provided if this option is selected. However, there is no assurance that
|
||||
the settings in this float.h are actually correct for your platform!
|
||||
|
||||
stdarg.h
|
||||
|
||||
In most cases, the correct version of stdarg.h is the version provided with your toolchain. However, sometimes there are issues with with using your toolchains stdarg.h. For example, it may attempt to draw in header files that do not exist in NuttX or perhaps the header files that is uses are not compatible with the NuttX header files. In those cases, you can use an architecture-specific stdarg.h header file by defining CONFIG_ARCH_STDARG_H=y.
|
||||
|
@ -189,7 +207,8 @@ Instantiating "Canned" Configurations
|
|||
|
||||
Where <board-name> is the name of your development board and <config-dir>.
|
||||
Configuring NuttX requires only copying three files from the <config-dir>
|
||||
to the directly where you installed NuttX (TOPDIR):
|
||||
to the directory where you installed NuttX (TOPDIR) (and sometimes one
|
||||
additional file to the directory the NuttX application package (APPSDIR)):
|
||||
|
||||
Copy configs/<board-name>/<config-dir>/Make.def to ${TOPDIR}/Make.defs
|
||||
|
||||
|
@ -211,6 +230,14 @@ to the directly where you installed NuttX (TOPDIR):
|
|||
included in the build and what is not. This file is also used
|
||||
to generate a C configuration header at include/nuttx/config.h.
|
||||
|
||||
Copy configs/<board-name>/<config-dir>/appconfig to ${APPSDIR}/.config
|
||||
|
||||
The appconfig file describes the applications that need to be
|
||||
built in the appliction directory (APPSDIR). Not all configurations
|
||||
have an appconfig file. This file is deprecated and will not be
|
||||
used with new defconfig files produced with the mconf configuration
|
||||
tool.
|
||||
|
||||
General information about configuring NuttX can be found in:
|
||||
|
||||
${TOPDIR}/configs/README.txt
|
||||
|
@ -468,6 +495,97 @@ Build Targets and Options
|
|||
useful when adding new boards or tracking down compile time errors and
|
||||
warnings (Contributed by Richard Cochran).
|
||||
|
||||
Native Windows Build
|
||||
--------------------
|
||||
|
||||
The beginnings of a Windows native build are in place but still not full
|
||||
usable as of this writing. The windows native build logic initiatiated
|
||||
if CONFIG_WINDOWS_NATIVE=y is defined in the NuttX configuration file:
|
||||
|
||||
This build:
|
||||
|
||||
- Uses all Windows style paths
|
||||
- Uses primarily Windows batch commands from cmd.exe, with
|
||||
- A few extensions from GNUWin32
|
||||
|
||||
In this build, you cannot use a Cygwin or MSYS shell. Rather the build must
|
||||
be performed in a Windows CMD shell. Here is a better shell than than the
|
||||
standard issue, CMD shell: ConEmu which can be downloaded from:
|
||||
http://code.google.com/p/conemu-maximus5/
|
||||
|
||||
Build Tools. The build still relies on some Unix-like commands. I use
|
||||
the GNUWin32 tools that can be downloaded from http://gnuwin32.sourceforge.net/.
|
||||
|
||||
Host Compiler: I use the MingGW compiler which can be downloaded from
|
||||
http://www.mingw.org/. If you are using GNUWin32, then it is recommended
|
||||
the you not install the optional MSYS components as there may be conflicts.
|
||||
|
||||
Installing GNUWin32
|
||||
-------------------
|
||||
|
||||
The Windows native build will depend upon a few Unix-like tools that can be
|
||||
provided either by MSYS or GNUWin32. The GNUWin32 are available from
|
||||
http://gnuwin32.sourceforge.net/. GNUWin32 provides ports of tools with a
|
||||
GPL or similar open source license to modern MS-Windows (Microsoft Windows
|
||||
2000 / XP / 2003 / Vista / 2008 / 7). See
|
||||
http://gnuwin32.sourceforge.net/packages.html for a list of all of the tools
|
||||
available in the GNUWin32 package.
|
||||
|
||||
The SourceForge project is located here:
|
||||
http://sourceforge.net/projects/gnuwin32/. The project is still being
|
||||
actively supported (although some of the Windows ports have gotten very old).
|
||||
|
||||
Some commercial toolchains include a subset of the GNUWin32 tools in the
|
||||
installation. My recommendation is that you download the GNUWin32 tools
|
||||
directly from the sourceforge.net website so that you will know what you are
|
||||
using and can reproduce your build environment.
|
||||
|
||||
GNUWin32 Installation Steps:
|
||||
|
||||
The following steps will download and execute the GNUWin32 installer.
|
||||
|
||||
1. Download GetGNUWin32-x.x.x.exe from
|
||||
http://sourceforge.net/projects/getgnuwin32/files/. This is the
|
||||
installer. The current version as of this writing is 0.6.3.
|
||||
|
||||
2. Run the installer.
|
||||
|
||||
3. Accept the license.
|
||||
|
||||
4. Select the installation directory. My recommendation is the
|
||||
directory that contains this README file (<this-directory>).
|
||||
|
||||
5. After running GetGNUWin32-0.x.x.exe, you will have a new directory
|
||||
<this-directory>/GetGNUWin32
|
||||
|
||||
Note the the GNUWin32 installer didn't install GNUWin32. Instead, it
|
||||
installed another, smarter downloader. That downloader is the GNUWin32
|
||||
package management tool developed by the Open SSL project.
|
||||
|
||||
The following steps probably should be performed from inside a DOS shell.
|
||||
|
||||
6. Change to the directory created by GetGNUWin32-x.x.x.exe
|
||||
|
||||
cd GetGNUWin32
|
||||
|
||||
7. Execute the download.bat script. The download.bat script will download
|
||||
about 446 packages! Enough to have a very complete Linux-like environment
|
||||
under the DOS shell. This will take awhile. This step only downloads
|
||||
the packages and the next step will install the packages.
|
||||
|
||||
download
|
||||
|
||||
8. This step will install the downloaded packages. The argument of the
|
||||
install.bat script is the installation location. C:\gnuwin32 is the
|
||||
standard install location:
|
||||
|
||||
install C:\gnuwin32
|
||||
|
||||
NOTE: This installation step will install *all* GNUWin32 packages... far
|
||||
more than you will ever need. If disc space is a problem for you, you might
|
||||
need to perform a manual installation of the individual ZIP files that you
|
||||
will find in the <this directory>/GetGNUWin32/packages directory.
|
||||
|
||||
CYGWIN BUILD PROBLEMS
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
@ -523,18 +641,16 @@ Window Native Toolchain Issues
|
|||
is not a long as you might think because there is no dependency checking
|
||||
if you are using a native Windows toolchain. That bring us to #3:
|
||||
|
||||
3. Dependencies are not made when using Windows versions of the GCC. This is
|
||||
because the dependencies are generated using Windows pathes which do not
|
||||
work with the Cygwin make.
|
||||
3. Dependencies are not made when using Windows versions of the GCC on a POSIX
|
||||
platform (i.e., Cygwin). This is because the dependencies are generated
|
||||
using Windows paths which do not work with the Cygwin make.
|
||||
|
||||
Support has been added for making dependencies with the windows-native toolchains.
|
||||
That support can be enabled by modifying your Make.defs file as follows:
|
||||
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
|
||||
|
||||
- MKDEP = $(TOPDIR)/tools/mknulldeps.sh
|
||||
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
|
||||
If you are building natively on Windows, then no such conflict exists
|
||||
and the best selection is:
|
||||
|
||||
If you have problems with the dependency build (for example, if you are not
|
||||
building on C:), then you may need to modify tools/mkdeps.sh
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps.exe
|
||||
|
||||
General Pre-built Toolchain Issues
|
||||
|
||||
|
@ -629,7 +745,8 @@ nuttx
|
|||
| | `-README.txt
|
||||
| `- z80/
|
||||
| | `- src/
|
||||
| | `- z80/README.txt
|
||||
| | |- z80/README.txt
|
||||
| | `- z180/README.txt, z180_mmu.txt
|
||||
| `- README.txt
|
||||
|- configs/
|
||||
| |- amber/
|
||||
|
@ -728,6 +845,8 @@ nuttx
|
|||
| | |- include/README.txt
|
||||
| | |- src/README.txt
|
||||
| | `- README.txt
|
||||
| |- p112/
|
||||
| | `- README.txt
|
||||
| |- pcblogic-pic32mx/
|
||||
| | `- README.txt
|
||||
| |- pic32-starterkit/
|
||||
|
@ -765,6 +884,8 @@ nuttx
|
|||
| | `- README.txt
|
||||
| |- stm3240g-eval/
|
||||
| | `- README.txt
|
||||
| |- stm32f100rc_generic/
|
||||
| | `- README.txt
|
||||
| |- stm32f4discovery/
|
||||
| | `- README.txt
|
||||
| |- sure-pic32mx/
|
||||
|
@ -817,6 +938,8 @@ nuttx
|
|||
| `- README.txt
|
||||
|- lib/
|
||||
| `- README.txt
|
||||
|- libc/
|
||||
| `- README.txt
|
||||
|- libxx/
|
||||
| `- README.txt
|
||||
|- mm/
|
||||
|
@ -828,6 +951,7 @@ nuttx
|
|||
|
||||
apps
|
||||
|- examples/
|
||||
| |- json/README.txt
|
||||
| |- pashello/README.txt
|
||||
| `- README.txt
|
||||
|- graphics/
|
||||
|
@ -843,6 +967,8 @@ apps
|
|||
| | `- README.txt
|
||||
| |- ftpc
|
||||
| | `- README.txt
|
||||
| |- json
|
||||
| | `- README.txt
|
||||
| |- telnetd
|
||||
| | `- README.txt
|
||||
| `- README.txt
|
||||
|
@ -864,3 +990,12 @@ apps
|
|||
| `- sysinfo
|
||||
| `- README.txt
|
||||
`- README.txt
|
||||
|
||||
NxWidgets
|
||||
|- Doxygen
|
||||
| `- README.txt
|
||||
|- tools
|
||||
| `- README.txt
|
||||
|- UnitTests
|
||||
| `- README.txt
|
||||
`- README.txt
|
||||
|
|
|
@ -3171,3 +3171,272 @@ Bugfixes (see the change log for details). Some of these are very important
|
|||
Vainish). Fix some field-width handling issues in sscanf()
|
||||
|
||||
As well as other, less critical bugs (see the ChangeLog for details)
|
||||
|
||||
NuttX-6.23
|
||||
^^^^^^^^^^
|
||||
|
||||
The 90th release of NuttX, Version 6.23, was made on November 5, 2012,
|
||||
and is available for download from the SourceForge website. Note
|
||||
that release consists of two tarballs: nuttx-6.23.tar.gz and
|
||||
apps-6.23.tar.gz. Both may be needed (see the top-level nuttx/README.txt
|
||||
file for build information).
|
||||
|
||||
This release corresponds with SVN release number: r5313
|
||||
|
||||
Note that all SVN information has been stripped from the tarballs. If you
|
||||
need the SVN configuration, you should check out directly from SVN. Revision
|
||||
r5313 should equivalent to release 6.23 of NuttX 6.23:
|
||||
|
||||
svn checkout -r5313 svn://svn.code.sf.net/p/nuttx/code/trunk nuttx-code
|
||||
|
||||
Or
|
||||
|
||||
svn checkout -r5313 http://svn.code.sf.net/p/nuttx/code/trunk nuttx-code
|
||||
|
||||
Additional new features and extended functionality:
|
||||
|
||||
* RTOS: If both atexit() and on_exit() are enabled, use on_exit() to
|
||||
implement atexit(). Updates for RGMP 4.0.
|
||||
|
||||
* Binfmt: Add support for loading and executing ELF binary modules from
|
||||
a file system.
|
||||
|
||||
* Drivers: Maxim MAX11802 touchscreen controller (Petteri Aimonen)
|
||||
|
||||
* STM32 Driver: Implementation of /dev/random using the STM32 Random Number
|
||||
Generator (RNG).
|
||||
|
||||
* STM32 Boards: ADC support for the Shenzhou IV board. Relay support for
|
||||
the Shenzhou IV board.
|
||||
|
||||
* C Library: Support is now included for the add-on uClibc++ C++
|
||||
standard library support. This includes support for iostreams, strings,
|
||||
STL, RTTI, exceptions -- the complete C++ environment. (uClibc++ is
|
||||
provided as a separate add-on package due to licensing issues).
|
||||
|
||||
Optimized generic and ARM-specific memcpy() function. Optimized
|
||||
memset() function.
|
||||
|
||||
Add support for ferror(), feof(), and clearerror(). Add support for
|
||||
__cxa_atexit().
|
||||
|
||||
Math Library: Port of the math library from Rhombus OS by Nick Johnson
|
||||
(Darcy Gong).
|
||||
|
||||
* Applications: New NSH commands: ifup, ifdown, urlencode, urldecode,
|
||||
base64enc, bas64dec, md5 (Darcy Gong). Add support for NSH telnet login
|
||||
(Darcy Gong). Enancements to NSH ping command to support pinging hosts
|
||||
with very long round-trip times. Extensions to the ifconfig command
|
||||
Darcy Gong),
|
||||
|
||||
Many extensions to the webclient/wget and DNS resolver logic from Darcy
|
||||
Gong. JSON, Base64, URL encoding, and MD5 libraries contributed by Darcy
|
||||
Gong.
|
||||
|
||||
New examples: ELF loader, JSON, wgetjson, cxxtest, relays.
|
||||
|
||||
Bugfixes (see the change log for details). Some of these are very important
|
||||
(marked *critical*):
|
||||
|
||||
* Drivers: W25 SPI FLASH
|
||||
|
||||
* STM32 Drivers: ADC reset
|
||||
|
||||
* Graphics: Missing implementation of the blocked method (*critical*,
|
||||
Petteri Aimonen).
|
||||
|
||||
* C Library: Floating point numbers in printf and related formatting functions
|
||||
(Mike Smith), cf[get|set]speed() (Mike Smith)
|
||||
|
||||
As well as other, less critical bugs (see the ChangeLog for details)
|
||||
|
||||
NuttX-6.24
|
||||
^^^^^^^^^^
|
||||
|
||||
The 91st release of NuttX, Version 6.24, was made on December 20, 2012,
|
||||
and is available for download from the SourceForge website. Note
|
||||
that release consists of two tarballs: nuttx-6.24.tar.gz and
|
||||
apps-6.24.tar.gz. Both may be needed (see the top-level nuttx/README.txt
|
||||
file for build information).
|
||||
|
||||
This release corresponds with SVN release number: r5447
|
||||
|
||||
Note that all SVN information has been stripped from the tarballs. If you
|
||||
need the SVN configuration information, you should check out directly from
|
||||
SVN. Revision r5447 should equivalent to release 6.24 of NuttX 6.24:
|
||||
|
||||
svn checkout -r5447 svn://svn.code.sf.net/p/nuttx/code/trunk nuttx-code
|
||||
|
||||
Or (HTTP):
|
||||
|
||||
svn checkout -r5447 http://svn.code.sf.net/p/nuttx/code/trunk nuttx-code
|
||||
|
||||
Additional new features and extended functionality:
|
||||
|
||||
* RTOS:
|
||||
|
||||
- Implemented the POSIX pause() function (still has some compiance
|
||||
issues).
|
||||
- Tasking logic is extended to support the notion of address
|
||||
environments. An address environment is the key notion underlying
|
||||
"process" vs. tasks. If tasks are created with address environments
|
||||
(by binfmt), the OS will propogate that environment to child threads
|
||||
and will destroy the address environment when the "process" exists.
|
||||
- If support for the PATH variable is enabled, the OS start up logic
|
||||
will create an initial environment containing the default PATH
|
||||
setting (CONFIG_PATH_INITIAL). This initial PATH will then be
|
||||
inherited by all tasks.
|
||||
|
||||
* Binfmt
|
||||
|
||||
- The NuttX binary loaders have been updated to support the PATH
|
||||
environment variable. Now, if the PATH is properly defined, programs
|
||||
can be executed from mass storage using only the file name. This
|
||||
feature is added to support more standard behavior (eventually, NSH
|
||||
will support execution of programs in file systems by just entering
|
||||
the file name, perhaps in 6.25?).
|
||||
- The NXFLAT and ELF binary loaders have been extended to create
|
||||
address environments for any new tasks executed from the file system.
|
||||
This feature requires that the architecture support a memory management
|
||||
unit (MMU) and the address environment interfaces declared in
|
||||
include/nuttx/arch.h (currently, this is only supported by the z180).
|
||||
|
||||
* Drivers: LCD driver for the Univision UG-2864AMBAG01 OLED
|
||||
|
||||
* STM32: Support for STM32F100 high density chips contributed by Freddie
|
||||
Chopin.
|
||||
|
||||
* STM32 Drivers: Added optional RS-485 direction bit control (from
|
||||
Freddie Chopin).
|
||||
|
||||
* STM32 Boards:
|
||||
|
||||
- Support for generic STM32F100RC board contributed by Freddie Chopin.
|
||||
- stm32f4discovery/nxlines: STM32F4Discovery support for the
|
||||
UG-2864AMBAG01 OLED.
|
||||
- stm32f4discovery/winbuild: A version of the NuttX OS test
|
||||
configured to build natively on Windows.
|
||||
- stm32f4discovery/elf: Now uses the PATH variable to find ELF
|
||||
executables.
|
||||
- configs/cloudctrl: Added for Darcy Gong's CloudController board
|
||||
|
||||
* PIC32 Boards: Update the Mirtool configuration for Release 2 of the
|
||||
Mirtoo module.
|
||||
|
||||
* Calypso: Add Calypso keypad driver. From Denis Cariki.
|
||||
|
||||
* ZiLOG:
|
||||
|
||||
- Add support for the z180 chip family and, specifically, for
|
||||
the P112 retro hardware (see http://p112.feedle.net/).
|
||||
- All ZiLOG configurations updated to use the current ZDS-II
|
||||
and/or SDCC toolchains.
|
||||
|
||||
* Graphics:
|
||||
|
||||
- Add a semaphore handshake so that operations on buffers from
|
||||
the NXMU client will be blocked until the NX server operates on the
|
||||
buffer data (from Petteri Aimonen).
|
||||
- nxtk_subwindowmove() and nxtk_getwindow(): Improvements to clipping
|
||||
logic from Petteri Aimonen.
|
||||
|
||||
* C Library: lib/ sub-directory renamed libc/ (there is a new lib/ sub-
|
||||
directory that is used to hold all archives).
|
||||
|
||||
* C++: Exception stubs from Petteri Aimonen.
|
||||
|
||||
* Applications:
|
||||
|
||||
- Add NSH hexdump command to dump the contents of a file (or character
|
||||
device) to the console (contributed by Petteri Aimonen).
|
||||
- Extend the NSH ifconfig command plus various DHCPC improvements
|
||||
(from Darcy Gong).
|
||||
|
||||
* apps/examples:
|
||||
|
||||
- ostest: Replace large tables with algorithmic prime number
|
||||
generation. This allows the roundrobin test to run on platforms
|
||||
with minimal SRAM (Freddie Chopin).
|
||||
- keypadtest: A new keypad test example contributed by Denis Carikli.
|
||||
- elf and nxflat: If CONFIG_BINFMT_EXEPATH is defined, these examples
|
||||
will now use a relative path to the program and expect the binfmt/
|
||||
logic to find the absolute path to the program using the PATH
|
||||
variable.
|
||||
|
||||
* Build system:
|
||||
|
||||
- New top-level Makefiles: Makefile.unix and Makefile.win (along with
|
||||
numerous changes to other make-related files). This adds basic
|
||||
support for building NuttX natively under Windows from a CMD.exe
|
||||
window (rather than in a POSIX-like environment). This build: (1)
|
||||
Uses all Windows style paths, (2) Uses primarily Windows batch
|
||||
commands from cmd.exe, with (3) a few extensions from GNUWin32.
|
||||
|
||||
This capability should still be considered a work in progress
|
||||
because: (1) it has not been verfied on all targets and tools,
|
||||
and (2) still lacks some of the creature-comforts of the more
|
||||
mature environments (like a function configure.sh script and
|
||||
'make menuconfig' support).
|
||||
|
||||
- Example Windows native builds for STM32F4Discovery, eZ80, z16f, z8,
|
||||
Z80, and Z180.
|
||||
- Several configurations have been converted to work the kconfig-
|
||||
frontends mconf configuration tool: stm32f4discovery/nxlines, and
|
||||
all eZ80, z16f, z8, Z80, and Z180 configurations.
|
||||
- Architectures now include a common Toolchain.defs file that can be
|
||||
used to manage toolchains in a more configurable way (most of this
|
||||
contributed by Mike Smith).
|
||||
|
||||
* Build tools:
|
||||
|
||||
- Renamed tools/winlink.sh to tools/copydir.sh.
|
||||
- Several new tools/scripts to support the Windows native build:
|
||||
tools/mkdeps.bat, tools/mkdeps.c, tools/link.bat, unlink.bat, and
|
||||
copydir.bat.
|
||||
- tools/incdir.sh and incdir.bat now support an -s option to generate
|
||||
system header file paths.
|
||||
- tools/b16.c: Fixed precision math conversion utility.
|
||||
|
||||
Bugfixes (see the change log for details). Some of these are very important
|
||||
(marked *critical*):
|
||||
|
||||
* RTOS: Fix some backward conditional compilation in the work queue
|
||||
logic (Freddie Chopin).
|
||||
|
||||
* File System: Uninitialized variable caused assertions (from Lorenz
|
||||
Meier).
|
||||
|
||||
* Drivers: Partial fix for STM32 OTGFS device drivers and fix for short,
|
||||
unaligned writes in the flash translation layer (drivers/mtd/ftl.c),
|
||||
both from Petteri Aimonen.
|
||||
|
||||
* STM32 Drivers:
|
||||
|
||||
- Qencoder driver and TIM3 driver fixes from Ryan Sundberg.
|
||||
- Fix timeout delay calculation in the STM32 OTG FS host driver.
|
||||
|
||||
* LPC17xx Drivers: Resources not being properly released when I2C
|
||||
driver is un-initialized.
|
||||
|
||||
* Graphics:
|
||||
|
||||
- Fix logic when the mouse drags outside of the window; fix
|
||||
another "blocked message" handling case (both from Petteri Aimonen).
|
||||
- nxtk_filltrapwindow(): Correct an offset problem (also from Peterri
|
||||
Aimonen).
|
||||
- nxglib_splitline(): Correct the "fat flat line" bug.
|
||||
|
||||
* C Library:
|
||||
|
||||
- nrand() changes to prevent coefficients from becoming zero which
|
||||
would "lock up" the random number generate.
|
||||
- Add rounding functions to the math library (contributed by Petteri
|
||||
Aimonen).
|
||||
|
||||
* Build system: Changes to MIN definitions in all limit.h header files
|
||||
to avoid integer overflows. For example from (-128) to (-127 - 1)
|
||||
(from Petteri Aimonen).
|
||||
|
||||
* Applications: Modbus fixes from Freddie Chopin.
|
||||
|
||||
As well as other, less critical bugs (see the ChangeLog for details)
|
||||
|
|
152
nuttx/TODO
152
nuttx/TODO
|
@ -1,4 +1,4 @@
|
|||
NuttX TODO List (Last updated September 16, 2012)
|
||||
NuttX TODO List (Last updated November 25, 2012)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This file summarizes known NuttX bugs, limitations, inconsistencies with
|
||||
|
@ -14,13 +14,13 @@ nuttx/
|
|||
(2) C++ Support
|
||||
(6) Binary loaders (binfmt/)
|
||||
(17) Network (net/, drivers/net)
|
||||
(3) USB (drivers/usbdev, drivers/usbhost)
|
||||
(11) Libraries (lib/)
|
||||
(4) USB (drivers/usbdev, drivers/usbhost)
|
||||
(11) Libraries (libc/, )
|
||||
(9) File system/Generic drivers (fs/, drivers/)
|
||||
(5) Graphics subystem (graphics/)
|
||||
(1) Pascal add-on (pcode/)
|
||||
(1) Documentation (Documentation/)
|
||||
(6) Build system / Toolchains
|
||||
(8) Build system / Toolchains
|
||||
(5) Linux/Cywgin simulation (arch/sim)
|
||||
(6) ARM (arch/arm/)
|
||||
(1) ARM/C5471 (arch/arm/src/c5471/)
|
||||
|
@ -32,15 +32,15 @@ nuttx/
|
|||
(0) ARM/LPC43x (arch/arm/src/lpc43xx/)
|
||||
(3) ARM/STR71x (arch/arm/src/str71x/)
|
||||
(3) ARM/LM3S6918 (arch/arm/src/lm3s/)
|
||||
(7) ARM/STM32 (arch/arm/src/stm32/)
|
||||
(4) ARM/STM32 (arch/arm/src/stm32/)
|
||||
(3) AVR (arch/avr)
|
||||
(0) Intel x86 (arch/x86)
|
||||
(4) 8051 / MCS51 (arch/8051/)
|
||||
(5) 8051 / MCS51 (arch/8051/)
|
||||
(3) MIPS/PIC32 (arch/mips)
|
||||
(1) Hitachi/Renesas SH-1 (arch/sh/src/sh1)
|
||||
(4) Renesas M16C/26 (arch/sh/src/m16c)
|
||||
(10) z80/z8/ez80 (arch/z80/)
|
||||
(8) z16 (arch/z16/)
|
||||
(9) z16 (arch/z16/)
|
||||
(1) mc68hc1x (arch/hc)
|
||||
|
||||
apps/
|
||||
|
@ -421,7 +421,7 @@ o Binary loaders (binfmt/)
|
|||
.word .LC3-(.LPIC4+4)
|
||||
.word .LC4-(.LPIC5+4)
|
||||
|
||||
This is good and bad. This is good because it means that .rodata.str1.1 can not
|
||||
This is good and bad. This is good because it means that .rodata.str1.1 can now
|
||||
reside in FLASH with .text and can be accessed using PC-relative addressing.
|
||||
That can be accomplished by simply moving the .rodata from the .data section to
|
||||
the .text section in the linker script. (The NXFLAT linker script is located at
|
||||
|
@ -629,8 +629,13 @@ o USB (drivers/usbdev, drivers/usbhost)
|
|||
CDC/ACM serial driver might need the line coding data (that
|
||||
data is not used currenly, but it might be).
|
||||
|
||||
o Libraries (lib/)
|
||||
^^^^^^^^^^^^^^^^
|
||||
Title: USB HUB SUPPORT
|
||||
Description: Add support for USB hubs
|
||||
Status: Open
|
||||
Priority: Low/Unknown. This is a feature enhancement.
|
||||
|
||||
o Libraries (libc/)
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
Title: ENVIRON
|
||||
Description: The definition of environ in stdlib.h is bogus and will not
|
||||
|
@ -643,7 +648,7 @@ o Libraries (lib/)
|
|||
Description: Need some minimal termios support... at a minimum, enough to
|
||||
switch between raw and "normal" modes to support behavior like
|
||||
that needed for readline().
|
||||
UPDATE: There is growing functionality in lib/termios/ and in the
|
||||
UPDATE: There is growing functionality in libc/termios/ and in the
|
||||
ioctl methods of several MCU serial drivers (stm32, lpc43, lpc17,
|
||||
pic32). However, as phrased, this bug cannot yet be closed since
|
||||
this "growing functionality" does not address all termios.h
|
||||
|
@ -708,7 +713,7 @@ o Libraries (lib/)
|
|||
Priority:
|
||||
|
||||
Title: OLD dtoa NEEDS TO BE UPDATED
|
||||
Description: This implementation of dtoa in lib/stdio is old and will not
|
||||
Description: This implementation of dtoa in libc/stdio is old and will not
|
||||
work with some newer compilers. See
|
||||
http://patrakov.blogspot.com/2009/03/dont-use-old-dtoac.html
|
||||
Status: Open
|
||||
|
@ -716,7 +721,7 @@ o Libraries (lib/)
|
|||
|
||||
Title: SYSLOG INTEGRATION
|
||||
Description: There are the beginnings of some system logging capabilities (see
|
||||
drivers/syslog, fs/fs_syslog.c, and lib/stdio/lib_librawprintf.c and
|
||||
drivers/syslog, fs/fs_syslog.c, and libc/stdio/lib_librawprintf.c and
|
||||
lib_liblowprintf.c. For NuttX, SYSLOG is a concept and includes,
|
||||
extends, and replaces the legacy NuttX debug ouput. Some additional
|
||||
integration is required to formalized this. For example:
|
||||
|
@ -890,23 +895,30 @@ o Build system
|
|||
Description: Need a NuttX configuration tool. The number of configuration
|
||||
settings has become quite large and difficult to manage manually.
|
||||
Update: This task is essentially completed. But probably not for
|
||||
all platforms and all features. When do we know that the the
|
||||
features is complete and that we can switch to exclusive use of
|
||||
the tool?
|
||||
all platforms and all features. When do we know that the feature
|
||||
is complete and that we can switch to exclusive use of the tool?
|
||||
Status: Open
|
||||
Priority: Medium-low
|
||||
|
||||
Title: NATIVE WINDOWS BUILD
|
||||
Description: At present, NuttX builds only under Linux or Cygwin.
|
||||
Investigate the possibility of a native Windows build using
|
||||
something like the GNUWin32 tools (coreutils+make+grep+sed+uname).
|
||||
Description: This effort is underway using MinGW-GCC and GNUWin32 tools
|
||||
for (coreutils+make+grep+sed+uname). Current status:
|
||||
|
||||
1. configs/stm32f4discovery/winbuild - builds okay natively
|
||||
2. configs/ez80f910200kitg - Can be reconfigured to build natively.
|
||||
Requires some manual intervention to get a clean build.
|
||||
See configs/ez80f910200kitg/README.txt.
|
||||
|
||||
Status: Open
|
||||
Priority: Low
|
||||
|
||||
Title: WINDOWS DEPENDENCY GENERATION
|
||||
Description: Dependency generation is currently disabled when a Windows native
|
||||
toolchain is used. I think that the only issue is that all of the
|
||||
Windows dependencies needed to be quoted in the Make.dep files.
|
||||
toolchain is used in a POSIX-like enviornment (like Cygwin). The
|
||||
issue is that the Windows tool generates dependencies use Windows
|
||||
path formatting and this fails with the dependency file (Make.dep)
|
||||
is include). Perhaps the only issue is that all of the Windows
|
||||
dependencies needed to be quoted in the Make.dep files.
|
||||
Status: Open
|
||||
Priority: Low -- unless some dependency-related build issues is discovered.
|
||||
|
||||
|
@ -953,7 +965,7 @@ o Build system
|
|||
built configuration, only the multiple user mode can be supported
|
||||
with the NX server residing inside of the kernel space. In
|
||||
this case, most of the user end functions in graphics/nxmu
|
||||
must be moved to lib/nx and those functions must be built into
|
||||
must be moved to libc/nx and those functions must be built into
|
||||
libuser.a to be linked with the user-space code.
|
||||
A similar issue exists in NSH that uses some internal OS
|
||||
interfaces that would not be available in a kernel build
|
||||
|
@ -962,6 +974,48 @@ o Build system
|
|||
Priority: Low -- the kernel build configuration is not fully fielded
|
||||
yet.
|
||||
|
||||
Title: mconf NOT AVAILABLE IN NATIVE WINDOWS BUILD
|
||||
Description: NuttX is migrating to the use of the kconfig-frontends mconf
|
||||
tool for all configurations. In NuttX 6.24, support for native
|
||||
Windows builds was added. However, the mconf tool does not
|
||||
build to run natively under Windows.
|
||||
|
||||
Some effort was spent trying to get a clean mconf build under
|
||||
Windows. This is documented in the message thread beginning
|
||||
here: http://tech.groups.yahoo.com/group/nuttx/message/2900.
|
||||
The build was successfully completed using: MinGW-GCC, MSYS,
|
||||
additional Windows libraries, and additional MSYS libraries
|
||||
(MSYS is a variant of Cygwin so, presumeably, Cygwin could
|
||||
have been used as well). However, on final testing, it was
|
||||
found that there are problems with text and numeric entry:
|
||||
http://tech.groups.yahoo.com/group/nuttx/message/2953. This
|
||||
was considered a show stopper and the changs were not checked
|
||||
in.
|
||||
|
||||
Options: (1) Use conf (not mconf). confis the text-only
|
||||
configuration tool, (2) fix mconf, (3) write another variant
|
||||
of the configuration tool for windows, or (4) do all configuration
|
||||
under Cygwin or MSYS. I am doing (4) now, but this is very
|
||||
awkward because I have to set the apps path to ../apps (vs
|
||||
..\apps) and CONFIG_WINDOWS_NATIVE=n for the 'make menuconfig'
|
||||
to run error free under windows. Very awkward!
|
||||
Status: Open, there are some workarounds, but none are good.
|
||||
Priority: High
|
||||
|
||||
Title: configure.sh NOT AVAILABLE IN NATIVE WINDOWS BUILD
|
||||
Description: configure.sh is a Bash script and cannot be used from a Windows
|
||||
CMD.exe window. I started a configure.bat script, but I do
|
||||
not have the batch file programming skills to duplicate some
|
||||
of the more complex operations.
|
||||
|
||||
I also considered adding a configure.c file that could be
|
||||
compiled and then executed by configure.bat (and configure.sh?).
|
||||
But I have not gone down that path yet.
|
||||
|
||||
The current work-around is to configure under Cygwin.
|
||||
Status: Open
|
||||
Priority: High
|
||||
|
||||
o Linux/Cywgin simulation (arch/sim)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
@ -1344,11 +1398,6 @@ o ARM/LM3S6918 (arch/arm/src/lm3s/)
|
|||
o ARM/STM32 (arch/arm/src/stm32/)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Title: NOR FLASH DRIVER
|
||||
Description: NOR Flash driver with FTL layer to support a file system.
|
||||
Status: Open
|
||||
Priority: Low
|
||||
|
||||
Title: USBSERIAL ISSUES
|
||||
Description A USB device-side driver is in place but not well tested. At
|
||||
present, the apps/examples/usbserial test sometimes fails. The situation
|
||||
|
@ -1371,11 +1420,6 @@ o ARM/STM32 (arch/arm/src/stm32/)
|
|||
Status: Open
|
||||
Priority: Medium-High
|
||||
|
||||
Title: FSMC EXTERNAL MEMORY UNTESTED
|
||||
Description: FSMC external memory support is untested
|
||||
Status: Open
|
||||
Priority: Low
|
||||
|
||||
Title: DMA EXTENSIONS
|
||||
Description: DMA logic needs to be extended. DMA2, Channel 5, will not work
|
||||
because the DMA2 channels 4 & 5 share the same interrupt.
|
||||
|
@ -1383,12 +1427,6 @@ o ARM/STM32 (arch/arm/src/stm32/)
|
|||
Priority: Low until someone needs DMA1, Channel 5 (ADC3, UART4_TX, TIM5_CH1, or
|
||||
TIM8_CH2).
|
||||
|
||||
Title: UNFINISHED DRIVERS
|
||||
Description: The following drivers are incomplete: DAC. The following drivers
|
||||
are untested: DMA on the F4, CAN.
|
||||
Status: Open
|
||||
Priority: Medium
|
||||
|
||||
Title: F4 SDIO MULTI-BLOCK TRANSFER FAILURES
|
||||
Description: If you use a large I/O buffer to access the file system, then the
|
||||
MMCSD driver will perform multiple block SD transfers. With DMA
|
||||
|
@ -1412,13 +1450,15 @@ o ARM/STM32 (arch/arm/src/stm32/)
|
|||
Status: Open
|
||||
Priority: Low (I am not even sure if this is a problem yet).
|
||||
|
||||
Status: UNFINISHED STM32 F4 OTG FS HOST DRIVER
|
||||
Description: A quick-n-dirty leverage of the the LPC17xx host driver was put into
|
||||
the STM32 source to support development of the STM32 F4 OTG FS host
|
||||
driver. It is non-functional and still waiting for STM32 F4 logic
|
||||
to be added. Don't use it!
|
||||
Title: DMA FROM EXTERNAL, FSMC MEMORY
|
||||
Description: I have seen a problem on F1 where all SDIO DMAs work exist for
|
||||
write DMAs from FSMC memory (i.e., from FSMC memory to SDIO).
|
||||
Read transfers work fine (SDIO to FSMC memory). The failure is
|
||||
a data underrun error with zero bytes of data transferred. The
|
||||
workaround for now is to use DMA buffers allocted from internal
|
||||
SRAM.
|
||||
Status: Open
|
||||
Priority: Low (unless you need a host driver).
|
||||
Priority: Low
|
||||
|
||||
o AVR (arch/avr)
|
||||
^^^^^^^^^^^^^^
|
||||
|
@ -1507,6 +1547,16 @@ o 8051 / MCS51 (arch/8051/)
|
|||
Status: Open
|
||||
Priority: Low -- only because there as so many other issues with 8051
|
||||
|
||||
Title: 8051 BUILD BROKEN
|
||||
Description: The last time I tried to build the pjrc-8051 configurtion using
|
||||
the SDCC 3.2.1 toolchain (for Windows). I got compilation
|
||||
errors in sched/os_bringup.c. It complained about type
|
||||
mis-matches. What I gather from Googling, this is a problem
|
||||
with the --stack-auto option. At any rate, this problem will
|
||||
need to be fixed if you want to resurrect the 8051 NuttX port.
|
||||
Status: Open
|
||||
Priority: Low -- I don't think anyone uses the 8051 port.
|
||||
|
||||
o MIPS/PIC32(arch/mips)
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
@ -1835,9 +1885,17 @@ o z16 (arch/z16)
|
|||
Internal Error(0503) On line 2504 of "MMCSD\MMCSD_SDIO.C"
|
||||
File <c3>, Args(562,46)
|
||||
|
||||
Status: Open. Recommended workaround: remove mmcsd_sdio.c from
|
||||
drivers/mmcsd/Make.defs. There is no SDIO support for the Z16 anyway
|
||||
Priority: Low
|
||||
Status: Open. Recommended workaround: remove mmcsd_sdio.c from
|
||||
drivers/mmcsd/Make.defs. There is no SDIO support for the Z16 anyway
|
||||
Priority: Low
|
||||
|
||||
Title: NATIVE BUILD PROBLEMS
|
||||
Description: When last tested (ca.12/12), there were some missing .obj files in
|
||||
arch/z16/src. A little additional TLC will be needed to get a
|
||||
reliable Windows native build. As of this writing, the Cygwin
|
||||
based build has not been re-verified.
|
||||
Status: Open
|
||||
Priority: Low -- I don't think anyone uses the Z16 port.
|
||||
|
||||
o mc68hc1x (arch/hc)
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -9,6 +9,7 @@ choice
|
|||
|
||||
config ARCH_8051
|
||||
bool "8051"
|
||||
select CUSTOM_STACK
|
||||
---help---
|
||||
Intel 8051 architectures and derivaties
|
||||
|
||||
|
@ -111,12 +112,30 @@ config ARCH_DMA
|
|||
bool
|
||||
default n
|
||||
|
||||
config ARCH_IRQPRIO
|
||||
bool
|
||||
default n
|
||||
|
||||
config CUSTOM_STACK
|
||||
bool
|
||||
default n
|
||||
|
||||
config ADDRENV
|
||||
bool
|
||||
default n
|
||||
|
||||
config ARCH_STACKDUMP
|
||||
bool "Dump stack on assertions"
|
||||
default n
|
||||
---help---
|
||||
Enable to do stack dumps after assertions
|
||||
|
||||
config ENDIAN_BIG
|
||||
bool "Big Endian Architecture"
|
||||
default n
|
||||
---help---
|
||||
Select if architecture operates using big-endian byte ordering.
|
||||
|
||||
comment "Board Settings"
|
||||
|
||||
config BOARD_LOOPSPERMSEC
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#
|
||||
|
||||
if ARCH_ARM
|
||||
comment "ARM Options"
|
||||
|
||||
choice
|
||||
prompt "ARM chip selection"
|
||||
default ARCH_CHIP_STM32
|
||||
|
@ -44,6 +46,7 @@ config ARCH_CHIP_KINETIS
|
|||
bool "Freescale Kinetis"
|
||||
select ARCH_CORTEXM4
|
||||
select ARCH_HAVE_MPU
|
||||
select ARCH_IRQPRIO
|
||||
---help---
|
||||
Freescale Kinetis Architectures (ARM Cortex-M4)
|
||||
|
||||
|
@ -51,6 +54,7 @@ config ARCH_CHIP_LM3S
|
|||
bool "TI Stellaris"
|
||||
select ARCH_CORTEXM3
|
||||
select ARCH_HAVE_MPU
|
||||
select ARCH_IRQPRIO
|
||||
---help---
|
||||
TI Stellaris LMS3 architecutres (ARM Cortex-M3)
|
||||
|
||||
|
@ -58,6 +62,7 @@ config ARCH_CHIP_LPC17XX
|
|||
bool "NXP LPC17xx"
|
||||
select ARCH_CORTEXM3
|
||||
select ARCH_HAVE_MPU
|
||||
select ARCH_IRQPRIO
|
||||
---help---
|
||||
NXP LPC17xx architectures (ARM Cortex-M3)
|
||||
|
||||
|
@ -89,6 +94,7 @@ config ARCH_CHIP_LPC43XX
|
|||
select ARCH_HAVE_CMNVECTOR
|
||||
select ARMV7M_CMNVECTOR
|
||||
select ARCH_HAVE_MPU
|
||||
select ARCH_IRQPRIO
|
||||
---help---
|
||||
NPX LPC43XX architectures (ARM Cortex-M4).
|
||||
|
||||
|
@ -96,6 +102,7 @@ config ARCH_CHIP_SAM3U
|
|||
bool "Atmel AT91SAM3U"
|
||||
select ARCH_CORTEXM3
|
||||
select ARCH_HAVE_MPU
|
||||
select ARCH_IRQPRIO
|
||||
---help---
|
||||
Atmel AT91SAM3U architectures (ARM Cortex-M3)
|
||||
|
||||
|
@ -104,6 +111,7 @@ config ARCH_CHIP_STM32
|
|||
select ARCH_HAVE_CMNVECTOR
|
||||
select ARCH_HAVE_MPU
|
||||
select ARCH_HAVE_I2CRESET
|
||||
select ARCH_IRQPRIO
|
||||
---help---
|
||||
STMicro STM32 architectures (ARM Cortex-M3/4).
|
||||
|
||||
|
@ -153,6 +161,9 @@ config ARCH_CHIP
|
|||
default "stm32" if ARCH_CHIP_STM32
|
||||
default "str71x" if ARCH_CHIP_STR71X
|
||||
|
||||
config ARCH_HAVE_CMNVECTOR
|
||||
bool
|
||||
|
||||
config ARMV7M_CMNVECTOR
|
||||
bool "Use common ARMv7-M vectors"
|
||||
default n
|
||||
|
@ -217,12 +228,6 @@ config PAGING
|
|||
If set =y in your configation file, this setting will enable the on-demand
|
||||
paging feature as described in http://www.nuttx.org/NuttXDemandPaging.html.
|
||||
|
||||
config ARCH_IRQPRIO
|
||||
bool "Interrupt priority"
|
||||
default y if ARCH_CORTEXM3 || ARCH_CORTEXM4
|
||||
---help---
|
||||
Select if your board supports interrupt prioritization.
|
||||
|
||||
config BOARD_LOOPSPERMSEC
|
||||
int "Delay loops per millisecond"
|
||||
default 5000
|
||||
|
@ -239,6 +244,21 @@ config ARCH_CALIBRATION
|
|||
watch to measure the 100 second delay then adjust BOARD_LOOPSPERMSEC until
|
||||
the delay actually is 100 seconds.
|
||||
|
||||
config DEBUG_HARDFAULT
|
||||
bool "Verbose Hard-Fault Debug"
|
||||
default n
|
||||
depends on DEBUG && (ARCH_CORTEXM3 || ARCH_CORTEXM4)
|
||||
---help---
|
||||
Enables verbose debug output when a hard fault is occurs. This verbose
|
||||
output is sometimes helpful when debugging difficult hard fault problems,
|
||||
but may be more than you typcially want to see.
|
||||
|
||||
if ARCH_CORTEXM3 || ARCH_CORTEXM4
|
||||
source arch/arm/src/armv7-m/Kconfig
|
||||
endif
|
||||
if ARCH_ARM7TDMI || ARCH_ARM926EJS
|
||||
source arch/arm/src/arm/Kconfig
|
||||
endif
|
||||
if ARCH_CHIP_C5471
|
||||
source arch/arm/src/c5471/Kconfig
|
||||
endif
|
||||
|
|
|
@ -0,0 +1,243 @@
|
|||
/****************************************************************************
|
||||
* arch/arm/include/syscall.h
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Reference: "ELF for the ARM® Architecture," ARM IHI 0044D, current through
|
||||
* ABI release 2.08, October 28, 2009, ARM Limited.
|
||||
*
|
||||
* 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 __ARCH_ARM_INCLUDE_ELF_H
|
||||
#define __ARCH_ARM_INCLUDE_ELF_H
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* 4.3.1 ELF Identification. Should have:
|
||||
*
|
||||
* e_machine = EM_ARM
|
||||
* e_ident[EI_CLASS] = ELFCLASS32
|
||||
* e_ident[EI_DATA] = ELFDATA2LSB (little endian) or ELFDATA2MSB (big endian)
|
||||
*/
|
||||
|
||||
#if 0 /* Defined in include/elf32.h */
|
||||
#define EM_ARM 40
|
||||
#endif
|
||||
|
||||
/* Table 4-2, ARM-specific e_flags */
|
||||
|
||||
#define EF_ARM_EABI_MASK 0xff000000
|
||||
#define EF_ARM_EABI_UNKNOWN 0x00000000
|
||||
#define EF_ARM_EABI_VER1 0x01000000
|
||||
#define EF_ARM_EABI_VER2 0x02000000
|
||||
#define EF_ARM_EABI_VER3 0x03000000
|
||||
#define EF_ARM_EABI_VER4 0x04000000
|
||||
#define EF_ARM_EABI_VER5 0x05000000
|
||||
|
||||
#define EF_ARM_BE8 0x00800000
|
||||
|
||||
/* Table 4-4, Processor specific section types */
|
||||
|
||||
#define SHT_ARM_EXIDX 0x70000001 /* Exception Index table */
|
||||
#define SHT_ARM_PREEMPTMAP 0x70000002 /* BPABI DLL dynamic linking pre-emption map */
|
||||
#define SHT_ARM_ATTRIBUTES 0x70000003 /* Object file compatibility attributes */
|
||||
#define SHT_ARM_DEBUGOVERLAY 0x70000004
|
||||
#define SHT_ARM_OVERLAYSECTION 0x70000005
|
||||
|
||||
/* 4.7.1 Relocation codes
|
||||
*
|
||||
* S (when used on its own) is the address of the symbol.
|
||||
* A is the addend for the relocation.
|
||||
* P is the address of the place being relocated (derived from r_offset).
|
||||
* Pa is the adjusted address of the place being relocated, defined as (P & 0xFFFFFFFC).
|
||||
* T is 1 if the target symbol S has type STT_FUNC and the symbol addresses a Thumb instruction;
|
||||
* it is 0 otherwise.
|
||||
* B(S) is the addressing origin of the output segment defining the symbol S.
|
||||
* GOT_ORG is the addressing origin of the Global Offset Table
|
||||
* GOT(S) is the address of the GOT entry for the symbol S.
|
||||
*/
|
||||
|
||||
#define R_ARM_NONE 0 /* No relocation */
|
||||
#define R_ARM_PC24 1 /* ARM ((S + A) | T) - P */
|
||||
#define R_ARM_ABS32 2 /* Data (S + A) | T */
|
||||
#define R_ARM_REL32 3 /* Data ((S + A) | T) - P */
|
||||
#define R_ARM_LDR_PC_G0 4 /* ARM S + A - P */
|
||||
#define R_ARM_ABS16 5 /* Data S + A */
|
||||
#define R_ARM_ABS12 6 /* ARM S + A */
|
||||
#define R_ARM_THM_ABS5 7 /* Thumb16 S + A */
|
||||
#define R_ARM_ABS8 8 /* Data S + A */
|
||||
#define R_ARM_SBREL32 9 /* Data ((S + A) | T) - B(S) */
|
||||
#define R_ARM_THM_CALL 10 /* Thumb32 ((S + A) | T) - P */
|
||||
#define R_ARM_THM_PC8 11 /* Thumb16 S + A - Pa */
|
||||
#define R_ARM_BREL_ADJ 12 /* Data ?B(S) + A */
|
||||
#define R_ARM_TLS_DESC 13 /* Data */
|
||||
#define R_ARM_THM_SWI8 14 /* Obsolete */
|
||||
#define R_ARM_XPC25 15 /* Obsolete */
|
||||
#define R_ARM_THM_XPC22 16 /* Obsolete */
|
||||
#define R_ARM_TLS_DTPMOD32 17 /* Data Module[S] */
|
||||
#define R_ARM_TLS_DTPOFF32 18 /* Data S + A - TLS */
|
||||
#define R_ARM_TLS_TPOFF32 19 /* Data S + A - tp */
|
||||
#define R_ARM_COPY 20 /* Miscellaneous */
|
||||
#define R_ARM_GLOB_DAT 21 /* Data (S + A) | T */
|
||||
#define R_ARM_JUMP_SLOT 22 /* Data (S + A) | T */
|
||||
#define R_ARM_RELATIVE 23 /* Data B(S) + A */
|
||||
#define R_ARM_GOTOFF32 24 /* Data ((S + A) | T) - GOT_ORG */
|
||||
#define R_ARM_BASE_PREL 25 /* Data B(S) + A - P */
|
||||
#define R_ARM_GOT_BREL 26 /* Data GOT(S) + A - GOT_ORG */
|
||||
#define R_ARM_PLT32 27 /* ARM ((S + A) | T) - P */
|
||||
#define R_ARM_CALL 28 /* ARM ((S + A) | T) - P */
|
||||
#define R_ARM_JUMP24 29 /* ARM ((S + A) | T) - P */
|
||||
#define R_ARM_THM_JUMP24 30 /* Thumb32 ((S + A) | T) - P */
|
||||
#define R_ARM_BASE_ABS 31 /* Data B(S) + A */
|
||||
#define R_ARM_ALU_PCREL_7_0 32 /* Obsolete */
|
||||
#define R_ARM_ALU_PCREL_15_8 33 /* Obsolete */
|
||||
#define R_ARM_ALU_PCREL_23_15 34 /* Obsolete */
|
||||
#define R_ARM_LDR_SBREL_11_0_NC 35 /* ARM S + A - B(S) */
|
||||
#define R_ARM_ALU_SBREL_19_12_NC 36 /* ARM S + A - B(S) */
|
||||
#define R_ARM_ALU_SBREL_27_20_CK 37 /* ARM S + A - B(S) */
|
||||
#define R_ARM_TARGET1 38 /* Miscellaneous (S + A) | T or ((S + A) | T) - P */
|
||||
#define R_ARM_SBREL31 39 /* Data ((S + A) | T) - B(S) */
|
||||
#define R_ARM_V4BX 40 /* Miscellaneous */
|
||||
#define R_ARM_TARGET2 41 /* Miscellaneous */
|
||||
#define R_ARM_PREL31 42 /* Data ((S + A) | T) - P */
|
||||
#define R_ARM_MOVW_ABS_NC 43 /* ARM (S + A) | T */
|
||||
#define R_ARM_MOVT_ABS 44 /* ARM S + A */
|
||||
#define R_ARM_MOVW_PREL_NC 45 /* ARM ((S + A) | T) - P */
|
||||
#define R_ARM_MOVT_PREL 46 /* ARM S + A - P */
|
||||
#define R_ARM_THM_MOVW_ABS_NC 47 /* Thumb32 (S + A) | T */
|
||||
#define R_ARM_THM_MOVT_ABS 48 /* Thumb32 S + A */
|
||||
#define R_ARM_THM_MOVW_PREL_NC 49 /* Thumb32 ((S + A) | T) - P */
|
||||
#define R_ARM_THM_MOVT_PREL 50 /* Thumb32 S + A - P */
|
||||
#define R_ARM_THM_JUMP19 51 /* Thumb32 ((S + A) | T) - P */
|
||||
#define R_ARM_THM_JUMP6 52 /* Thumb16 S + A - P */
|
||||
#define R_ARM_THM_ALU_PREL_11_0 53 /* Thumb32 ((S + A) | T) - Pa */
|
||||
#define R_ARM_THM_PC12 54 /* Thumb32 S + A - Pa */
|
||||
#define R_ARM_ABS32_NOI 55 /* Data S + A */
|
||||
#define R_ARM_REL32_NOI 56 /* Data S + A - P */
|
||||
#define R_ARM_ALU_PC_G0_NC 57 /* ARM ((S + A) | T) - P */
|
||||
#define R_ARM_ALU_PC_G0 58 /* ARM ((S + A) | T) - P */
|
||||
#define R_ARM_ALU_PC_G1_NC 59 /* ARM ((S + A) | T) - P */
|
||||
#define R_ARM_ALU_PC_G1 60 /* ARM ((S + A) | T) - P */
|
||||
#define R_ARM_ALU_PC_G2 61 /* ARM ((S + A) | T) - P */
|
||||
#define R_ARM_LDR_PC_G1 62 /* ARM S + A - P */
|
||||
#define R_ARM_LDR_PC_G2 63 /* ARM S + A - P */
|
||||
#define R_ARM_LDRS_PC_G0 64 /* ARM S + A - P */
|
||||
#define R_ARM_LDRS_PC_G1 65 /* ARM S + A - P */
|
||||
#define R_ARM_LDRS_PC_G2 66 /* ARM S + A - P */
|
||||
#define R_ARM_LDC_PC_G0 67 /* ARM S + A - P */
|
||||
#define R_ARM_LDC_PC_G1 68 /* ARM S + A - P */
|
||||
#define R_ARM_LDC_PC_G2 69 /* ARM S + A - P */
|
||||
#define R_ARM_ALU_SB_G0_NC 70 /* ARM ((S + A) | T) - B(S) */
|
||||
#define R_ARM_ALU_SB_G0 71 /* ARM ((S + A) | T) - B(S) */
|
||||
#define R_ARM_ALU_SB_G1_NC 72 /* ARM ((S + A) | T) - B(S) */
|
||||
#define R_ARM_ALU_SB_G1 73 /* ARM ((S + A) | T) - B(S) */
|
||||
#define R_ARM_ALU_SB_G2 74 /* ARM ((S + A) | T) - B(S) */
|
||||
#define R_ARM_LDR_SB_G0 75 /* ARM S + A - B(S) */
|
||||
#define R_ARM_LDR_SB_G1 76 /* ARM S + A - B(S) */
|
||||
#define R_ARM_LDR_SB_G2 77 /* ARM S + A - B(S) */
|
||||
#define R_ARM_LDRS_SB_G0 78 /* ARM S + A - B(S) */
|
||||
#define R_ARM_LDRS_SB_G1 79 /* ARM S + A - B(S) */
|
||||
#define R_ARM_LDRS_SB_G2 80 /* ARM S + A - B(S) */
|
||||
#define R_ARM_LDC_SB_G0 81 /* ARM S + A - B(S) */
|
||||
#define R_ARM_LDC_SB_G1 82 /* ARM S + A - B(S) */
|
||||
#define R_ARM_LDC_SB_G2 83 /* ARM S + A - B(S) */
|
||||
#define R_ARM_MOVW_BREL_NC 84 /* ARM ((S + A) | T) - B(S) */
|
||||
#define R_ARM_MOVT_BREL 85 /* ARM S + A - B(S) */
|
||||
#define R_ARM_MOVW_BREL 86 /* ARM ((S + A) | T) - B(S) */
|
||||
#define R_ARM_THM_MOVW_BREL_NC 87 /* Thumb32 ((S + A) | T) - B(S) */
|
||||
#define R_ARM_THM_MOVT_BREL 88 /* Thumb32 S + A - B(S) */
|
||||
#define R_ARM_THM_MOVW_BREL 89 /* Thumb32 ((S + A) | T) - B(S) */
|
||||
#define R_ARM_TLS_GOTDESC 90 /* Data */
|
||||
#define R_ARM_TLS_CALL 91 /* ARM */
|
||||
#define R_ARM_TLS_DESCSEQ 92 /* ARM TLS relaxation */
|
||||
#define R_ARM_THM_TLS_CALL 93 /* Thumb32 */
|
||||
#define R_ARM_PLT32_ABS 94 /* Data PLT(S) + A */
|
||||
#define R_ARM_GOT_ABS 95 /* Data GOT(S) + A */
|
||||
#define R_ARM_GOT_PREL 96 /* Data GOT(S) + A - P */
|
||||
#define R_ARM_GOT_BREL12 97 /* ARM GOT(S) + A - GOT_ORG */
|
||||
#define R_ARM_GOTOFF12 98 /* ARM S + A - GOT_ORG */
|
||||
#define R_ARM_GOTRELAX 99 /* Miscellaneous */
|
||||
#define R_ARM_GNU_VTENTRY 100 /* Data */
|
||||
#define R_ARM_GNU_VTINHERIT 101 /* Data */
|
||||
#define R_ARM_THM_JUMP11 102 /* Thumb16 S + A - P */
|
||||
#define R_ARM_THM_JUMP8 103 /* Thumb16 S + A - P */
|
||||
#define R_ARM_TLS_GD32 104 /* Data GOT(S) + A - P */
|
||||
#define R_ARM_TLS_LDM32 105 /* Data GOT(S) + A - P */
|
||||
#define R_ARM_TLS_LDO32 106 /* Data S + A - TLS */
|
||||
#define R_ARM_TLS_IE32 107 /* Data GOT(S) + A - P */
|
||||
#define R_ARM_TLS_LE32 108 /* Data S + A - tp */
|
||||
#define R_ARM_TLS_LDO12 109 /* ARM S + A - TLS */
|
||||
#define R_ARM_TLS_LE12 110 /* ARM S + A - tp */
|
||||
#define R_ARM_TLS_IE12GP 111 /* ARM GOT(S) + A - GOT_ORG */
|
||||
#define R_ARM_ME_TOO 128 /* Obsolete */
|
||||
#define R_ARM_THM_TLS_DESCSEQ16 129 /* Thumb16 */
|
||||
#define R_ARM_THM_TLS_DESCSEQ32 130 /* Thumb32 */
|
||||
|
||||
/* 5.2.1 Platform architecture compatibility data */
|
||||
|
||||
#define PT_ARM_ARCHEXT_FMTMSK 0xff000000
|
||||
#define PT_ARM_ARCHEXT_PROFMSK 0x00ff0000
|
||||
#define PT_ARM_ARCHEXT_ARCHMSK 0x000000ff
|
||||
|
||||
#define PT_ARM_ARCHEXT_FMT_OS 0x00000000
|
||||
#define PT_ARM_ARCHEXT_FMT_ABI 0x01000000
|
||||
|
||||
#define PT_ARM_ARCHEXT_PROF_NONE 0x00000000
|
||||
#define PT_ARM_ARCHEXT_PROF_ARM 0x00410000
|
||||
#define PT_ARM_ARCHEXT_PROF_RT 0x00520000
|
||||
#define PT_ARM_ARCHEXT_PROF_MC 0x004d0000
|
||||
#define PT_ARM_ARCHEXT_PROF_CLASSIC 0x00530000
|
||||
|
||||
#define PT_ARM_ARCHEXT_ARCH_UNKNOWN 0x00
|
||||
#define PT_ARM_ARCHEXT_ARCHv4 0x01
|
||||
#define PT_ARM_ARCHEXT_ARCHv4T 0x02
|
||||
#define PT_ARM_ARCHEXT_ARCHv5T 0x03
|
||||
#define PT_ARM_ARCHEXT_ARCHv5TE 0x04
|
||||
#define PT_ARM_ARCHEXT_ARCHv5TEJ 0x05
|
||||
#define PT_ARM_ARCHEXT_ARCHv6 0x06
|
||||
#define PT_ARM_ARCHEXT_ARCHv6KZ 0x07
|
||||
#define PT_ARM_ARCHEXT_ARCHv6T2 0x08
|
||||
#define PT_ARM_ARCHEXT_ARCHv6K 0x09
|
||||
#define PT_ARM_ARCHEXT_ARCHv7 0x0a
|
||||
#define PT_ARM_ARCHEXT_ARCHv6M 0x0b
|
||||
#define PT_ARM_ARCHEXT_ARCHv6SM 0x0c
|
||||
#define PT_ARM_ARCHEXT_ARCHv7EM 0x0d
|
||||
|
||||
/* Table 5-6, ARM-specific dynamic array tags */
|
||||
|
||||
#define DT_ARM_RESERVED1 0x70000000
|
||||
#define DT_ARM_SYMTABSZ 0x70000001
|
||||
#define DT_ARM_PREEMPTMAP 0x70000002
|
||||
#define DT_ARM_RESERVED2 0x70000003
|
||||
|
||||
#endif /* __ARCH_ARM_INCLUDE_ELF_H */
|
|
@ -45,37 +45,42 @@
|
|||
****************************************************************************/
|
||||
|
||||
#define CHAR_BIT 8
|
||||
#define SCHAR_MIN (-128)
|
||||
#define SCHAR_MAX 127
|
||||
#define UCHAR_MAX 0xff
|
||||
#define SCHAR_MIN (-SCHAR_MAX - 1)
|
||||
#define SCHAR_MAX 127
|
||||
#define UCHAR_MAX 255
|
||||
|
||||
/* These could be different on machines where char is unsigned */
|
||||
|
||||
#ifdef __CHAR_UNSIGNED__
|
||||
#define CHAR_MIN 0
|
||||
#define CHAR_MAX UCHAR_MAX
|
||||
#else
|
||||
#define CHAR_MIN SCHAR_MIN
|
||||
#define CHAR_MAX SCHAR_MAX
|
||||
#endif
|
||||
|
||||
#define SHRT_MIN 0x8000
|
||||
#define SHRT_MAX 0x7fff
|
||||
#define USHRT_MAX 0xffff
|
||||
#define SHRT_MIN (-SHRT_MAX - 1)
|
||||
#define SHRT_MAX 32767
|
||||
#define USHRT_MAX 65535U
|
||||
|
||||
#define INT_MIN 0x80000000
|
||||
#define INT_MAX 0x7fffffff
|
||||
#define UINT_MAX 0xffffffff
|
||||
#define INT_MIN (-INT_MAX - 1)
|
||||
#define INT_MAX 2147483647
|
||||
#define UINT_MAX 4294967295U
|
||||
|
||||
/* These change on 32-bit and 64-bit platforms */
|
||||
|
||||
#define LONG_MAX 0x80000000
|
||||
#define LONG_MIN 0x7fffffff
|
||||
#define ULONG_MAX 0xffffffff
|
||||
#define LONG_MIN (-LONG_MAX - 1)
|
||||
#define LONG_MAX 2147483647L
|
||||
#define ULONG_MAX 4294967295UL
|
||||
|
||||
#define LLONG_MAX 0x8000000000000000
|
||||
#define LLONG_MIN 0x7fffffffffffffff
|
||||
#define ULLONG_MAX 0xffffffffffffffff
|
||||
#define LLONG_MIN (-LLONG_MAX - 1)
|
||||
#define LLONG_MAX 9223372036854775807LL
|
||||
#define ULLONG_MAX 18446744073709551615ULL
|
||||
|
||||
/* A pointer is 4 bytes */
|
||||
|
||||
#define PTR_MIN 0x80000000
|
||||
#define PTR_MAX 0x7fffffff
|
||||
#define UPTR_MAX 0xffffffff
|
||||
#define PTR_MIN (-PTR_MAX - 1)
|
||||
#define PTR_MAX 2147483647
|
||||
#define UPTR_MAX 4294967295U
|
||||
|
||||
#endif /* __ARCH_ARM_INCLUDE_LIMITS_H */
|
||||
|
|
|
@ -59,12 +59,11 @@
|
|||
/* STM32 F100 Value Line ************************************************************/
|
||||
|
||||
#if defined(CONFIG_ARCH_CHIP_STM32F100C8) || defined(CONFIG_ARCH_CHIP_STM32F100CB) \
|
||||
|| defined(CONFIG_ARCH_CHIP_STM32F100R8) || defined(CONFIG_ARCH_CHIP_STM32F100RB) \
|
||||
|| defined(CONFIG_ARCH_CHIP_STM32F100V8) || defined(CONFIG_ARCH_CHIP_STM32F100VB)
|
||||
|| defined(CONFIG_ARCH_CHIP_STM32F100R8) || defined(CONFIG_ARCH_CHIP_STM32F100RB)
|
||||
# define CONFIG_STM32_STM32F10XX 1 /* STM32F10xxx family */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F100x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# define CONFIG_STM32_MEDIUMDENSITY 1 /* STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F101x and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# define CONFIG_STM32_MEDIUMDENSITY 1 /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F100x, STM32F101x, and STM32F103x w/ 256/512 Kbytes */
|
||||
# define CONFIG_STM32_VALUELINE 1 /* STM32F100x */
|
||||
# undef CONFIG_STM32_CONNECTIVITYLINE /* STM32F105x and STM32F107x */
|
||||
# undef CONFIG_STM32_STM32F20XX /* STM32F205x and STM32F207x */
|
||||
|
@ -72,15 +71,110 @@
|
|||
# define STM32_NFSMC 0 /* FSMC */
|
||||
# define STM32_NATIM 1 /* One advanced timer TIM1 */
|
||||
# define STM32_NGTIM 3 /* 16-bit general timers TIM2,3,4 with DMA */
|
||||
# define STM32_NBTIM 0 /* No basic timers */
|
||||
# define STM32_NDMA 2 /* DMA1-2 */
|
||||
# define STM32_NBTIM 2 /* 2 basic timers: TIM6, TIM7 */
|
||||
// TODO: there are also 3 additional timers (15-17) that don't fit any existing category
|
||||
# define STM32_NDMA 1 /* DMA1 */
|
||||
# define STM32_NSPI 2 /* SPI1-2 */
|
||||
# define STM32_NI2S 0 /* No I2S (?) */
|
||||
# define STM32_NI2S 0 /* No I2S */
|
||||
# define STM32_NUSART 3 /* USART1-3 */
|
||||
# define STM32_NI2C 2 /* I2C1-2 */
|
||||
# define STM32_NCAN 0 /* No CAN */
|
||||
# define STM32_NSDIO 0 /* No SDIO */
|
||||
# define STM32_NUSBOTG 0 /* No USB OTG FS/HS */
|
||||
# define STM32_NGPIO 64 /* GPIOA-D */
|
||||
# define STM32_NADC 1 /* ADC1 */
|
||||
# define STM32_NDAC 2 /* DAC 1-2 */
|
||||
# define STM32_NCRC 1 /* CRC1 */
|
||||
# define STM32_NETHERNET 0 /* No ethernet */
|
||||
# define STM32_NRNG 0 /* No random number generator (RNG) */
|
||||
# define STM32_NDCMI 0 /* No digital camera interface (DCMI) */
|
||||
|
||||
#elif defined(CONFIG_ARCH_CHIP_STM32F100V8) || defined(CONFIG_ARCH_CHIP_STM32F100VB)
|
||||
# define CONFIG_STM32_STM32F10XX 1 /* STM32F10xxx family */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# define CONFIG_STM32_MEDIUMDENSITY 1 /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F100x, STM32F101x, and STM32F103x w/ 256/512 Kbytes */
|
||||
# define CONFIG_STM32_VALUELINE 1 /* STM32F100x */
|
||||
# undef CONFIG_STM32_CONNECTIVITYLINE /* STM32F105x and STM32F107x */
|
||||
# undef CONFIG_STM32_STM32F20XX /* STM32F205x and STM32F207x */
|
||||
# undef CONFIG_STM32_STM32F40XX /* STM32F405xx and STM32407xx families */
|
||||
# define STM32_NFSMC 0 /* FSMC */
|
||||
# define STM32_NATIM 1 /* One advanced timer TIM1 */
|
||||
# define STM32_NGTIM 3 /* 16-bit general timers TIM2,3,4 with DMA */
|
||||
# define STM32_NBTIM 2 /* 2 basic timers: TIM6, TIM7 */
|
||||
// TODO: there are also 3 additional timers (15-17) that don't fit any existing category
|
||||
# define STM32_NDMA 1 /* DMA1 */
|
||||
# define STM32_NSPI 2 /* SPI1-2 */
|
||||
# define STM32_NI2S 0 /* No I2S */
|
||||
# define STM32_NUSART 3 /* USART1-3 */
|
||||
# define STM32_NI2C 2 /* I2C1-2 */
|
||||
# define STM32_NCAN 0 /* No CAN */
|
||||
# define STM32_NSDIO 0 /* No SDIO */
|
||||
# define STM32_NUSBOTG 0 /* No USB OTG FS/HS */
|
||||
# define STM32_NGPIO 80 /* GPIOA-E */
|
||||
# define STM32_NADC 1 /* ADC1 */
|
||||
# define STM32_NDAC 2 /* DAC 1-2 */
|
||||
# define STM32_NCRC 1 /* CRC1 */
|
||||
# define STM32_NETHERNET 0 /* No ethernet */
|
||||
# define STM32_NRNG 0 /* No random number generator (RNG) */
|
||||
# define STM32_NDCMI 0 /* No digital camera interface (DCMI) */
|
||||
|
||||
/* STM32 F100 High-density value Line ************************************************************/
|
||||
|
||||
#elif defined(CONFIG_ARCH_CHIP_STM32F100RC) || defined(CONFIG_ARCH_CHIP_STM32F100RD) \
|
||||
|| defined(CONFIG_ARCH_CHIP_STM32F100RE)
|
||||
# define CONFIG_STM32_STM32F10XX 1 /* STM32F10xxx family */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# define CONFIG_STM32_HIGHDENSITY 1 /* STM32F100x, STM32F101x, and STM32F103x w/ 256/512 Kbytes */
|
||||
# define CONFIG_STM32_VALUELINE 1 /* STM32F100x */
|
||||
# undef CONFIG_STM32_CONNECTIVITYLINE /* STM32F105x and STM32F107x */
|
||||
# undef CONFIG_STM32_STM32F20XX /* STM32F205x and STM32F207x */
|
||||
# undef CONFIG_STM32_STM32F40XX /* STM32F405xx and STM32407xx families */
|
||||
# define STM32_NFSMC 0 /* FSMC */
|
||||
# define STM32_NATIM 1 /* One advanced timer TIM1 */
|
||||
# define STM32_NGTIM 4 /* 16-bit general timers TIM2,3,4,5 with DMA */
|
||||
# define STM32_NBTIM 2 /* 2 basic timers: TIM6, TIM7 */
|
||||
// TODO: there are also 6 additional timers (12-17) that don't fit any existing category
|
||||
# define STM32_NDMA 2 /* DMA1-2 */
|
||||
# define STM32_NSPI 3 /* SPI1-3 */
|
||||
# define STM32_NI2S 0 /* No I2S */
|
||||
# define STM32_NUSART 5 /* USART1-5 */
|
||||
# define STM32_NI2C 2 /* I2C1-2 */
|
||||
# define STM32_NCAN 0 /* No CAN */
|
||||
# define STM32_NSDIO 0 /* No SDIO */
|
||||
# define STM32_NUSBOTG 0 /* No USB OTG FS/HS */
|
||||
# define STM32_NGPIO 64 /* GPIOA-D */
|
||||
# define STM32_NADC 1 /* ADC1 */
|
||||
# define STM32_NDAC 2 /* DAC 1-2 */
|
||||
# define STM32_NCRC 1 /* CRC1 */
|
||||
# define STM32_NETHERNET 0 /* No ethernet */
|
||||
# define STM32_NRNG 0 /* No random number generator (RNG) */
|
||||
# define STM32_NDCMI 0 /* No digital camera interface (DCMI) */
|
||||
|
||||
#elif defined(CONFIG_ARCH_CHIP_STM32F100VC) || defined(CONFIG_ARCH_CHIP_STM32F100VD) \
|
||||
|| defined(CONFIG_ARCH_CHIP_STM32F100VE)
|
||||
# define CONFIG_STM32_STM32F10XX 1 /* STM32F10xxx family */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# define CONFIG_STM32_HIGHDENSITY 1 /* STM32F100x, STM32F101x, and STM32F103x w/ 256/512 Kbytes */
|
||||
# define CONFIG_STM32_VALUELINE 1 /* STM32F100x */
|
||||
# undef CONFIG_STM32_CONNECTIVITYLINE /* STM32F105x and STM32F107x */
|
||||
# undef CONFIG_STM32_STM32F20XX /* STM32F205x and STM32F207x */
|
||||
# undef CONFIG_STM32_STM32F40XX /* STM32F405xx and STM32407xx families */
|
||||
# define STM32_NFSMC 1 /* FSMC */
|
||||
# define STM32_NATIM 1 /* One advanced timer TIM1 */
|
||||
# define STM32_NGTIM 4 /* 16-bit general timers TIM2,3,4,5 with DMA */
|
||||
# define STM32_NBTIM 2 /* 2 basic timers: TIM6, TIM7 */
|
||||
// TODO: there are also 6 additional timers (12-17) that don't fit any existing category
|
||||
# define STM32_NDMA 2 /* DMA1-2 */
|
||||
# define STM32_NSPI 3 /* SPI1-3 */
|
||||
# define STM32_NI2S 0 /* No I2S */
|
||||
# define STM32_NUSART 5 /* USART1-5 */
|
||||
# define STM32_NI2C 2 /* I2C1-2 */
|
||||
# define STM32_NCAN 0 /* No CAN */
|
||||
# define STM32_NSDIO 0 /* No SDIO */
|
||||
# define STM32_NUSBOTG 0 /* No USB OTG FS/HS */
|
||||
# define STM32_NGPIO 80 /* GPIOA-E */
|
||||
# define STM32_NADC 1 /* ADC1 */
|
||||
# define STM32_NDAC 2 /* DAC 1-2 */
|
||||
|
@ -96,9 +190,9 @@
|
|||
|
||||
#elif defined(CONFIG_ARCH_CHIP_STM32F103RET6)
|
||||
# define CONFIG_STM32_STM32F10XX 1 /* STM32F10xxx family */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# define CONFIG_STM32_HIGHDENSITY 1 /* STM32F101x and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# define CONFIG_STM32_HIGHDENSITY 1 /* STM32F100x, STM32F101x, and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_VALUELINE /* STM32F100x */
|
||||
# undef CONFIG_STM32_CONNECTIVITYLINE /* STM32F105x and STM32F107x */
|
||||
# undef CONFIG_STM32_STM32F20XX /* STM32F205x and STM32F207x */
|
||||
|
@ -129,9 +223,9 @@
|
|||
|
||||
#elif defined(CONFIG_ARCH_CHIP_STM32F103VCT6) || defined(CONFIG_ARCH_CHIP_STM32F103VET6)
|
||||
# define CONFIG_STM32_STM32F10XX 1 /* STM32F10xxx family */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# define CONFIG_STM32_HIGHDENSITY 1 /* STM32F101x and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# define CONFIG_STM32_HIGHDENSITY 1 /* STM32F100x, STM32F101x, and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_VALUELINE /* STM32F100x */
|
||||
# undef CONFIG_STM32_CONNECTIVITYLINE /* STM32F105x and STM32F107x */
|
||||
# undef CONFIG_STM32_STM32F20XX /* STM32F205x and STM32F207x */
|
||||
|
@ -162,9 +256,9 @@
|
|||
|
||||
#elif defined(CONFIG_ARCH_CHIP_STM32F103ZET6)
|
||||
# define CONFIG_STM32_STM32F10XX 1 /* STM32F10xxx family */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# define CONFIG_STM32_HIGHDENSITY 1 /* STM32F101x and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# define CONFIG_STM32_HIGHDENSITY 1 /* STM32F100x, STM32F101x, and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_VALUELINE /* STM32F100x */
|
||||
# undef CONFIG_STM32_CONNECTIVITYLINE /* STM32F105x and STM32F107x */
|
||||
# undef CONFIG_STM32_STM32F20XX /* STM32F205x and STM32F207x */
|
||||
|
@ -192,9 +286,9 @@
|
|||
/* STM32 F105/F107 Connectivity Line *******************************************************/
|
||||
#elif defined(CONFIG_ARCH_CHIP_STM32F105VBT7)
|
||||
# define CONFIG_STM32_STM32F10XX 1 /* STM32F10xxx family */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F101x and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F100x, STM32F101x, and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_VALUELINE /* STM32F100x */
|
||||
# define CONFIG_STM32_CONNECTIVITYLINE 1 /* STM32F105x and STM32F107x */
|
||||
# undef CONFIG_STM32_STM32F20XX /* STM32F205x and STM32F207x */
|
||||
|
@ -221,9 +315,9 @@
|
|||
|
||||
#elif defined(CONFIG_ARCH_CHIP_STM32F107VC)
|
||||
# define CONFIG_STM32_STM32F10XX 1 /* STM32F10xxx family */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F101x and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F100x, STM32F101x, and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_VALUELINE /* STM32F100x */
|
||||
# define CONFIG_STM32_CONNECTIVITYLINE 1 /* STM32F105x and STM32F107x */
|
||||
# undef CONFIG_STM32_STM32F20XX /* STM32F205x and STM32F207x */
|
||||
|
@ -251,9 +345,9 @@
|
|||
/* STM32 F2 Family ******************************************************************/
|
||||
#elif defined(CONFIG_ARCH_CHIP_STM32F207IG) /* UFBGA-176 1024Kb FLASH 128Kb SRAM */
|
||||
# undef CONFIG_STM32_STM32F10XX /* STM32F10xxx family */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F101x and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F100x, STM32F101x, and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_VALUELINE /* STM32F100x */
|
||||
# undef CONFIG_STM32_CONNECTIVITYLINE /* STM32F105x and STM32F107x */
|
||||
# define CONFIG_STM32_STM32F20XX 1 /* STM32F205x and STM32F207x */
|
||||
|
@ -283,9 +377,9 @@
|
|||
/* STM23 F4 Family ******************************************************************/
|
||||
#elif defined(CONFIG_ARCH_CHIP_STM32F405RG) /* LQFP 64 10x10x1.4 1024Kb FLASH 192Kb SRAM */
|
||||
# undef CONFIG_STM32_STM32F10XX /* STM32F10xxx family */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F101x and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F100x, STM32F101x, and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_VALUELINE /* STM32F100x */
|
||||
# undef CONFIG_STM32_CONNECTIVITYLINE /* STM32F105x and STM32F107x */
|
||||
# undef CONFIG_STM32_STM32F20XX /* STM32F205x and STM32F207x */
|
||||
|
@ -314,9 +408,9 @@
|
|||
|
||||
#elif defined(CONFIG_ARCH_CHIP_STM32F405VG) /* LQFP 100 14x14x1.4 1024Kb FLASH 192Kb SRAM */
|
||||
# undef CONFIG_STM32_STM32F10XX /* STM32F10xxx family */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F101x and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F100x, STM32F101x, and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_VALUELINE /* STM32F100x */
|
||||
# undef CONFIG_STM32_CONNECTIVITYLINE /* STM32F105x and STM32F107x */
|
||||
# undef CONFIG_STM32_STM32F20XX /* STM32F205x and STM32F207x */
|
||||
|
@ -345,9 +439,9 @@
|
|||
|
||||
#elif defined(CONFIG_ARCH_CHIP_STM32F405ZG) /* LQFP 144 20x20x1.4 1024Kb FLASH 192Kb SRAM */
|
||||
# undef CONFIG_STM32_STM32F10XX /* STM32F10xxx family */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F101x and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F100x, STM32F101x, and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_VALUELINE /* STM32F100x */
|
||||
# undef CONFIG_STM32_CONNECTIVITYLINE /* STM32F105x and STM32F107x */
|
||||
# undef CONFIG_STM32_STM32F20XX /* STM32F205x and STM32F207x */
|
||||
|
@ -376,9 +470,9 @@
|
|||
|
||||
#elif defined(CONFIG_ARCH_CHIP_STM32F407VE) /* LQFP-100 512Kb FLASH 192Kb SRAM */
|
||||
# undef CONFIG_STM32_STM32F10XX /* STM32F10xxx family */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F101x and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F100x, STM32F101x, and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_VALUELINE /* STM32F100x */
|
||||
# undef CONFIG_STM32_CONNECTIVITYLINE /* STM32F105x and STM32F107x */
|
||||
# undef CONFIG_STM32_STM32F20XX /* STM32F205x and STM32F207x */
|
||||
|
@ -407,9 +501,9 @@
|
|||
|
||||
#elif defined(CONFIG_ARCH_CHIP_STM32F407VG) /* LQFP-100 14x14x1.4 1024Kb FLASH 192Kb SRAM */
|
||||
# undef CONFIG_STM32_STM32F10XX /* STM32F10xxx family */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F101x and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F100x, STM32F101x, and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_VALUELINE /* STM32F100x */
|
||||
# undef CONFIG_STM32_CONNECTIVITYLINE /* STM32F105x and STM32F107x */
|
||||
# undef CONFIG_STM32_STM32F20XX /* STM32F205x and STM32F207x */
|
||||
|
@ -438,9 +532,9 @@
|
|||
|
||||
#elif defined(CONFIG_ARCH_CHIP_STM32F407ZE) /* LQFP-144 512Kb FLASH 192Kb SRAM */
|
||||
# undef CONFIG_STM32_STM32F10XX /* STM32F10xxx family */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F101x and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F100x, STM32F101x, and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_VALUELINE /* STM32F100x */
|
||||
# undef CONFIG_STM32_CONNECTIVITYLINE /* STM32F105x and STM32F107x */
|
||||
# undef CONFIG_STM32_STM32F20XX /* STM32F205x and STM32F207x */
|
||||
|
@ -469,9 +563,9 @@
|
|||
|
||||
#elif defined(CONFIG_ARCH_CHIP_STM32F407ZG) /* LQFP 144 20x20x1.4 1024Kb FLASH 192Kb SRAM */
|
||||
# undef CONFIG_STM32_STM32F10XX /* STM32F10xxx family */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F101x and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F100x, STM32F101x, and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_VALUELINE /* STM32F100x */
|
||||
# undef CONFIG_STM32_CONNECTIVITYLINE /* STM32F105x and STM32F107x */
|
||||
# undef CONFIG_STM32_STM32F20XX /* STM32F205x and STM32F207x */
|
||||
|
@ -500,9 +594,9 @@
|
|||
|
||||
#elif defined(CONFIG_ARCH_CHIP_STM32F407IE) /* LQFP 176 24x24x1.4 512Kb FLASH 192Kb SRAM */
|
||||
# undef CONFIG_STM32_STM32F10XX /* STM32F10xxx family */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F101x and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F100x, STM32F101x, and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_VALUELINE /* STM32F100x */
|
||||
# undef CONFIG_STM32_CONNECTIVITYLINE /* STM32F105x and STM32F107x */
|
||||
# undef CONFIG_STM32_STM32F20XX /* STM32F205x and STM32F207x */
|
||||
|
@ -531,9 +625,9 @@
|
|||
|
||||
#elif defined(CONFIG_ARCH_CHIP_STM32F407IG) /* BGA 176; LQFP 176 24x24x1.4 1024Kb FLASH 192Kb SRAM */
|
||||
# undef CONFIG_STM32_STM32F10XX /* STM32F10xxx family */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F101x and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_LOWDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */
|
||||
# undef CONFIG_STM32_MEDIUMDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */
|
||||
# undef CONFIG_STM32_HIGHDENSITY /* STM32F100x, STM32F101x, and STM32F103x w/ 256/512 Kbytes */
|
||||
# undef CONFIG_STM32_VALUELINE /* STM32F100x */
|
||||
# undef CONFIG_STM32_CONNECTIVITYLINE /* STM32F105x and STM32F107x */
|
||||
# undef CONFIG_STM32_STM32F20XX /* STM32F205x and STM32F207x */
|
||||
|
|
|
@ -61,11 +61,13 @@
|
|||
* External interrupts (vectors >= 16)
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_STM32_VALUELINE) && defined(CONFIG_STM32_MEDIUMDENSITY)
|
||||
/* Value line devices */
|
||||
|
||||
#if defined(CONFIG_STM32_VALUELINE)
|
||||
# define STM32_IRQ_WWDG (16) /* 0: Window Watchdog interrupt */
|
||||
# define STM32_IRQ_PVD (17) /* 1: PVD through EXTI Line detection interrupt */
|
||||
# define STM32_IRQ_TAMPER (18) /* 2: Tamper interrupt */
|
||||
# define STM32_IRQ_RTC (19) /* 3: RTC global interrupt */
|
||||
# define STM32_IRQ_RTC (19) /* 3: RTC Wakeup through EXTI line interrupt */
|
||||
# define STM32_IRQ_FLASH (20) /* 4: Flash global interrupt */
|
||||
# define STM32_IRQ_RCC (21) /* 5: RCC global interrupt */
|
||||
# define STM32_IRQ_EXTI0 (22) /* 6: EXTI Line 0 interrupt */
|
||||
|
@ -80,12 +82,18 @@
|
|||
# define STM32_IRQ_DMA1CH5 (31) /* 15: DMA1 Channel 5 global interrupt */
|
||||
# define STM32_IRQ_DMA1CH6 (32) /* 16: DMA1 Channel 6 global interrupt */
|
||||
# define STM32_IRQ_DMA1CH7 (33) /* 17: DMA1 Channel 7 global interrupt */
|
||||
# define STM32_IRQ_ADC12 (34) /* 18: ADC1 and ADC2 global interrupt */
|
||||
/* 19-22: reserved */
|
||||
# define STM32_IRQ_ADC1 (34) /* 18: ADC1 global interrupt */
|
||||
# define STM32_IRQ_RESERVED0 (35) /* 19: Reserved 0 */
|
||||
# define STM32_IRQ_RESERVED1 (36) /* 20: Reserved 1 */
|
||||
# define STM32_IRQ_RESERVED2 (37) /* 21: Reserved 2 */
|
||||
# define STM32_IRQ_RESERVED3 (38) /* 22: Reserved 3 */
|
||||
# define STM32_IRQ_EXTI95 (39) /* 23: EXTI Line[9:5] interrupts */
|
||||
# define STM32_IRQ_TIM1BRK (40) /* 24: TIM1 Break interrupt */
|
||||
# define STM32_IRQ_TIM1UP (41) /* 25: TIM1 Update interrupt (TIM16 global interrupt) */
|
||||
# define STM32_IRQ_TIM1TRGCOM (42) /* 26: TIM1 Trigger and Commutation interrupts (TIM17 global interrupt) */
|
||||
# define STM32_IRQ_TIM15 (40) /* TIM15 global interrupt */
|
||||
# define STM32_IRQ_TIM1UP (41) /* 25: TIM1 Update interrupt */
|
||||
# define STM32_IRQ_TIM16 (41) /* TIM16 global interrupt */
|
||||
# define STM32_IRQ_TIM1TRGCOM (42) /* 26: TIM1 Trigger and Commutation interrupts */
|
||||
# define STM32_IRQ_TIM17 (42) /* TIM17 global interrupt */
|
||||
# define STM32_IRQ_TIM1CC (43) /* 27: TIM1 Capture Compare interrupt */
|
||||
# define STM32_IRQ_TIM2 (44) /* 28: TIM2 global interrupt */
|
||||
# define STM32_IRQ_TIM3 (45) /* 29: TIM3 global interrupt */
|
||||
|
@ -100,29 +108,30 @@
|
|||
# define STM32_IRQ_USART2 (54) /* 38: USART2 global interrupt */
|
||||
# define STM32_IRQ_USART3 (55) /* 39: USART3 global interrupt */
|
||||
# define STM32_IRQ_EXTI1510 (56) /* 40: EXTI Line[15:10] interrupts */
|
||||
# define STM32_IRQ_RTCALR (57) /* 41: RTC alarm through EXTI line interrupt */
|
||||
# define STM32_IRQ_RTCALR (57) /* 41: RTC alarms (A and B) through EXTI line interrupt */
|
||||
# define STM32_IRQ_CEC (58) /* 42: CEC global interrupt */
|
||||
# if defined(CONFIG_STM32_HIGHDENSITY)
|
||||
# define STM32_IRQ_TIM12 (59) /* 43: TIM12 global interrupt */
|
||||
# define STM32_IRQ_TIM13 (60) /* 44: TIM13 global interrupt */
|
||||
# define STM32_IRQ_TIM14 (61) /* 45: TIM14 global interrupt */
|
||||
/* 46-47: reserved */
|
||||
# define STM32_IRQ_FSMC (64) /* 48: FSMC global interrupt */
|
||||
/* 49: reserved */
|
||||
# define STM32_IRQ_TIM5 (66) /* 50: TIM5 global interrupt */
|
||||
# define STM32_IRQ_SPI3 (67) /* 51: SPI1 global interrupt */
|
||||
# define STM32_IRQ_UART4 (68) /* 52: USART2 global interrupt */
|
||||
# define STM32_IRQ_UART5 (69) /* 53: USART3 global interrupt */
|
||||
# else
|
||||
/* 43-53: reserved */
|
||||
# endif
|
||||
# define STM32_IRQ_TIM12 (59) /* 43: TIM12 global interrupt */
|
||||
# define STM32_IRQ_TIM13 (60) /* 44: TIM13 global interrupt */
|
||||
# define STM32_IRQ_TIM14 (61) /* 45: TIM14 global interrupt */
|
||||
# define STM32_IRQ_RESERVED4 (62) /* 46: Reserved 4 */
|
||||
# define STM32_IRQ_RESERVED5 (63) /* 47: Reserved 5 */
|
||||
# define STM32_IRQ_FSMC (64) /* 48: FSMC global interrupt */
|
||||
# define STM32_IRQ_RESERVED6 (65) /* 49: Reserved 6 */
|
||||
# define STM32_IRQ_TIM5 (66) /* 50: TIM5 global interrupt */
|
||||
# define STM32_IRQ_SPI3 (67) /* 51: SPI3 global interrupt */
|
||||
# define STM32_IRQ_UART4 (68) /* 52: USART2 global interrupt */
|
||||
# define STM32_IRQ_UART5 (69) /* 53: USART5 global interrupt */
|
||||
# define STM32_IRQ_TIM6 (70) /* 54: TIM6 global interrupt */
|
||||
# define STM32_IRQ_TIM7 (71) /* 55: TIM7 global interrupt */
|
||||
# define STM32_IRQ_DMA2CH1 (72) /* 56: DMA2 Channel 1 global interrupt */
|
||||
# define STM32_IRQ_DMA2CH2 (73) /* 57: DMA2 Channel 2 global interrupt */
|
||||
# define STM32_IRQ_DMA2CH3 (74) /* 58: DMA2 Channel 3 global interrupt */
|
||||
# define STM32_IRQ_DMA2CH45 (75) /* 59: DMA2 Channel 4 global interrupt */
|
||||
# define NR_IRQS (76)
|
||||
# define STM32_IRQ_DMA2CH45 (75) /* 59: DMA2 Channel 4 and 5 global interrupt */
|
||||
# define STM32_IRQ_DMA2CH5 (76) /* 60: DMA2 Channel 5 global interrupt */
|
||||
# define NR_IRQS (77)
|
||||
|
||||
/* Connectivity Line Devices */
|
||||
|
||||
#elif defined(CONFIG_STM32_CONNECTIVITYLINE)
|
||||
# define STM32_IRQ_WWDG (16) /* 0: Window Watchdog interrupt */
|
||||
# define STM32_IRQ_PVD (17) /* 1: PVD through EXTI Line detection interrupt */
|
||||
|
@ -193,6 +202,9 @@
|
|||
# define STM32_IRQ_CAN2SCE (82) /* 66: CAN2 SCE interrupt */
|
||||
# define STM32_IRQ_OTGFS (83) /* 67: USB On The Go FS global interrupt */
|
||||
# define NR_IRQS (84)
|
||||
|
||||
/* Medium and High Density Devices */
|
||||
|
||||
#else
|
||||
# define STM32_IRQ_WWDG (16) /* 0: Window Watchdog interrupt */
|
||||
# define STM32_IRQ_PVD (17) /* 1: PVD through EXTI Line detection interrupt */
|
||||
|
|
|
@ -36,58 +36,90 @@
|
|||
-include $(TOPDIR)/Make.defs
|
||||
-include chip/Make.defs
|
||||
|
||||
ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
|
||||
ifeq ($(CONFIG_ARCH_CORTEXM3),y) # Cortex-M3 is ARMv7-M
|
||||
ARCH_SUBDIR = armv7-m
|
||||
ARCH_SUBDIR = armv7-m
|
||||
else
|
||||
ifeq ($(CONFIG_ARCH_CORTEXM4),y) # Cortex-M4 is ARMv7E-M
|
||||
ARCH_SUBDIR = armv7-m
|
||||
ARCH_SUBDIR = armv7-m
|
||||
else
|
||||
ARCH_SUBDIR = arm
|
||||
ARCH_SUBDIR = arm
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
ARCH_SRCDIR = $(TOPDIR)\arch\$(CONFIG_ARCH)\src
|
||||
NUTTX = "$(TOPDIR)\nuttx$(EXEEXT)"
|
||||
CFLAGS += -I$(ARCH_SRCDIR)\chip
|
||||
CFLAGS += -I$(ARCH_SRCDIR)\common
|
||||
CFLAGS += -I$(ARCH_SRCDIR)\$(ARCH_SUBDIR)
|
||||
CFLAGS += -I$(TOPDIR)\sched
|
||||
else
|
||||
ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
|
||||
ifeq ($(WINTOOL),y)
|
||||
NUTTX = "${shell cygpath -w $(TOPDIR)/nuttx$(EXEEXT)}"
|
||||
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}"
|
||||
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/common}"
|
||||
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/$(ARCH_SUBDIR)}"
|
||||
CFLAGS += -I "${shell cygpath -w $(TOPDIR)/sched}"
|
||||
else
|
||||
NUTTX = "$(TOPDIR)/nuttx$(EXEEXT)"
|
||||
CFLAGS += -I$(ARCH_SRCDIR)/chip
|
||||
CFLAGS += -I$(ARCH_SRCDIR)/common
|
||||
CFLAGS += -I$(ARCH_SRCDIR)/$(ARCH_SUBDIR)
|
||||
CFLAGS += -I$(TOPDIR)/sched
|
||||
endif
|
||||
endif
|
||||
|
||||
HEAD_OBJ = $(HEAD_ASRC:.S=$(OBJEXT))
|
||||
|
||||
ASRCS = $(CHIP_ASRCS) $(CMN_ASRCS)
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
|
||||
CSRCS = $(CHIP_CSRCS) $(CMN_CSRCS)
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
LDFLAGS += $(ARCHSCRIPT)
|
||||
|
||||
EXTRA_LIBS ?=
|
||||
EXTRA_LIBPATHS ?=
|
||||
LINKLIBS ?=
|
||||
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BOARDMAKE = $(if $(wildcard .\board\Makefile),y,)
|
||||
LIBPATHS += -L"$(TOPDIR)\lib"
|
||||
ifeq ($(BOARDMAKE),y)
|
||||
LIBPATHS += -L"$(TOPDIR)\arch\$(CONFIG_ARCH)\src\board"
|
||||
endif
|
||||
|
||||
else
|
||||
BOARDMAKE = $(if $(wildcard ./board/Makefile),y,)
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
NUTTX = "${shell cygpath -w $(TOPDIR)/nuttx}"
|
||||
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
|
||||
-I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
|
||||
-I "${shell cygpath -w $(ARCH_SRCDIR)/$(ARCH_SUBDIR)}" \
|
||||
-I "${shell cygpath -w $(TOPDIR)/sched}"
|
||||
else
|
||||
NUTTX = $(TOPDIR)/nuttx
|
||||
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common \
|
||||
-I$(ARCH_SRCDIR)/$(ARCH_SUBDIR) -I$(TOPDIR)/sched
|
||||
LIBPATHS += -L"${shell cygpath -w "$(TOPDIR)/lib"}"
|
||||
ifeq ($(BOARDMAKE),y)
|
||||
LIBPATHS += -L"${shell cygpath -w "$(TOPDIR)/arch/$(CONFIG_ARCH)/src/board"}"
|
||||
endif
|
||||
|
||||
HEAD_OBJ = $(HEAD_ASRC:.S=$(OBJEXT))
|
||||
|
||||
ASRCS = $(CHIP_ASRCS) $(CMN_ASRCS)
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
|
||||
CSRCS = $(CHIP_CSRCS) $(CMN_CSRCS)
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
LDFLAGS = $(ARCHSCRIPT)
|
||||
EXTRA_LIBS ?=
|
||||
|
||||
LINKLIBS =
|
||||
ifeq ($(WINTOOL),y)
|
||||
LIBPATHS = ${shell for path in $(LINKLIBS); do dir=`dirname $(TOPDIR)/$$path`;echo "-L\"`cygpath -w $$dir`\"";done}
|
||||
LIBPATHS += -L"${shell cygpath -w $(BOARDDIR)}"
|
||||
else
|
||||
LIBPATHS = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS)))
|
||||
LIBPATHS += -L"$(BOARDDIR)"
|
||||
LIBPATHS += -L"$(TOPDIR)/lib"
|
||||
ifeq ($(BOARDMAKE),y)
|
||||
LIBPATHS += -L"$(TOPDIR)/arch/$(CONFIG_ARCH)/src/board"
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))
|
||||
|
||||
BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board
|
||||
LDLIBS = $(patsubst %.a,%,$(patsubst lib%,-l%,$(LINKLIBS)))
|
||||
ifeq ($(BOARDMAKE),y)
|
||||
LDLIBS += -lboard
|
||||
endif
|
||||
|
||||
LIBGCC = "${shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name}"
|
||||
LIBGCC = "${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name}"
|
||||
GCC_LIBDIR := ${shell dirname $(LIBGCC)}
|
||||
|
||||
VPATH = chip:common:$(ARCH_SUBDIR)
|
||||
VPATH = chip:common:$(ARCH_SUBDIR)
|
||||
|
||||
all: $(HEAD_OBJ) libarch$(LIBEXT)
|
||||
|
||||
|
@ -100,20 +132,21 @@ $(COBJS): %$(OBJEXT): %.c
|
|||
$(call COMPILE, $<, $@)
|
||||
|
||||
libarch$(LIBEXT): $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $@, $${obj}); \
|
||||
done ; )
|
||||
$(call ARCHIVE, $@, $(OBJS))
|
||||
|
||||
board/libboard$(LIBEXT):
|
||||
@$(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT) EXTRADEFINES=$(EXTRADEFINES)
|
||||
$(Q) $(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT) EXTRADEFINES=$(EXTRADEFINES)
|
||||
|
||||
nuttx: $(HEAD_OBJ) board/libboard$(LIBEXT)
|
||||
@echo "LD: nuttx"
|
||||
@$(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) -o $(NUTTX)$(EXEEXT) $(HEAD_OBJ) $(EXTRA_OBJS) \
|
||||
--start-group $(LDLIBS) -lboard $(EXTRA_LIBS) $(LIBGCC) --end-group
|
||||
@$(NM) $(NUTTX)$(EXEEXT) | \
|
||||
nuttx$(EXEEXT): $(HEAD_OBJ) board/libboard$(LIBEXT)
|
||||
$(Q) echo "LD: nuttx"
|
||||
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
|
||||
-o $(NUTTX)$(EXEEXT) $(HEAD_OBJ) $(EXTRA_OBJS) \
|
||||
--start-group $(LDLIBS) $(EXTRA_LIBS) $(LIBGCC) --end-group
|
||||
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
$(Q) $(NM) $(NUTTX)$(EXEEXT) | \
|
||||
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
|
||||
sort > $(TOPDIR)/System.map
|
||||
endif
|
||||
|
||||
# This is part of the top-level export target
|
||||
# Note that there may not be a head object if layout is handled
|
||||
|
@ -121,37 +154,38 @@ nuttx: $(HEAD_OBJ) board/libboard$(LIBEXT)
|
|||
|
||||
export_head: board/libboard$(LIBEXT) $(HEAD_OBJ)
|
||||
ifneq ($(HEAD_OBJ),)
|
||||
@if [ -d "$(EXPORT_DIR)/startup" ]; then \
|
||||
$(Q) if [ -d "$(EXPORT_DIR)/startup" ]; then \
|
||||
cp -f $(HEAD_OBJ) "$(EXPORT_DIR)/startup"; \
|
||||
else \
|
||||
echo "$(EXPORT_DIR)/startup does not exist"; \
|
||||
exit 1; \
|
||||
fi
|
||||
exit 1; \
|
||||
fi
|
||||
endif
|
||||
|
||||
# Dependencies
|
||||
|
||||
.depend: Makefile chip/Make.defs $(SRCS)
|
||||
@if [ -e board/Makefile ]; then \
|
||||
$(MAKE) -C board TOPDIR="$(TOPDIR)" depend ; \
|
||||
fi
|
||||
@$(MKDEP) --dep-path chip --dep-path common --dep-path $(ARCH_SUBDIR) \
|
||||
$(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
ifeq ($(BOARDMAKE),y)
|
||||
$(Q) $(MAKE) -C board TOPDIR="$(TOPDIR)" depend
|
||||
endif
|
||||
$(Q) $(MKDEP) --dep-path chip --dep-path common --dep-path $(ARCH_SUBDIR) \
|
||||
"$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
$(Q) touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@if [ -e board/Makefile ]; then \
|
||||
$(MAKE) -C board TOPDIR="$(TOPDIR)" clean ; \
|
||||
fi
|
||||
@rm -f libarch$(LIBEXT) *~ .*.swp
|
||||
ifeq ($(BOARDMAKE),y)
|
||||
$(Q) $(MAKE) -C board TOPDIR="$(TOPDIR)" clean
|
||||
endif
|
||||
$(call DELFILE, libarch$(LIBEXT))
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@if [ -e board/Makefile ]; then \
|
||||
$(MAKE) -C board TOPDIR="$(TOPDIR)" distclean ; \
|
||||
fi
|
||||
@rm -f Make.dep .depend
|
||||
ifeq ($(BOARDMAKE),y)
|
||||
$(Q) $(MAKE) -C board TOPDIR="$(TOPDIR)" distclean
|
||||
endif
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see misc/tools/kconfig-language.txt.
|
||||
#
|
||||
|
||||
comment "ARM Configuration Options"
|
||||
|
||||
choice
|
||||
prompt "Toolchain Selection"
|
||||
default ARM_TOOLCHAIN_CODESOURCERYW if HOST_WINDOWS
|
||||
default ARM_TOOLCHAIN_GNU_EABI if !HOST_WINDOWS
|
||||
|
||||
config ARM_TOOLCHAIN_BUILDROOT
|
||||
bool "Buildroot (Cygwin or Linux)"
|
||||
depends on !WINDOWS_NATIVE
|
||||
|
||||
config ARM_TOOLCHAIN_CODESOURCERYL
|
||||
bool "CodeSourcery GNU toolchain under Linux"
|
||||
depends on HOST_LINUX
|
||||
|
||||
config ARM_TOOLCHAIN_CODESOURCERYW
|
||||
bool "CodeSourcery GNU toolchain under Windows"
|
||||
depends on HOST_WINDOWS
|
||||
|
||||
config ARM_TOOLCHAIN_DEVKITARM
|
||||
bool "devkitARM GNU toolchain"
|
||||
depends on HOST_WINDOWS
|
||||
|
||||
config ARM_TOOLCHAIN_GNU_EABI
|
||||
bool "Generic GNU EABI toolchain"
|
||||
---help---
|
||||
This option should work for any modern GNU toolchain (GCC 4.5 or newer)
|
||||
configured for arm-none-eabi.
|
||||
|
||||
endchoice
|
|
@ -0,0 +1,146 @@
|
|||
############################################################################
|
||||
# arch/arm/src/armv/Toolchain.defs
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
# Setup for the selected toolchain
|
||||
|
||||
#
|
||||
# Handle old-style chip-specific toolchain names in the absence of
|
||||
# a new-style toolchain specification, force the selection of a single
|
||||
# toolchain and allow the selected toolchain to be overridden by a
|
||||
# command-line selection.
|
||||
#
|
||||
|
||||
ifeq ($(filter y, \
|
||||
$(CONFIG_DM320_BUILDROOT) \
|
||||
$(CONFIG_LPC313X_BUILDROOT) \
|
||||
$(CONFIG_LPC31_BUILDROOT) \
|
||||
$(CONFIG_OLIMEX_LPC2378_BUILDROOT) \
|
||||
$(CONFIG_ARM_TOOLCHAIN_BUILDROOT) \
|
||||
),y)
|
||||
CONFIG_ARM_TOOLCHAIN ?= BUILDROOT
|
||||
endif
|
||||
ifeq ($(filter y, \
|
||||
$(CONFIG_DM320_CODESOURCERYL) \
|
||||
$(CONFIG_LPC31_CODESOURCERYL) \
|
||||
$(CONFIG_OLIMEX_LPC2378_CODESOURCERYL) \
|
||||
$(CONFIG_ARM_TOOLCHAIN_CODESOURCERYL) \
|
||||
),y)
|
||||
CONFIG_ARM_TOOLCHAIN ?= CODESOURCERYL
|
||||
endif
|
||||
ifeq ($(filter y, \
|
||||
$(CONFIG_DM320_CODESOURCERYW) \
|
||||
$(CONFIG_LPC31_CODESOURCERYW) \
|
||||
$(CONFIG_OLIMEX_LPC2378_CODESOURCERYW) \
|
||||
$(CONFIG_ARM_TOOLCHAIN_CODESOURCERYW) \
|
||||
),y)
|
||||
CONFIG_ARM_TOOLCHAIN ?= CODESOURCERYW
|
||||
endif
|
||||
ifeq ($(filter y, \
|
||||
$(CONFIG_DM320_DEVKITARM) \
|
||||
$(CONFIG_LPC31_DEVKITARM) \
|
||||
$(CONFIG_OLIMEX_LPC2378_DEVKITARM) \
|
||||
$(CONFIG_ARM_TOOLCHAIN_DEVKITARM) \
|
||||
),y)
|
||||
CONFIG_ARM_TOOLCHAIN ?= DEVKITARM
|
||||
endif
|
||||
ifeq ($(filter y, \
|
||||
$(CONFIG_ARM_TOOLCHAIN_GNU_EABI) \
|
||||
),y)
|
||||
CONFIG_ARM_TOOLCHAIN ?= GNU_EABI
|
||||
endif
|
||||
|
||||
#
|
||||
# Supported toolchains
|
||||
#
|
||||
# TODO - It's likely that all of these toolchains now support the
|
||||
# CortexM4. Since they are all GCC-based, we could almost
|
||||
# certainly simplify this further.
|
||||
#
|
||||
# Each toolchain definition should set:
|
||||
#
|
||||
# CROSSDEV The GNU toolchain triple (command prefix)
|
||||
# ARCROSSDEV If required, an alternative prefix used when
|
||||
# invoking ar and nm.
|
||||
# ARCHCPUFLAGS CPU-specific flags selecting the instruction set
|
||||
# FPU options, etc.
|
||||
# MAXOPTIMIZATION The maximum optimization level that results in
|
||||
# reliable code generation.
|
||||
#
|
||||
|
||||
# NuttX buildroot under Linux or Cygwin
|
||||
|
||||
ifeq ($(CONFIG_ARM_TOOLCHAIN),BUILDROOT)
|
||||
CROSSDEV = arm-nuttx-elf-
|
||||
ARCROSSDEV = arm-nuttx-elf-
|
||||
MAXOPTIMIZATION = -Os
|
||||
endif
|
||||
|
||||
# CodeSourcery under Linux
|
||||
|
||||
ifeq ($(CONFIG_ARM_TOOLCHAIN),CODESOURCERYL)
|
||||
CROSSDEV = arm-none-eabi-
|
||||
ARCROSSDEV = arm-none-eabi-
|
||||
MAXOPTIMIZATION = -O2
|
||||
endif
|
||||
|
||||
# CodeSourcery under Windows
|
||||
|
||||
ifeq ($(CONFIG_ARM_TOOLCHAIN),CODESOURCERYW)
|
||||
CROSSDEV = arm-none-eabi-
|
||||
ARCROSSDEV = arm-none-eabi-
|
||||
MAXOPTIMIZATION = -O2
|
||||
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
WINTOOL = y
|
||||
endif
|
||||
endif
|
||||
|
||||
# devkitARM under Windows
|
||||
|
||||
ifeq ($(CONFIG_ARM_TOOLCHAIN),DEVKITARM)
|
||||
CROSSDEV = arm-eabi-
|
||||
ARCROSSDEV = arm-eabi-
|
||||
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
WINTOOL = y
|
||||
endif
|
||||
endif
|
||||
|
||||
# Generic GNU EABI toolchain on OS X, Linux or any typical Posix system
|
||||
|
||||
ifeq ($(CONFIG_ARM_TOOLCHAIN),GNU_EABI)
|
||||
CROSSDEV = arm-none-eabi-
|
||||
ARCROSSDEV = arm-none-eabi-
|
||||
MAXOPTIMIZATION = -O3
|
||||
endif
|
||||
|
|
@ -0,0 +1,257 @@
|
|||
/****************************************************************************
|
||||
* arch/arm/src/arm/up_elf.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <elf32.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <arch/elf.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/binfmt/elf.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: arch_checkarch
|
||||
*
|
||||
* Description:
|
||||
* Given the ELF header in 'hdr', verify that the ELF file is appropriate
|
||||
* for the current, configured architecture. Every architecture that uses
|
||||
* the ELF loader must provide this function.
|
||||
*
|
||||
* Input Parameters:
|
||||
* hdr - The ELF header read from the ELF file.
|
||||
*
|
||||
* Returned Value:
|
||||
* True if the architecture supports this ELF file.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
bool arch_checkarch(FAR const Elf32_Ehdr *ehdr)
|
||||
{
|
||||
/* Make sure it's an ARM executable */
|
||||
|
||||
if (ehdr->e_machine != EM_ARM)
|
||||
{
|
||||
bdbg("Not for ARM: e_machine=%04x\n", ehdr->e_machine);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
/* Make sure that 32-bit objects are supported */
|
||||
|
||||
if (ehdr->e_ident[EI_CLASS] != ELFCLASS32)
|
||||
{
|
||||
bdbg("Need 32-bit objects: e_ident[EI_CLASS]=%02x\n", ehdr->e_ident[EI_CLASS]);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
/* Verify endian-ness */
|
||||
|
||||
#ifdef CONFIG_ENDIAN_BIG
|
||||
if (ehdr->e_ident[EI_DATA] != ELFDATA2MSB)
|
||||
#else
|
||||
if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB)
|
||||
#endif
|
||||
{
|
||||
bdbg("Wrong endian-ness: e_ident[EI_DATA]=%02x\n", ehdr->e_ident[EI_DATA]);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
/* Make sure the entry point address is properly aligned */
|
||||
|
||||
if ((ehdr->e_entry & 3) != 0)
|
||||
{
|
||||
bdbg("Entry point is not properly aligned: %08x\n", ehdr->e_entry);
|
||||
return -ENOEXEC
|
||||
}
|
||||
|
||||
/* TODO: Check ABI here. */
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: arch_relocate and arch_relocateadd
|
||||
*
|
||||
* Description:
|
||||
* Perform on architecture-specific ELF relocation. Every architecture
|
||||
* that uses the ELF loader must provide this function.
|
||||
*
|
||||
* Input Parameters:
|
||||
* rel - The relocation type
|
||||
* sym - The ELF symbol structure containing the fully resolved value.
|
||||
* addr - The address that requires the relocation.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) if the relocation was successful. Otherwise, a negated errno
|
||||
* value indicating the cause of the relocation failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int arch_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
|
||||
uintptr_t addr)
|
||||
{
|
||||
int32_t offset;
|
||||
|
||||
switch (ELF32_R_TYPE(rel->r_info))
|
||||
{
|
||||
case R_ARM_NONE:
|
||||
{
|
||||
/* No relocation */
|
||||
}
|
||||
break;
|
||||
|
||||
case R_ARM_PC24:
|
||||
case R_ARM_CALL:
|
||||
case R_ARM_JUMP24:
|
||||
{
|
||||
bvdbg("Performing PC24 [%d] link at addr %08lx [%08lx] to sym '%s' st_value=%08lx\n",
|
||||
ELF32_R_TYPE(rel->r_info), (long)addr, (long)(*(uint32_t*)addr),
|
||||
sym, (long)sym->st_value);
|
||||
|
||||
offset = (*(uint32_t*)addr & 0x00ffffff) << 2;
|
||||
if (offset & 0x02000000)
|
||||
{
|
||||
offset -= 0x04000000;
|
||||
}
|
||||
|
||||
offset += sym->st_value - addr;
|
||||
if (offset & 3 || offset <= (int32_t) 0xfe000000 || offset >= (int32_t) 0x02000000)
|
||||
{
|
||||
bdbg(" ERROR: PC24 [%d] relocation out of range, offset=%08lx\n",
|
||||
ELF32_R_TYPE(rel->r_info), offset);
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
offset >>= 2;
|
||||
|
||||
*(uint32_t*)addr &= 0xff000000;
|
||||
*(uint32_t*)addr |= offset & 0x00ffffff;
|
||||
}
|
||||
break;
|
||||
|
||||
case R_ARM_ABS32:
|
||||
case R_ARM_TARGET1: /* New ABI: TARGET1 always treated as ABS32 */
|
||||
{
|
||||
bvdbg("Performing ABS32 link at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n",
|
||||
(long)addr, (long)(*(uint32_t*)addr), sym, (long)sym->st_value);
|
||||
|
||||
*(uint32_t*)addr += sym->st_value;
|
||||
}
|
||||
break;
|
||||
|
||||
case R_ARM_V4BX:
|
||||
{
|
||||
bvdbg("Performing V4BX link at addr=%08lx [%08lx]\n",
|
||||
(long)addr, (long)(*(uint32_t*)addr));
|
||||
|
||||
/* Preserve only Rm and the condition code */
|
||||
|
||||
*(uint32_t*)addr &= 0xf000000f;
|
||||
|
||||
/* Change instruction to 'mov pc, Rm' */
|
||||
|
||||
*(uint32_t*)addr |= 0x01a0f000;
|
||||
}
|
||||
break;
|
||||
|
||||
case R_ARM_PREL31:
|
||||
{
|
||||
bvdbg("Performing PREL31 link at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n",
|
||||
(long)addr, (long)(*(uint32_t*)addr), sym, (long)sym->st_value);
|
||||
|
||||
offset = *(uint32_t*)addr + sym->st_value - addr;
|
||||
*(uint32_t*)addr = offset & 0x7fffffff;
|
||||
}
|
||||
break;
|
||||
|
||||
case R_ARM_MOVW_ABS_NC:
|
||||
case R_ARM_MOVT_ABS:
|
||||
{
|
||||
bvdbg("Performing MOVx_ABS [%d] link at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n",
|
||||
ELF32_R_TYPE(rel->r_info), (long)addr, (long)(*(uint32_t*)addr),
|
||||
sym, (long)sym->st_value);
|
||||
|
||||
offset = *(uint32_t*)addr;
|
||||
offset = ((offset & 0xf0000) >> 4) | (offset & 0xfff);
|
||||
offset = (offset ^ 0x8000) - 0x8000;
|
||||
|
||||
offset += sym->st_value;
|
||||
if (ELF32_R_TYPE(rel->r_info) == R_ARM_MOVT_ABS)
|
||||
{
|
||||
offset >>= 16;
|
||||
}
|
||||
|
||||
*(uint32_t*)addr &= 0xfff0f000;
|
||||
*(uint32_t*)addr |= ((offset & 0xf000) << 4) | (offset & 0x0fff);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
bdbg("Unsupported relocation: %d\n", ELF32_R_TYPE(rel->r_info));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int arch_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym,
|
||||
uintptr_t addr)
|
||||
{
|
||||
bdbg("RELA relocation not supported\n");
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see misc/tools/kconfig-language.txt.
|
||||
#
|
||||
|
||||
comment "ARMV7M Configuration Options"
|
||||
|
||||
choice
|
||||
prompt "Toolchain Selection"
|
||||
default ARMV7M_TOOLCHAIN_CODESOURCERYW if HOST_WINDOWS
|
||||
default ARMV7M_TOOLCHAIN_GNU_EABI if !HOST_WINDOWS
|
||||
|
||||
config ARMV7M_TOOLCHAIN_ATOLLIC
|
||||
bool "Atollic Lite/Pro for Windows"
|
||||
depends on HOST_WINDOWS
|
||||
|
||||
config ARMV7M_TOOLCHAIN_BUILDROOT
|
||||
bool "Buildroot (Cygwin or Linux)"
|
||||
depends on !WINDOWS_NATIVE
|
||||
|
||||
config ARMV7M_TOOLCHAIN_CODEREDL
|
||||
bool "CodeRed for Linux"
|
||||
depends on HOST_LINUX
|
||||
|
||||
config ARMV7M_TOOLCHAIN_CODEREDW
|
||||
bool "CodeRed for Windows"
|
||||
depends on HOST_WINDOWS
|
||||
|
||||
config ARMV7M_TOOLCHAIN_CODESOURCERYL
|
||||
bool "CodeSourcery GNU toolchain under Linux"
|
||||
depends on HOST_LINUX
|
||||
|
||||
config ARMV7M_TOOLCHAIN_CODESOURCERYW
|
||||
bool "CodeSourcery GNU toolchain under Windows"
|
||||
depends on HOST_WINDOWS
|
||||
|
||||
config ARMV7M_TOOLCHAIN_DEVKITARM
|
||||
bool "devkitARM GNU toolchain"
|
||||
depends on HOST_WINDOWS
|
||||
|
||||
config ARMV7M_TOOLCHAIN_GNU_EABI
|
||||
bool "Generic GNU EABI toolchain"
|
||||
---help---
|
||||
This option should work for any modern GNU toolchain (GCC 4.5 or newer)
|
||||
configured for arm-none-eabi.
|
||||
|
||||
config ARMV7M_TOOLCHAIN_RAISONANCE
|
||||
bool "STMicro Raisonance for Windows"
|
||||
depends on HOST_WINDOWS
|
||||
|
||||
endchoice
|
|
@ -0,0 +1,266 @@
|
|||
############################################################################
|
||||
# arch/arm/src/armv7-m/Toolchain.defs
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
# Setup for the selected toolchain
|
||||
|
||||
#
|
||||
# Handle old-style chip-specific toolchain names in the absence of
|
||||
# a new-style toolchain specification, force the selection of a single
|
||||
# toolchain and allow the selected toolchain to be overridden by a
|
||||
# command-line selection.
|
||||
#
|
||||
|
||||
ifeq ($(filter y, \
|
||||
$(CONFIG_LPC43_ATOLLIC_LITE) \
|
||||
$(CONFIG_STM32_ATOLLIC_LITE) \
|
||||
$(CONFIG_LPC43_ATOLLIC_PRO) \
|
||||
$(CONFIG_STM32_ATOLLIC_PRO) \
|
||||
$(CONFIG_ARMV7M_TOOLCHAIN_ATOLLIC) \
|
||||
),y)
|
||||
CONFIG_ARMV7M_TOOLCHAIN ?= ATOLLIC
|
||||
endif
|
||||
ifeq ($(filter y, \
|
||||
$(CONFIG_KINETIS_BUILDROOT) \
|
||||
$(CONFIG_LM3S_BUILDROOT) \
|
||||
$(CONFIG_LPC17_BUILDROOT) \
|
||||
$(CONFIG_LPC43_BUILDROOT) \
|
||||
$(CONFIG_SAM3U_BUILDROOT) \
|
||||
$(CONFIG_STM32_BUILDROOT) \
|
||||
$(CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT) \
|
||||
),y)
|
||||
CONFIG_ARMV7M_TOOLCHAIN ?= BUILDROOT
|
||||
endif
|
||||
ifeq ($(filter y, \
|
||||
$(CONFIG_LPC17_CODEREDL) \
|
||||
$(CONFIG_ARMV7M_TOOLCHAIN_CODEREDL) \
|
||||
),y)
|
||||
CONFIG_ARMV7M_TOOLCHAIN ?= CODEREDL
|
||||
endif
|
||||
ifeq ($(filter y, \
|
||||
$(CONFIG_LPC17_CODEREDW) \
|
||||
$(CONFIG_LPC43_CODEREDW) \
|
||||
$(CONFIG_ARMV7M_TOOLCHAIN_CODEREDW) \
|
||||
),y)
|
||||
CONFIG_ARMV7M_TOOLCHAIN ?= CODEREDW
|
||||
endif
|
||||
ifeq ($(filter y, \
|
||||
$(CONFIG_KINETIS_CODESOURCERYL) \
|
||||
$(CONFIG_LM3S_CODESOURCERYL) \
|
||||
$(CONFIG_LPC17_CODESOURCERYL) \
|
||||
$(CONFIG_LPC43_CODESOURCERYL) \
|
||||
$(CONFIG_SAM3U_CODESOURCERYL) \
|
||||
$(CONFIG_STM32_CODESOURCERYL) \
|
||||
$(CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL) \
|
||||
),y)
|
||||
CONFIG_ARMV7M_TOOLCHAIN ?= CODESOURCERYL
|
||||
endif
|
||||
ifeq ($(filter y, \
|
||||
$(CONFIG_KINETIS_CODESOURCERYW) \
|
||||
$(CONFIG_LM3S_CODESOURCERYW) \
|
||||
$(CONFIG_LPC17_CODESOURCERYW) \
|
||||
$(CONFIG_LPC43_CODESOURCERYW) \
|
||||
$(CONFIG_SAM3U_CODESOURCERYW) \
|
||||
$(CONFIG_STM32_CODESOURCERYW) \
|
||||
$(CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW) \
|
||||
),y)
|
||||
CONFIG_ARMV7M_TOOLCHAIN ?= CODESOURCERYW
|
||||
endif
|
||||
ifeq ($(filter y, \
|
||||
$(CONFIG_KINETIS_DEVKITARM) \
|
||||
$(CONFIG_LM3S_DEVKITARM) \
|
||||
$(CONFIG_LPC17_DEVKITARM) \
|
||||
$(CONFIG_LPC43_DEVKITARM) \
|
||||
$(CONFIG_SAM3U_DEVKITARM) \
|
||||
$(CONFIG_STM32_DEVKITARM) \
|
||||
$(CONFIG_ARMV7M_TOOLCHAIN_DEVKITARM) \
|
||||
),y)
|
||||
CONFIG_ARMV7M_TOOLCHAIN ?= DEVKITARM
|
||||
endif
|
||||
ifeq ($(filter y, \
|
||||
$(CONFIG_ARMV7M_TOOLCHAIN_GNU_EABI) \
|
||||
),y)
|
||||
CONFIG_ARMV7M_TOOLCHAIN ?= GNU_EABI
|
||||
endif
|
||||
ifeq ($(filter y, \
|
||||
$(CONFIG_STM32_RAISONANCE) \
|
||||
$(CONFIG_ARMV7M_TOOLCHAIN_RAISONANCE) \
|
||||
),y)
|
||||
CONFIG_ARMV7M_TOOLCHAIN ?= RAISONANCE
|
||||
endif
|
||||
|
||||
#
|
||||
# Supported toolchains
|
||||
#
|
||||
# TODO - It's likely that all of these toolchains now support the
|
||||
# CortexM4. Since they are all GCC-based, we could almost
|
||||
# certainly simplify this further.
|
||||
#
|
||||
# Each toolchain definition should set:
|
||||
#
|
||||
# CROSSDEV The GNU toolchain triple (command prefix)
|
||||
# ARCROSSDEV If required, an alternative prefix used when
|
||||
# invoking ar and nm.
|
||||
# ARCHCPUFLAGS CPU-specific flags selecting the instruction set
|
||||
# FPU options, etc.
|
||||
# MAXOPTIMIZATION The maximum optimization level that results in
|
||||
# reliable code generation.
|
||||
#
|
||||
|
||||
# Atollic toolchain under Windows
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),ATOLLIC)
|
||||
CROSSDEV = arm-atollic-eabi-
|
||||
ARCROSSDEV = arm-atollic-eabi-
|
||||
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
WINTOOL = y
|
||||
endif
|
||||
ifeq ($(CONFIG_ARCH_CORTEXM4),y)
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
|
||||
else
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfloat-abi=soft
|
||||
endif
|
||||
else ifeq ($(CONFIG_ARCH_CORTEXM3),y)
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
|
||||
endif
|
||||
endif
|
||||
|
||||
# NuttX buildroot under Linux or Cygwin
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),BUILDROOT)
|
||||
# OABI
|
||||
# CROSSDEV = arm-nuttx-elf-
|
||||
# ARCROSSDEV = arm-nuttx-elf-
|
||||
# ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
|
||||
# EABI
|
||||
CROSSDEV = arm-nuttx-eabi-
|
||||
ARCROSSDEV = arm-nuttx-eabi-
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
|
||||
MAXOPTIMIZATION = -Os
|
||||
endif
|
||||
|
||||
# Code Red RedSuite under Linux
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),CODEREDL)
|
||||
CROSSDEV = arm-none-eabi-
|
||||
ARCROSSDEV = arm-none-eabi-
|
||||
ifeq ($(CONFIG_ARCH_CORTEXM4),y)
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
|
||||
else
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfloat-abi=soft
|
||||
endif
|
||||
else ifeq ($(CONFIG_ARCH_CORTEXM3),y)
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
|
||||
endif
|
||||
endif
|
||||
|
||||
# Code Red RedSuite under Windows
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),CODEREDW)
|
||||
CROSSDEV = arm-none-eabi-
|
||||
ARCROSSDEV = arm-none-eabi-
|
||||
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
WINTOOL = y
|
||||
endif
|
||||
ifeq ($(CONFIG_ARCH_CORTEXM4),y)
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
|
||||
else
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfloat-abi=soft
|
||||
endif
|
||||
else ifeq ($(CONFIG_ARCH_CORTEXM3),y)
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
|
||||
endif
|
||||
endif
|
||||
|
||||
# CodeSourcery under Linux
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),CODESOURCERYL)
|
||||
CROSSDEV = arm-none-eabi-
|
||||
ARCROSSDEV = arm-none-eabi-
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
|
||||
MAXOPTIMIZATION = -O2
|
||||
endif
|
||||
|
||||
# CodeSourcery under Windows
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),CODESOURCERYW)
|
||||
CROSSDEV = arm-none-eabi-
|
||||
ARCROSSDEV = arm-none-eabi-
|
||||
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
WINTOOL = y
|
||||
endif
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
|
||||
endif
|
||||
|
||||
# devkitARM under Windows
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),DEVKITARM)
|
||||
CROSSDEV = arm-eabi-
|
||||
ARCROSSDEV = arm-eabi-
|
||||
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
WINTOOL = y
|
||||
endif
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
|
||||
endif
|
||||
|
||||
# Generic GNU EABI toolchain on OS X, Linux or any typical Posix system
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),GNU_EABI)
|
||||
CROSSDEV = arm-none-eabi-
|
||||
ARCROSSDEV = arm-none-eabi-
|
||||
MAXOPTIMIZATION = -O3
|
||||
ifeq ($(CONFIG_ARCH_CORTEXM4),y)
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
|
||||
else
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfloat-abi=soft
|
||||
endif
|
||||
else ifeq ($(CONFIG_ARCH_CORTEXM3),y)
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
|
||||
endif
|
||||
endif
|
||||
|
||||
# Raisonance RIDE7 under Windows
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),RAISONANCE)
|
||||
CROSSDEV = arm-none-eabi-
|
||||
ARCROSSDEV = arm-none-eabi-
|
||||
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
WINTOOL = y
|
||||
endif
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
|
||||
endif
|
|
@ -0,0 +1,450 @@
|
|||
/****************************************************************************
|
||||
* arch/arm/src/armv7-m/up_elf.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <elf32.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <arch/elf.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/binfmt/elf.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: arch_checkarch
|
||||
*
|
||||
* Description:
|
||||
* Given the ELF header in 'hdr', verify that the ELF file is appropriate
|
||||
* for the current, configured architecture. Every architecture that uses
|
||||
* the ELF loader must provide this function.
|
||||
*
|
||||
* Input Parameters:
|
||||
* hdr - The ELF header read from the ELF file.
|
||||
*
|
||||
* Returned Value:
|
||||
* True if the architecture supports this ELF file.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
bool arch_checkarch(FAR const Elf32_Ehdr *ehdr)
|
||||
{
|
||||
/* Make sure it's an ARM executable */
|
||||
|
||||
if (ehdr->e_machine != EM_ARM)
|
||||
{
|
||||
bdbg("Not for ARM: e_machine=%04x\n", ehdr->e_machine);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
/* Make sure that 32-bit objects are supported */
|
||||
|
||||
if (ehdr->e_ident[EI_CLASS] != ELFCLASS32)
|
||||
{
|
||||
bdbg("Need 32-bit objects: e_ident[EI_CLASS]=%02x\n", ehdr->e_ident[EI_CLASS]);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
/* Verify endian-ness */
|
||||
|
||||
#ifdef CONFIG_ENDIAN_BIG
|
||||
if (ehdr->e_ident[EI_DATA] != ELFDATA2MSB)
|
||||
#else
|
||||
if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB)
|
||||
#endif
|
||||
{
|
||||
bdbg("Wrong endian-ness: e_ident[EI_DATA]=%02x\n", ehdr->e_ident[EI_DATA]);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
/* TODO: Check ABI here. */
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: arch_relocate and arch_relocateadd
|
||||
*
|
||||
* Description:
|
||||
* Perform on architecture-specific ELF relocation. Every architecture
|
||||
* that uses the ELF loader must provide this function.
|
||||
*
|
||||
* Input Parameters:
|
||||
* rel - The relocation type
|
||||
* sym - The ELF symbol structure containing the fully resolved value.
|
||||
* addr - The address that requires the relocation.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) if the relocation was successful. Otherwise, a negated errno
|
||||
* value indicating the cause of the relocation failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int arch_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
|
||||
uintptr_t addr)
|
||||
{
|
||||
int32_t offset;
|
||||
uint32_t upper_insn;
|
||||
uint32_t lower_insn;
|
||||
|
||||
switch (ELF32_R_TYPE(rel->r_info))
|
||||
{
|
||||
case R_ARM_NONE:
|
||||
{
|
||||
/* No relocation */
|
||||
}
|
||||
break;
|
||||
|
||||
case R_ARM_PC24:
|
||||
case R_ARM_CALL:
|
||||
case R_ARM_JUMP24:
|
||||
{
|
||||
bvdbg("Performing PC24 [%d] link at addr %08lx [%08lx] to sym '%s' st_value=%08lx\n",
|
||||
ELF32_R_TYPE(rel->r_info), (long)addr, (long)(*(uint32_t*)addr),
|
||||
sym, (long)sym->st_value);
|
||||
|
||||
offset = (*(uint32_t*)addr & 0x00ffffff) << 2;
|
||||
if (offset & 0x02000000)
|
||||
{
|
||||
offset -= 0x04000000;
|
||||
}
|
||||
|
||||
offset += sym->st_value - addr;
|
||||
if (offset & 3 || offset <= (int32_t) 0xfe000000 || offset >= (int32_t) 0x02000000)
|
||||
{
|
||||
bdbg(" ERROR: PC24 [%d] relocation out of range, offset=%08lx\n",
|
||||
ELF32_R_TYPE(rel->r_info), offset);
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
offset >>= 2;
|
||||
|
||||
*(uint32_t*)addr &= 0xff000000;
|
||||
*(uint32_t*)addr |= offset & 0x00ffffff;
|
||||
}
|
||||
break;
|
||||
|
||||
case R_ARM_ABS32:
|
||||
case R_ARM_TARGET1: /* New ABI: TARGET1 always treated as ABS32 */
|
||||
{
|
||||
bvdbg("Performing ABS32 link at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n",
|
||||
(long)addr, (long)(*(uint32_t*)addr), sym, (long)sym->st_value);
|
||||
|
||||
*(uint32_t*)addr += sym->st_value;
|
||||
}
|
||||
break;
|
||||
|
||||
case R_ARM_THM_CALL:
|
||||
case R_ARM_THM_JUMP24:
|
||||
{
|
||||
uint32_t S;
|
||||
uint32_t J1;
|
||||
uint32_t J2;
|
||||
|
||||
/* Thumb BL and B.W instructions. Encoding:
|
||||
*
|
||||
* upper_insn:
|
||||
*
|
||||
* 1 1 1 1 1 1
|
||||
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
||||
* +----------+---+-------------------------------+--------------+
|
||||
* |1 1 1 |OP1| OP2 | | 32-Bit Instructions
|
||||
* +----------+---+--+-----+----------------------+--------------+
|
||||
* |1 1 1 | 1 0| S | imm10 | BL Instruction
|
||||
* +----------+------+-----+-------------------------------------+
|
||||
*
|
||||
* lower_insn:
|
||||
*
|
||||
* 1 1 1 1 1 1
|
||||
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
||||
* +---+---------------------------------------------------------+
|
||||
* |OP | | 32-Bit Instructions
|
||||
* +---+--+---+---+---+------------------------------------------+
|
||||
* |1 1 |J1 | 1 |J2 | imm11 | BL Instruction
|
||||
* +------+---+---+---+------------------------------------------+
|
||||
*
|
||||
* The branch target is encoded in these bits:
|
||||
*
|
||||
* S = upper_insn[10]
|
||||
* imm10 = upper_insn[0:9]
|
||||
* imm11 = lower_insn[0:10]
|
||||
* J1 = lower_insn[13]
|
||||
* J2 = lower_insn[11]
|
||||
*/
|
||||
|
||||
upper_insn = (uint32_t)(*(uint16_t*)addr);
|
||||
lower_insn = (uint32_t)(*(uint16_t*)(addr + 2));
|
||||
|
||||
bvdbg("Performing THM_JUMP24 [%d] link at addr=%08lx [%04x %04x] to sym=%p st_value=%08lx\n",
|
||||
ELF32_R_TYPE(rel->r_info), (long)addr, (int)upper_insn, (int)lower_insn,
|
||||
sym, (long)sym->st_value);
|
||||
|
||||
/* Extract the 25-bit offset from the 32-bit instruction:
|
||||
*
|
||||
* offset[24] = S
|
||||
* offset[23] = ~(J1 ^ S)
|
||||
* offset[22] = ~(J2 ^ S)]
|
||||
* offset[12:21] = imm10
|
||||
* offset[1:11] = imm11
|
||||
* offset[0] = 0
|
||||
*/
|
||||
|
||||
S = (upper_insn >> 10) & 1;
|
||||
J1 = (lower_insn >> 13) & 1;
|
||||
J2 = (lower_insn >> 11) & 1;
|
||||
|
||||
offset = (S << 24) | /* S - > offset[24] */
|
||||
((~(J1 ^ S) & 1) << 23) | /* J1 -> offset[23] */
|
||||
((~(J2 ^ S) & 1) << 22) | /* J2 -> offset[22] */
|
||||
((upper_insn & 0x03ff) << 12) | /* imm10 -> offset[12:21] */
|
||||
((lower_insn & 0x07ff) << 1); /* imm11 -> offset[1:11] */
|
||||
/* 0 -> offset[0] */
|
||||
|
||||
/* Sign extend */
|
||||
|
||||
if (offset & 0x01000000)
|
||||
{
|
||||
offset -= 0x02000000;
|
||||
}
|
||||
|
||||
/* And perform the relocation */
|
||||
|
||||
bvdbg(" S=%d J1=%d J2=%d offset=%08lx branch target=%08lx\n",
|
||||
S, J1, J2, (long)offset, offset + sym->st_value - addr);
|
||||
|
||||
offset += sym->st_value - addr;
|
||||
|
||||
/* Is this a function symbol? If so, then the branch target must be
|
||||
* an odd Thumb address
|
||||
*/
|
||||
|
||||
if (ELF32_ST_TYPE(sym->st_info) == STT_FUNC && (offset & 1) == 0)
|
||||
{
|
||||
bdbg(" ERROR: JUMP24 [%d] requires odd offset, offset=%08lx\n",
|
||||
ELF32_R_TYPE(rel->r_info), offset);
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Check the range of the offset */
|
||||
|
||||
if (offset <= (int32_t)0xff000000 || offset >= (int32_t)0x01000000)
|
||||
{
|
||||
bdbg(" ERROR: JUMP24 [%d] relocation out of range, branch taget=%08lx\n",
|
||||
ELF32_R_TYPE(rel->r_info), offset);
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Now, reconstruct the 32-bit instruction using the new, relocated
|
||||
* branch target.
|
||||
*/
|
||||
|
||||
S = (offset >> 24) & 1;
|
||||
J1 = S ^ (~(offset >> 23) & 1);
|
||||
J2 = S ^ (~(offset >> 22) & 1);
|
||||
|
||||
upper_insn = ((upper_insn & 0xf800) | (S << 10) | ((offset >> 12) & 0x03ff));
|
||||
*(uint16_t*)addr = (uint16_t)upper_insn;
|
||||
|
||||
lower_insn = ((lower_insn & 0xd000) | (J1 << 13) | (J2 << 11) | ((offset >> 1) & 0x07ff));
|
||||
*(uint16_t*)(addr + 2) = (uint16_t)lower_insn;
|
||||
|
||||
bvdbg(" S=%d J1=%d J2=%d insn [%04x %04x]\n",
|
||||
S, J1, J2, (int)upper_insn, (int)lower_insn);
|
||||
}
|
||||
break;
|
||||
|
||||
case R_ARM_V4BX:
|
||||
{
|
||||
bvdbg("Performing V4BX link at addr=%08lx [%08lx]\n",
|
||||
(long)addr, (long)(*(uint32_t*)addr));
|
||||
|
||||
/* Preserve only Rm and the condition code */
|
||||
|
||||
*(uint32_t*)addr &= 0xf000000f;
|
||||
|
||||
/* Change instruction to 'mov pc, Rm' */
|
||||
|
||||
*(uint32_t*)addr |= 0x01a0f000;
|
||||
}
|
||||
break;
|
||||
|
||||
case R_ARM_PREL31:
|
||||
{
|
||||
bvdbg("Performing PREL31 link at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n",
|
||||
(long)addr, (long)(*(uint32_t*)addr), sym, (long)sym->st_value);
|
||||
|
||||
offset = *(uint32_t*)addr + sym->st_value - addr;
|
||||
*(uint32_t*)addr = offset & 0x7fffffff;
|
||||
}
|
||||
break;
|
||||
|
||||
case R_ARM_MOVW_ABS_NC:
|
||||
case R_ARM_MOVT_ABS:
|
||||
{
|
||||
bvdbg("Performing MOVx_ABS [%d] link at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n",
|
||||
ELF32_R_TYPE(rel->r_info), (long)addr, (long)(*(uint32_t*)addr),
|
||||
sym, (long)sym->st_value);
|
||||
|
||||
offset = *(uint32_t*)addr;
|
||||
offset = ((offset & 0xf0000) >> 4) | (offset & 0xfff);
|
||||
offset = (offset ^ 0x8000) - 0x8000;
|
||||
|
||||
offset += sym->st_value;
|
||||
if (ELF32_R_TYPE(rel->r_info) == R_ARM_MOVT_ABS)
|
||||
{
|
||||
offset >>= 16;
|
||||
}
|
||||
|
||||
*(uint32_t*)addr &= 0xfff0f000;
|
||||
*(uint32_t*)addr |= ((offset & 0xf000) << 4) | (offset & 0x0fff);
|
||||
}
|
||||
break;
|
||||
|
||||
case R_ARM_THM_MOVW_ABS_NC:
|
||||
case R_ARM_THM_MOVT_ABS:
|
||||
{
|
||||
/* Thumb BL and B.W instructions. Encoding:
|
||||
*
|
||||
* upper_insn:
|
||||
*
|
||||
* 1 1 1 1 1 1
|
||||
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
||||
* +----------+---+-------------------------------+--------------+
|
||||
* |1 1 1 |OP1| OP2 | | 32-Bit Instructions
|
||||
* +----------+---+--+-----+----------------------+--------------+
|
||||
* |1 1 1 | 1 0| i | 1 0 1 1 0 0 | imm4 | MOVT Instruction
|
||||
* +----------+------+-----+----------------------+--------------+
|
||||
*
|
||||
* lower_insn:
|
||||
*
|
||||
* 1 1 1 1 1 1
|
||||
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
||||
* +---+---------------------------------------------------------+
|
||||
* |OP | | 32-Bit Instructions
|
||||
* +---+----------+--------------+-------------------------------+
|
||||
* |0 | imm3 | Rd | imm8 | MOVT Instruction
|
||||
* +---+----------+--------------+-------------------------------+
|
||||
*
|
||||
* The 16-bit immediate value is encoded in these bits:
|
||||
*
|
||||
* i = imm16[11] = upper_insn[10]
|
||||
* imm4 = imm16[12:15] = upper_insn[3:0]
|
||||
* imm3 = imm16[8:10] = lower_insn[14:12]
|
||||
* imm8 = imm16[0:7] = lower_insn[7:0]
|
||||
*/
|
||||
|
||||
upper_insn = (uint32_t)(*(uint16_t*)addr);
|
||||
lower_insn = (uint32_t)(*(uint16_t*)(addr + 2));
|
||||
|
||||
bvdbg("Performing THM_MOVx [%d] link at addr=%08lx [%04x %04x] to sym=%p st_value=%08lx\n",
|
||||
ELF32_R_TYPE(rel->r_info), (long)addr, (int)upper_insn, (int)lower_insn,
|
||||
sym, (long)sym->st_value);
|
||||
|
||||
/* Extract the 16-bit offset from the 32-bit instruction */
|
||||
|
||||
offset = ((upper_insn & 0x000f) << 12) | /* imm4 -> imm16[8:10] */
|
||||
((upper_insn & 0x0400) << 1) | /* i -> imm16[11] */
|
||||
((lower_insn & 0x7000) >> 4) | /* imm3 -> imm16[8:10] */
|
||||
(lower_insn & 0x00ff); /* imm8 -> imm16[0:7] */
|
||||
|
||||
/* Sign extend */
|
||||
|
||||
offset = (offset ^ 0x8000) - 0x8000;
|
||||
|
||||
/* And perform the relocation */
|
||||
|
||||
bvdbg(" offset=%08lx branch target=%08lx\n",
|
||||
(long)offset, offset + sym->st_value);
|
||||
|
||||
offset += sym->st_value;
|
||||
|
||||
/* Update the immediate value in the instruction. For MOVW we want the bottom
|
||||
* 16-bits; for MOVT we want the top 16-bits.
|
||||
*/
|
||||
|
||||
if (ELF32_R_TYPE(rel->r_info) == R_ARM_THM_MOVT_ABS)
|
||||
{
|
||||
offset >>= 16;
|
||||
}
|
||||
|
||||
upper_insn = ((upper_insn & 0xfbf0) | ((offset & 0xf000) >> 12) | ((offset & 0x0800) >> 1));
|
||||
*(uint16_t*)addr = (uint16_t)upper_insn;
|
||||
|
||||
lower_insn = ((lower_insn & 0x8f00) | ((offset & 0x0700) << 4) | (offset & 0x00ff));
|
||||
*(uint16_t*)(addr + 2) = (uint16_t)lower_insn;
|
||||
|
||||
bvdbg(" insn [%04x %04x]\n",
|
||||
(int)upper_insn, (int)lower_insn);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
bdbg("Unsupported relocation: %d\n", ELF32_R_TYPE(rel->r_info));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int arch_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym,
|
||||
uintptr_t addr)
|
||||
{
|
||||
bdbg("RELA relocation not supported\n");
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
|
@ -134,9 +134,9 @@ exception_common:
|
|||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
ldr sp, =g_intstackbase
|
||||
push r1 /* Save the MSP on the interrupt stack */
|
||||
push {r1} /* Save the MSP on the interrupt stack */
|
||||
bl up_doirq /* R0=IRQ, R1=register save area on stack */
|
||||
pop r1 /* Recover R1=main stack pointer */
|
||||
pop {r1} /* Recover R1=main stack pointer */
|
||||
#else
|
||||
msr msp, r1 /* We are using the main stack pointer */
|
||||
bl up_doirq /* R0=IRQ, R1=register save area on stack */
|
||||
|
|
|
@ -57,9 +57,7 @@
|
|||
|
||||
/* Debug output from this file may interfere with context switching! */
|
||||
|
||||
#undef DEBUG_HARDFAULTS /* Define to debug hard faults */
|
||||
|
||||
#ifdef DEBUG_HARDFAULTS
|
||||
#ifdef CONFIG_DEBUG_HARDFAULT
|
||||
# define hfdbg(format, arg...) lldbg(format, ##arg)
|
||||
#else
|
||||
# define hfdbg(x...)
|
||||
|
|
|
@ -0,0 +1,416 @@
|
|||
/************************************************************************************
|
||||
* nuttx/arch/arm/src/armv7-m/up_memcpy.S
|
||||
*
|
||||
* armv7m-optimised memcpy, contributed by Mike Smith. Apparently in the public
|
||||
* domain and is re-released here under the modified BSD license:
|
||||
*
|
||||
* Obtained via a posting on the Stellaris forum:
|
||||
* http://e2e.ti.com/support/microcontrollers/\
|
||||
* stellaris_arm_cortex-m3_microcontroller/f/473/t/44360.aspx
|
||||
*
|
||||
* Posted by rocksoft on Jul 24, 2008 10:19 AM
|
||||
*
|
||||
* Hi,
|
||||
*
|
||||
* I recently finished a "memcpy" replacement and thought it might be useful for
|
||||
* others...
|
||||
*
|
||||
* I've put some instructions and the code here:
|
||||
*
|
||||
* http://www.rock-software.net/downloads/memcpy/
|
||||
*
|
||||
* Hope it works for you as well as it did for me.
|
||||
*
|
||||
* Liam.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Global Symbols
|
||||
************************************************************************************/
|
||||
|
||||
.global memcpy
|
||||
|
||||
.syntax unified
|
||||
.thumb
|
||||
.cpu cortex-m3
|
||||
.file "up_memcpy.S"
|
||||
|
||||
/************************************************************************************
|
||||
* .text
|
||||
************************************************************************************/
|
||||
|
||||
.text
|
||||
|
||||
/************************************************************************************
|
||||
* Private Constant Data
|
||||
************************************************************************************/
|
||||
|
||||
/* We have 16 possible alignment combinations of src and dst, this jump table
|
||||
* directs the copy operation
|
||||
*
|
||||
* Bits: Src=00, Dst=00 - Long to Long copy
|
||||
* Bits: Src=00, Dst=01 - Long to Byte before half word
|
||||
* Bits: Src=00, Dst=10 - Long to Half word
|
||||
* Bits: Src=00, Dst=11 - Long to Byte before long word
|
||||
* Bits: Src=01, Dst=00 - Byte before half word to long
|
||||
* Bits: Src=01, Dst=01 - Byte before half word to byte before half word -
|
||||
* Same alignment
|
||||
* Bits: Src=01, Dst=10 - Byte before half word to half word
|
||||
* Bits: Src=01, Dst=11 - Byte before half word to byte before long word
|
||||
* Bits: Src=10, Dst=00 - Half word to long word
|
||||
* Bits: Src=10, Dst=01 - Half word to byte before half word
|
||||
* Bits: Src=10, Dst=10 - Half word to half word - Same Alignment
|
||||
* Bits: Src=10, Dst=11 - Half word to byte before long word
|
||||
* Bits: Src=11, Dst=00 - Byte before long word to long word
|
||||
* Bits: Src=11, Dst=01 - Byte before long word to byte before half word
|
||||
* Bits: Src=11, Dst=11 - Byte before long word to half word
|
||||
* Bits: Src=11, Dst=11 - Byte before long word to Byte before long word -
|
||||
* Same alignment
|
||||
*/
|
||||
|
||||
MEM_DataCopyTable:
|
||||
.byte (MEM_DataCopy0 - MEM_DataCopyJump) >> 1
|
||||
.byte (MEM_DataCopy1 - MEM_DataCopyJump) >> 1
|
||||
.byte (MEM_DataCopy2 - MEM_DataCopyJump) >> 1
|
||||
.byte (MEM_DataCopy3 - MEM_DataCopyJump) >> 1
|
||||
.byte (MEM_DataCopy4 - MEM_DataCopyJump) >> 1
|
||||
.byte (MEM_DataCopy5 - MEM_DataCopyJump) >> 1
|
||||
.byte (MEM_DataCopy6 - MEM_DataCopyJump) >> 1
|
||||
.byte (MEM_DataCopy7 - MEM_DataCopyJump) >> 1
|
||||
.byte (MEM_DataCopy8 - MEM_DataCopyJump) >> 1
|
||||
.byte (MEM_DataCopy9 - MEM_DataCopyJump) >> 1
|
||||
.byte (MEM_DataCopy10 - MEM_DataCopyJump) >> 1
|
||||
.byte (MEM_DataCopy11 - MEM_DataCopyJump) >> 1
|
||||
.byte (MEM_DataCopy12 - MEM_DataCopyJump) >> 1
|
||||
.byte (MEM_DataCopy13 - MEM_DataCopyJump) >> 1
|
||||
.byte (MEM_DataCopy14 - MEM_DataCopyJump) >> 1
|
||||
.byte (MEM_DataCopy15 - MEM_DataCopyJump) >> 1
|
||||
|
||||
.align 2
|
||||
|
||||
MEM_LongCopyTable:
|
||||
.byte (MEM_LongCopyEnd - MEM_LongCopyJump) >> 1 /* 0 bytes left */
|
||||
.byte 0 /* 4 bytes left */
|
||||
.byte (1 * 10) >> 1 /* 8 bytes left */
|
||||
.byte (2 * 10) >> 1 /* 12 bytes left */
|
||||
.byte (3 * 10) >> 1 /* 16 bytes left */
|
||||
.byte (4 * 10) >> 1 /* 20 bytes left */
|
||||
.byte (5 * 10) >> 1 /* 24 bytes left */
|
||||
.byte (6 * 10) >> 1 /* 28 bytes left */
|
||||
.byte (7 * 10) >> 1 /* 32 bytes left */
|
||||
.byte (8 * 10) >> 1 /* 36 bytes left */
|
||||
|
||||
.align 2
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
/************************************************************************************
|
||||
* Name: memcpy
|
||||
*
|
||||
* Description:
|
||||
* Optimised "general" copy routine
|
||||
*
|
||||
* Input Parameters:
|
||||
* r0 = destination, r1 = source, r2 = length
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
.thumb_func
|
||||
memcpy:
|
||||
push {r14}
|
||||
|
||||
/* This allows the inner workings to "assume" a minimum amount of bytes */
|
||||
/* Quickly check for very short copies */
|
||||
|
||||
cmp r2, #4
|
||||
blt MEM_DataCopyBytes
|
||||
|
||||
and r14, r0, #3 /* Get destination alignment bits */
|
||||
bfi r14, r1, #2, #2 /* Get source alignment bits */
|
||||
ldr r3, =MEM_DataCopyTable /* Jump table base */
|
||||
tbb [r3, r14] /* Perform jump on src/dst alignment bits */
|
||||
MEM_DataCopyJump:
|
||||
|
||||
.align 4
|
||||
|
||||
/* Bits: Src=01, Dst=01 - Byte before half word to byte before half word - Same alignment
|
||||
* 3 bytes to read for long word aligning
|
||||
*/
|
||||
|
||||
MEM_DataCopy5:
|
||||
ldrb r3, [r1], #0x01
|
||||
strb r3, [r0], #0x01
|
||||
sub r2, r2, #0x01
|
||||
|
||||
/* Bits: Src=10, Dst=10 - Half word to half word - Same Alignment
|
||||
* 2 bytes to read for long word aligning
|
||||
*/
|
||||
|
||||
MEM_DataCopy10:
|
||||
ldrb r3, [r1], #0x01
|
||||
strb r3, [r0], #0x01
|
||||
sub r2, r2, #0x01
|
||||
|
||||
/* Bits: Src=11, Dst=11 - Byte before long word to Byte before long word - Same alignment
|
||||
* 1 bytes to read for long word aligning
|
||||
*/
|
||||
|
||||
MEM_DataCopy15:
|
||||
ldrb r3, [r1], #0x01
|
||||
strb r3, [r0], #0x01
|
||||
sub r2, r2, #0x01
|
||||
|
||||
/* Bits: Src=00, Dst=00 - Long to Long copy */
|
||||
|
||||
MEM_DataCopy0:
|
||||
/* Save regs that may be used by memcpy */
|
||||
|
||||
push {r4-r12}
|
||||
|
||||
/* Check for short word-aligned copy */
|
||||
|
||||
cmp r2, #0x28
|
||||
blt MEM_DataCopy0_2
|
||||
|
||||
/* Bulk copy loop */
|
||||
|
||||
MEM_DataCopy0_1:
|
||||
ldmia r1!, {r3-r12}
|
||||
stmia r0!, {r3-r12}
|
||||
sub r2, r2, #0x28
|
||||
cmp r2, #0x28
|
||||
bge MEM_DataCopy0_1
|
||||
|
||||
/* Copy remaining long words */
|
||||
|
||||
MEM_DataCopy0_2:
|
||||
/* Copy remaining long words */
|
||||
|
||||
ldr r14, =MEM_LongCopyTable
|
||||
lsr r11, r2, #0x02
|
||||
tbb [r14, r11]
|
||||
|
||||
/* longword copy branch table anchor */
|
||||
|
||||
MEM_LongCopyJump:
|
||||
ldr.w r3, [r1], #0x04 /* 4 bytes remain */
|
||||
str.w r3, [r0], #0x04
|
||||
b MEM_LongCopyEnd
|
||||
ldmia.w r1!, {r3-r4} /* 8 bytes remain */
|
||||
stmia.w r0!, {r3-r4}
|
||||
b MEM_LongCopyEnd
|
||||
ldmia.w r1!, {r3-r5} /* 12 bytes remain */
|
||||
stmia.w r0!, {r3-r5}
|
||||
b MEM_LongCopyEnd
|
||||
ldmia.w r1!, {r3-r6} /* 16 bytes remain */
|
||||
stmia.w r0!, {r3-r6}
|
||||
b MEM_LongCopyEnd
|
||||
ldmia.w r1!, {r3-r7} /* 20 bytes remain */
|
||||
stmia.w r0!, {r3-r7}
|
||||
b MEM_LongCopyEnd
|
||||
ldmia.w r1!, {r3-r8} /* 24 bytes remain */
|
||||
stmia.w r0!, {r3-r8}
|
||||
b MEM_LongCopyEnd
|
||||
ldmia.w r1!, {r3-r9} /* 28 bytes remain */
|
||||
stmia.w r0!, {r3-r9}
|
||||
b MEM_LongCopyEnd
|
||||
ldmia.w r1!, {r3-r10} /* 32 bytes remain */
|
||||
stmia.w r0!, {r3-r10}
|
||||
b MEM_LongCopyEnd
|
||||
ldmia.w r1!, {r3-r11} /* 36 bytes remain */
|
||||
stmia.w r0!, {r3-r11}
|
||||
|
||||
MEM_LongCopyEnd:
|
||||
pop {r4-r12}
|
||||
and r2, r2, #0x03 /* All the longs have been copied */
|
||||
|
||||
/* Deal with up to 3 remaining bytes */
|
||||
|
||||
MEM_DataCopyBytes:
|
||||
/* Deal with up to 3 remaining bytes */
|
||||
|
||||
cmp r2, #0x00
|
||||
it eq
|
||||
popeq {pc}
|
||||
ldrb r3, [r1], #0x01
|
||||
strb r3, [r0], #0x01
|
||||
subs r2, r2, #0x01
|
||||
it eq
|
||||
popeq {pc}
|
||||
ldrb r3, [r1], #0x01
|
||||
strb r3, [r0], #0x01
|
||||
subs r2, r2, #0x01
|
||||
it eq
|
||||
popeq {pc}
|
||||
ldrb r3, [r1], #0x01
|
||||
strb r3, [r0], #0x01
|
||||
pop {pc}
|
||||
|
||||
.align 4
|
||||
|
||||
/* Bits: Src=01, Dst=11 - Byte before half word to byte before long word
|
||||
* 3 bytes to read for long word aligning the source
|
||||
*/
|
||||
|
||||
MEM_DataCopy7:
|
||||
ldrb r3, [r1], #0x01
|
||||
strb r3, [r0], #0x01
|
||||
sub r2, r2, #0x01
|
||||
|
||||
/* Bits: Src=10, Dst=00 - Half word to long word
|
||||
* 2 bytes to read for long word aligning the source
|
||||
*/
|
||||
|
||||
MEM_DataCopy8:
|
||||
ldrb r3, [r1], #0x01
|
||||
strb r3, [r0], #0x01
|
||||
sub r2, r2, #0x01
|
||||
|
||||
/* Bits: Src=11, Dst=01 - Byte before long word to byte before half word
|
||||
* 1 byte to read for long word aligning the source
|
||||
*/
|
||||
|
||||
MEM_DataCopy13:
|
||||
ldrb r3, [r1], #0x01
|
||||
strb r3, [r0], #0x01
|
||||
sub r2, r2, #0x01
|
||||
|
||||
/* Bits: Src=00, Dst=10 - Long to Half word */
|
||||
|
||||
MEM_DataCopy2:
|
||||
cmp r2, #0x28
|
||||
blt MEM_DataCopy2_1
|
||||
|
||||
/* Save regs */
|
||||
|
||||
push {r4-r12}
|
||||
|
||||
/* Bulk copy loop */
|
||||
|
||||
MEM_DataCopy2_2:
|
||||
ldmia r1!, {r3-r12}
|
||||
|
||||
strh r3, [r0], #0x02
|
||||
|
||||
lsr r3, r3, #0x10
|
||||
bfi r3, r4, #0x10, #0x10
|
||||
lsr r4, r4, #0x10
|
||||
bfi r4, r5, #0x10, #0x10
|
||||
lsr r5, r5, #0x10
|
||||
bfi r5, r6, #0x10, #0x10
|
||||
lsr r6, r6, #0x10
|
||||
bfi r6, r7, #0x10, #0x10
|
||||
lsr r7, r7, #0x10
|
||||
bfi r7, r8, #0x10, #0x10
|
||||
lsr r8, r8, #0x10
|
||||
bfi r8, r9, #0x10, #0x10
|
||||
lsr r9, r9, #0x10
|
||||
bfi r9, r10, #0x10, #0x10
|
||||
lsr r10, r10, #0x10
|
||||
bfi r10, r11, #0x10, #0x10
|
||||
lsr r11, r11, #0x10
|
||||
bfi r11, r12, #0x10, #0x10
|
||||
stmia r0!, {r3-r11}
|
||||
lsr r12, r12, #0x10
|
||||
strh r12, [r0], #0x02
|
||||
|
||||
sub r2, r2, #0x28
|
||||
cmp r2, #0x28
|
||||
bge MEM_DataCopy2_2
|
||||
pop {r4-r12}
|
||||
|
||||
MEM_DataCopy2_1: /* Read longs and write 2 x half words */
|
||||
cmp r2, #4
|
||||
blt MEM_DataCopyBytes
|
||||
ldr r3, [r1], #0x04
|
||||
strh r3, [r0], #0x02
|
||||
lsr r3, r3, #0x10
|
||||
strh r3, [r0], #0x02
|
||||
sub r2, r2, #0x04
|
||||
b MEM_DataCopy2
|
||||
|
||||
/* Bits: Src=01, Dst=00 - Byte before half word to long
|
||||
* Bits: Src=01, Dst=10 - Byte before half word to half word
|
||||
* 3 bytes to read for long word aligning the source
|
||||
*/
|
||||
|
||||
MEM_DataCopy4:
|
||||
MEM_DataCopy6:
|
||||
/* Read B and write B */
|
||||
|
||||
ldrb r3, [r1], #0x01
|
||||
strb r3, [r0], #0x01
|
||||
sub r2, r2, #0x01
|
||||
|
||||
/* Bits: Src=10, Dst=01 - Half word to byte before half word
|
||||
* Bits: Src=10, Dst=11 - Half word to byte before long word
|
||||
* 2 bytes to read for long word aligning the source
|
||||
*/
|
||||
|
||||
MEM_DataCopy9:
|
||||
MEM_DataCopy11:
|
||||
ldrb r3, [r1], #0x01
|
||||
strb r3, [r0], #0x01
|
||||
sub r2, r2, #0x01
|
||||
|
||||
/* Bits: Src=11, Dst=00 -chm Byte before long word to long word
|
||||
* Bits: Src=11, Dst=11 - Byte before long word to half word
|
||||
* 1 byte to read for long word aligning the source
|
||||
*/
|
||||
|
||||
MEM_DataCopy12:
|
||||
MEM_DataCopy14:
|
||||
/* Read B and write B */
|
||||
|
||||
ldrb r3, [r1], #0x01
|
||||
strb r3, [r0], #0x01
|
||||
sub r2, r2, #0x01
|
||||
|
||||
/* Bits: Src=00, Dst=01 - Long to Byte before half word
|
||||
* Bits: Src=00, Dst=11 - Long to Byte before long word
|
||||
*/
|
||||
|
||||
MEM_DataCopy1: /* Read longs, write B->H->B */
|
||||
MEM_DataCopy3:
|
||||
cmp r2, #4
|
||||
blt MEM_DataCopyBytes
|
||||
ldr r3, [r1], #0x04
|
||||
strb r3, [r0], #0x01
|
||||
lsr r3, r3, #0x08
|
||||
strh r3, [r0], #0x02
|
||||
lsr r3, r3, #0x10
|
||||
strb r3, [r0], #0x01
|
||||
sub r2, r2, #0x04
|
||||
b MEM_DataCopy3
|
||||
|
||||
.size memcpy, .-memcpy
|
||||
.end
|
|
@ -0,0 +1,379 @@
|
|||
/****************************************************************************
|
||||
* Driver for Calypso keypad hardware
|
||||
*
|
||||
* Copyright (C) 2011 Stefan Richter. All rights reserved.
|
||||
* Author: Stefan Richter <ichgeh@l--putt.de>
|
||||
*
|
||||
* 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 <nuttx/config.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <semaphore.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sched.h>
|
||||
|
||||
#include <arch/calypso/defines.h>
|
||||
#include <arch/calypso/memory.h>
|
||||
#include <arch/calypso/timer.h>
|
||||
|
||||
/****************************************************************************
|
||||
* HW access
|
||||
****************************************************************************/
|
||||
|
||||
#define BASE_ADDR_ARMIO 0xfffe4800
|
||||
#define ARMIO_REG(x) ((void *)BASE_ADDR_ARMIO + (x))
|
||||
|
||||
enum armio_reg
|
||||
{
|
||||
LATCH_IN = 0x00,
|
||||
LATCH_OUT = 0x02,
|
||||
IO_CNTL = 0x04,
|
||||
CNTL_REG = 0x06,
|
||||
LOAD_TIM = 0x08,
|
||||
KBR_LATCH_REG = 0x0a,
|
||||
KBC_REG = 0x0c,
|
||||
BUZZ_LIGHT_REG = 0x0e,
|
||||
LIGHT_LEVEL = 0x10,
|
||||
BUZZER_LEVEL = 0x12,
|
||||
GPIO_EVENT_MODE = 0x14,
|
||||
KBD_GPIO_INT = 0x16,
|
||||
KBD_GPIO_MASKIT = 0x18,
|
||||
GPIO_DEBOUNCING = 0x1a,
|
||||
GPIO_LATCH = 0x1c,
|
||||
};
|
||||
|
||||
#define KBD_INT (1 << 0)
|
||||
#define GPIO_INT (1 << 1)
|
||||
|
||||
/****************************************************************************
|
||||
* Decoder functions for matrix and power button
|
||||
****************************************************************************/
|
||||
|
||||
static int btn_dec(uint32_t * btn_state, uint8_t col, uint8_t reg,
|
||||
char *buf, size_t buflen, size_t * len)
|
||||
{
|
||||
uint8_t diff = (*btn_state ^ reg) & 0x1f;
|
||||
|
||||
while (diff)
|
||||
{
|
||||
uint8_t val = diff & ~(diff - 1);
|
||||
uint8_t sc = val >> 1;
|
||||
sc |= sc << 2;
|
||||
sc += col;
|
||||
sc += (sc & 0x20) ? 0x26 : 0x3f;
|
||||
|
||||
if (reg & val)
|
||||
{
|
||||
sc |= 0x20;
|
||||
}
|
||||
|
||||
/* Check for space in buffer and dispatch */
|
||||
|
||||
if (*len < buflen)
|
||||
{
|
||||
buf[(*len)++] = sc;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
/* Only change diff if dispatched/buffer not full */
|
||||
|
||||
diff ^= val;
|
||||
}
|
||||
|
||||
/* Store new state of the buttons (but only if they where dispatch) */
|
||||
|
||||
*btn_state >>= 5;
|
||||
#ifdef INCLUDE_ALL_COLS
|
||||
*btn_state |= (reg ^ diff) << 20;
|
||||
#else
|
||||
*btn_state |= (reg ^ diff) << 15;
|
||||
#endif
|
||||
return diff;
|
||||
}
|
||||
|
||||
static int pwr_btn_dec(uint32_t * state, uint8_t reg, char *buf, size_t * len)
|
||||
{
|
||||
if (reg)
|
||||
{
|
||||
/* Check for pressed power button. If pressed, ignore other
|
||||
* buttons since it collides with an entire row.
|
||||
*/
|
||||
|
||||
if (~*state & 0x80000000)
|
||||
{
|
||||
buf[0] = 'z';
|
||||
*len = 1;
|
||||
*state |= 0x80000000;
|
||||
}
|
||||
|
||||
return 1; // break loop in caller
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Check for released power button. */
|
||||
|
||||
if (*state & 0x80000000)
|
||||
{
|
||||
buf[0] = 'Z';
|
||||
*len = 1;
|
||||
|
||||
*state &= 0x7fffffff;
|
||||
|
||||
/* Don't scan others when released; might trigger
|
||||
* false keystrokes otherwise
|
||||
*/
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0; // continue with other columns
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Keypad: Fileops Prototypes and Structures
|
||||
****************************************************************************/
|
||||
|
||||
typedef FAR struct file file_t;
|
||||
|
||||
static int keypad_open(file_t * filep);
|
||||
static int keypad_close(file_t * filep);
|
||||
static ssize_t keypad_read(file_t * filep, FAR char *buffer, size_t buflen);
|
||||
#ifndef CONFIG_DISABLE_POLL
|
||||
static int keypad_poll(file_t * filep, FAR struct pollfd *fds, bool setup);
|
||||
#endif
|
||||
|
||||
static const struct file_operations keypad_ops =
|
||||
{
|
||||
keypad_open, /* open */
|
||||
keypad_close, /* close */
|
||||
keypad_read, /* read */
|
||||
0, /* write */
|
||||
0, /* seek */
|
||||
0, /* ioctl */
|
||||
#ifndef CONFIG_DISABLE_POLL
|
||||
keypad_poll /* poll */
|
||||
#endif
|
||||
};
|
||||
|
||||
static sem_t kbdsem;
|
||||
|
||||
/****************************************************************************
|
||||
* Keypad: Fileops
|
||||
****************************************************************************/
|
||||
|
||||
static int keypad_open(file_t * filep)
|
||||
{
|
||||
register uint16_t reg;
|
||||
|
||||
/* Unmask keypad interrupt */
|
||||
|
||||
reg = readw(ARMIO_REG(KBD_GPIO_MASKIT));
|
||||
writew(reg & ~KBD_INT, ARMIO_REG(KBD_GPIO_MASKIT));
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int keypad_close(file_t * filep)
|
||||
{
|
||||
register uint16_t reg;
|
||||
|
||||
/* Mask keypad interrupt */
|
||||
|
||||
reg = readw(ARMIO_REG(KBD_GPIO_MASKIT));
|
||||
writew(reg | KBD_INT, ARMIO_REG(KBD_GPIO_MASKIT));
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
static ssize_t keypad_read(file_t * filep, FAR char *buf, size_t buflen)
|
||||
{
|
||||
static uint32_t btn_state = 0;
|
||||
register uint16_t reg;
|
||||
uint16_t col, col_mask;
|
||||
size_t len = 0;
|
||||
|
||||
if (buf == NULL || buflen < 1)
|
||||
{
|
||||
/* Well... nothing to do */
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
retry:
|
||||
col = 1;
|
||||
col_mask = 0x1e;
|
||||
|
||||
if (!btn_state)
|
||||
{
|
||||
/* Drive all cols low such that all buttons cause events */
|
||||
|
||||
writew(0, ARMIO_REG(KBC_REG));
|
||||
|
||||
/* No button currently pressed, use IRQ */
|
||||
|
||||
reg = readw(ARMIO_REG(KBD_GPIO_MASKIT));
|
||||
writew(reg & ~KBD_INT, ARMIO_REG(KBD_GPIO_MASKIT));
|
||||
sem_wait(&kbdsem);
|
||||
}
|
||||
else
|
||||
{
|
||||
writew(0x1f, ARMIO_REG(KBC_REG));
|
||||
usleep(80000);
|
||||
}
|
||||
|
||||
/* Scan columns */
|
||||
|
||||
#ifdef INCLUDE_ALL_COLS
|
||||
while (col <= 6)
|
||||
{
|
||||
#else
|
||||
while (col <= 5)
|
||||
{
|
||||
#endif
|
||||
/* Read keypad latch and immediately set new column since
|
||||
* synchronization takes about 5usec. For the 1st round, the
|
||||
* interrupt has prepared this and the context switch takes
|
||||
* long enough to serve as a delay.
|
||||
*/
|
||||
|
||||
reg = readw(ARMIO_REG(KBR_LATCH_REG));
|
||||
writew(col_mask, ARMIO_REG(KBC_REG));
|
||||
|
||||
/* Turn pressed buttons into 1s */
|
||||
|
||||
reg = 0x1f & ~reg;
|
||||
|
||||
if (col == 1)
|
||||
{
|
||||
/* Power/End switch */
|
||||
|
||||
if (pwr_btn_dec(&btn_state, reg, buf, &len))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Non-power switches */
|
||||
|
||||
if (btn_dec(&btn_state, col, reg, buf, buflen, &len))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Select next column and respective mask */
|
||||
|
||||
col_mask = 0x1f & ~(1 << col++);
|
||||
|
||||
/* We have to wait for synchronization of the inputs. The
|
||||
* processing is too fast if no/few buttons are processed.
|
||||
*/
|
||||
|
||||
usleep(5);
|
||||
|
||||
/* XXX: usleep seems to suffer hugh overhead. Better this!?
|
||||
* If nothing else can be done, it's overhead still wastes
|
||||
* time 'usefully'.
|
||||
*/
|
||||
/* sched_yield(); up_udelay(2); */
|
||||
}
|
||||
|
||||
/* If we don't have anything to return, retry to avoid EOF */
|
||||
|
||||
if (!len)
|
||||
{
|
||||
goto retry;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Keypad interrupt handler
|
||||
* mask interrupts
|
||||
* prepare column drivers for scan
|
||||
* posts keypad semaphore
|
||||
****************************************************************************/
|
||||
|
||||
inline int calypso_kbd_irq(int irq, uint32_t * regs)
|
||||
{
|
||||
register uint16_t reg;
|
||||
|
||||
/* Mask keypad interrupt */
|
||||
|
||||
reg = readw(ARMIO_REG(KBD_GPIO_MASKIT));
|
||||
writew(reg | KBD_INT, ARMIO_REG(KBD_GPIO_MASKIT));
|
||||
|
||||
/* Turn off column drivers */
|
||||
|
||||
writew(0x1f, ARMIO_REG(KBC_REG));
|
||||
|
||||
/* Let the userspace know */
|
||||
|
||||
sem_post(&kbdsem);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Initialize device, add /dev/... nodes
|
||||
****************************************************************************/
|
||||
|
||||
void up_keypad(void)
|
||||
{
|
||||
/* Semaphore; helps leaving IRQ ctx as soon as possible */
|
||||
|
||||
sem_init(&kbdsem, 0, 0);
|
||||
|
||||
/* Drive cols low in idle state such that all buttons cause events */
|
||||
|
||||
writew(0, ARMIO_REG(KBC_REG));
|
||||
|
||||
(void)register_driver("/dev/keypad", &keypad_ops, 0444, NULL);
|
||||
}
|
||||
|
||||
int keypad_kbdinit(void)
|
||||
{
|
||||
calypso_armio();
|
||||
up_keypad();
|
||||
|
||||
return OK;
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
/************************************************************
|
||||
* lib/string/lib_memset.c
|
||||
/****************************************************************************
|
||||
* arch/arm/src/common/arm-elf.h
|
||||
*
|
||||
* Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved.
|
||||
* 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
|
||||
|
@ -31,29 +31,23 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Compilation Switches
|
||||
************************************************************/
|
||||
#ifndef __ARCH_ARM_SRC_ARM_ELF_H
|
||||
#define __ARCH_ARM_SRC_ARM_ELF_H
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
|
||||
/************************************************************
|
||||
* Global Functions
|
||||
************************************************************/
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_ARCH_MEMSET
|
||||
void *memset(void *s, int c, size_t n)
|
||||
{
|
||||
unsigned char *p = (unsigned char*)s;
|
||||
while (n-- > 0) *p++ = c;
|
||||
return s;
|
||||
}
|
||||
#endif
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_ARM_ELF_H */
|
File diff suppressed because it is too large
Load Diff
|
@ -41,36 +41,40 @@ endif
|
|||
|
||||
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
|
||||
CMN_CSRCS = up_assert.c up_blocktask.c up_copystate.c \
|
||||
up_createstack.c up_mdelay.c up_udelay.c up_exit.c \
|
||||
up_initialize.c up_initialstate.c up_interruptcontext.c \
|
||||
up_memfault.c up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c \
|
||||
up_releasepending.c up_releasestack.c up_reprioritizertr.c \
|
||||
up_schedulesigaction.c up_sigdeliver.c up_systemreset.c \
|
||||
up_unblocktask.c up_usestack.c up_doirq.c up_hardfault.c up_svcall.c \
|
||||
up_stackcheck.c
|
||||
up_createstack.c up_mdelay.c up_udelay.c up_exit.c \
|
||||
up_initialize.c up_initialstate.c up_interruptcontext.c \
|
||||
up_memfault.c up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c \
|
||||
up_releasepending.c up_releasestack.c up_reprioritizertr.c \
|
||||
up_schedulesigaction.c up_sigdeliver.c up_systemreset.c \
|
||||
up_unblocktask.c up_usestack.c up_doirq.c up_hardfault.c up_svcall.c \
|
||||
up_stackcheck.c
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_CMNVECTOR),y)
|
||||
CMN_ASRCS += up_exception.S
|
||||
CMN_CSRCS += up_vectors.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_MEMCPY),y)
|
||||
CMN_ASRCS += up_memcpy.S
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_STACK),y)
|
||||
CMN_CSRCS += up_checkstack.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ELF),y)
|
||||
CMN_CSRCS += up_elf.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += up_fpu.S
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_MEMCPY),y)
|
||||
CMN_ASRCS += memcpy.S
|
||||
endif
|
||||
|
||||
CHIP_ASRCS =
|
||||
CHIP_CSRCS = stm32_allocateheap.c stm32_start.c stm32_rcc.c stm32_lse.c \
|
||||
stm32_lsi.c stm32_gpio.c stm32_exti_gpio.c stm32_flash.c stm32_irq.c \
|
||||
stm32_timerisr.c stm32_dma.c stm32_lowputc.c stm32_serial.c \
|
||||
stm32_spi.c stm32_sdio.c stm32_tim.c stm32_i2c.c stm32_waste.c
|
||||
stm32_lsi.c stm32_gpio.c stm32_exti_gpio.c stm32_flash.c stm32_irq.c \
|
||||
stm32_timerisr.c stm32_dma.c stm32_lowputc.c stm32_serial.c \
|
||||
stm32_spi.c stm32_sdio.c stm32_tim.c stm32_i2c.c stm32_waste.c
|
||||
|
||||
ifeq ($(CONFIG_USBDEV),y)
|
||||
ifeq ($(CONFIG_STM32_USB),y)
|
||||
|
|
|
@ -835,14 +835,6 @@ struct eth_rxdesc_s
|
|||
* Public Functions
|
||||
****************************************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* STM32_NETHERNET > 0 */
|
||||
#endif /* __ARCH_ARM_SRC_STM32_CHIP_STM32_ETH_H */
|
||||
|
|
|
@ -110,6 +110,7 @@
|
|||
# define FLASH_ACR_HLFCYA (1 << 3) /* FLASH half cycle access */
|
||||
# define FLASH_ACR_PRTFBE (1 << 4) /* FLASH prefetch enable */
|
||||
#elif defined(CONFIG_STM32_STM32F20XX) || defined(CONFIG_STM32_STM32F40XX)
|
||||
# define FLASH_ACR_PRFTEN (1 << 8) /* FLASH prefetch enable */
|
||||
# define FLASH_ACR_ICEN (1 << 9) /* Bit 9: Instruction cache enable */
|
||||
# define FLASH_ACR_DCEN (1 << 10) /* Bit 10: Data cache enable */
|
||||
# define FLASH_ACR_ICRST (1 << 11) /* Bit 11: Instruction cache reset */
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
* Copyright (C) 2012 Michael Smith. All Rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
* Uros Platise <uros.platise@isotel.eu>
|
||||
* Michael Smith
|
||||
* Freddie Chopin <freddie_chopin@op.pl>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -49,6 +51,87 @@
|
|||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Alternate Pin Functions: */
|
||||
|
||||
/* ADC */
|
||||
|
||||
#define GPIO_ADC1_IN0 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN0)
|
||||
#define GPIO_ADC1_IN1 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN1)
|
||||
#define GPIO_ADC1_IN2 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN2)
|
||||
#define GPIO_ADC1_IN3 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN3)
|
||||
#define GPIO_ADC1_IN4 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN4)
|
||||
#define GPIO_ADC1_IN5 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN5)
|
||||
#define GPIO_ADC1_IN6 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN6)
|
||||
#define GPIO_ADC1_IN7 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN7)
|
||||
#define GPIO_ADC1_IN8 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN0)
|
||||
#define GPIO_ADC1_IN9 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN1)
|
||||
#define GPIO_ADC1_IN10 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN0)
|
||||
#define GPIO_ADC1_IN11 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN1)
|
||||
#define GPIO_ADC1_IN12 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN2)
|
||||
#define GPIO_ADC1_IN13 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN3)
|
||||
#define GPIO_ADC1_IN14 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN4)
|
||||
#define GPIO_ADC1_IN15 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN5)
|
||||
|
||||
/* CEC */
|
||||
#if defined(CONFIG_STM32_CEC_REMAP)
|
||||
# define GPIO_CEC (GPIO_ALT|GPIO_CNF_AFOD|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN10)
|
||||
#else
|
||||
# define GPIO_CEC (GPIO_ALT|GPIO_CNF_AFOD|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN8)
|
||||
#endif
|
||||
|
||||
/* DAC
|
||||
* Note from RM0041, 11.2: "Once the DAC channelx is enabled, the corresponding
|
||||
* GPIO pin (PA4 or PA5) is automatically connected to the analog converter
|
||||
* output (DAC_OUTx). In order to avoid parasitic consumption, the PA4 or PA5
|
||||
* pin should first be configured to analog (AIN)."
|
||||
*/
|
||||
|
||||
#define GPIO_DAC_OUT1 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN4)
|
||||
#define GPIO_DAC_OUT2 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN5)
|
||||
|
||||
/* FSMC */
|
||||
|
||||
/* TODO - VL devices in 100- and 144-pin packages have FSMC */
|
||||
|
||||
/* I2C */
|
||||
|
||||
#if defined(CONFIG_STM32_I2C1_REMAP)
|
||||
# define GPIO_I2C1_SCL (GPIO_ALT|GPIO_CNF_AFOD|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN8)
|
||||
# define GPIO_I2C1_SDA (GPIO_ALT|GPIO_CNF_AFOD|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN9)
|
||||
#else
|
||||
# define GPIO_I2C1_SCL (GPIO_ALT|GPIO_CNF_AFOD|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN6)
|
||||
# define GPIO_I2C1_SDA (GPIO_ALT|GPIO_CNF_AFOD|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN7)
|
||||
#endif
|
||||
#define GPIO_I2C1_SMBA (GPIO_ALT|GPIO_CNF_INFLOAT|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN5)
|
||||
|
||||
#define GPIO_I2C2_SCL (GPIO_ALT|GPIO_CNF_AFOD|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN10)
|
||||
#define GPIO_I2C2_SDA (GPIO_ALT|GPIO_CNF_AFOD|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN11)
|
||||
#define GPIO_I2C2_SMBA (GPIO_ALT|GPIO_CNF_INFLOAT|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN12)
|
||||
|
||||
/* SPI */
|
||||
|
||||
#if defined(CONFIG_STM32_SPI1_REMAP)
|
||||
# define GPIO_SPI1_NSS (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN15)
|
||||
# define GPIO_SPI1_SCK (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN3)
|
||||
# define GPIO_SPI1_MISO (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN4)
|
||||
# define GPIO_SPI1_MOSI (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN5)
|
||||
#else
|
||||
# define GPIO_SPI1_NSS (GPIO_INPUT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTA|GPIO_PIN4)
|
||||
# define GPIO_SPI1_SCK (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTA|GPIO_PIN5)
|
||||
# define GPIO_SPI1_MISO (GPIO_INPUT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTA|GPIO_PIN6)
|
||||
# define GPIO_SPI1_MOSI (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTA|GPIO_PIN7)
|
||||
#endif
|
||||
|
||||
#define GPIO_SPI2_NSS (GPIO_INPUT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN12)
|
||||
#define GPIO_SPI2_SCK (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN13)
|
||||
#define GPIO_SPI2_MISO (GPIO_INPUT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN14)
|
||||
#define GPIO_SPI2_MOSI (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN15)
|
||||
|
||||
#define GPIO_SPI3_NSS (GPIO_INPUT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTA|GPIO_PIN15)
|
||||
#define GPIO_SPI3_SCK (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN3)
|
||||
#define GPIO_SPI3_MISO (GPIO_INPUT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN4)
|
||||
#define GPIO_SPI3_MOSI (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN5)
|
||||
|
||||
/* TIMERS */
|
||||
|
||||
#if defined(CONFIG_STM32_TIM1_FULL_REMAP)
|
||||
|
@ -186,6 +269,77 @@
|
|||
# define GPIO_TIM4_CH4OUT (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN9)
|
||||
#endif
|
||||
|
||||
#define GPIO_TIM5_CH1IN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN0)
|
||||
#define GPIO_TIM5_CH1OUT (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTA|GPIO_PIN0)
|
||||
#define GPIO_TIM5_CH2IN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN1)
|
||||
#define GPIO_TIM5_CH2OUT (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTA|GPIO_PIN1)
|
||||
#define GPIO_TIM5_CH3IN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN2)
|
||||
#define GPIO_TIM5_CH3OUT (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTA|GPIO_PIN2)
|
||||
#define GPIO_TIM5_CH4IN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN3)
|
||||
#define GPIO_TIM5_CH4OUT (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTA|GPIO_PIN3)
|
||||
|
||||
#if defined(CONFIG_STM32_TIM12_REMAP)
|
||||
# define GPIO_TIM12_CH1IN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN12)
|
||||
# define GPIO_TIM12_CH1OUT (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN12)
|
||||
# define GPIO_TIM12_CH2IN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN13)
|
||||
# define GPIO_TIM12_CH2OUT (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN13)
|
||||
#else
|
||||
# define GPIO_TIM12_CH1IN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN4)
|
||||
# define GPIO_TIM12_CH1OUT (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTC|GPIO_PIN4)
|
||||
# define GPIO_TIM12_CH2IN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN5)
|
||||
# define GPIO_TIM12_CH2OUT (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTC|GPIO_PIN5)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_STM32_TIM13_REMAP)
|
||||
# define GPIO_TIM13_CH1IN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN0)
|
||||
# define GPIO_TIM13_CH1OUT (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN0)
|
||||
#else
|
||||
# define GPIO_TIM13_CH1IN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN8)
|
||||
# define GPIO_TIM13_CH1OUT (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTC|GPIO_PIN8)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_STM32_TIM14_REMAP)
|
||||
# define GPIO_TIM14_CH1IN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN1)
|
||||
# define GPIO_TIM14_CH1OUT (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN1)
|
||||
#else
|
||||
# define GPIO_TIM14_CH1IN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN9)
|
||||
# define GPIO_TIM14_CH1OUT (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTC|GPIO_PIN9)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_STM32_TIM15_REMAP)
|
||||
# define GPIO_TIM15_CH1IN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN14)
|
||||
# define GPIO_TIM15_CH1OUT (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN14)
|
||||
# define GPIO_TIM15_CH2IN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN15)
|
||||
# define GPIO_TIM15_CH2OUT (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN15)
|
||||
#else
|
||||
# define GPIO_TIM15_CH1IN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN2)
|
||||
# define GPIO_TIM15_CH1OUT (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTA|GPIO_PIN2)
|
||||
# define GPIO_TIM15_CH2IN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN3)
|
||||
# define GPIO_TIM15_CH2OUT (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTA|GPIO_PIN3)
|
||||
#endif
|
||||
#define GPIO_TIM15_BKIN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN9)
|
||||
#define GPIO_TIM15_CH1N (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN15)
|
||||
|
||||
#if defined(CONFIG_STM32_TIM16_REMAP)
|
||||
# define GPIO_TIM16_CH1IN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN6)
|
||||
# define GPIO_TIM16_CH1OUT (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTA|GPIO_PIN6)
|
||||
#else
|
||||
# define GPIO_TIM16_CH1IN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN8)
|
||||
# define GPIO_TIM16_CH1OUT (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN8)
|
||||
#endif
|
||||
#define GPIO_TIM16_BKIN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN5)
|
||||
#define GPIO_TIM16_CH1N (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN6)
|
||||
|
||||
#if defined(CONFIG_STM32_TIM17_REMAP)
|
||||
# define GPIO_TIM17_CH1IN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN7)
|
||||
# define GPIO_TIM17_CH1OUT (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTA|GPIO_PIN7)
|
||||
#else
|
||||
# define GPIO_TIM17_CH1IN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN9)
|
||||
# define GPIO_TIM17_CH1OUT (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN9)
|
||||
#endif
|
||||
#define GPIO_TIM17_BKIN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN10)
|
||||
#define GPIO_TIM17_CH1N (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN7)
|
||||
|
||||
/* USART */
|
||||
|
||||
#if defined(CONFIG_STM32_USART1_REMAP)
|
||||
|
@ -230,38 +384,10 @@
|
|||
# define GPIO_USART3_RTS (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN14)
|
||||
#endif
|
||||
|
||||
/* SPI */
|
||||
#define GPIO_UART4_TX (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTC|GPIO_PIN10)
|
||||
#define GPIO_UART4_RX (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN11)
|
||||
|
||||
#if defined(CONFIG_STM32_SPI1_REMAP)
|
||||
# define GPIO_SPI1_NSS (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN15)
|
||||
# define GPIO_SPI1_SCK (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN3)
|
||||
# define GPIO_SPI1_MISO (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN4)
|
||||
# define GPIO_SPI1_MOSI (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN5)
|
||||
#else
|
||||
# define GPIO_SPI1_NSS (GPIO_INPUT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTA|GPIO_PIN4)
|
||||
# define GPIO_SPI1_SCK (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTA|GPIO_PIN5)
|
||||
# define GPIO_SPI1_MISO (GPIO_INPUT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTA|GPIO_PIN6)
|
||||
# define GPIO_SPI1_MOSI (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTA|GPIO_PIN7)
|
||||
#endif
|
||||
|
||||
#define GPIO_SPI2_NSS (GPIO_INPUT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN12)
|
||||
#define GPIO_SPI2_SCK (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN13)
|
||||
#define GPIO_SPI2_MISO (GPIO_INPUT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN14)
|
||||
#define GPIO_SPI2_MOSI (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN15)
|
||||
|
||||
/* I2C */
|
||||
|
||||
#if defined(CONFIG_STM32_I2C1_REMAP)
|
||||
# define GPIO_I2C1_SCL (GPIO_ALT|GPIO_CNF_AFOD|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN8)
|
||||
# define GPIO_I2C1_SDA (GPIO_ALT|GPIO_CNF_AFOD|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN9)
|
||||
#else
|
||||
# define GPIO_I2C1_SCL (GPIO_ALT|GPIO_CNF_AFOD|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN6)
|
||||
# define GPIO_I2C1_SDA (GPIO_ALT|GPIO_CNF_AFOD|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN7)
|
||||
#endif
|
||||
#define GPIO_I2C1_SMBA (GPIO_ALT|GPIO_CNF_INFLOAT|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN5)
|
||||
|
||||
#define GPIO_I2C2_SCL (GPIO_ALT|GPIO_CNF_AFOD|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN10)
|
||||
#define GPIO_I2C2_SDA (GPIO_ALT|GPIO_CNF_AFOD|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN11)
|
||||
#define GPIO_I2C2_SMBA (GPIO_ALT|GPIO_CNF_INFLOAT|GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN12)
|
||||
#define GPIO_UART5_TX (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTC|GPIO_PIN12)
|
||||
#define GPIO_UART5_RX (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTD|GPIO_PIN2)
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_STM32_CHIP_STM32F100_PINMAP_H */
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
|
||||
|
||||
#if 0 /* Needs further investigation */
|
||||
#define GPIO_DAC_OUT1 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUTz|GPIO_PORTA|GPIO_PIN4)
|
||||
#define GPIO_DAC_OUT1 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN4)
|
||||
#define GPIO_DAC_OUT2 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN5)
|
||||
#endif
|
||||
|
||||
|
|
|
@ -50,53 +50,53 @@
|
|||
|
||||
/* ADC */
|
||||
|
||||
#define GPIO_ADC1_IN0 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN0)
|
||||
#define GPIO_ADC1_IN1 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN1)
|
||||
#define GPIO_ADC1_IN2 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN2)
|
||||
#define GPIO_ADC1_IN3 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN3)
|
||||
#define GPIO_ADC1_IN4 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN4)
|
||||
#define GPIO_ADC1_IN5 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN5)
|
||||
#define GPIO_ADC1_IN6 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN6)
|
||||
#define GPIO_ADC1_IN7 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN7)
|
||||
#define GPIO_ADC1_IN8 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN0)
|
||||
#define GPIO_ADC1_IN9 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN1)
|
||||
#define GPIO_ADC1_IN10 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN0)
|
||||
#define GPIO_ADC1_IN11 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN1)
|
||||
#define GPIO_ADC1_IN12 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN2)
|
||||
#define GPIO_ADC1_IN13 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN3)
|
||||
#define GPIO_ADC1_IN14 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN4)
|
||||
#define GPIO_ADC1_IN15 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN5)
|
||||
#define GPIO_ADC1_IN0 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN0)
|
||||
#define GPIO_ADC1_IN1 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN1)
|
||||
#define GPIO_ADC1_IN2 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN2)
|
||||
#define GPIO_ADC1_IN3 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN3)
|
||||
#define GPIO_ADC1_IN4 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN4)
|
||||
#define GPIO_ADC1_IN5 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN5)
|
||||
#define GPIO_ADC1_IN6 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN6)
|
||||
#define GPIO_ADC1_IN7 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN7)
|
||||
#define GPIO_ADC1_IN8 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN0)
|
||||
#define GPIO_ADC1_IN9 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN1)
|
||||
#define GPIO_ADC1_IN10 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN0)
|
||||
#define GPIO_ADC1_IN11 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN1)
|
||||
#define GPIO_ADC1_IN12 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN2)
|
||||
#define GPIO_ADC1_IN13 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN3)
|
||||
#define GPIO_ADC1_IN14 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN4)
|
||||
#define GPIO_ADC1_IN15 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN5)
|
||||
|
||||
#define GPIO_ADC2_IN0 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN0)
|
||||
#define GPIO_ADC2_IN1 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN1)
|
||||
#define GPIO_ADC2_IN2 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN2)
|
||||
#define GPIO_ADC2_IN3 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN3)
|
||||
#define GPIO_ADC2_IN4 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN4)
|
||||
#define GPIO_ADC2_IN5 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN5)
|
||||
#define GPIO_ADC2_IN6 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN6)
|
||||
#define GPIO_ADC2_IN7 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN7)
|
||||
#define GPIO_ADC2_IN8 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN0)
|
||||
#define GPIO_ADC2_IN9 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN1)
|
||||
#define GPIO_ADC2_IN10 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN0)
|
||||
#define GPIO_ADC2_IN11 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN1)
|
||||
#define GPIO_ADC2_IN12 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN2)
|
||||
#define GPIO_ADC2_IN13 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN3)
|
||||
#define GPIO_ADC2_IN14 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN4)
|
||||
#define GPIO_ADC2_IN15 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN5)
|
||||
#define GPIO_ADC2_IN0 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN0)
|
||||
#define GPIO_ADC2_IN1 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN1)
|
||||
#define GPIO_ADC2_IN2 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN2)
|
||||
#define GPIO_ADC2_IN3 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN3)
|
||||
#define GPIO_ADC2_IN4 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN4)
|
||||
#define GPIO_ADC2_IN5 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN5)
|
||||
#define GPIO_ADC2_IN6 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN6)
|
||||
#define GPIO_ADC2_IN7 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN7)
|
||||
#define GPIO_ADC2_IN8 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN0)
|
||||
#define GPIO_ADC2_IN9 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN1)
|
||||
#define GPIO_ADC2_IN10 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN0)
|
||||
#define GPIO_ADC2_IN11 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN1)
|
||||
#define GPIO_ADC2_IN12 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN2)
|
||||
#define GPIO_ADC2_IN13 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN3)
|
||||
#define GPIO_ADC2_IN14 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN4)
|
||||
#define GPIO_ADC2_IN15 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN5)
|
||||
|
||||
#define GPIO_ADC3_IN0 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN0)
|
||||
#define GPIO_ADC3_IN1 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN1)
|
||||
#define GPIO_ADC3_IN2 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN2)
|
||||
#define GPIO_ADC3_IN3 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN3)
|
||||
#define GPIO_ADC3_IN4 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTF|GPIO_PIN6)
|
||||
#define GPIO_ADC3_IN5 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTF|GPIO_PIN7)
|
||||
#define GPIO_ADC3_IN6 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTF|GPIO_PIN8)
|
||||
#define GPIO_ADC3_IN7 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTF|GPIO_PIN9)
|
||||
#define GPIO_ADC3_IN8 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTF|GPIO_PIN10)
|
||||
#define GPIO_ADC3_IN10 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN0)
|
||||
#define GPIO_ADC3_IN11 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN1)
|
||||
#define GPIO_ADC3_IN12 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN2)
|
||||
#define GPIO_ADC3_IN13 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN3)
|
||||
#define GPIO_ADC3_IN0 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN0)
|
||||
#define GPIO_ADC3_IN1 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN1)
|
||||
#define GPIO_ADC3_IN2 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN2)
|
||||
#define GPIO_ADC3_IN3 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN3)
|
||||
#define GPIO_ADC3_IN4 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTF|GPIO_PIN6)
|
||||
#define GPIO_ADC3_IN5 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTF|GPIO_PIN7)
|
||||
#define GPIO_ADC3_IN6 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTF|GPIO_PIN8)
|
||||
#define GPIO_ADC3_IN7 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTF|GPIO_PIN9)
|
||||
#define GPIO_ADC3_IN8 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTF|GPIO_PIN10)
|
||||
#define GPIO_ADC3_IN10 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN0)
|
||||
#define GPIO_ADC3_IN11 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN1)
|
||||
#define GPIO_ADC3_IN12 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN2)
|
||||
#define GPIO_ADC3_IN13 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN3)
|
||||
|
||||
/* DAC - "Once the DAC channelx is enabled, the corresponding GPIO pin
|
||||
* (PA4 or PA5) is automatically connected to the analog converter output
|
||||
|
@ -104,8 +104,8 @@
|
|||
* should first be configured to analog (AIN)."
|
||||
*/
|
||||
|
||||
#define GPIO_DAC_OUT1 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTF|GPIO_PIN10)
|
||||
#define GPIO_DAC_OUT2 (GPIO_ALT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PIN10)
|
||||
#define GPIO_DAC_OUT1 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN4)
|
||||
#define GPIO_DAC_OUT2 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN5)
|
||||
|
||||
/* TIMERS */
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
#endif
|
||||
|
||||
#if 0 /* Needs further investigation */
|
||||
#define GPIO_DAC_OUT1 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUTz|GPIO_PORTA|GPIO_PIN4)
|
||||
#define GPIO_DAC_OUT1 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN4)
|
||||
#define GPIO_DAC_OUT2 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN5)
|
||||
#endif
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
#endif
|
||||
|
||||
#if 0 /* Needs further investigation */
|
||||
#define GPIO_DAC_OUT1 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUTz|GPIO_PORTA|GPIO_PIN4)
|
||||
#define GPIO_DAC_OUT1 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN4)
|
||||
#define GPIO_DAC_OUT2 (GPIO_INPUT|GPIO_CNF_ANALOGIN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN5)
|
||||
#endif
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#define STM32_AFIO_EXTICR2_OFFSET 0x000c /* External interrupt configuration register 2 */
|
||||
#define STM32_AFIO_EXTICR3_OFFSET 0x0010 /* External interrupt configuration register 3 */
|
||||
#define STM32_AFIO_EXTICR4_OFFSET 0x0014 /* External interrupt configuration register 4 */
|
||||
#define STM32_AFIO_MAPR2_OFFSET 0x001c /* AF remap and debug I/O configuration register 2 */
|
||||
|
||||
/* Register Addresses ***************************************************************/
|
||||
|
||||
|
@ -373,5 +374,27 @@
|
|||
#define AFIO_EXTICR4_EXTI15_SHIFT (12) /* Bits 15-12: EXTI 15 configuration */
|
||||
#define AFIO_EXTICR4_EXTI15_MASK (AFIO_EXTICR_PORT_MASK << AFIO_EXTICR4_EXTI15_SHIFT)
|
||||
|
||||
/* AF remap and debug I/O configuration register 2 */
|
||||
|
||||
#ifdef CONFIG_STM32_VALUELINE
|
||||
# define AFIO_MAPR2_TIM15_REMAP (1 << 0) /* Bit 0: TIM15 remapping */
|
||||
# define AFIO_MAPR2_TIM16_REMAP (1 << 1) /* Bit 1: TIM16 remapping */
|
||||
# define AFIO_MAPR2_TIM17_REMAP (1 << 2) /* Bit 2: TIM17 remapping */
|
||||
# define AFIO_MAPR2_CEC_REMAP (1 << 3) /* Bit 3: CEC remapping */
|
||||
# define AFIO_MAPR2_TIM1_DMA_REMAP (1 << 4) /* Bit 4: TIM1 DMA remapping */
|
||||
#else
|
||||
# define AFIO_MAPR2_TIM9_REMAP (1 << 5) /* Bit 5: TIM9 remapping */
|
||||
# define AFIO_MAPR2_TIM10_REMAP (1 << 6) /* Bit 6: TIM10 remapping */
|
||||
# define AFIO_MAPR2_TIM11_REMAP (1 << 7) /* Bit 7: TIM11 remapping */
|
||||
#endif
|
||||
#define AFIO_MAPR2_TIM13_REMAP (1 << 8) /* Bit 8: TIM13 remapping */
|
||||
#define AFIO_MAPR2_TIM14_REMAP (1 << 9) /* Bit 9: TIM14 remapping */
|
||||
#define AFIO_MAPR2_FSMC_NADV (1 << 10) /* Bit 10: NADV connect/disconnect */
|
||||
#ifdef CONFIG_STM32_VALUELINE
|
||||
# define AFIO_MAPR2_TIM67_DAC_DMA_REMAP (1 << 11) /* Bit 11: TIM67_DAC DMA remapping */
|
||||
# define AFIO_MAPR2_TIM12_REMAP (1 << 12) /* Bit 12: TIM12 remapping */
|
||||
# define AFIO_MAPR2_MISC_REMAP (1 << 13) /* Bit 13: Miscellaneous features remapping */
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_STM32_CHIP_STM32F10XXX_GPIO_H */
|
||||
|
||||
|
|
|
@ -60,7 +60,9 @@
|
|||
#define STM32_TIM5_BASE 0x40000c00 /* 0x40000c00 - 0x40000fff: TIM5 timer */
|
||||
#define STM32_TIM6_BASE 0x40001000 /* 0x40001000 - 0x400013ff: TIM6 timer */
|
||||
#define STM32_TIM7_BASE 0x40001400 /* 0x40001400 - 0x400007ff: TIM7 timer */
|
||||
/* 0x40001800 - 0x40000fff: Reserved */
|
||||
#define STM32_TIM12_BASE 0x40001800 /* 0x40001800 - 0x40001bff: TIM12 timer */
|
||||
#define STM32_TIM13_BASE 0x40001c00 /* 0x40001c00 - 0x40001fff: TIM13 timer */
|
||||
#define STM32_TIM14_BASE 0x40002000 /* 0x40002000 - 0x400023ff: TIM14 timer */
|
||||
#define STM32_RTC_BASE 0x40002800 /* 0x40002800 - 0x40002bff: RTC */
|
||||
#define STM32_WWDG_BASE 0x40002c00 /* 0x40002C00 - 0x40002fff: Window watchdog (WWDG) */
|
||||
#define STM32_IWDG_BASE 0x40003000 /* 0x40003000 - 0x400033ff: Independent watchdog (IWDG) */
|
||||
|
@ -83,8 +85,8 @@
|
|||
#define STM32_BKP_BASE 0x40006c00 /* 0x40006c00 - 0x40006fff: Backup registers (BKP) */
|
||||
#define STM32_PWR_BASE 0x40007000 /* 0x40007000 - 0x400073ff: Power control PWR */
|
||||
#define STM32_DAC_BASE 0x40007400 /* 0x40007400 - 0x400077ff: DAC */
|
||||
/* 0x40007800 - 0x4000ffff: Reserved */
|
||||
|
||||
#define STM32_CEC_BASE 0x40007800 /* 0x40007800 - 0x40007bff: CEC */
|
||||
/* 0x40007c00 - 0x4000ffff: Reserved */
|
||||
/* APB2 bus */
|
||||
|
||||
#define STM32_AFIO_BASE 0x40010000 /* 0x40010000 - 0x400103ff: AFIO */
|
||||
|
@ -102,44 +104,49 @@
|
|||
#define STM32_SPI1_BASE 0x40013000 /* 0x40013000 - 0x400133ff: SPI1 */
|
||||
#define STM32_TIM8_BASE 0x40013400 /* 0x40013400 - 0x400137ff: TIM8 timer */
|
||||
#define STM32_USART1_BASE 0x40013800 /* 0x40013800 - 0x40013bff: USART1 */
|
||||
#define STM32_ADC3_BASE 0x40012800 /* 0x40012800 - 0x40013fff: ADC3 */
|
||||
/* 0x40014000 - 0x40017fff: Reserved */
|
||||
#define STM32_ADC3_BASE 0x40012800 /* 0x40012800 - 0x40013c00: ADC3 */
|
||||
/* 0x40013c00 - 0x40013fff: Reserved */
|
||||
#define STM32_TIM15_BASE 0x40014400 /* 0x40014400 - 0x400147ff: TIM15 */
|
||||
#define STM32_TIM16_BASE 0x40014400 /* 0x40014400 - 0x400147ff: TIM16 */
|
||||
#define STM32_TIM17_BASE 0x40014800 /* 0x40014800 - 0x40014bff: TIM17 */
|
||||
/* 0x40014c00 - 0x4001ffff: Reserved */
|
||||
|
||||
/* AHB bus */
|
||||
|
||||
#define STM32_SDIO_BASE 0x40018000 /* 0x40018000 - 0x400183ff: SDIO */
|
||||
/* 0x40018400 - 0x40017fff: Reserved */
|
||||
#define STM32_DMA1_BASE 0x40020000 /* 0x40020000 - 0x400203ff: DMA1 */
|
||||
#define STM32_DMA2_BASE 0x40020400 /* 0x40020000 - 0x400207ff: DMA2 */
|
||||
/* 0x40020800 - 0x40020fff: Reserved */
|
||||
#define STM32_RCC_BASE 0x40021000 /* 0x40021000 - 0x400213ff: Reset and Clock control RCC */
|
||||
/* 0x40021400 - 0x40021fff: Reserved */
|
||||
#define STM32_OTGFS_BASE 0x50000000 /* 0x50000000 - 0x500003ff: USB OTG FS */
|
||||
#define STM32_FLASHIF_BASE 0x40022000 /* 0x40022000 - 0x400223ff: Flash memory interface */
|
||||
#define STM32_CRC_BASE 0x40028000 /* 0x40023000 - 0x400233ff: CRC */
|
||||
/* 0x40023400 - 0x40027fff: Reserved */
|
||||
#define STM32_ETHERNET_BASE 0x40028000 /* 0x40028000 - 0x40029fff: Ethernet */
|
||||
/* 0x40030000 - 0x4fffffff: Reserved */
|
||||
#define STM32_SDIO_BASE 0x40018000 /* 0x40018000 - 0x400183ff: SDIO */
|
||||
/* 0x40018400 - 0x40017fff: Reserved */
|
||||
#define STM32_DMA1_BASE 0x40020000 /* 0x40020000 - 0x400203ff: DMA1 */
|
||||
#define STM32_DMA2_BASE 0x40020400 /* 0x40020000 - 0x400207ff: DMA2 */
|
||||
/* 0x40020800 - 0x40020fff: Reserved */
|
||||
#define STM32_RCC_BASE 0x40021000 /* 0x40021000 - 0x400213ff: Reset and Clock control RCC */
|
||||
/* 0x40021400 - 0x40021fff: Reserved */
|
||||
#define STM32_OTGFS_BASE 0x50000000 /* 0x50000000 - 0x500003ff: USB OTG FS */
|
||||
#define STM32_FLASHIF_BASE 0x40022000 /* 0x40022000 - 0x400223ff: Flash memory interface */
|
||||
#define STM32_CRC_BASE 0x40028000 /* 0x40023000 - 0x400233ff: CRC */
|
||||
/* 0x40023400 - 0x40027fff: Reserved */
|
||||
#define STM32_ETHERNET_BASE 0x40028000 /* 0x40028000 - 0x40029fff: Ethernet */
|
||||
/* 0x40030000 - 0x4fffffff: Reserved */
|
||||
|
||||
/* Peripheral BB base */
|
||||
|
||||
#define STM32_PERIPHBB_BASE 0x42000000
|
||||
#define STM32_PERIPHBB_BASE 0x42000000
|
||||
|
||||
/* Flexible SRAM controller (FSMC) */
|
||||
|
||||
#define STM32_FSMC_BANK1 0x60000000 /* 0x60000000-0x6fffffff: 256Mb NOR/SRAM */
|
||||
#define STM32_FSMC_BANK2 0x70000000 /* 0x70000000-0x7fffffff: 256Mb NAND FLASH */
|
||||
#define STM32_FSMC_BANK3 0x80000000 /* 0x80000000-0x8fffffff: 256Mb NAND FLASH */
|
||||
#define STM32_FSMC_BANK4 0x90000000 /* 0x90000000-0x9fffffff: 256Mb PC CARD*/
|
||||
#define STM32_IS_EXTSRAM(a) ((((uint32_t)(a)) & STM32_REGION_MASK) == STM32_FSMC_BANK1)
|
||||
#define STM32_FSMC_BANK1 0x60000000 /* 0x60000000-0x6fffffff: 256Mb NOR/SRAM */
|
||||
#define STM32_FSMC_BANK2 0x70000000 /* 0x70000000-0x7fffffff: 256Mb NAND FLASH */
|
||||
#define STM32_FSMC_BANK3 0x80000000 /* 0x80000000-0x8fffffff: 256Mb NAND FLASH */
|
||||
#define STM32_FSMC_BANK4 0x90000000 /* 0x90000000-0x9fffffff: 256Mb PC CARD*/
|
||||
#define STM32_IS_EXTSRAM(a) ((((uint32_t)(a)) & STM32_REGION_MASK) == STM32_FSMC_BANK1)
|
||||
|
||||
#define STM32_FSMC_BASE 0xa0000000 /* 0xa0000000-0xbfffffff: 512Mb FSMC register block */
|
||||
#define STM32_FSMC_BASE 0xa0000000 /* 0xa0000000-0xbfffffff: 512Mb FSMC register block */
|
||||
|
||||
/* Other registers -- see armv7-m/nvic.h for standard Cortex-M3 registers in this
|
||||
* address range
|
||||
*/
|
||||
|
||||
#define STM32_SCS_BASE 0xe000e000
|
||||
#define STM32_DEBUGMCU_BASE 0xe0042000
|
||||
#define STM32_SCS_BASE 0xe000e000
|
||||
#define STM32_DEBUGMCU_BASE 0xe0042000
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_STM32_CHIP_STM32F10XXX_MEMORYMAP_H */
|
||||
|
||||
|
|
|
@ -163,7 +163,9 @@
|
|||
# define RCC_CFGR_PLLMUL_CLKx14 (12 << RCC_CFGR_PLLMUL_SHIFT) /* 1100: PLL input clock x 14 */
|
||||
# define RCC_CFGR_PLLMUL_CLKx15 (13 << RCC_CFGR_PLLMUL_SHIFT) /* 1101: PLL input clock x 15 */
|
||||
# define RCC_CFGR_PLLMUL_CLKx16 (14 << RCC_CFGR_PLLMUL_SHIFT) /* 111x: PLL input clock x 16 */
|
||||
#define RCC_CFGR_USBPRE (1 << 22) /* Bit 22: USB prescaler */
|
||||
#ifndef CONFIG_STM32_VALUELINE
|
||||
# define RCC_CFGR_USBPRE (1 << 22) /* Bit 22: USB prescaler */
|
||||
#endif
|
||||
#define RCC_CFGR_MCO_SHIFT (24) /* Bits 26-24: Microcontroller Clock Output */
|
||||
#define RCC_CFGR_MCO_MASK (0x0f << RCC_CFGR_MCO_SHIFT)
|
||||
# define RCC_CFGR_NOCLK (0 << RCC_CFGR_MCO_SHIFT) /* 0xx: No clock */
|
||||
|
@ -207,12 +209,22 @@
|
|||
#define TCC_APB2RSTR_IOPFRST (1 << 7) /* Bit 7: IO port F reset */
|
||||
#define TCC_APB2RSTR_IOPGRST (1 << 8) /* Bit 8: IO port G reset */
|
||||
#define RCC_APB2RSTR_ADC1RST (1 << 9) /* Bit 9: ADC 1 interface reset */
|
||||
#define RCC_APB2RSTR_ADC2RST (1 << 10) /* Bit 10: ADC 2 interface reset */
|
||||
#ifndef CONFIG_STM32_VALUELINE
|
||||
# define RCC_APB2RSTR_ADC2RST (1 << 10) /* Bit 10: ADC 2 interface reset */
|
||||
#endif
|
||||
#define RCC_APB2RSTR_TIM1RST (1 << 11) /* Bit 11: TIM1 Timer reset */
|
||||
#define RCC_APB2RSTR_SPI1RST (1 << 12) /* Bit 12: SPI 1 reset */
|
||||
#define RCC_APB2RSTR_TIM8RST (1 << 13) /* Bit 13: TIM8 Timer reset */
|
||||
#ifndef CONFIG_STM32_VALUELINE
|
||||
# define RCC_APB2RSTR_TIM8RST (1 << 13) /* Bit 13: TIM8 Timer reset */
|
||||
#endif
|
||||
#define RCC_APB2RSTR_USART1RST (1 << 14) /* Bit 14: USART1 reset */
|
||||
#define RCC_APB2RSTR_ADC3RST (1 << 15) /* Bit 15: ADC3 interface reset */
|
||||
#ifndef CONFIG_STM32_VALUELINE
|
||||
# define RCC_APB2RSTR_ADC3RST (1 << 15) /* Bit 15: ADC3 interface reset */
|
||||
#else
|
||||
# define RCC_APB2RSTR_TIM15RST (1 << 16) /* Bit 16: TIM15 reset */
|
||||
# define RCC_APB2RSTR_TIM16RST (1 << 17) /* Bit 17: TIM16 reset */
|
||||
# define RCC_APB2RSTR_TIM17RST (1 << 18) /* Bit 18: TIM17 reset */
|
||||
#endif
|
||||
|
||||
/* APB1 Peripheral reset register */
|
||||
|
||||
|
@ -222,6 +234,11 @@
|
|||
#define RCC_APB1RSTR_TIM5RST (1 << 3) /* Bit 3: Timer 5 reset */
|
||||
#define RCC_APB1RSTR_TIM6RST (1 << 4) /* Bit 4: Timer 6 reset */
|
||||
#define RCC_APB1RSTR_TIM7RST (1 << 5) /* Bit 5: Timer 7 reset */
|
||||
#ifdef CONFIG_STM32_VALUELINE
|
||||
# define RCC_APB1RSTR_TIM12RST (1 << 6) /* Bit 6: TIM12 reset */
|
||||
# define RCC_APB1RSTR_TIM13RST (1 << 7) /* Bit 7: TIM13 reset */
|
||||
# define RCC_APB1RSTR_TIM14RST (1 << 8) /* Bit 8: TIM14 reset */
|
||||
#endif
|
||||
#define RCC_APB1RSTR_WWDGRST (1 << 11) /* Bit 11: Window Watchdog reset */
|
||||
#define RCC_APB1RSTR_SPI2RST (1 << 14) /* Bit 14: SPI 2 reset */
|
||||
#define RCC_APB1RSTR_SPI3RST (1 << 15) /* Bit 15: SPI 3 reset */
|
||||
|
@ -231,12 +248,17 @@
|
|||
#define RCC_APB1RSTR_UART5RST (1 << 20) /* Bit 18: UART 5 reset */
|
||||
#define RCC_APB1RSTR_I2C1RST (1 << 21) /* Bit 21: I2C 1 reset */
|
||||
#define RCC_APB1RSTR_I2C2RST (1 << 22) /* Bit 22: I2C 2 reset */
|
||||
#define RCC_APB1RSTR_USBRST (1 << 23) /* Bit 23: USB reset */
|
||||
#define RCC_APB1RSTR_CAN1RST (1 << 25) /* Bit 25: CAN1 reset */
|
||||
#define RCC_APB1RSTR_CAN2RST (1 << 26) /* Bit 26: CAN2 reset */
|
||||
#ifndef CONFIG_STM32_VALUELINE
|
||||
# define RCC_APB1RSTR_USBRST (1 << 23) /* Bit 23: USB reset */
|
||||
# define RCC_APB1RSTR_CAN1RST (1 << 25) /* Bit 25: CAN1 reset */
|
||||
# define RCC_APB1RSTR_CAN2RST (1 << 26) /* Bit 26: CAN2 reset */
|
||||
#endif
|
||||
#define RCC_APB1RSTR_BKPRST (1 << 27) /* Bit 27: Backup interface reset */
|
||||
#define RCC_APB1RSTR_PWRRST (1 << 28) /* Bit 28: Power interface reset */
|
||||
#define RCC_APB1RSTR_DACRST (1 << 29) /* Bit 29: DAC interface reset */
|
||||
#ifdef CONFIG_STM32_VALUELINE
|
||||
# define RCC_APB1RSTR_CECRST (1 << 30) /* Bit 30: CEC reset */
|
||||
#endif
|
||||
|
||||
/* AHB Peripheral Clock enable register */
|
||||
|
||||
|
@ -246,7 +268,9 @@
|
|||
#define RCC_AHBENR_FLITFEN (1 << 4) /* Bit 4: FLITF clock enable */
|
||||
#define RCC_AHBENR_CRCEN (1 << 6) /* Bit 6: CRC clock enable */
|
||||
#define RCC_AHBENR_FSMCEN (1 << 8) /* Bit 8: FSMC clock enable */
|
||||
#define RCC_AHBENR_SDIOEN (1 << 10) /* Bit 10: SDIO clock enable */
|
||||
#ifndef CONFIG_STM32_VALUELINE
|
||||
# define RCC_AHBENR_SDIOEN (1 << 10) /* Bit 10: SDIO clock enable */
|
||||
#endif
|
||||
#ifdef CONFIG_STM32_CONNECTIVITYLINE
|
||||
# define RCC_AHBENR_ETHMACEN (1 << 14) /* Bit 14: Ethernet MAC clock enable */
|
||||
# define RCC_AHBENR_ETHMACTXEN (1 << 15) /* Bit 15: Ethernet MAC TX clock enable */
|
||||
|
@ -272,12 +296,22 @@
|
|||
#define RCC_APB2ENR_IOPFEN (1 << 7) /* Bit 7: I/O port F clock enable */
|
||||
#define RCC_APB2ENR_IOPGEN (1 << 8) /* Bit 8: I/O port G clock enable */
|
||||
#define RCC_APB2ENR_ADC1EN (1 << 9) /* Bit 9: ADC 1 interface clock enable */
|
||||
#define RCC_APB2ENR_ADC2EN (1 << 10) /* Bit 10: ADC 2 interface clock enable */
|
||||
#ifndef CONFIG_STM32_VALUELINE
|
||||
# define RCC_APB2ENR_ADC2EN (1 << 10) /* Bit 10: ADC 2 interface clock enable */
|
||||
#endif
|
||||
#define RCC_APB2ENR_TIM1EN (1 << 11) /* Bit 11: TIM1 Timer clock enable */
|
||||
#define RCC_APB2ENR_SPI1EN (1 << 12) /* Bit 12: SPI 1 clock enable */
|
||||
#define RCC_APB2ENR_TIM8EN (1 << 13) /* Bit 13: TIM8 Timer clock enable */
|
||||
#ifndef CONFIG_STM32_VALUELINE
|
||||
# define RCC_APB2ENR_TIM8EN (1 << 13) /* Bit 13: TIM8 Timer clock enable */
|
||||
#endif
|
||||
#define RCC_APB2ENR_USART1EN (1 << 14) /* Bit 14: USART1 clock enable */
|
||||
#define RCC_APB2ENR_ADC3EN (1 << 15) /* Bit 14: ADC3 interface clock enable */
|
||||
#ifndef CONFIG_STM32_VALUELINE
|
||||
# define RCC_APB2ENR_ADC3EN (1 << 15) /* Bit 14: ADC3 interface clock enable */
|
||||
#else
|
||||
# define RCC_APB2ENR_TIM15EN (1 << 16) /* Bit 16: TIM15 clock enable */
|
||||
# define RCC_APB2ENR_TIM16EN (1 << 17) /* Bit 17: TIM16 clock enable */
|
||||
# define RCC_APB2ENR_TIM17EN (1 << 18) /* Bit 18: TIM17 clock enable */
|
||||
#endif
|
||||
|
||||
/* APB1 Peripheral Clock enable register */
|
||||
|
||||
|
@ -287,6 +321,11 @@
|
|||
#define RCC_APB1ENR_TIM5EN (1 << 3) /* Bit 3: Timer 5 clock enable */
|
||||
#define RCC_APB1ENR_TIM6EN (1 << 4) /* Bit 4: Timer 6 clock enable */
|
||||
#define RCC_APB1ENR_TIM7EN (1 << 5) /* Bit 5: Timer 7 clock enable */
|
||||
#ifdef CONFIG_STM32_VALUELINE
|
||||
# define RCC_APB1ENR_TIM12EN (1 << 6) /* Bit 6: Timer 12 clock enable */
|
||||
# define RCC_APB1ENR_TIM13EN (1 << 7) /* Bit 7: Timer 13 clock enable */
|
||||
# define RCC_APB1ENR_TIM14EN (1 << 8) /* Bit 8: Timer 14 clock enable */
|
||||
#endif
|
||||
#define RCC_APB1ENR_WWDGEN (1 << 11) /* Bit 11: Window Watchdog clock enable */
|
||||
#define RCC_APB1ENR_SPI2EN (1 << 14) /* Bit 14: SPI 2 clock enable */
|
||||
#define RCC_APB1ENR_SPI3EN (1 << 15) /* Bit 15: SPI 3 clock enable */
|
||||
|
@ -296,12 +335,17 @@
|
|||
#define RCC_APB1ENR_UART5EN (1 << 20) /* Bit 20: UART 5 clock enable */
|
||||
#define RCC_APB1ENR_I2C1EN (1 << 21) /* Bit 21: I2C 1 clock enable */
|
||||
#define RCC_APB1ENR_I2C2EN (1 << 22) /* Bit 22: I2C 2 clock enable */
|
||||
#define RCC_APB1ENR_USBEN (1 << 23) /* Bit 23: USB clock enable */
|
||||
#define RCC_APB1ENR_CAN1EN (1 << 25) /* Bit 25: CAN1 clock enable */
|
||||
#define RCC_APB1ENR_CAN2EN (1 << 26) /* Bit 25: CAN2 clock enable */
|
||||
#ifndef CONFIG_STM32_VALUELINE
|
||||
# define RCC_APB1ENR_USBEN (1 << 23) /* Bit 23: USB clock enable */
|
||||
# define RCC_APB1ENR_CAN1EN (1 << 25) /* Bit 25: CAN1 clock enable */
|
||||
# define RCC_APB1ENR_CAN2EN (1 << 26) /* Bit 25: CAN2 clock enable */
|
||||
#endif
|
||||
#define RCC_APB1ENR_BKPEN (1 << 27) /* Bit 27: Backup interface clock enable */
|
||||
#define RCC_APB1ENR_PWREN (1 << 28) /* Bit 28: Power interface clock enable */
|
||||
#define RCC_APB1ENR_DACEN (1 << 29) /* Bit 29: DAC interface clock enable */
|
||||
#ifdef CONFIG_STM32_VALUELINE
|
||||
# define RCC_APB1ENR_CECEN (1 << 30) /* Bit 30: CEC clock enable */
|
||||
#endif
|
||||
|
||||
/* Backup domain control register */
|
||||
|
||||
|
@ -331,7 +375,7 @@
|
|||
|
||||
#if defined(CONFIG_STM32_VALUELINE) || defined(CONFIG_STM32_CONNECTIVITYLINE)
|
||||
|
||||
/* Clock configuration register 2 (For connectivity line only) */
|
||||
/* Clock configuration register 2 (For value line and connectivity line only) */
|
||||
|
||||
#define RCC_CFGR2_PREDIV1_SHIFT (0)
|
||||
#define RCC_CFGR2_PREDIV1_MASK (0x0f << RCC_CFGR2_PREDIV1_SHIFT)
|
||||
|
@ -352,6 +396,10 @@
|
|||
# define RCC_CFGR2_PREDIV1d15 (14 << RCC_CFGR2_PREDIV1_SHIFT)
|
||||
# define RCC_CFGR2_PREDIV1d16 (15 << RCC_CFGR2_PREDIV1_SHIFT)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32_CONNECTIVITYLINE
|
||||
|
||||
#define RCC_CFGR2_PREDIV2_SHIFT (4)
|
||||
#define RCC_CFGR2_PREDIV2_MASK (0x0f << RCC_CFGR2_PREDIV2_SHIFT)
|
||||
# define RCC_CFGR2_PREDIV2d1 (0 << RCC_CFGR2_PREDIV2_SHIFT)
|
||||
|
|
|
@ -49,15 +49,77 @@
|
|||
* definition that provides the number of supported vectors.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ARMV7M_CMNVECTOR
|
||||
# ifdef CONFIG_ARMV7M_CMNVECTOR
|
||||
|
||||
/* Reserve 60 interrupt table entries for I/O interrupts. */
|
||||
/* Reserve 61 interrupt table entries for I/O interrupts. */
|
||||
|
||||
# define ARMV7M_PERIPHERAL_INTERRUPTS 60
|
||||
# define ARMV7M_PERIPHERAL_INTERRUPTS 61
|
||||
|
||||
#else
|
||||
# error This target requires CONFIG_ARMV7M_CMNVECTOR
|
||||
#endif /* CONFIG_ARMV7M_CMNVECTOR */
|
||||
|
||||
VECTOR(stm32_wwdg, STM32_IRQ_WWDG) /* Vector 16+0: Window Watchdog interrupt */
|
||||
VECTOR(stm32_pvd, STM32_IRQ_PVD) /* Vector 16+1: PVD through EXTI Line detection interrupt */
|
||||
VECTOR(stm32_tamper, STM32_IRQ_TAMPER) /* Vector 16+2: Tamper interrupt */
|
||||
VECTOR(stm32_rtc, STM32_IRQ_RTC) /* Vector 16+3: RTC Wakeup through EXTI line interrupt */
|
||||
VECTOR(stm32_flash, STM32_IRQ_FLASH) /* Vector 16+4: Flash global interrupt */
|
||||
VECTOR(stm32_rcc, STM32_IRQ_RCC) /* Vector 16+5: RCC global interrupt */
|
||||
VECTOR(stm32_exti0, STM32_IRQ_EXTI0) /* Vector 16+6: EXTI Line 0 interrupt */
|
||||
VECTOR(stm32_exti1, STM32_IRQ_EXTI1) /* Vector 16+7: EXTI Line 1 interrupt */
|
||||
VECTOR(stm32_exti2, STM32_IRQ_EXTI2) /* Vector 16+8: EXTI Line 2 interrupt */
|
||||
VECTOR(stm32_exti3, STM32_IRQ_EXTI3) /* Vector 16+9: EXTI Line 3 interrupt */
|
||||
VECTOR(stm32_exti4, STM32_IRQ_EXTI4) /* Vector 16+10: EXTI Line 4 interrupt */
|
||||
VECTOR(stm32_dma1ch1, STM32_IRQ_DMA1CH1) /* Vector 16+11: DMA1 Channel 1 global interrupt */
|
||||
VECTOR(stm32_dma1ch2, STM32_IRQ_DMA1CH2) /* Vector 16+12: DMA1 Channel 2 global interrupt */
|
||||
VECTOR(stm32_dma1ch3, STM32_IRQ_DMA1CH3) /* Vector 16+13: DMA1 Channel 3 global interrupt */
|
||||
VECTOR(stm32_dma1ch4, STM32_IRQ_DMA1CH4) /* Vector 16+14: DMA1 Channel 4 global interrupt */
|
||||
VECTOR(stm32_dma1ch5, STM32_IRQ_DMA1CH5) /* Vector 16+15: DMA1 Channel 5 global interrupt */
|
||||
VECTOR(stm32_dma1ch6, STM32_IRQ_DMA1CH6) /* Vector 16+16: DMA1 Channel 6 global interrupt */
|
||||
VECTOR(stm32_dma1ch7, STM32_IRQ_DMA1CH7) /* Vector 16+17: DMA1 Channel 7 global interrupt */
|
||||
VECTOR(stm32_adc1, STM32_IRQ_ADC1) /* Vector 16+18: ADC1 global interrupt */
|
||||
UNUSED(STM32_IRQ_RESERVED0) /* Vector 16+19: Reserved 0 */
|
||||
UNUSED(STM32_IRQ_RESERVED1) /* Vector 16+20: Reserved 1 */
|
||||
UNUSED(STM32_IRQ_RESERVED2) /* Vector 16+21: Reserved 2 */
|
||||
UNUSED(STM32_IRQ_RESERVED3) /* Vector 16+22: Reserved 3 */
|
||||
VECTOR(stm32_exti95, STM32_IRQ_EXTI95) /* Vector 16+23: EXTI Line[9:5] interrupts */
|
||||
VECTOR(stm32_tim1brk, STM32_IRQ_TIM1BRK) /* Vector 16+24: TIM1 Break interrupt; TIM15 global interrupt */
|
||||
VECTOR(stm32_tim1up, STM32_IRQ_TIM1UP) /* Vector 16+25: TIM1 Update interrupt; TIM16 global interrupt */
|
||||
VECTOR(stm32_tim1trgcom, STM32_IRQ_TIM1TRGCOM) /* Vector 16+26: TIM1 Trigger and Commutation interrupts; TIM17 global interrupt */
|
||||
VECTOR(stm32_tim1cc, STM32_IRQ_TIM1CC) /* Vector 16+27: TIM1 Capture Compare interrupt */
|
||||
VECTOR(stm32_tim2, STM32_IRQ_TIM2) /* Vector 16+28: TIM2 global interrupt */
|
||||
VECTOR(stm32_tim3, STM32_IRQ_TIM3) /* Vector 16+29: TIM3 global interrupt */
|
||||
VECTOR(stm32_tim4, STM32_IRQ_TIM4) /* Vector 16+30: TIM4 global interrupt */
|
||||
VECTOR(stm32_i2c1ev, STM32_IRQ_I2C1EV) /* Vector 16+31: I2C1 event interrupt */
|
||||
VECTOR(stm32_i2c1er, STM32_IRQ_I2C1ER) /* Vector 16+32: I2C1 error interrupt */
|
||||
VECTOR(stm32_i2c2ev, STM32_IRQ_I2C2EV) /* Vector 16+33: I2C2 event interrupt */
|
||||
VECTOR(stm32_i2c2er, STM32_IRQ_I2C2ER) /* Vector 16+34: I2C2 error interrupt */
|
||||
VECTOR(stm32_spi1, STM32_IRQ_SPI1) /* Vector 16+35: SPI1 global interrupt */
|
||||
VECTOR(stm32_spi2, STM32_IRQ_SPI2) /* Vector 16+36: SPI2 global interrupt */
|
||||
VECTOR(stm32_usart1, STM32_IRQ_USART1) /* Vector 16+37: USART1 global interrupt */
|
||||
VECTOR(stm32_usart2, STM32_IRQ_USART2) /* Vector 16+38: USART2 global interrupt */
|
||||
VECTOR(stm32_usart3, STM32_IRQ_USART3) /* Vector 16+39: USART3 global interrupt */
|
||||
VECTOR(stm32_exti1510, STM32_IRQ_EXTI1510) /* Vector 16+40: EXTI Line[15:10] interrupts */
|
||||
VECTOR(stm32_rtcalr, STM32_IRQ_RTCALR) /* Vector 16+41: RTC alarms (A and B) through EXTI line interrupt */
|
||||
VECTOR(stm32_cec, STM32_IRQ_CEC) /* Vector 16+42: CEC global interrupt */
|
||||
VECTOR(stm32_tim12, STM32_IRQ_TIM12) /* Vector 16+43: TIM12 global interrupt */
|
||||
VECTOR(stm32_tim13, STM32_IRQ_TIM13) /* Vector 16+44: TIM13 global interrupt */
|
||||
VECTOR(stm32_tim14, STM32_IRQ_TIM14) /* Vector 16+45: TIM14 global interrupt */
|
||||
UNUSED(STM32_IRQ_RESERVED4) /* Vector 16+46: Reserved 4 */
|
||||
UNUSED(STM32_IRQ_RESERVED5) /* Vector 16+47: Reserved 5 */
|
||||
VECTOR(stm32_fsmc, STM32_IRQ_FSMC) /* Vector 16+48: FSMC global interrupt */
|
||||
UNUSED(STM32_IRQ_RESERVED6) /* Vector 16+49: Reserved 6 */
|
||||
VECTOR(stm32_tim5, STM32_IRQ_TIM5) /* Vector 16+50: TIM5 global interrupt */
|
||||
VECTOR(stm32_spi3, STM32_IRQ_SPI3) /* Vector 16+51: SPI3 global interrupt */
|
||||
VECTOR(stm32_uart4, STM32_IRQ_UART4) /* Vector 16+52: USART2 global interrupt */
|
||||
VECTOR(stm32_uart5, STM32_IRQ_UART5) /* Vector 16+53: USART5 global interrupt */
|
||||
VECTOR(stm32_tim6, STM32_IRQ_TIM6) /* Vector 16+54: TIM6 global interrupt */
|
||||
VECTOR(stm32_tim7, STM32_IRQ_TIM7) /* Vector 16+55: TIM7 global interrupt */
|
||||
VECTOR(stm32_dma2ch1, STM32_IRQ_DMA2CH1) /* Vector 16+56: DMA2 Channel 1 global interrupt */
|
||||
VECTOR(stm32_dma2ch2, STM32_IRQ_DMA2CH2) /* Vector 16+57: DMA2 Channel 2 global interrupt */
|
||||
VECTOR(stm32_dma2ch3, STM32_IRQ_DMA2CH3) /* Vector 16+58: DMA2 Channel 3 global interrupt */
|
||||
VECTOR(stm32_dma2ch45, STM32_IRQ_DMA2CH45) /* Vector 16+59: DMA2 Channel 4 and 5 global interrupt */
|
||||
VECTOR(stm32_dma2ch5, STM32_IRQ_DMA2CH5) /* Vector 16+60: DMA2 Channel 5 global interrupt */
|
||||
|
||||
# endif /* CONFIG_ARMV7M_CMNVECTOR */
|
||||
|
||||
#elif defined(CONFIG_STM32_CONNECTIVITYLINE)
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@
|
|||
#define GPIO_ETH_MII_TX_EN_2 (GPIO_ALT|GPIO_AF11|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN11)
|
||||
#define GPIO_ETH_PPS_OUT_1 (GPIO_ALT|GPIO_AF11|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN5)
|
||||
#define GPIO_ETH_PPS_OUT_2 (GPIO_ALT|GPIO_AF11|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN8)
|
||||
#define GPIO_ETH_RMII_CRS_DV (GPIO_ALT|GPIO_AF11|GPIO_SPEED_100MHz|GPIO_PUSHPULLGPIO_PORTA|GPIO_PIN7)
|
||||
#define GPIO_ETH_RMII_CRS_DV (GPIO_ALT|GPIO_AF11|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN7)
|
||||
#define GPIO_ETH_RMII_REF_CLK (GPIO_ALT|GPIO_AF11|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN1)
|
||||
#define GPIO_ETH_RMII_RXD0 (GPIO_ALT|GPIO_AF11|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN4)
|
||||
#define GPIO_ETH_RMII_RXD1 (GPIO_ALT|GPIO_AF11|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN5)
|
||||
|
|
|
@ -222,7 +222,7 @@
|
|||
#define GPIO_ETH_MII_TX_EN_2 (GPIO_ALT|GPIO_AF11|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN11)
|
||||
#define GPIO_ETH_PPS_OUT_1 (GPIO_ALT|GPIO_AF11|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN5)
|
||||
#define GPIO_ETH_PPS_OUT_2 (GPIO_ALT|GPIO_AF11|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN8)
|
||||
#define GPIO_ETH_RMII_CRS_DV (GPIO_ALT|GPIO_AF11|GPIO_SPEED_100MHz|GPIO_PUSHPULLGPIO_PORTA|GPIO_PIN7)
|
||||
#define GPIO_ETH_RMII_CRS_DV (GPIO_ALT|GPIO_AF11|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN7)
|
||||
#define GPIO_ETH_RMII_REF_CLK (GPIO_ALT|GPIO_AF11|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN1)
|
||||
#define GPIO_ETH_RMII_RXD0 (GPIO_ALT|GPIO_AF11|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN4)
|
||||
#define GPIO_ETH_RMII_RXD1 (GPIO_ALT|GPIO_AF11|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN5)
|
||||
|
|
|
@ -720,10 +720,10 @@ static int adc_timinit(FAR struct stm32_dev_s *priv)
|
|||
|
||||
case 4: /* TimerX TRGO event */
|
||||
{
|
||||
#warning "TRGO support not yet implemented"
|
||||
|
||||
/* TODO: TRGO support not yet implemented */
|
||||
/* Set the event TRGO */
|
||||
|
||||
ccenable = 0;
|
||||
egr = GTIM_EGR_TG;
|
||||
|
||||
/* Set the duty cycle by writing to the CCR register for this channel */
|
||||
|
@ -1128,7 +1128,7 @@ static void adc_reset(FAR struct adc_dev_s *dev)
|
|||
avdbg("intf: ADC%d\n", priv->intf);
|
||||
flags = irqsave();
|
||||
|
||||
/* Enable ADC reset state */
|
||||
/* Enable ADC reset state */
|
||||
|
||||
adc_rccreset(priv, true);
|
||||
|
||||
|
@ -1326,6 +1326,10 @@ static int adc_setup(FAR struct adc_dev_s *dev)
|
|||
ret = irq_attach(priv->irq, priv->isr);
|
||||
if (ret == OK)
|
||||
{
|
||||
/* Make sure that the ADC device is in the powered up, reset state */
|
||||
|
||||
adc_reset(dev);
|
||||
|
||||
/* Enable the ADC interrupt */
|
||||
|
||||
avdbg("Enable the ADC interrupt: irq=%d\n", priv->irq);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue