diff options
Diffstat (limited to 'nuttx/tools')
46 files changed, 0 insertions, 10098 deletions
diff --git a/nuttx/tools/Config.mk b/nuttx/tools/Config.mk deleted file mode 100644 index 9f36ed4f3..000000000 --- a/nuttx/tools/Config.mk +++ /dev/null @@ -1,221 +0,0 @@ -############################################################################ -# Config.mk -# Global build rules and macros. -# -# Copyright (C) 2011 Gregory Nutt. All rights reserved. -# Author: Richard Cochran -# Gregory Nutt <gnutt@nuttx.org> -# -# This file (along with $(TOPDIR)/.config) must be included by every -# configuration-specific Make.defs file. -# -# 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. -# -############################################################################ - -# These are configuration variables that are quoted by configuration tool -# but which must be unquoated when used in the build system. - -CONFIG_ARCH := $(patsubst "%",%,$(strip $(CONFIG_ARCH))) -CONFIG_ARCH_CHIP := $(patsubst "%",%,$(strip $(CONFIG_ARCH_CHIP))) -CONFIG_ARCH_BOARD := $(patsubst "%",%,$(strip $(CONFIG_ARCH_BOARD))) - -# Some defaults just to prohibit some bad behavior if for some reason they -# are not defined - -OBJEXT ?= .o -LIBEXT ?= .a - -# DELIM - Path segment delimiter character -# -# Depends on this settings defined in board-specific defconfig file installed -# at $(TOPDIR)/.config: -# -# CONFIG_WINDOWS_NATIVE - Defined for a Windows native build - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - DELIM = $(strip \) -else - DELIM = $(strip /) -endif - -# INCDIR - Convert a list of directory paths to a list of compiler include -# directirves -# Example: CFFLAGS += ${shell $(INCDIR) [options] "compiler" "dir1" "dir2" "dir2" ...} -# -# Note that the compiler string and each directory path string must quoted if -# they contain spaces or any other characters that might get mangled by the -# shell -# -# Depends on this setting passed as a make commaond line definition from the -# toplevel Makefile: -# -# TOPDIR - The path to the the top level NuttX directory in the form -# appropriate for the current build environment -# -# Depends on this settings defined in board-specific defconfig file installed -# at $(TOPDIR)/.config: -# -# CONFIG_WINDOWS_NATIVE - Defined for a Windows native build - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - INCDIR = "$(TOPDIR)\tools\incdir.bat" -else - INCDIR = "$(TOPDIR)/tools/incdir.sh" -endif - -# PREPROCESS - Default macro to run the C pre-processor -# Example: $(call PREPROCESS, in-file, out-file) -# -# Depends on these settings defined in board-specific Make.defs file -# installed at $(TOPDIR)/Make.defs: -# -# CPP - The command to invoke the C pre-processor -# CPPFLAGS - Options to pass to the C pre-processor - -define PREPROCESS - @echo "CPP: $1->$2" - $(Q) $(CPP) $(CPPFLAGS) $1 -o $2 -endef - -# COMPILE - Default macro to compile one C file -# Example: $(call COMPILE, in-file, out-file) -# -# Depends on these settings defined in board-specific Make.defs file -# installed at $(TOPDIR)/Make.defs: -# -# CC - The command to invoke the C compiler -# CFLAGS - Options to pass to the C compiler - -define COMPILE - @echo "CC: $1" - $(Q) $(CC) -c $(CFLAGS) $(abspath $1) -o $2 -endef - -# COMPILEXX - Default macro to compile one C++ file -# Example: $(call COMPILEXX, in-file, out-file) -# -# Depends on these settings defined in board-specific Make.defs file -# installed at $(TOPDIR)/Make.defs: -# -# CXX - The command to invoke the C++ compiler -# CXXFLAGS - Options to pass to the C++ compiler - -define COMPILEXX - @echo "CXX: $1" - $(Q) $(CXX) -c $(CXXFLAGS) $(abspath $1) -o $2 -endef - -# ASSEMBLE - Default macro to assemble one assembly language file -# Example: $(call ASSEMBLE, in-file, out-file) -# -# NOTE that the most common toolchain, GCC, uses the compiler to assemble -# files because this has the advantage of running the C Pre-Processor against -# the assembly language files. This is not possible with other toolchains; -# platforms using those other tools should define AS and over-ride this -# definition in order to use the assembler directly. -# -# Depends on these settings defined in board-specific Make.defs file -# installed at $(TOPDIR)/Make.defs: -# -# CC - By default, the C compiler is used to compile assembly language -# files -# AFLAGS - Options to pass to the C+compiler - -define ASSEMBLE - @echo "AS: $1" - $(Q) $(CC) -c $(AFLAGS) $(abspath $1) -o $2 -endef - -# ARCHIVE - Add a list of files to an archive -# Example: $(call ARCHIVE, archive-file, "file1 file2 file3 ...") -# -# Note: The fileN strings may not contain spaces or characters that may be -# interpreted strangely by the shell -# -# Depends on these settings defined in board-specific Make.defs file -# installed at $(TOPDIR)/Make.defs: -# -# AR - The command to invoke the archiver (includes any options) -# -# Depends on this settings defined in board-specific defconfig file installed -# at $(TOPDIR)/.config: -# -# CONFIG_WINDOWS_NATIVE - Defined for a Windows native build - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) -define ARCHIVE - @echo AR: $2 - $(Q) $(AR) $1 $(2) -endef -else -define ARCHIVE - @echo "AR: $2" - $(Q) $(AR) $1 $(2) || { echo "$(AR) $1 FAILED!" ; exit 1 ; } -endef -endif - -# DELFILE - Delete one file - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) -define DELFILE - $(Q) if exist $1 (del /f /q $1) -endef -else -define DELFILE - $(Q) rm -f $1 -endef -endif - -# DELDIR - Delect one directory - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) -define DELDIR - $(Q) if exist $1 (rmdir /q /s $1) -endef -else -define DELDIR - $(Q) rm -rf $1 -endef -endif - -# CLEAN - Default clean target - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) -define CLEAN - $(Q) if exist *$(OBJEXT) (del /f /q *$(OBJEXT)) - $(Q) if exist *$(LIBEXT) (del /f /q *$(LIBEXT)) - $(Q) if exist *~ (del /f /q *~) - $(Q) if exist (del /f /q .*.swp) -endef -else -define CLEAN - $(Q) rm -f *$(OBJEXT) *$(LIBEXT) *~ .*.swp -endef -endif -
\ No newline at end of file diff --git a/nuttx/tools/Makefile.export b/nuttx/tools/Makefile.export deleted file mode 100644 index 6dfe72bf9..000000000 --- a/nuttx/tools/Makefile.export +++ /dev/null @@ -1,77 +0,0 @@ -############################################################################ -# Makefile.export -# -# Copyright (C) 2011 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt <gnutt@nuttx.org> -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name NuttX nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -include $(TOPDIR)/.config -include $(EXPORTDIR)/Make.defs - -ifdef ARCHSCRIPT -# -# ARCHSCRIPT may contain a leading -T; it must not be followed by a space -# for this to work. -# -ifeq ($(WINTOOL),y) -LDPATH = $(shell cygpath -u $(patsubst -T%,%,$(ARCHSCRIPT))) -else -LDPATH = $(patsubst -T%,%,$(ARCHSCRIPT)) -endif - -LDNAME = ${notdir ${LDPATH}} -LDDIR = ${dir ${LDPATH}} -endif - -ARCHSUBDIR = "arch/$(CONFIG_ARCH)/src" -ARCHDIR ="$(TOPDIR)/$(ARCHSUBDIR)" - -all: $(EXPORTDIR)/makeinfo.sh -default: all -.PHONY: clean - -$(EXPORTDIR)/makeinfo.sh: $(TOPDIR)/.config $(EXPORTDIR)/Make.defs - @echo "#!/bin/bash" > $(EXPORTDIR)/makeinfo.sh - @echo "" >> $(EXPORTDIR)/makeinfo.sh - @echo "ARCHSUBDIR=\"$(ARCHSUBDIR)\"" >> $(EXPORTDIR)/makeinfo.sh - @echo "ARCHDIR=\"$(ARCHDIR)\"" >> $(EXPORTDIR)/makeinfo.sh -ifdef ARCHSCRIPT - @echo "LDNAME=\"$(LDNAME)\"" >> $(EXPORTDIR)/makeinfo.sh - @echo "LDDIR=\"$(LDDIR)\"" >> $(EXPORTDIR)/makeinfo.sh - @echo "LDPATH=\"$(LDPATH)\"" >> $(EXPORTDIR)/makeinfo.sh -endif - @echo "ARCHCFLAGS=\"$(ARCHCFLAGS) $(ARCHCPUFLAGS)\"" >> $(EXPORTDIR)/makeinfo.sh - @echo "ARCHCXXFLAGS=\"$(ARCHCXXFLAGS) $(ARCHCPUFLAGS)\"" >> $(EXPORTDIR)/makeinfo.sh - @echo "CROSSDEV=\"$(CROSSDEV)\"" >> $(EXPORTDIR)/makeinfo.sh - $(Q) chmod 755 $(EXPORTDIR)/makeinfo.sh - -clean: - $(Q) rm -f $(EXPORTDIR)/makeinfo.sh diff --git a/nuttx/tools/Makefile.host b/nuttx/tools/Makefile.host deleted file mode 100644 index 998d38916..000000000 --- a/nuttx/tools/Makefile.host +++ /dev/null @@ -1,170 +0,0 @@ -############################################################################ -# Makefile.host -# -# Copyright (C) 2007, 2008, 2011-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}/.. --include $(TOPDIR)/Make.defs -include ${TOPDIR}/tools/Config.mk - -# Define HOSTCC on the make command line if it differs from these defaults -# Define HOSTCFLAGS with -g on the make command line to build debug versions - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - -# In the Windows native environment, the MinGW GCC compiler is assumed - -HOSTCC ?= mingw-gcc.exe -HOSTCFLAGS ?= -O2 -Wall -Wstrict-prototypes -Wshadow -I. -DCONFIG_WINDOWS_NATIVE=y - -else - -# GCC is assumed in the POSIX environment. -# strtok_r is used in some tools, but does not seem to be available in -# the MinGW environment. - -HOSTCC ?= gcc -HOSTCFLAGS ?= -O2 -Wall -Wstrict-prototypes -Wshadow -I. -DHAVE_STRTOK_C - -endif - -# Targets - -all: b16$(HOSTEXEEXT) bdf-converter$(HOSTEXEEXT) cmpconfig$(HOSTEXEEXT) \ - configure$(HOSTEXEEXT) mkconfig$(HOSTEXEEXT) mkdeps$(HOSTEXEEXT) mksymtab$(HOSTEXEEXT) \ - mksyscall$(HOSTEXEEXT) mkversion$(HOSTEXEEXT) -default: mkconfig$(HOSTEXEEXT) mksyscall$(HOSTEXEEXT) mkdeps$(HOSTEXEEXT) - -ifdef HOSTEXEEXT -.PHONY: b16 bdf-converter cmpconfig clean configure mkconfig mkdeps mksymtab mksyscall mkversion -else -.PHONY: clean -endif - -# b16 - Fixed precision math conversion tool - -b16$(HOSTEXEEXT): b16.c - $(Q) $(HOSTCC) $(HOSTCFLAGS) -o b16$(HOSTEXEEXT) b16.c - -ifdef HOSTEXEEXT -b16: b16$(HOSTEXEEXT) -endif - -# configure - Instantiate a canned NuttX configuration - -configure$(HOSTEXEEXT): configure.c cfgparser.c - $(Q) $(HOSTCC) $(HOSTCFLAGS) -o configure$(HOSTEXEEXT) configure.c cfgparser.c - -ifdef HOSTEXEEXT -configure: configure$(HOSTEXEEXT) -endif - -# mkconfig - Convert a .config file into a C config.h file - -mkconfig$(HOSTEXEEXT): mkconfig.c cfgdefine.c - $(Q) $(HOSTCC) $(HOSTCFLAGS) -o mkconfig$(HOSTEXEEXT) mkconfig.c cfgdefine.c - -ifdef HOSTEXEEXT -mkconfig: mkconfig$(HOSTEXEEXT) -endif - -# cmpconfig - Compare the contents of two configuration files - -cmpconfig$(HOSTEXEEXT): cmpconfig.c cfgparser.c - $(Q) $(HOSTCC) $(HOSTCFLAGS) -o cmpconfig$(HOSTEXEEXT) cmpconfig.c cfgparser.c - -ifdef HOSTEXEEXT -cmpconfig: cmpconfig$(HOSTEXEEXT) -endif - -# mkversion - Convert a .version file into a C version.h file - -mkversion$(HOSTEXEEXT): mkconfig.c cfgdefine.c - $(Q) $(HOSTCC) $(HOSTCFLAGS) -o mkversion$(HOSTEXEEXT) mkversion.c cfgdefine.c - -ifdef HOSTEXEEXT -mkversion: mkversion$(HOSTEXEEXT) -endif - -# mksyscall - Convert a CSV file into syscall stubs and proxies - -mksyscall$(HOSTEXEEXT): mksyscall.c csvparser.c - $(Q) $(HOSTCC) $(HOSTCFLAGS) -o mksyscall$(HOSTEXEEXT) mksyscall.c csvparser.c - -ifdef HOSTEXEEXT -mksyscall: mksyscall$(HOSTEXEEXT) -endif - -# mksymtab - Convert a CSV file into a symbol table - -mksymtab$(HOSTEXEEXT): mksymtab.c csvparser.c - $(Q) $(HOSTCC) $(HOSTCFLAGS) -o mksymtab$(HOSTEXEEXT) mksymtab.c csvparser.c - -ifdef HOSTEXEEXT -mksymtab: mksymtab$(HOSTEXEEXT) -endif - -# bdf-converter - Converts a BDF font to the NuttX font format - -bdf-converter$(HOSTEXEEXT): bdf-converter.c - $(Q) $(HOSTCC) $(HOSTCFLAGS) -o bdf-converter$(HOSTEXEEXT) bdf-converter.c - -ifdef HOSTEXEEXT -bdf-converter: bdf-converter$(HOSTEXEEXT) -endif - -# Create dependencies for a list of files - -mkdeps$(HOSTEXEEXT): mkdeps.c csvparser.c - $(Q) $(HOSTCC) $(HOSTCFLAGS) -o mkdeps$(HOSTEXEEXT) mkdeps.c - -ifdef HOSTEXEEXT -mkdeps: mkdeps$(HOSTEXEEXT) -endif - -clean: - $(call DELFILE, mkdeps) - $(call DELFILE, mkdeps.exe) - $(call DELFILE, mkconfig) - $(call DELFILE, mkconfig.exe) - $(call DELFILE, Make.dep) - $(call DELFILE, mksyscall) - $(call DELFILE, mksyscall.exe) - $(call DELFILE, mkversion) - $(call DELFILE, mkversion.exe) - $(call DELFILE, bdf-converter) - $(call DELFILE, bdf-converter.exe) -ifneq ($(CONFIG_WINDOWS_NATIVE),y) - $(Q) rm -rf *.dSYM -endif - $(call CLEAN) diff --git a/nuttx/tools/README.txt b/nuttx/tools/README.txt deleted file mode 100644 index 8df4a7783..000000000 --- a/nuttx/tools/README.txt +++ /dev/null @@ -1,486 +0,0 @@ -tools/README.txt -================ - -This README file addresses the contents of the NuttX tools/ directory. - -The tools/ directory contains miscellaneous scripts and host C programs -that are necessary parts of the the NuttX build system. These files -include: - -README.txt ----------- - - This file! - -Config.mk ---------- - - This file contains common definitions used by many configureation files. - This file (along with <nuttx>/.config) must be included at the top of - each configuration-specific Make.defs file like: - - -include $(TOPDIR)/.config - include $(TOPDIR)/tools/Config.mk - - Subsequent logic within the configuration-specific Make.defs file may then - override these default definitions as necessary. - -configure.sh -configure.bat -configure.c, cfgparser.c, and cfgparser.h ------------- - - configure.sh is a bash script that is used to configure NuttX for a given - target board in a environment that supports POSIX paths (Linux, Cygwin, - OSX, or similar). See configs/README.txt or Documentation/NuttxPortingGuide.html - for a description of how to configure NuttX with this script. - - configure.c, cfgparser.c, and cfgparser.h can be used to build a work-alike - program as a replacement for configure.sh. This work-alike program would be - used in environments that do not support Bash scripting (such as the Windows - native environment). - - configure.bat is a small Windows batch file that can be used as a replacement - for configure.sh in a Windows native environment. configure.bat is actually - just a thin layer that execuates configure.exe if it is available. If - configure.exe is not available, then configure.bat will attempt to build it - first. - - In order two build configure.exe from configure.c in the Windows native - environment, two assumptions are made: - - 1) You have installed the MinGW GCC toolchain. This toolchain can be - downloaded from http://www.mingw.org/. Tt is recommended the you not - install the optional MSYS components as there may be conflicts. - 2) That path to bin bin/ directory containing mingw-gcc.exe must be - included in the PATH variable. - -discover.py ------------ - - Example script for discovering devices in the local network. - It is the counter part to apps/netutils/discover - -mkconfig.c, cfgdefine.c, and cfgdefine.h ----------------------------------------- - - These are Cs file that are used to build mkconfig program. The mkconfig - program is used during the initial NuttX build. - - When you configure NuttX, you will copy a configuration file called .config - in the top level NuttX directory (See configs/README.txt or - Documentation/NuttxPortingGuide.html). The first time you make NuttX, - the top-level makefile will build the mkconfig executable from mkconfig.c - (using Makefile.host). The top-level Makefile will then execute the - mkconfig program to convert the .config file in the top level directory - into include/nuttx/config.h. config.h is a another version of the - NuttX configuration that can be included by C files. - -cmdconfig.c ------------ - - This C file can be used to build a utility for comparing two NuttX - configuration files. - -mkexport.sh and Makefile.export -------------------------------- - - These implement part of the top-level Makefile's 'export' target. That - target will bundle up all of the NuttX libraries, header files, and the - startup object into an export-able, binary NuttX distribution. The - Makefile.export is used only by the mkexport.sh script to parse out - options from the top-level Make.defs file. - -mkfsdata.pl ------------ - - This perl script is used to build the "fake" file system and CGI support - as needed for the apps/netutils/webserver. It is currently used only - by the Makefile at apps/examples/uip. That example serves as an example - of how to configure the uIP webserver "fake" file system. - - NOTE: This perl script comes from uIP and was (probably) written - by Adam Dunkels. uIP has a license that is compatible with NuttX. - -mkversion.c, cfgdefine.c, and cfgdefine.h ------------------------------------------ - - This is C file that is used to build mkversion program. The mkversion - program is used during the initial NuttX build. - - When you build NuttX there should be a version file called .version in - the top level NuttX directory (See Documentation/NuttxPortingGuide.html). - The first time you make NuttX, the top-level makefile will build th - mkversion executable from mkversion.c (using Makefile.host). The top- - level Makefile will then execute the mkversion program to convert the - .version file in the top level directory into include/nuttx/version.h. - version.h provides version information that can be included by C files. - -mksyscall.c, cvsparser.c, and cvsparser.h ------------------------------------------ - - This is a C file that is used to build mksyscall program. The mksyscall - program is used during the initial NuttX build by the logic in the top- - level syscall/ directory. - - If you build NuttX as a separately compiled, monolithic kernel and separate - applications, then there is a syscall layer that is used to get from the - user application space to the NuttX kernel space. In the user application - "proxies" for each of the kernel functions are provided. The proxies have - the same function signature as the kernel function, but only execute a - system call. - - Within the kernel, there are "stubs" for each of the system calls. The - stubs receive the marshalled system call data, and perform the actually - kernel function call (in kernel-mode) on behalf of the proxy function. - - Information about the stubs and proxies is maintained in a comma separated - value (CSV) file in the syscall/ directory. The mksyscall program will - accept this CVS file as input and generate all of the required proxy or - stub files as output. See syscall/README.txt for additonal information. - -mksymtab.c, cvsparser.c, and cvsparser.h ----------------------------------------- - - This is a C file that is used to build symbol tables from common-separated - value (CSV) files. This tool is not used during the NuttX build, but - can be used as needed to generate files. - - USAGE: ./mksymtab <cvs-file> <symtab-file> - - Where: - - <cvs-file> : The path to the input CSV file - <symtab-file>: The path to the output symbol table file - -d : Enable debug output - - Example: - - cd nuttx/tools - cat ../syscall/syscall.csv ../lib/lib.csv | sort >tmp.csv - ./mksymtab.exe tmp.csv tmp.c - -pic32mx -------- - - This directory contains build tools used only for PIC32MX platforms - -bdf-convert.c -------------- - - This C file is used to build the bdf-converter program. The bdf-converter - program be used to convert fonts in Bitmap Distribution Format (BDF) - into fonts that can be used in the NX graphics system. - - Below are general instructions for creating and installing a new font - in the NX graphic system: - - 1. Locate a font in BDF format, - 2. Use the bdf-converter program to convert the BDF font to the NuttX - font format. This will result in a C header file containing - defintions. That header file should be installed at, for example, - graphics/nxfonts/nxfonts_myfont.h. - - Create a new NuttX configuration variable. For example, suppose - you define the following variable: CONFIG_NXFONT_MYFONT. Then - you would need to: - - 3. Define CONFIG_NXFONT_MYFONT=y in your NuttX configuration file. - - A font ID number has to be assigned for each new font. The font ID - is defined in the file include/nuttx/nx/nxfonts.h. Those definitions - have to be extended to support your new font. Look at how the font ID - enabled by CONFIG_NXFONT_SANS23X27 is defined and add an ID for your - new font in a similar fashion: - - 4. include/nuttx/nx/nxfonts.h. Add you new font as a possible system - default font: - - #if defined(CONFIG_NXFONT_SANS23X27) - # define NXFONT_DEFAULT FONTID_SANS23X27 - #elif defined(CONFIG_NXFONT_MYFONT) - # define NXFONT_DEFAULT FONTID_MYFONT - #endif - - Then define the actual font ID. Make sure that the font ID value - is unique: - - enum nx_fontid_e - { - FONTID_DEFAULT = 0 /* The default font */ - #ifdef CONFIG_NXFONT_SANS23X27 - , FONTID_SANS23X27 = 1 /* The 23x27 sans serif font */ - #endif - #ifdef CONFIG_NXFONT_MYFONT - , FONTID_MYFONT = 2 /* My shiny, new font */ - #endif - ... - - New Add the font to the NX build system. There are several files that - you have to modify to to this. Look how the build system uses the - font CONFIG_NXFONT_SANS23X27 for examaples: - - 5. nuttx/graphics/Makefile. This file needs logic to auto-generate - a C source file from the header file that you generated with the - the bdf-converter program. Notice NXFONTS_FONTID=2; this must be - set to the same font ID value that you defined in the - include/nuttx/nx/nxfonts.h file. - - genfontsources: - ifeq ($(CONFIG_NXFONT_SANS23X27),y) - @$(MAKE) -C nxfonts -f Makefile.sources TOPDIR=$(TOPDIR) NXFONTS_FONTID=1 EXTRADEFINES=$(EXTRADEFINES) - endif - ifeq ($(CONFIG_NXFONT_MYFONT),y) - @$(MAKE) -C nxfonts -f Makefile.sources TOPDIR=$(TOPDIR) NXFONTS_FONTID=2 EXTRADEFINES=$(EXTRADEFINES) - endif - - 6. nuttx/graphics/nxfonts/Make.defs. Set the make variable NXFSET_CSRCS. - NXFSET_CSRCS determines the name of the font C file to build when - NXFONTS_FONTID=2: - - ifeq ($(CONFIG_NXFONT_SANS23X27),y) - NXFSET_CSRCS += nxfonts_bitmaps_sans23x27.c - endif - ifeq ($(CONFIG_NXFONT_MYFONT),y) - NXFSET_CSRCS += nxfonts_bitmaps_myfont.c - endif - - 7. nuttx/graphics/nxfonts/Makefile.sources. This is the Makefile used - in step 5 that will actually generate the font C file. So, given - your NXFONTS_FONTID=2, it needs to determine a prefix to use for - auto-generated variable and function names and (again) the name of - the autogenerated file to create (this must be the same name that - was used in nuttx/graphics/nxfonts/Make.defs): - - ifeq ($(NXFONTS_FONTID),1) - NXFONTS_PREFIX := g_sans23x27_ - GEN_CSRC = nxfonts_bitmaps_sans23x27.c - endif - ifeq ($(NXFONTS_FONTID),2) - NXFONTS_PREFIX := g_myfont_ - GEN_CSRC = nxfonts_bitmaps_myfont.c - endif - - 8. graphics/nxfonts/nxfonts_bitmaps.c. This is the file that contains - the generic font structures. It is used as a "template" file by - nuttx/graphics/nxfonts/Makefile.sources to create your customized - font data set. - - #if NXFONTS_FONTID == 1 - # include "nxfonts_sans23x27.h" - #elif NXFONTS_FONTID == 2 - # include "nxfonts_myfont.h" - #else - # error "No font ID specified" - #endif - - Where nxfonts_myfont.h is the NuttX font file that we generated in - step 2 using the bdf-converter tool. - - 9. graphics/nxfonts/nxfonts_getfont.c. Finally, we need to extend the - logic that does the run-time font lookups so that can find our new - font. The lookup function is NXHANDLE nxf_getfonthandle(enum nx_fontid_e fontid). - The new font information needs to be added to data structures used by - that function: - - #ifdef CONFIG_NXFONT_SANS23X27 - extern const struct nx_fontpackage_s g_sans23x27_package; - #endif - #ifdef CONFIG_NXFONT_MYFONT - extern const struct nx_fontpackage_s g_myfont_package; - #endif - - static FAR const struct nx_fontpackage_s *g_fontpackages[] = - { - #ifdef CONFIG_NXFONT_SANS23X27 - &g_sans23x27_package, - #endif - #ifdef CONFIG_NXFONT_MYFONT - &g_myfont_package, - #endif - NULL - }; - -Makefile.host -------------- - - This is the makefile that is used to make the mkconfig program from - the mkconfig.c C file, the cmpconfig program from cmpconfig.c C file - the mkversion program from the mkconfig.c C file, or the mksyscall - program from the mksyscall.c file. Usage: - - cd tools/ - make -f Makefile.host <program> - -mkromfsimg.sh -------------- - - This script may be used to automate the generate of a ROMFS file system - image. It accepts an rcS script "template" and generates and image that - may be mounted under /etc in the NuttX pseudo file system. - -mkdeps.sh -mkdeps.bat -mkdeps.c -mknulldeps.sh -------------- - - NuttX uses the GCC compilers capabilities to create Makefile dependencies. - The bash script mkdeps.sh is used to run GCC in order to create the - dependencies. If a NuttX configuration uses the GCC toolchain, its Make.defs - file (see configs/README.txt) will include a line like: - - MKDEP = $(TOPDIR)/tools/mkdeps.sh, or - MKDEP = $(TOPDIR)/tools/mkdeps[.exe] (See NOTE below) - - If the NuttX configuration does not use a GCC compatible toolchain, then - it cannot use the dependencies and instead it uses mknulldeps.sh: - - MKDEP = $(TOPDIR)/tools/mknulldeps.sh - - The mknulldeps.sh is a stub script that does essentially nothing. - - NOTE: The mk*deps.* files are undergoing change. mkdeps.sh is a bash - script that produces dependencies well for POSIX style hosts (e..g., - Linux and Cygwin). It does not work well for mixed environments with - a Windows toolchain running in a POSIX style environemnt (hence, the - mknulldeps.sh script). And, of course, cannot be used in a Windows - nativ environment. - - [mkdeps.sh does have an option, --winpath, that purports to convert - the dependencies generated by a Windows toolchain to POSIX format. - However, that is not being used and mostly likely does not cover - all of the conversion cases.] - - mkdeps.bat is a simple port of the bash script to run in a Windows - command shell. However, it does not work well either because some - of the common CFLAGS use characters like '=' which are transformed - by the CMD.exe shell. - - mkdeps.c generates mkdeps (on Linux) or mkdeps.exe (on Windows). - However, this verison is still under-development. It works well in - the all POSIX environment or in the all Windows environment but also - does not work well in mixed POSIX environment with a Windows toolchain. - In that case, there are still issues with the conversion of things like - 'c:\Program Files' to 'c:program files' by bash. Those issues may, - eventually be solvable but for now continue to use mknulldeps.sh in - that mixed environment. - -define.sh -define.bat ---------- - - Different compilers have different conventions for specifying pre- - processor definitions on the compiler command line. This bash - script allows the build system to create create command line definitions - without concern for the particular compiler in use. - - The define.bat script is a counterpart for use in the native Windows - build. - -incdir.sh -incdir.bat ---------- - - Different compilers have different conventions for specifying lists - of include file paths on the the compiler command line. This incdir.sh - bash script allows the build system to create include file paths without - concern for the particular compiler in use. - - The incdir.bat script is a counterpart for use in the native Windows - build. However, there is currently only one compiler supported in - that context: MinGW-GCC. - -link.sh -link.bat -copydir.sh -copydir.bat -unlink.sh -unlink.bat ----------- - - Different file system have different capabilities for symbolic links. - Some windows file systems have no native support for symbolic links. - Cygwin running under windows has special links built in that work with - all cygwin tools. However, they do not work when Windows native tools - are used with cygwin. In that case something different must be done. - - If you are building under Linux or under cygwin with a cygwin tool - chain, then your Make.defs file may have definitions like the - following: - - DIRLINK = $(TOPDIR)/tools/link.sh - DIRUNLINK = (TOPDIR)/tools/unlink.sh - - The first definition is not always present because link.sh is the - default. link.sh is a bash script that performs a normal, Linux-style - symbolic link; unlink.sh is a do-it-all unlinking script. - - But if you are building under cygwin using a Windows native toolchain - within a POSIX framework (such as Cygwin), then you will need something - like the following in you Make.defs file: - - DIRLINK = $(TOPDIR)/tools/copydir.sh - DIRUNLINK = (TOPDIR)/tools/unlink.sh - - copydir.sh will copy the whole directory instead of linking it. - - Finally, if you are running in a pure native Windows environment with - a CMD.exe shell, then you will need something like this: - - DIRLINK = $(TOPDIR)/tools/copydir.bat - DIRUNLINK = (TOPDIR)/tools/unlink.bat - - Note that this will copy directories. ;ink.bat might also be used in - this case. link.bat will attempt to create a symbolic link using the - NTFS mklink.exe command instead of copying files. That logic, however, - has not been verified as of this writing. - -kconfig.bat ------------ - - Recent versions of NuttX support building NuttX from a native Windows - CMD.exe shell. But kconfig-frontends is a Linux tool and is not yet - available in the pure CMD.exe environment. At this point, there are - only a few options for the Windows user (see the top-level README.txt - file). - - You can, with some effort, run the the Cygwin kconfig-mconf tool directly - in the CMD.exe shell. In this case, you do not have to modify the - .config file, but there are other complexities: You need to - temporarily set the Cgywin directories in the PATH variable and - then run kconfig-mconf outside of the Make system. - - kconfig.bat is a Windows batch file at tools/kconfig.bat that automates - these steps. It is used from the top-level NuttX directory like: - - tools/kconfig menuconfig - - NOTE: There is an currently an issue with accessing DOS environment - variables from the Cygwin kconfig-mconf running in the CMD.exe shell. - The following change to the top-level Kconfig file seems to work around - these problems: - - config APPSDIR - string - - option env="APPSDIR" - + default "../apps" - -mkimage.sh ----------- - - The creates a downloadable image as needed with the rrload bootloader. - -indent.sh ---------- - - This script can be used to indent .c and .h files in a manner similar - to my coding NuttX coding style. It doesn't do a really good job, - however (see the comments at the top of the indent.sh file). - -zipme.sh --------- - - I use this script to create the nuttx-xx.yy.tar.gz tarballs for - release on SourceForge. It is handy because it also does the - kind of clean that you need to do to make a clean code release. diff --git a/nuttx/tools/b16.c b/nuttx/tools/b16.c deleted file mode 100644 index 66d581ffa..000000000 --- a/nuttx/tools/b16.c +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** - * tools/b16.c - * - * 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <stdio.h> -#include <stdlib.h> - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -static void show_usage(const char *progname) -{ - fprintf(stderr, "\nUSAGE: %s <b16_t>|<float>\n", progname); - fprintf(stderr, "\nWhere:\n"); - fprintf(stderr, " <b16_t>:\n"); - fprintf(stderr, " A b16 fixed precision value in hexadecimal form: E.g., 0x00010000\n"); - fprintf(stderr, " Any value begininning with '0' will assumed by be hexadecimal format\n"); - fprintf(stderr, " <float>:\n"); - fprintf(stderr, " A floating value in standard form: E.g., 5.1\n"); - exit(EXIT_FAILURE); -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv, char **envp) -{ - double fvalue; - unsigned long ulvalue; - long lvalue; - const char *str; - char *endptr; - - /* There must be exactly one argument */ - - if (argc != 2) - { - fprintf(stderr, "\nExpected a single argument\n"); - show_usage(argv[0]); - } - str = argv[1]; - - /* If the value begins with a zero, we will assume that it is a hexadecimal - * representation. - */ - - if (str[0] == '0') - { - endptr = NULL; - ulvalue = strtoul(str, &endptr, 16); - if (!endptr || *endptr != '\0') - { - fprintf(stderr, "\nHexadecimal argument not fully converted\n"); - show_usage(argv[0]); - } - - if (ulvalue >= 0x80000000) - { - lvalue = ~ulvalue + 1; - } - else - { - lvalue = ulvalue; - } - - fvalue = ((double)lvalue) / 65536.0; - printf("0x%08lx -> %10.5f\n", ulvalue, fvalue); - } - else - { - endptr = NULL; - fvalue = strtod(str, &endptr); - if (!endptr || *endptr != '\0') - { - fprintf(stderr, "\nFloating point argument not fully converted\n"); - show_usage(argv[0]); - } - - lvalue = 65536.0 * fvalue; - printf("%10.5f -> 0x%08lx\n", fvalue, lvalue); - } - - return 0; -} diff --git a/nuttx/tools/bdf-converter.c b/nuttx/tools/bdf-converter.c deleted file mode 100644 index a03faa93e..000000000 --- a/nuttx/tools/bdf-converter.c +++ /dev/null @@ -1,676 +0,0 @@ -/**************************************************************************** - * tools/bdf-converter.c - * - * Copyright (C) 2011 NX Engineering, S.A., All rights reserved. - * Author: Jose Pablo Carballo Gomez <jcarballo@nx-engineering.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/* - * Based one the "Glyph Bitmap Distribution Format (BDF) Specification", - * Version 2.2, by Adobe Systems Incorporated. - * - */ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <stdbool.h> -#include <string.h> -#include <ctype.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/* -#define VERBOSE -#define DBG -*/ - -// BDF Specification Version 2.2: -// This version lifts the restriction on line length. In this version, the new -// maximum length of a value of the type string is 65535 characters, and hence -// lines may now be at least this long. - -#define BDF_MAX_LINE_LENGTH 65535 - -/* Ranges of 7-bit and 8-bit fonts */ - -#define NXFONT_MIN7BIT 33 -#define NXFONT_MAX7BIT 126 - -#define NXFONT_MIN8BIT 161 -#define NXFONT_MAX8BIT 255 - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* This structure holds information about a glyph */ - -typedef struct glyphinfo_s -{ - char *name; /* Name for they glyph */ - int encoding; /* The Adobe Standard Encoding value */ - int dw_x0; /* Width in x of the vector indicating - * the position of the next glyph's origin - * relative to the origin of this glyph */ - int dw_y0; /* Width in y of the vector indicating - * the position of the next glyph's origin - * relative to the origin of this glyph */ - int bb_w; /* The width of the black pixels in x */ - int bb_h; /* The height of the black pixels in y */ - int bb_x_off; /* X displacement of the lower left corner - * of the bitmap from origin 0 */ - int bb_y_off; /* Y displacement of the lower left corner - * of the bitmap from origin 0 */ - uint64_t *bitmap; /* Hexadecimal data for the character bitmap */ -} glyphinfo_t; - -/* This structures provides the metrics for one glyph */ - -typedef struct nx_fontmetric_s -{ - uint32_t stride : 3; /* Width of one font row in bytes */ - uint32_t width : 6; /* Width of the font in bits */ - uint32_t height : 6; /* Height of the font in rows */ - uint32_t xoffset : 6; /* Top, left-hand corner X-offset in pixels */ - uint32_t yoffset : 6; /* Top, left-hand corner y-offset in pixels */ - uint32_t unused : 5; -} nx_fontmetric_t; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: trimLine - * - * Description: - * Trims the line removing space characters at the front and at the end - * of the line. - * - * Input Parameters: - * line - The line to trim - * - ****************************************************************************/ -static void trimLine(char *line) -{ - char *str; - str = line; - char *strEnd; - for (strEnd = str + strlen(str) - 1; - strEnd >= str && isspace((int)(*strEnd)); - strEnd--); - *(strEnd + 1) = 0; -} - -/**************************************************************************** - * Name: bdf_parseIntLine - * - * Description: - * Parses a line containing a BDF property followed by integers. It will - * ignore the first token that corresponds to the property name. - * - * Input Parameters: - * line - A line with a BDF property followed by integers, i.e.: - * "FONTBOUNDINGBOX 8 13 0 -2" - * count - How many integers are specified by the BDF property. In the - * example above, count = 4. - * info - A pointer to memory provided by the caller in which to - * return the array of integers. For the example above: - * info[0] = 8 - * info[1] = 13 - * info[2] = 0 - * info[3] = -2 - * - ****************************************************************************/ -static void bdf_parseintline(char *line, unsigned int count, int *info) -{ - char *str, *token, *saveptr1; - str = line; - - /* Ignore the key */ - - token = (char *)strtok_r(str, " ", &saveptr1); - - while ((token = (char *)strtok_r(NULL, " ", &saveptr1)) && count--) - { - *(info++) = atoi(token); - } -} - -/**************************************************************************** - * Name: bdf_printglyphinfo - * - * Description: - * Prints the information available for a glyph. - * - * Input Parameters: - * ginfo - A glyphinfo_t struct with the glyph's information. - * - ****************************************************************************/ -#ifdef DBG -static void bdf_printglyphinfo(const glyphinfo_t *ginfo) -{ - printf("NAME = %s\n", ginfo->name); - printf("ENCODING = %d\n", ginfo->encoding); - printf("DW_X0 = %d\n", ginfo->dw_x0); - printf("DW_Y0 = %d\n", ginfo->dw_y0); - printf("BB_W = %d\n", ginfo->bb_w); - printf("BB_H = %d\n", ginfo->bb_h); - printf("BB_X_OFF = %d\n", ginfo->bb_x_off); - printf("BB_Y_OFF = %d\n", ginfo->bb_y_off); - int i; - for (i = 0; i < ginfo->bb_h; i++) - { - printf("BITMAP[%d] = %x\n", i, ginfo->bitmap[i]); - } -} -#endif /* DBG */ - -/**************************************************************************** - * Name: bdf_printnxmetricinfo - * - * Description: - * Prints the information available for a glyph's metric in the NX - * graphics system. - * - * Input Parameters: - * info - A nx_fontmetric_t struct with the glyph's information. - * - ****************************************************************************/ -#ifdef DBG -static void bdf_printnxmetricinfo(const nx_fontmetric_t *info) -{ - printf("STRIDE = %d\n", info->stride); - printf("WIDTH = %d\n", info->width); - printf("HEIGHT = %d\n", info->height); - printf("XOFFSET = %d\n", info->xoffset); - printf("YOFFSET = %d\n", info->yoffset); -} -#endif /* DBG */ - -/**************************************************************************** - * Name: bdf_getglyphinfo - * - * Description: - * Obtains the information for an individual glyph. The BDF properties - * taken into account are: - * - ENCODING - * - DWIDTH - * - BBX - * BDF properties ignored: - * - SWIDTH - * - SWIDTH1 - * - DWIDTH1 - * - VVECTOR - * - * Input Parameters: - * file - The input file stream pointing to the first line of the - * glyph's information (right after STARTCHAR). - * ginfo - A glyphinfo_t struct to fill with the glyph's information. - * - ****************************************************************************/ -static void bdf_getglyphinfo(FILE *file, glyphinfo_t *ginfo) -{ - char line[BDF_MAX_LINE_LENGTH]; - char lineCopy[BDF_MAX_LINE_LENGTH]; - char *str, *token, *saveptr1; - bool done; - - done = false; - - while(fgets(line, BDF_MAX_LINE_LENGTH, file) != NULL && !done) - { - trimLine(line); - strcpy(lineCopy, line); - str = line; - - while ((token = (char *)strtok_r(str, " ", &saveptr1))) - { - - /* ENCODING information */ - - if(strcmp(token, "ENCODING") == 0) - { - token = (char *)strtok_r(NULL, " ", &saveptr1); - ginfo->encoding = atoi(token); - } - - /* DWIDTH information */ - - if(strcmp(token, "DWIDTH") == 0) - { - token = (char *)strtok_r(NULL, " ", &saveptr1); - ginfo->dw_x0 = atoi(token); - token = (char *)strtok_r(NULL, " ", &saveptr1); - ginfo->dw_y0 = atoi(token); - } - - /* BBX information */ - - else if(strcmp(token, "BBX") == 0) - { - int bbxinfo[4]; - bdf_parseintline(lineCopy, 4, bbxinfo); - ginfo->bb_w = bbxinfo[0]; - ginfo->bb_h = bbxinfo[1]; - ginfo->bb_x_off = bbxinfo[2]; - ginfo->bb_y_off = bbxinfo[3]; - - /* This is the last BDF property of interest*/ - - done = true; - } - - str = NULL; - } - - } -} - -/**************************************************************************** - * Name: bdf_getglyphbitmap - * - * Description: - * Obtains the character bitmap information for an individual glyph. - * - * Input Parameters: - * file - The input file stream pointing to the first line of the - * glyph's bitmap (right after BITMAP). - * ginfo - A glyphinfo_t struct to fill with the glyph's bitmap. - * - ****************************************************************************/ -static void bdf_getglyphbitmap(FILE *file, glyphinfo_t *ginfo) -{ - char line[BDF_MAX_LINE_LENGTH]; - uint64_t *bitmap; - bool readingbitmap; - - bitmap = ginfo->bitmap; - readingbitmap = true; - - while (readingbitmap) - { - if (fgets(line, BDF_MAX_LINE_LENGTH, file) != NULL) - { - trimLine(line); - - if(strcmp(line, "ENDCHAR") == 0) - { - readingbitmap = false; - } - else - { - char *endptr; - *bitmap = strtoul(line, &endptr, 16); - bitmap++; - } - - } - else - { - /* error condition */ - - readingbitmap = false; - } - - } -} - -/**************************************************************************** - * Name: bdf_getstride - * - * Description: - * Obtains the stride for an individual glyph. The stride is the width - * of one glyph's bitmap row in bytes. - * - * Input Parameters: - * ginfo - A glyphinfo_t struct with the glyph's information. - * stride - A pointer to memory provided by the caller in which to - * return the stride. - * - ****************************************************************************/ -static void bdf_getstride(glyphinfo_t *ginfo, uint32_t *stride) -{ - *stride = (ginfo->bb_w % 8 == 0) ? ginfo->bb_w / 8 : ginfo->bb_w / 8 + 1; -} - -/**************************************************************************** - * Name: bdf_printoutput - * - * Description: - * Prints to the output stream the information of an individual glyph in - * the NuttX font format. - * - * Input Parameters: - * out - The output stream. - * ginfo - A glyphinfo_t struct with the glyph's information. - * nxmetric - A nx_fontmetric_t struct with the glyph's information. - * - ****************************************************************************/ -static void bdf_printoutput(FILE *out, - glyphinfo_t *ginfo, - nx_fontmetric_t *nxmetric) -{ - - /* Only interested in the 7 and 8 bit ranges */ - - if ((ginfo->encoding >= NXFONT_MIN7BIT && - ginfo->encoding <= NXFONT_MAX7BIT) || - (ginfo->encoding >= NXFONT_MIN8BIT && - ginfo->encoding <= NXFONT_MAX8BIT)) - { - - /* Glyph general info */ - - if (ginfo->bb_x_off < 0) - { - fprintf(out, - "/* %s (%d) -- NOTE: Xoffset should be %d, not 0. */\n", - ginfo->name, - ginfo->encoding, - ginfo->bb_x_off); - } - else - { - fprintf(out, "/* %s (%d) */\n", ginfo->name, ginfo->encoding); - } - - /* Glyph metrics */ - - fprintf(out, - "#define NXFONT_METRICS_%d {%d, %d, %d, %d, %d, 0}\n", - ginfo->encoding, - nxmetric->stride, - nxmetric->width, - nxmetric->height, - nxmetric->xoffset, - nxmetric->yoffset); - - /* Glyph bitmap */ - - fprintf(out, "#define NXFONT_BITMAP_%d {", ginfo->encoding); - int i, j; - for (i = 0; i < ginfo->bb_h - 1; i++) - { - for (j = 1; j <= nxmetric->stride; j++) - { - int nxbyteoffset; - uint8_t nxbyte = 0; - uint64_t tempbitmap = ginfo->bitmap[i]; - - /* Get the next byte */ - - nxbyteoffset = (nxmetric->stride - j) * 8; - nxbyte = (uint8_t)(tempbitmap >> nxbyteoffset); - fprintf(out, "0x%x, ", nxbyte); - } - } - - /* Different behavior for the last bitmap */ - - for (j = 1; j <= nxmetric->stride; j++) - { - int nxbyteoffset; - uint8_t nxbyte = 0; - uint64_t tempbitmap = ginfo->bitmap[i]; - - /* Get the next byte */ - - nxbyteoffset = (nxmetric->stride - j) * 8; - nxbyte = (uint8_t)(tempbitmap >> nxbyteoffset); - - if (j == nxmetric->stride) - { - fprintf(out, "0x%x}\n", nxbyte); - } - else - { - fprintf(out, "0x%x, ", nxbyte); - } - } - - fprintf(out, "\n"); - } - -} - -/**************************************************************************** - * Main - ****************************************************************************/ - -int main(int argc, char **argv) -{ - FILE *file, *out; - char line[BDF_MAX_LINE_LENGTH]; - char lineCopy[BDF_MAX_LINE_LENGTH]; - char *str, *token, *saveptr1; - char *input, *output; - - /* FONTBOUNDINGBOX properties*/ - - int fbb_x = 0; - int fbb_y = 0; - int fbb_x_off = 0; - int fbb_y_off = 0; - - /* Input BDF file */ - - input = argv[1]; - - if (input == NULL) - { - printf("%s: no input file\n", argv[0]); - exit(0); - } - - file = fopen(input, "r"); - - if (file == NULL) - { - printf("%s: error opening file %s\n", argv[0], input); - exit(0); - } - else - { -#ifdef VERBOSE - printf("Opening \"%s\"\n", input); -#endif /* VERBOSE */ - } - - /* Output file */ - if (argv[2]) - { - output = argv[2]; - } - else - { - output = "nxfonts_myfont.h"; - } - - out = fopen(output, "w"); - - if (out == NULL) - { - printf("%s: error opening file %s\n", argv[0], output); - fclose(file); - exit(0); - } - else - { - while (fgets(line, BDF_MAX_LINE_LENGTH, file) != NULL) - { - -#ifdef DBG - printf("--\n"); -#endif /* DBG */ - - // Save a copy of the line - - strcpy(lineCopy,line); - - // Clean it - - trimLine(line); - str = line; - - while ((token = (char *)strtok_r(str, " ", &saveptr1))) - { - - /* FONTBOUNDINGBOX - Global font information */ - - if (strcmp(token, "FONTBOUNDINGBOX") == 0) - { - int fbbinfo[4]; - bdf_parseintline(lineCopy, 4, fbbinfo); - fbb_x = fbbinfo[0]; - fbb_y = fbbinfo[1]; - fbb_x_off = fbbinfo[2]; - fbb_y_off = fbbinfo[3]; - - /* Print FONTBOUNDINGBOX information */ - - fprintf(out, "/* Maximum height and width of any"); - fprintf(out, " glyph in the set */\n\n"); - fprintf(out, "#define NXFONT_MAXHEIGHT %d\n", fbb_y); - fprintf(out, "#define NXFONT_MAXWIDTH %d\n\n", fbb_x); - } - - /* STARTCHAR - Individual glyph information */ - - if (strcmp(token, "STARTCHAR") == 0) - { - glyphinfo_t ginfo; - - /* Glyph name */ - - ginfo.name = (char *)strtok_r(NULL, " ", &saveptr1); - -#ifdef VERBOSE - printf("Processing glyph: %s\n", ginfo.name); -#endif /* VERBOSE */ - - /* Glyph information: - * ENCODING - * DWIDTH - * BBX - */ - ginfo.encoding = 0; - ginfo.dw_x0 = 0; - ginfo.dw_y0 = 0; - ginfo.bb_w = 0; - ginfo.bb_h = 0; - ginfo.bb_x_off = 0; - ginfo.bb_y_off = 0; - bdf_getglyphinfo(file, &ginfo); - - /* Glyph bitmap */ - - ginfo.bitmap = malloc(sizeof(uint64_t) * ginfo.bb_h); - bdf_getglyphbitmap(file, &ginfo); - -#ifdef DBG - bdf_printglyphinfo(&ginfo); -#endif /* DBG */ - - /* Convert to nxfonts */ - - nx_fontmetric_t nxmetric; - uint32_t stride; - bdf_getstride(&ginfo, &stride); - nxmetric.stride = stride; - nxmetric.width = ginfo.bb_w; - nxmetric.height = ginfo.bb_h; - - /* The NuttX font format does not support - * negative X offsets. */ - - if (ginfo.bb_x_off < 0) - { - nxmetric.xoffset = 0; - printf("%s: ignoring negative x offset for " - "glyph '%s' (%d)\n", - argv[0], - ginfo.name, - ginfo.encoding); - } - else - { - nxmetric.xoffset = ginfo.bb_x_off; - } - - nxmetric.yoffset = fbb_y + fbb_y_off - - ginfo.bb_y_off - ginfo.bb_h; - - -#ifdef DBG - bdf_printnxmetricinfo(&nxmetric); -#endif /* DBG */ - - /* The space (32) character is treated differently */ - - if (ginfo.encoding == 32) - { - fprintf(out, "/* The width of a space */\n\n"); - fprintf(out, "#define NXFONT_SPACEWIDTH %d\n\n", ginfo.dw_x0); - } - else - { - bdf_printoutput(out, &ginfo, &nxmetric); - } - - /* Free memory */ - - free(ginfo.bitmap); - - } - - str = NULL; - } - - } - fclose(file); - fclose(out); - - /* The End */ - - printf("Generated \"%s\"\n", output); - - } - - return EXIT_SUCCESS; -} diff --git a/nuttx/tools/cfgdefine.c b/nuttx/tools/cfgdefine.c deleted file mode 100644 index f026a186f..000000000 --- a/nuttx/tools/cfgdefine.c +++ /dev/null @@ -1,323 +0,0 @@ -/**************************************************************************** - * tools/cfgdefine.c - * - * 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <string.h> -#include <ctype.h> -#include "cfgdefine.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -char line[LINESIZE+1]; - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/* These are configuration variable name that are quoted by configuration tool - * but which must be unquoted when used in C code. - */ - -static const char *dequote_list[] = -{ - /* NuttX */ - - "CONFIG_USER_ENTRYPOINT", /* Name of entry point function */ - "CONFIG_EXECFUNCS_SYMTAB", /* Symbol table used by exec[l|v] */ - - /* NxWidgets/NxWM */ - - "CONFIG_NXWM_BACKGROUND_IMAGE", /* Name of bitmap image class */ - "CONFIG_NXWM_STARTWINDOW_ICON", /* Name of bitmap image class */ - "CONFIG_NXWM_NXCONSOLE_ICON", /* Name of bitmap image class */ - "CONFIG_NXWM_CALIBRATION_ICON", /* Name of bitmap image class */ - "CONFIG_NXWM_HEXCALCULATOR_ICON", /* Name of bitmap image class */ - - NULL /* Marks the end of the list */ -}; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - - /* Skip over any spaces */ - -static char *skip_space(char *ptr) -{ - while (*ptr && isspace((int)*ptr)) ptr++; - return ptr; -} - -/* Find the end of a variable string */ - -static char *find_name_end(char *ptr) -{ - while (*ptr && (isalnum((int)*ptr) || *ptr == '_')) ptr++; - return ptr; -} - -/* Find the end of a value string */ - -static char *find_value_end(char *ptr) -{ - while (*ptr && !isspace((int)*ptr)) - { - if (*ptr == '"') - { - do ptr++; while (*ptr && *ptr != '"'); - if (*ptr) ptr++; - } - else - { - do ptr++; while (*ptr && !isspace((int)*ptr) && *ptr != '"'); - } - } - return ptr; -} - -/* Read the next line from the configuration file */ - -static char *read_line(FILE *stream) -{ - char *ptr; - - for (;;) - { - line[LINESIZE] = '\0'; - if (!fgets(line, LINESIZE, stream)) - { - return NULL; - } - else - { - ptr = skip_space(line); - if (*ptr && *ptr != '#' && *ptr != '\n') - { - return ptr; - } - } - } -} - -/* Parse the line from the configuration file into a variable name - * string and a value string. - */ - -static void parse_line(char *ptr, char **varname, char **varval) -{ - /* Skip over any leading spaces */ - - ptr = skip_space(ptr); - - /* The first no-space is the beginning of the variable name */ - - *varname = skip_space(ptr); - *varval = NULL; - - /* Parse to the end of the variable name */ - - ptr = find_name_end(ptr); - - /* An equal sign is expected next, perhaps after some white space */ - - if (*ptr && *ptr != '=') - { - /* Some else follows the variable name. Terminate the variable - * name and skip over any spaces. - */ - - *ptr = '\0'; - ptr = skip_space(ptr + 1); - } - - /* Verify that the equal sign is present */ - - if (*ptr == '=') - { - /* Make sure that the variable name is terminated (this was already - * done if the name was followed by white space. - */ - - *ptr = '\0'; - - /* The variable value should follow =, perhaps separated by some - * white space. - */ - - ptr = skip_space(ptr + 1); - if (*ptr) - { - /* Yes.. a variable follows. Save the pointer to the start - * of the variable string. - */ - - *varval = ptr; - - /* Find the end of the variable string and make sure that it - * is terminated. - */ - - ptr = find_value_end(ptr); - *ptr = '\0'; - } - } -} - -static char *dequote_value(const char *varname, char *varval) -{ - const char **dqnam; - char *dqval = varval; - int len; - - if (dqval) - { - /* Check if the variable name is in the list of strings to be dequoated */ - - for (dqnam = dequote_list; *dqnam; dqnam++) - { - if (strcmp(*dqnam, varname) == 0) - { - break; - } - } - - /* Did we find the variable name in the list of configuration variables - * to be dequoated? - */ - - if (*dqnam) - { - /* Yes... Check if there is a traiing quote */ - - len = strlen(dqval); - if (dqval[len-1] == '"') - { - /* Yes... replace it with a terminator */ - - dqval[len-1] = '\0'; - len--; - } - - /* Is there a leading quote? */ - - if (dqval[0] == '"') - { - /* Yes.. skip over the leading quote */ - - dqval++; - len--; - } - - /* Handle the case where nothing is left after dequoting */ - - if (len <= 0) - { - dqval = NULL; - } - } - } - - return dqval; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -void generate_definitions(FILE *stream) -{ - char *varname; - char *varval; - char *ptr; - - /* Loop until the entire file has been parsed. */ - - do - { - /* Read the next line from the file */ - - ptr = read_line(stream); - if (ptr) - { - /* Parse the line into a variable and a value field */ - - parse_line(ptr, &varname, &varval); - - /* Was a variable name found? */ - - if (varname) - { - /* Yes.. dequote the value if necessary */ - - varval = dequote_value(varname, varval); - - /* If no value was provided or if the special value 'n' was provided, - * then undefine the configuration variable. - */ - - if (!varval || strcmp(varval, "n") == 0) - { - printf("#undef %s\n", varname); - } - - /* Simply define the configuration variable if it has the special - * value "y" - */ - - else if (strcmp(varval, "y") == 0) - { - printf("#define %s 1\n", varname); - } - - /* Otherwise, use the value as provided */ - - else - { - printf("#define %s %s\n", varname, varval); - } - } - } - } - while (ptr); -} diff --git a/nuttx/tools/cfgdefine.h b/nuttx/tools/cfgdefine.h deleted file mode 100644 index f76ba73fb..000000000 --- a/nuttx/tools/cfgdefine.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** - * tools/cfgdefine.h - * - * Copyright (C) 2007-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -#ifndef __TOOLS_CFGDEFINE_H -#define __TOOLS_CFGDEFINE_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <stdio.h> -#include <limits.h> - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -#define LINESIZE ( PATH_MAX > 256 ? PATH_MAX : 256 ) - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -extern char line[LINESIZE+1]; - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -void generate_definitions(FILE *stream); - -#endif /* __TOOLS_CFGDEFINE_H */ diff --git a/nuttx/tools/cfgparser.c b/nuttx/tools/cfgparser.c deleted file mode 100644 index ac25bd26b..000000000 --- a/nuttx/tools/cfgparser.c +++ /dev/null @@ -1,296 +0,0 @@ -/**************************************************************************** - * tools/cfgpaser.c - * - * 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <string.h> -#include <stdlib.h> -#include <ctype.h> - -#include "cfgparser.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -char line[LINESIZE+1]; - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - - /* Skip over any spaces */ - -static char *skip_space(char *ptr) -{ - while (*ptr && isspace((int)*ptr)) ptr++; - return ptr; -} - -/* Find the end of a variable string */ - -static char *find_name_end(char *ptr) -{ - while (*ptr && (isalnum((int)*ptr) || *ptr == '_')) ptr++; - return ptr; -} - -/* Find the end of a value string */ - -static char *find_value_end(char *ptr) -{ - while (*ptr && !isspace((int)*ptr)) - { - if (*ptr == '"') - { - do ptr++; while (*ptr && *ptr != '"'); - if (*ptr) ptr++; - } - else - { - do ptr++; while (*ptr && !isspace((int)*ptr) && *ptr != '"'); - } - } - return ptr; -} - -/* Read the next line from the configuration file */ - -static char *read_line(FILE *stream) -{ - char *ptr; - - for (;;) - { - line[LINESIZE] = '\0'; - if (!fgets(line, LINESIZE, stream)) - { - return NULL; - } - else - { - ptr = skip_space(line); - if (*ptr && *ptr != '#' && *ptr != '\n') - { - return ptr; - } - } - } -} - -/* Parse the line from the configuration file into a variable name - * string and a value string. - */ - -static void parse_line(char *ptr, char **varname, char **varval) -{ - /* Skip over any leading spaces */ - - ptr = skip_space(ptr); - - /* The first no-space is the beginning of the variable name */ - - *varname = skip_space(ptr); - *varval = NULL; - - /* Parse to the end of the variable name */ - - ptr = find_name_end(ptr); - - /* An equal sign is expected next, perhaps after some white space */ - - if (*ptr && *ptr != '=') - { - /* Some else follows the variable name. Terminate the variable - * name and skip over any spaces. - */ - - *ptr = '\0'; - ptr = skip_space(ptr + 1); - } - - /* Verify that the equal sign is present */ - - if (*ptr == '=') - { - /* Make sure that the variable name is terminated (this was already - * done if the name was followed by white space. - */ - - *ptr = '\0'; - - /* The variable value should follow =, perhaps separated by some - * white space. - */ - - ptr = skip_space(ptr + 1); - if (*ptr) - { - /* Yes.. a variable follows. Save the pointer to the start - * of the variable string. - */ - - *varval = ptr; - - /* Find the end of the variable string and make sure that it - * is terminated. - */ - - ptr = find_value_end(ptr); - *ptr = '\0'; - } - } -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -void parse_file(FILE *stream, struct variable_s **list) -{ - struct variable_s *curr; - struct variable_s *prev; - struct variable_s *next; - char *varname; - char *varval; - char *ptr; - - /* Loop until the entire file has been parsed. */ - - do - { - /* Read the next line from the file */ - - ptr = read_line(stream); - if (ptr) - { - /* Parse the line into a variable and a value field */ - - parse_line(ptr, &varname, &varval); - - /* If the variable has not value (or the special value 'n'), then - * ignore it. - */ - - if (!varval || strcmp(varval, "n") == 0) - { - continue; - } - - /* Make sure that a variable name was found. */ - - if (varname) - { - int varlen = strlen(varname) + 1; - int vallen = 0; - - /* Get the size of the value, including the NUL terminating - * character. - */ - - if (varval) - { - vallen = strlen(varval) + 1; - } - - /* Allocate memory to hold the struct variable_s with the - * variable name and the value. - */ - - curr = (struct variable_s *)malloc(sizeof(struct variable_s) + varlen + vallen - 1); - if (curr) - { - /* Add the variable to the list */ - - curr->var = &curr->storage[0]; - strcpy(curr->var, varname); - - curr->val = NULL; - if (varval) - { - curr->val = &curr->storage[varlen]; - strcpy(curr->val, varval); - } - } - - prev = 0; - next = *list; - while (next && strcmp(next->var, curr->var) <= 0) - { - prev = next; - next = next->flink; - } - - if (prev) - { - prev->flink = curr; - } - else - { - *list = curr; - } - - curr->flink = next; - } - } - } - while (ptr); -} - -struct variable_s *find_variable(const char *varname, struct variable_s *list) -{ - while (list) - { - if (strcmp(varname, list->var) == 0) - { - return list; - } - - list = list->flink; - } - - return NULL; -} - diff --git a/nuttx/tools/cfgparser.h b/nuttx/tools/cfgparser.h deleted file mode 100644 index b1f421a68..000000000 --- a/nuttx/tools/cfgparser.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * tools/cfgpaser.h - * - * Copyright (C) 2007-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -#ifndef __TOOLS_CFGPARSER_H -#define __TOOLS_CFGPARSER_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <stdio.h> -#include <limits.h> - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -#define LINESIZE ( PATH_MAX > 256 ? PATH_MAX : 256 ) - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -struct variable_s -{ - struct variable_s *flink; - char *var; - char *val; - char storage[1]; -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -extern char line[LINESIZE+1]; - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -void parse_file(FILE *stream, struct variable_s **list); -struct variable_s *find_variable(const char *varname, struct variable_s *list); - -#endif /* __TOOLS_CFGPARSER_H */ diff --git a/nuttx/tools/cmpconfig.c b/nuttx/tools/cmpconfig.c deleted file mode 100644 index a5a539401..000000000 --- a/nuttx/tools/cmpconfig.c +++ /dev/null @@ -1,179 +0,0 @@ -/**************************************************************************** - * tools/cmpconfig.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 <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <ctype.h> -#include <errno.h> - -#include "cfgparser.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -static void show_usage(const char *progname) -{ - fprintf(stderr, "USAGE: %s <config1> <config2>\n", progname); - exit(EXIT_FAILURE); -} - -static void compare_variables(struct variable_s *list1, struct variable_s *list2) -{ - char *varval1; - char *varval2; - int result; - - while (list1 || list2) - { - if (list1 && list1->val) - { - varval1 = list1->val; - } - else - { - varval1 = "<NULL>"; - } - - if (list2 && list2->val) - { - varval2 = list2->val; - } - else - { - varval2 = "<NULL>"; - } - - if (!list1) - { - printf("file1:\n"); - printf("file2: %s=%s\n\n", list2->var, varval2); - list2 = list2->flink; - } - else if (!list2) - { - printf("file1: %s=%s\n", list1->var, varval1); - printf("file2:\n\n"); - list1 = list1->flink; - } - else - { - result = strcmp(list1->var, list2->var); - if (result < 0) - { - printf("file1: %s=%s\n", list1->var, varval1); - printf("file2:\n\n"); - list1 = list1->flink; - } - else if (result > 0) - { - printf("file1:\n"); - printf("file2: %s=%s\n\n", list2->var, varval2); - list2 = list2->flink; - } - else /* if (result == 0) */ - { - result = strcmp(varval1, varval2); - if (result != 0) - { - printf("file1: %s=%s\n", list1->var, varval1); - printf("file2: %s=%s\n\n", list2->var, varval2); - } - - list1 = list1->flink; - list2 = list2->flink; - } - } - } -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv, char **envp) -{ - struct variable_s *list1 = 0; - struct variable_s *list2 = 0; - FILE *stream1; - FILE *stream2; - - if (argc != 3) - { - fprintf(stderr, "Unexpected number of arguments: %d\n\n", argc); - show_usage(argv[0]); - } - - stream1 = fopen(argv[1], "r"); - if (!stream1) - { - fprintf(stderr, "Failed to open %s for reading: %s\n\n", - argv[1], strerror(errno)); - show_usage(argv[0]); - } - - stream2 = fopen(argv[2], "r"); - if (!stream2) - { - fprintf(stderr, "Failed to open %s for reading: %s\n\n", - argv[2], strerror(errno)); - show_usage(argv[0]); - } - - parse_file(stream1, &list1); - parse_file(stream2, &list2); - - fclose(stream1); - fclose(stream2); - - printf("Comparing:\n\n"); - printf(" file1 = %s\n", argv[1]); - printf(" file2 = %s\n\n", argv[2]); - compare_variables(list1, list2); - return EXIT_SUCCESS; -} diff --git a/nuttx/tools/configure.bat b/nuttx/tools/configure.bat deleted file mode 100644 index 7dc9ca116..000000000 --- a/nuttx/tools/configure.bat +++ /dev/null @@ -1,127 +0,0 @@ -@echo off
-
-rem tools/configure.bat
-rem
-rem Copyright (C) 2012 Gregory Nutt. All rights reserved.
-rem Author: Gregory Nutt <gnutt@nuttx.org>
-rem
-rem Redistribution and use in source and binary forms, with or without
-rem modification, are permitted provided that the following conditions
-rem are met:
-rem
-rem 1. Redistributions of source code must retain the above copyright
-rem notice, this list of conditions and the following disclaimer.
-rem 2. Redistributions in binary form must reproduce the above copyright
-rem notice, this list of conditions and the following disclaimer in
-rem the documentation and/or other materials provided with the
-rem distribution.
-rem 3. Neither the name NuttX nor the names of its contributors may be
-rem used to endorse or promote products derived from this software
-rem without specific prior written permission.
-rem
-rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-rem FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-rem COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-rem OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-rem AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-rem LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-rem ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-rem POSSIBILITY OF SUCH DAMAGE.
-rem
-
-rem Parse command line arguments
-
-set debug=
-set fmt=-w
-set posix=
-set help=
-set appdir=
-set config=
-
-:ArgLoop
-if "%1"=="" goto :NoConfig
-if "%1"=="-h" goto :ShowUsage
-if "%1"=="-d" goto :SetDebug
-if "%1"=="-w" goto :SetWindows
-if "%1"=="-l" goto :SetPosix
-if "%1"=="-a" goto :SetAppDir
-
-set config=%1
-goto EndOfLoop
-
-:SetDebug
-set debug=-d
-goto :NextArg
-
-:SetWindows
-set fmt=-w
-goto :NextArg
-
-:SetWindows
-set fmt=-l
-goto :NextArg
-
-:SetAppDir
-shift
-set appdir=-a %1
-
-:NextArg
-shift
-goto :ArgLoop
-
-:EndOfLoop
-
-rem Check if we have to build configure.exe
-
-if exist configure.exe goto :HaveConfigureExe
-
-set cc=mingw32-gcc.exe
-set cflags=-Wall -Wstrict-prototypes -Wshadow -g -pipe -I. -DCONFIG_WINDOWS_NATIVE=y
-%cc% %cflags% -o configure.exe configure.c cfgparser.c
-if errorlevel 1 (
- echo ERROR: %cc% failed
- echo Is ming32-gcc.exe installed? Is it in the PATH variable?
- goto End
-)
-
-:HaveConfigureExe
-configure.exe %debug% %fmt% %appdir% %config%
-if errorlevel 1 echo configure.exe failed
-goto End
-
-:NoConfig
-echo Missing ^<board-name^>/^<config-name^> argument
-
-:ShowUsage
-echo USAGE: %0 [-d] [-w] [-l] [-h] [-a ^<app-dir^>] ^<board-name^>\^<config-name^>
-echo\nWhere:
-echo ^<board-name^>:
-echo Identifies the board. This must correspond to a board directory
-echo under nuttx/configs/.
-echo ^<config-name^>:
-echo Identifies the specific configuratin for the selected ^<board-name^>.
-echo This must correspond to a sub-directory under the board directory at
-echo under nuttx/configs/^<board-name^>/.
-echo ^<-d^>:
-echo Enables debug output
-echo ^<-w^>:
-echo Informs the tool that it should use Windows style paths like C:\\Program Files
-echo instead of POSIX style paths are used like /usr/local/bin. Windows
-echo style paths are used by default.
-echo ^<-l^>:
-echo Informs the tool that it should use POSIX style paths like /usr/local/bin.
-echo By default, Windows style paths like C:\\Program Files are used.
-echo -a ^<app-dir^>:
-echo Informs the configuration tool where the application build
-echo directory. This is a relative path from the top-level NuttX
-echo build directory. But default, this tool will look in the usual
-echo places to try to locate the application directory: ../apps or
-echo ../apps-xx.yy where xx.yy is the NuttX version number.
-echo ^<-h^>:
-echo Prints this message and exits.
-
-:End
diff --git a/nuttx/tools/configure.c b/nuttx/tools/configure.c deleted file mode 100644 index 9e82c3657..000000000 --- a/nuttx/tools/configure.c +++ /dev/null @@ -1,890 +0,0 @@ -/**************************************************************************** - * tools/configure.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 <sys/stat.h> - -#include <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> -#include <unistd.h> -#include <fcntl.h> -#include <string.h> -#include <dirent.h> -#include <libgen.h> -#include <errno.h> - -#include "cfgparser.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#define BUFFER_SIZE 1024 - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -#ifdef CONFIG_WINDOWS_NATIVE -static char g_delim = '\\'; /* Delimiter to use when forming paths */ -static bool g_winpaths = true; /* True: Windows style paths */ -#else -static char g_delim = '/'; /* Delimiter to use when forming paths */ -static bool g_winpaths = false; /* False: POSIX style paths */ -#endif -static bool g_debug = false; /* Enable debug output */ - -static const char *g_appdir = NULL; /* Relative path to the applicatin directory */ -static const char *g_boarddir = NULL; /* Name of board subdirectory */ -static char *g_configdir = NULL; /* Name of configuration subdirectory */ - -static char *g_topdir = NULL; /* Full path to top-level NuttX build directory */ -static char *g_apppath = NULL; /* Full path to the applicatino directory */ -static char *g_configtop = NULL; /* Full path to the top-level configuration directory */ -static char *g_configpath = NULL; /* Full path to the configuration sub-directory */ -static char *g_verstring = "0.0"; /* Version String */ - -static char *g_srcdefconfig = NULL; /* Source defconfig file */ -static char *g_srcmakedefs = NULL; /* Source Make.defs file */ -static char *g_srcappconfig = NULL ; /* Source appconfig file (optional) */ -static char *g_srcsetenvsh = NULL; /* Source setenv.sh file (optional) */ -static char *g_srcsetenvbat = NULL; /* Source setenv.bat file (optional) */ - -static bool g_newconfig = false; /* True: New style configuration */ -static bool g_winnative = false; /* True: Windows native configuration */ -static bool g_needapppath = true; /* Need to add app path to the .config file */ - -static char g_buffer[BUFFER_SIZE]; /* Scratch buffer for forming full paths */ - -static struct variable_s *g_configvars = NULL; -static struct variable_s *g_versionvars = NULL; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -static void show_usage(const char *progname, int exitcode) -{ - fprintf(stderr, "\nUSAGE: %s [-d] [-w] [-l] [-h] [-a <app-dir>] <board-name>[%c<config-name>]\n", progname, g_delim); - fprintf(stderr, "\nWhere:\n"); - fprintf(stderr, " <board-name>:\n"); - fprintf(stderr, " Identifies the board. This must correspond to a board directory\n"); - fprintf(stderr, " under nuttx%cconfigs%c.\n", g_delim, g_delim); - fprintf(stderr, " <config-name>:\n"); - fprintf(stderr, " Identifies the specific configuration for the selected <board-name>.\n"); - fprintf(stderr, " This must correspond to a sub-directory under the board directory at\n"); - fprintf(stderr, " under nuttx%cconfigs%c<board-name>%c.\n", g_delim, g_delim, g_delim); - fprintf(stderr, " <-d>:\n"); - fprintf(stderr, " Enables debug output\n"); - fprintf(stderr, " <-w>:\n"); -#ifdef CONFIG_WINDOWS_NATIVE - fprintf(stderr, " Informs the tool that it should use Windows style paths like C:\\Program Files\n"); - fprintf(stderr, " instead of POSIX style paths are used like /usr/local/bin. Windows\n"); - fprintf(stderr, " style paths are used by default.\n"); -#else - fprintf(stderr, " Informs the tool that it should use Windows style paths like C:\\Program Files.\n"); - fprintf(stderr, " By default, POSIX style paths like /usr/local/bin are used.\n"); -#endif - fprintf(stderr, " <-l>:\n"); -#ifdef CONFIG_WINDOWS_NATIVE - fprintf(stderr, " Informs the tool that it should use POSIX style paths like /usr/local/bin.\n"); - fprintf(stderr, " By default, Windows style paths like C:\\Program Files are used.\n"); -#else - fprintf(stderr, " Informs the tool that it should use POSIX style paths like /usr/local/bin\n"); - fprintf(stderr, " instead of Windows style paths like C:\\Program Files are used. POSIX\n"); - fprintf(stderr, " style paths are used by default.\n"); -#endif - fprintf(stderr, " -a <app-dir>:\n"); - fprintf(stderr, " Informs the configuration tool where the application build\n"); - fprintf(stderr, " directory. This is a relative path from the top-level NuttX\n"); - fprintf(stderr, " build directory. But default, this tool will look in the usual\n"); - fprintf(stderr, " places to try to locate the application directory: ..%capps or\n", g_delim); - fprintf(stderr, " ..%capps-xx.yy where xx.yy is the NuttX version number.\n", g_delim); - fprintf(stderr, " <-h>:\n"); - fprintf(stderr, " Prints this message and exits.\n"); - exit(exitcode); -} - -static void debug(const char *fmt, ...) -{ - va_list ap; - - if (g_debug) - { - va_start(ap, fmt); - (void)vprintf(fmt, ap); - va_end(ap); - } -} - -static void parse_args(int argc, char **argv) -{ - char *ptr; - int ch; - - /* Parse command line options */ - - g_debug = false; - - while ((ch = getopt(argc, argv, ":a:dwlh")) > 0) - { - switch (ch) - { - case 'a' : - g_appdir = optarg; - break; - - case 'd' : - g_debug = true; - break; - - case 'w' : - g_delim = '/'; - g_winpaths = true; - break; - - case 'l' : - g_delim = '\\'; - g_winpaths = false; - break; - - case 'h' : - show_usage(argv[0], EXIT_SUCCESS); - - case '?' : - fprintf(stderr, "ERROR: Unrecognized option: %c\n", optopt); - show_usage(argv[0], EXIT_FAILURE); - - case ':' : - fprintf(stderr, "ERROR: Missing option argument, option: %c\n", optopt); - show_usage(argv[0], EXIT_FAILURE); - - break; - fprintf(stderr, "ERROR: Unexpected option: %c\n", ch); - show_usage(argv[0], EXIT_FAILURE); - } - } - - /* There should be exactly one argument following the options */ - - if (optind >= argc) - { - fprintf(stderr, "ERROR: Missing <board-name>%c<config-name>\n", g_delim); - show_usage(argv[0], EXIT_FAILURE); - } - - /* The required option should be the board directory name and the - * configuration directory name separated by '/' or '\'. Either is - * acceptable in this context. - */ - - g_boarddir = argv[optind]; - optind++; - - ptr = strchr(g_boarddir, '/'); - if (!ptr) - { - ptr = strchr(g_boarddir, '\\'); - } - - if (!ptr) - { - fprintf(stderr, "ERROR: Invalid <board-name>%c<config-name>\n", g_delim); - show_usage(argv[0], EXIT_FAILURE); - } - - *ptr++ = '\0'; - g_configdir = ptr; - - if (optind < argc) - { - fprintf(stderr, "Unexpected garbage at the end of the line\n"); - show_usage(argv[0], EXIT_FAILURE); - } -} - -static void verify_directory(const char *directory) -{ - struct stat buf; - - if (stat(directory, &buf) < 0) - { - fprintf(stderr, "ERROR: stat of %s failed: %s\n", directory, strerror(errno)); - exit(EXIT_FAILURE); - } - - if (!S_ISDIR(buf.st_mode)) - { - fprintf(stderr, "ERROR: %s exists but is not a directory\n", directory); - exit(EXIT_FAILURE); - } -} - -static bool verify_optiondir(const char *directory) -{ - struct stat buf; - - if (stat(directory, &buf) < 0) - { - /* It may be okay if the dirctory does not exist */ - - /* It may be okay if the file does not exist */ - - int errcode = errno; - if (errcode == ENOENT) - { - debug("verify_optiondir: stat of %s failed: %s\n", directory, strerror(errno)); - return false; - } - else - { - fprintf(stderr, "ERROR: stat of %s failed: %s\n", directory, strerror(errno)); - exit(EXIT_FAILURE); - } - } - - if (!S_ISDIR(buf.st_mode)) - { - fprintf(stderr, "ERROR: %s exists but is not a directory\n", directory); - exit(EXIT_FAILURE); - } - - return true; -} - -static bool verify_file(const char *path) -{ - struct stat buf; - - if (stat(path, &buf) < 0) - { - /* It may be okay if the file does not exist */ - - int errcode = errno; - if (errcode == ENOENT) - { - debug("verify_file: stat of %s failed: %s\n", path, strerror(errno)); - return false; - } - else - { - fprintf(stderr, "ERROR: stat of %s failed: %s\n", path, strerror(errno)); - exit(EXIT_FAILURE); - } - } - - if (!S_ISREG(buf.st_mode)) - { - fprintf(stderr, "ERROR: %s exists but is not a regular file\n", path); - exit(EXIT_FAILURE); - } - - return true; -} - -static void get_topdir(void) -{ - /* Get and verify the top-level NuttX directory */ - - if (getcwd(g_buffer, BUFFER_SIZE) == NULL) - { - fprintf(stderr, "ERROR: getcwd failed: %s\n", strerror(errno)); - exit(EXIT_FAILURE); - } - - g_topdir = strdup(dirname(g_buffer)); - debug("get_topdir: Checking topdir=%s\n", g_topdir); - verify_directory(g_topdir); -} - -static void config_search(const char *boarddir) -{ - DIR *dir; - struct dirent *dp; - struct stat buf; - char *parent; - char *child; - - /* Skip over any leading '/' or '\\'. This happens on the first second - * call because the starting boarddir is "" - */ - - if (boarddir[0] == g_delim) - { - boarddir++; - } - - /* Get the full directory path and open it */ - - snprintf(g_buffer, BUFFER_SIZE, "%s%c%s", g_configtop, g_delim, boarddir); - dir = opendir(g_buffer); - if (!dir) - { - fprintf(stderr, "ERROR: Could not open %s: %s\n", - g_buffer, strerror(errno)); - return; - } - - /* Make a copy of the path to the directory */ - - parent = strdup(g_buffer); - - /* Vist each entry in the directory */ - - while ((dp = readdir (dir)) != NULL) - { - /* Ignore directory entries that start with '.' */ - - if (dp->d_name[0] == '.') - { - continue; - } - - /* Get a properly terminated copy of d_name (if d_name is long it may - * not include a NUL terminator.\ */ - - child = strndup(dp->d_name, NAME_MAX); - - /* Get the full path to d_name and stat the file/directory */ - - snprintf(g_buffer, BUFFER_SIZE, "%s%c%s", parent, g_delim, child); - if (stat(g_buffer, &buf) < 0) - { - fprintf(stderr, "ERROR: stat of %s failed: %s\n", - g_buffer, strerror(errno)); - free(child); - continue; - } - - /* If it is a directory, the recurse */ - - if (S_ISDIR(buf.st_mode)) - { - char *tmppath; - snprintf(g_buffer, BUFFER_SIZE, "%s%c%s", boarddir, g_delim, child); - tmppath = strdup(g_buffer); - config_search(tmppath); - free(tmppath); - } - - /* If it is a regular file named 'defconfig' then we have found a - * configuration directory. We could terminate the serach in this case - * because we do not expect sub-directories within configuration - * directories. - */ - - else if (S_ISREG(buf.st_mode) && strcmp("defconfig", child) == 0) - { - fprintf(stderr, " %s\n", boarddir); - } - - free(child); - } - - free(parent); - closedir(dir); -} - -static void enumerate_configs(void) -{ - fprintf(stderr, "Options for <board-name>[%c<config-name>] include:\n\n", g_delim); - config_search(""); -} - -static void check_configdir(void) -{ - /* Get the path to the top level configuration directory */ - - snprintf(g_buffer, BUFFER_SIZE, "%s%cconfigs", g_topdir, g_delim); - debug("check_configdir: Checking configtop=%s\n", g_buffer); - - verify_directory(g_buffer); - g_configtop = strdup(g_buffer); - - /* Get and verify the path to the selected configuration */ - - snprintf(g_buffer, BUFFER_SIZE, "%s%cconfigs%c%s%c%s", - g_topdir, g_delim, g_delim, g_boarddir, g_delim, g_configdir); - debug("check_configdir: Checking configpath=%s\n", g_buffer); - - if (!verify_optiondir(g_buffer)) - { - fprintf(stderr, "ERROR: No configuration at %s\n", g_buffer); - enumerate_configs(); - exit(EXIT_FAILURE); - } - - g_configpath = strdup(g_buffer); -} - -static void read_configfile(void) -{ - FILE *stream; - - snprintf(g_buffer, BUFFER_SIZE, "%s%cdefconfig", g_configpath, g_delim); - stream = fopen(g_buffer, "r"); - if (!stream) - { - fprintf(stderr, "ERROR: failed to open %s for reading: %s\n", - g_buffer, strerror(errno)); - exit(EXIT_FAILURE); - } - - parse_file(stream, &g_configvars); - fclose(stream); -} - -static void read_versionfile(void) -{ - FILE *stream; - - snprintf(g_buffer, BUFFER_SIZE, "%s%c.version", g_topdir, g_delim); - stream = fopen(g_buffer, "r"); - if (!stream) - { - /* It may not be an error if there is no .version file */ - - debug("Failed to open %s for reading: %s\n", - g_buffer, strerror(errno)); - } - else - { - parse_file(stream, &g_versionvars); - fclose(stream); - } -} - -static void get_verstring(void) -{ - struct variable_s *var; - - if (g_versionvars) - { - var = find_variable("CONFIG_VERSION_STRING", g_versionvars); - if (var && var->val) - { - g_verstring = strdup(var->val); - } - } - - debug("get_verstring: Version string=%s\n", g_verstring); -} - -static bool verify_appdir(const char *appdir) -{ - /* Does this directory exist? */ - - snprintf(g_buffer, BUFFER_SIZE, "%s%c%s", g_topdir, g_delim, appdir); - debug("verify_appdir: Checking apppath=%s\n", g_buffer); - if (verify_optiondir(g_buffer)) - { - /* Yes.. Use this application directory path */ - - g_appdir = strdup(appdir); - g_apppath = strdup(g_buffer); - return true; - } - - debug("verify_appdir: apppath=%s does not exist\n", g_buffer); - return false; -} - -static void check_appdir(void) -{ - char tmp[16]; - - /* Get and verify the full path to the application directory */ - /* Was the appdir provided on the command line? */ - - debug("check_appdir: Command line appdir=%s\n", - g_appdir ? g_appdir : "<null>"); - - if (!g_appdir) - { - /* No, was the path provided in the configuration? */ - - struct variable_s *var = find_variable("CONFIG_APP_DIR", g_configvars); - if (var) - { - debug("check_appdir: Config file appdir=%s\n", - var->val ? var->val : "<null>"); - - /* Yes.. does this directory exist? */ - - if (var->val && verify_appdir(var->val)) - { - /* We are using the CONFIG_APP_DIR setting already - * in the defconfig file. - */ - - g_needapppath = false; - return; - } - } - - /* Now try some canned locations */ - - /* Try ../apps-xx.yy where xx.yy is the version string */ - - snprintf(tmp, 16, ".%capps-%s", g_delim, g_verstring); - debug("check_appdir: Try appdir=%s\n", tmp); - if (verify_appdir(tmp)) - { - return; - } - - /* Try ../apps with no version */ - - snprintf(tmp, 16, "..%capps", g_delim); - debug("check_appdir: Try appdir=%s\n", tmp); - if (verify_appdir(tmp)) - { - return; - } - - /* Try ../apps-xx.yy where xx.yy are the NuttX version number */ - - fprintf(stderr, "ERROR: Could not find the path to the application directory\n"); - exit(EXIT_FAILURE); - } - else - { - snprintf(g_buffer, BUFFER_SIZE, "%s%c%s", g_topdir, g_delim, g_appdir); - if (!verify_appdir(g_buffer)) - { - fprintf(stderr, "ERROR: Command line path to application directory does not exist\n"); - exit(EXIT_FAILURE); - } - } -} - -static void check_configuration(void) -{ - struct variable_s *var; - - /* Check if this the new style configuration based on kconfig-fontends */ - - var = find_variable("CONFIG_NUTTX_NEWCONFIG", g_configvars); - if (var && var->val && strcmp("y", var->val) == 0) - { - debug("check_configuration: New style configuration\n"); - g_newconfig = true; - } - - /* Check if this is a Windows native configuration */ - - var = find_variable("CONFIG_WINDOWS_NATIVE", g_configvars); - if (var && var->val && strcmp("y", var->val) == 0) - { - debug("check_configuration: Windows native configuration\n"); - g_winnative = true; - } - - /* All configurations must provide a defconfig and Make.defs file */ - - snprintf(g_buffer, BUFFER_SIZE, "%s%cdefconfig", g_configpath, g_delim); - debug("check_configuration: Checking %s\n", g_buffer); - if (!verify_file(g_buffer)) - { - fprintf(stderr, "ERROR: No configuration in %s\n", g_configpath); - fprintf(stderr, " No defconfig file found.\n"); - enumerate_configs(); - exit(EXIT_FAILURE); - } - - g_srcdefconfig = strdup(g_buffer); - - snprintf(g_buffer, BUFFER_SIZE, "%s%cMake.defs", g_configpath, g_delim); - debug("check_configuration: Checking %s\n", g_buffer); - if (!verify_file(g_buffer)) - { - fprintf(stderr, "ERROR: Configuration corrupted in %s\n", g_configpath); - fprintf(stderr, " No Make.defs file found.\n"); - enumerate_configs(); - exit(EXIT_FAILURE); - } - - g_srcmakedefs = strdup(g_buffer); - - /* Windows native configurations may provide setenv.bat; POSIX - * configurations may provide a setenv.sh. - */ - - if (g_winnative) - { - snprintf(g_buffer, BUFFER_SIZE, "%s%csetenv.bat", g_configpath, g_delim); - debug("check_configuration: Checking %s\n", g_buffer); - if (verify_file(g_buffer)) - { - g_srcsetenvbat = strdup(g_buffer); - } - } - else - { - snprintf(g_buffer, BUFFER_SIZE, "%s%csetenv.sh", g_configpath, g_delim); - debug("check_configuration: Checking %s\n", g_buffer); - if (verify_file(g_buffer)) - { - g_srcsetenvsh = strdup(g_buffer); - } - } - - /* Old style configurations MUST provide an appconfig file */ - - if (!g_newconfig) - { - snprintf(g_buffer, BUFFER_SIZE, "%s%cappconfig", g_configpath, g_delim); - debug("check_configuration: Checking %s\n", g_buffer); - if (!verify_file(g_buffer)) - { - fprintf(stderr, "ERROR: Configuration corrupted in %s\n", g_configpath); - fprintf(stderr, " Required appconfig file not found.\n"); - enumerate_configs(); - exit(EXIT_FAILURE); - } - - g_srcappconfig = strdup(g_buffer); - } -} - -static void copy_file(const char *srcpath, const char *destpath, mode_t mode) -{ - int nbytesread; - int nbyteswritten; - int rdfd; - int wrfd; - - /* Open the source file for reading */ - - rdfd = open(srcpath, O_RDONLY); - if (rdfd < 0) - { - fprintf(stderr, "ERROR: Failed to open %s for reading: %s\n", srcpath, strerror(errno)); - exit(EXIT_FAILURE); - } - - /* Now open the destination for writing*/ - - wrfd = open(destpath, O_WRONLY|O_CREAT|O_TRUNC, mode); - if (wrfd < 0) - { - fprintf(stderr, "ERROR: Failed to open %s for writing: %s\n", destpath, strerror(errno)); - exit(EXIT_FAILURE); - } - - /* Now copy the file */ - - for (;;) - { - do - { - nbytesread = read(rdfd, g_buffer, BUFFER_SIZE); - if (nbytesread == 0) - { - /* End of file */ - - close(rdfd); - close(wrfd); - return; - } - else if (nbytesread < 0) - { - /* EINTR is not an error (but will still stop the copy) */ - - fprintf(stderr, "ERROR: Read failure: %s\n", strerror(errno)); - exit(EXIT_FAILURE); - } - } - while (nbytesread <= 0); - - do - { - nbyteswritten = write(wrfd, g_buffer, nbytesread); - if (nbyteswritten >= 0) - { - nbytesread -= nbyteswritten; - } - else - { - /* EINTR is not an error (but will still stop the copy) */ - - fprintf(stderr, "ERROR: Write failure: %s\n", strerror(errno)); - exit(EXIT_FAILURE); - } - } - while (nbytesread > 0); - } -} - -static void substitute(char *str, int ch1, int ch2) -{ - for (; *str; str++) - { - if (*str == ch1) - { - *str = ch2; - } - } -} - -static void configure(void) -{ - char *destconfig; - - /* Copy the defconfig file as .config */ - - snprintf(g_buffer, BUFFER_SIZE, "%s%c.config", g_topdir, g_delim); - destconfig = strdup(g_buffer); - debug("configure: Copying from %s to %s\n", g_srcdefconfig, destconfig); - copy_file(g_srcdefconfig, destconfig, 0644); - - /* Copy the Make.defs file as Make.defs */ - - snprintf(g_buffer, BUFFER_SIZE, "%s%cMake.defs", g_topdir, g_delim); - debug("configure: Copying from %s to %s\n", g_srcmakedefs, g_buffer); - copy_file(g_srcmakedefs, g_buffer, 0644); - - /* Copy the setenv.sh file if have one and need one */ - - if (g_srcsetenvsh) - { - snprintf(g_buffer, BUFFER_SIZE, "%s%csetenv.sh", g_topdir, g_delim); - debug("configure: Copying from %s to %s\n", g_srcsetenvsh, g_buffer); - copy_file(g_srcsetenvsh, g_buffer, 0755); - } - - /* Copy the setenv.bat file if have one and need one */ - - if (g_srcsetenvbat) - { - snprintf(g_buffer, BUFFER_SIZE, "%s%csetenv.bat", g_topdir, g_delim); - debug("configure: Copying from %s to %s\n", g_srcsetenvbat, g_buffer); - copy_file(g_srcsetenvbat, g_buffer, 0644); - } - - /* Copy the appconfig file to ../apps/.config if have one and need one */ - - if (g_srcappconfig) - { - snprintf(g_buffer, BUFFER_SIZE, "%s%c.config", g_apppath, g_delim); - debug("configure: Copying from %s to %s\n", g_srcappconfig, g_buffer); - copy_file(g_srcappconfig, g_buffer, 0644); - } - - /* If we did not use the CONFIG_APPS_DIR that was in the defconfig config file, - * then append the correct application information to the tail of the .config - * file - */ - - if (g_needapppath) - { - FILE *stream; - char *appdir = strdup(g_appdir); - - /* One complexity is if we are using Windows paths, but the configuration - * needs POSIX paths (or vice versa). - */ - - if (g_winpaths != g_winnative) - { - /* Not the same */ - - if (g_winpaths) - { - /* Using Windows paths, but the configuration wants POSIX paths */ - - substitute(appdir, '\\', '/'); - } - else - { - /* Using POSIX paths, but the configuration wants Windows paths */ - - substitute(appdir, '/', '\\'); - } - } - - /* Open the file for appending */ - - stream = fopen(destconfig, "a"); - if (!stream) - { - fprintf(stderr, "ERROR: Failed to open %s for append mode mode: %s\n", - destconfig, strerror(errno)); - exit(EXIT_FAILURE); - } - - fprintf(stream, "\n# Application configuration\n\n"); - fprintf(stream, "CONFIG_APPS_DIR=\"%s\"\n", appdir); - fclose(stream); - free(appdir); - } - - free(destconfig); -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv, char **envp) -{ - debug("main: Checking arguments\n"); - parse_args(argc, argv); - - debug("main: Checking Nuttx Directories\n"); - get_topdir(); - check_configdir(); - - debug("main: Reading the configuration/version files\n"); - read_configfile(); - read_versionfile(); - get_verstring(); - - debug("main: Checking Configuration Directory\n"); - check_configuration(); - - debug("main: Checking Application Directories\n"); - check_appdir(); - debug("main: Using apppath=%s\n", g_apppath ? g_apppath : "<null>"); - - debug("main: Configuring\n"); - configure(); - return EXIT_SUCCESS; -} diff --git a/nuttx/tools/configure.sh b/nuttx/tools/configure.sh deleted file mode 100755 index 89f2e2fbc..000000000 --- a/nuttx/tools/configure.sh +++ /dev/null @@ -1,233 +0,0 @@ -#!/bin/bash -# configure.sh -# -# Copyright (C) 2007, 2008, 2011 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. -# - -WD=`pwd` -TOPDIR="${WD}/.." -USAGE=" - -USAGE: ${0} [-d] [-a <app-dir>] <board-name>/<config-name> - -Where: - <board-name> is the name of the board in the configs directory - <config-name> is the name of the board configuration sub-directory - <add-dir> is the path to the apps/ directory, relative to the nuttx directory - -" - -# Parse command arguments - -unset boardconfig -unset appdir - -while [ ! -z "$1" ]; do - case "$1" in - -d ) - set -x - ;; - -h ) - echo "$USAGE" - exit 0 - ;; - -a ) - shift - appdir=$1 - ;; - *) - if [ ! -z "${boardconfig}" ]; then - echo "" - echo "<board/config> defined twice" - echo "$USAGE" - exit 1 - fi - boardconfig=$1 - ;; - esac - shift -done - -# Sanity checking - -if [ -z "${boardconfig}" ]; then - echo "" - echo "Missing <board/config> argument" - echo "$USAGE" - exit 2 -fi - -configpath=${TOPDIR}/configs/${boardconfig} -if [ ! -d "${configpath}" ]; then - echo "Directory ${configpath} does not exist. Options are:" - echo "" - echo "Select one of the following options for <board-name>:" - configlist=`find ${TOPDIR}/configs -name defconfig` - for defconfig in $configlist; do - config=`dirname $defconfig | sed -e "s,${TOPDIR}/configs/,,g"` - echo " $config" - done - echo "" - echo "$USAGE" - exit 3 -fi - -src_makedefs="${configpath}/Make.defs" -dest_makedefs="${TOPDIR}/Make.defs" - -if [ ! -r "${src_makedefs}" ]; then - echo "File \"${src_makedefs}\" does not exist" - exit 4 -fi - -src_setenv="${configpath}/setenv.sh" -unset have_setenv - -if [ -r "${src_setenv}" ]; then - dest_setenv=${TOPDIR}/setenv.sh - have_setenv=y -else - src_setenv="${configpath}/setenv.bat" - if [ -r "${src_setenv}" ]; then - dest_setenv=${TOPDIR}/setenv.bat - have_setenv=y - else - unset src_setenv - fi -fi - -src_config="${configpath}/defconfig" -dest_config="${TOPDIR}/.config" - -if [ ! -r "${src_config}" ]; then - echo "File \"${src_config}\" does not exist" - exit 6 -fi - -# Extract values needed from the defconfig file. We need: -# (1) The CONFIG_NUTTX_NEWCONFIG setting to know if this is a "new" style -# configuration, -# (2) The CONFIG_WINDOWS_NATIVE setting to know it this is target for a -# native Windows (meaning that we want setenv.bat vs setenv.sh and we need -# to use backslashes in the CONFIG_APPS_DIR setting). -# (3) The CONFIG_APPS_DIR setting to see if there is a configured location for the -# application directory. This can be overridden from the command line. - -newconfig=`grep CONFIG_NUTTX_NEWCONFIG= "${src_config}" | cut -d'=' -f2` -winnative=`grep CONFIG_WINDOWS_NATIVE= "${src_config}" | cut -d'=' -f2` - -defappdir=y -if [ -z "${appdir}" ]; then - quoted=`grep "^CONFIG_APPS_DIR=" "${src_config}" | cut -d'=' -f2` - if [ ! -z "${appdir}" ]; then - appdir=`echo ${quoted} | sed -e "s/\"//g"` - defappdir=n - fi -fi - -# Check for the apps/ directory in the usual place if appdir was not provided - -if [ -z "${appdir}" ]; then - - # Check for a version file - - unset CONFIG_VERSION_STRING - if [ -x "${TOPDIR}/.version" ]; then - . "${TOPDIR}/.version" - fi - - # Check for an unversioned apps/ directory - - if [ -d "${TOPDIR}/../apps" ]; then - appdir="../apps" - - else - # Check for a versioned apps/ directory - - if [ -d "${TOPDIR}/../apps-${CONFIG_VERSION_STRING}" ]; then - appdir="../apps-${CONFIG_VERSION_STRING}" - fi - fi -fi - -# For checking the apps dir path, we need a POSIX version of the relative path. - -posappdir=`echo "${appdir}" | sed -e 's/\\\\/\\//g'` -winappdir=`echo "${appdir}" | sed -e 's/\\//\\\\/g'` - -# If appsdir was provided (or discovered) then make sure that the apps/ -# directory exists - -if [ ! -z "${appdir}" -a ! -d "${TOPDIR}/${posappdir}" ]; then - echo "Directory \"${TOPDIR}/${posappdir}\" does not exist" - exit 7 -fi - -# Okay... Everything looks good. Setup the configuration - -install "${src_makedefs}" "${dest_makedefs}" || \ - { echo "Failed to copy \"${src_makedefs}\"" ; exit 7 ; } -if [ "X${have_setenv}" = "Xy" ]; then - install "${src_setenv}" "${dest_setenv}" || \ - { echo "Failed to copy ${src_setenv}" ; exit 8 ; } - chmod 755 "${dest_setenv}" -fi -install "${src_config}" "${dest_config}" || \ - { echo "Failed to copy \"${src_config}\"" ; exit 9 ; } - -# If we did not use the CONFIG_APPS_DIR that was in the defconfig config file, -# then append the correct application information to the tail of the .config -# file - -if [ "X${defappdir}" = "Xy" ]; then - sed -i -e "/^CONFIG_APPS_DIR/d" "${dest_config}" - echo "" >> "${dest_config}" - echo "# Application configuration" >> "${dest_config}" - echo "" >> "${dest_config}" - if [ "X${winnative}" = "Xy" ]; then - echo "CONFIG_APPS_DIR=\"$winappdir\"" >> "${dest_config}" - else - echo "CONFIG_APPS_DIR=\"$posappdir\"" >> "${dest_config}" - fi -fi - -# Copy appconfig file. The appconfig file will be copied to ${appdir}/.config -# if both (1) ${appdir} is defined and (2) we are not using the new configuration -# (which does not require a .config file in the appsdir. - -if [ ! -z "${appdir}" -a "X${newconfig}" != "Xy" ]; then - if [ ! -r "${configpath}/appconfig" ]; then - echo "NOTE: No readable appconfig file found in ${configpath}" - else - install "${configpath}/appconfig" "${TOPDIR}/${posappdir}/.config" || \ - { echo "Failed to copy ${configpath}/appconfig" ; exit 10 ; } - fi -fi diff --git a/nuttx/tools/copydir.bat b/nuttx/tools/copydir.bat deleted file mode 100755 index 2857c415f..000000000 --- a/nuttx/tools/copydir.bat +++ /dev/null @@ -1,102 +0,0 @@ -@echo off
-
-rem tools/copydir.bat
-rem
-rem Copyright (C) 2012 Gregory Nutt. All rights reserved.
-rem Author: Gregory Nutt <gnutt@nuttx.org>
-rem
-rem Redistribution and use in source and binary forms, with or without
-rem modification, are permitted provided that the following conditions
-rem are met:
-rem
-rem 1. Redistributions of source code must retain the above copyright
-rem notice, this list of conditions and the following disclaimer.
-rem 2. Redistributions in binary form must reproduce the above copyright
-rem notice, this list of conditions and the following disclaimer in
-rem the documentation and/or other materials provided with the
-rem distribution.
-rem 3. Neither the name NuttX nor the names of its contributors may be
-rem used to endorse or promote products derived from this software
-rem without specific prior written permission.
-rem
-rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-rem FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-rem COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-rem OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-rem AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-rem LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-rem ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-rem POSSIBILITY OF SUCH DAMAGE.
-rem
-
-rem
-rem NuttX uses symbolic links to configure platform-specific directories into
-rem the build system. This works great except for when a Windows native
-rem toolchain is used in a Cygwin environment. In that case, symbolic
-rem links do not work correctly when accessed from the Windows native toolchain;
-rem rather, just look link files with the extension .lnk
-rem
-rem In this environment, the build system will work around this using this script
-rem as a replacement for the 'ln' command. This scrpt will simply copy the
-rem directory into the expected positiion.
-rem
-
-set src=%1
-set dest=%2
-
-rem Verify that arguments were provided
-
-if "%src%"=="" goto :MissingSrc
-if "%dest%"=="" goto :MissingDest
-goto CheckSrc
-
-:MissingSrc
-
-echo Missing ^<src^> and ^<dest^> arguments
-goto :ShowUsage
-
-:MissingDest
-
-echo Missing ^<dest^> arguments
-goto :ShowUsage
-
-rem Verify that a directory exists at the source path
-
-:CheckSrc
-
-if exist %src% goto :CheckDest
-
-echo No directory at %src%
-goto :ShowUsage
-
-:CheckDest
-
-rem If something already exists at the destination path, remove it
-
-if not exist %dest% goto :CopyDir
-
-rmdir /q /s %dest%
-if errorlevel 1 (
- echo Failed to remove existing object at %dest%
- goto :ShowUsage
-)
-
-rem Copy the directory
-
-:CopyDir
-
-xcopy %src% %dest% /c /q /s /e /y /i
-echo FAKELNK > %dest%\.fakelnk
-goto :End
-
-:ShowUsage
-echo USAGE: %0 ^<src^> ^<dest^>
-echo Where:
-echo ^<src^> is the source directory to be copied
-echo ^<dest^> is the destination directory to be created
-
-:End
diff --git a/nuttx/tools/copydir.sh b/nuttx/tools/copydir.sh deleted file mode 100755 index 5d9f79002..000000000 --- a/nuttx/tools/copydir.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/bash -############################################################################ -# tools/copydir.sh -# -# Copyright (C) 2008 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. -# -############################################################################ -# -# NuttX uses symbolic links to configure platform-specific directories into -# the build system. This works great except for when a Windows native -# toolchain is used in a Cygwin environment. In that case, symbolic -# links do not work correctly when accessed from the Windows native toolchain; -# rather, just look link files with the extension .lnk -# -# In this environment, the build system will work around this using this script -# as a replacement for the 'ln' command. This scrpt will simply copy the -# directory into the expected positiion. -# -#set -x - -src=$1 -dest=$2 - -# Verify that arguments were provided - -if [ -z "${src}" -o -z "${dest}" ]; then - echo "Missing src and/or dest arguments" - exit 1 -fi - -# Check if something already exists at the destination path replace it with -# the new link (which might be different). Note that we check for the -# the link (-h) before we check for existence (-e) because a bad link will -# report that it does not exist. - -if [ -h "${dest}" ]; then - rm -f "${dest}" -else - - # If the path exists and is a directory that contains the "fake link" - # mark, then treat it like a soft link (i.e., remove the directory) - - if [ -d "${dest}" -a -f "${dest}/.fakelnk" ]; then - rm -rf "${dest}" - else - - # Does anything exist at the destination path? - - if [ -e "${dest}" ]; then - - # It is something else (like a file) or directory that does - # not contain the "fake link" mark - - echo "${dest} already exists but is not a symbolic link" - exit 1 - fi - fi -fi - - -# Verify that a directory exists at the source path - -if [ ! -d "${src}" ]; then - echo "No directory at ${src}" - exit 1 -fi - -# Copy the directory - -cp -a "${src}" "${dest}" || \ - { echo "Failed to create link: $dest" ; rm -rf ${dest} ; exit 1 ; } -touch "${dest}/.fakelnk" || \ - { echo "Failed to touch ${dest}/.fakelnk" ; rm -rf ${dest} ; exit 1 ; } - diff --git a/nuttx/tools/csvparser.c b/nuttx/tools/csvparser.c deleted file mode 100644 index 3f1916e2b..000000000 --- a/nuttx/tools/csvparser.c +++ /dev/null @@ -1,234 +0,0 @@ -/**************************************************************************** - * tools/csvparser.c - * - * 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 - * 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 <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> -#include <errno.h> - -#include "csvparser.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -bool g_debug; -char g_line[LINESIZE+1]; -char g_parm[MAX_FIELDS][MAX_PARMSIZE]; -int g_lineno; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: skip_space - ****************************************************************************/ - -static char *skip_space(char *ptr) -{ - while (*ptr && isspace((int)*ptr)) ptr++; - return ptr; -} - -/**************************************************************************** - * Name: copy_parm - ****************************************************************************/ - -static char *copy_parm(char *src, char *dest) -{ - char *start = src; - int i; - - /* De-quote the parameter and copy it into the parameter array */ - - for (i = 0; i < MAX_PARMSIZE; i++) - { - if (*src == '"') - { - *dest = '\0'; - return src; - } - else if (*src == '\n' || *src == '\0') - { - fprintf(stderr, "%d: Unexpected end of line: \"%s\"\n", g_lineno, start); - exit(4); - } - else - { - *dest++ = *src++; - } - } - - fprintf(stderr, "%d: Parameter too long: \"%s\"\n", g_lineno, start); - exit(3); -} - -/**************************************************************************** - * Name: find_parm - ****************************************************************************/ - -static char *find_parm(char *ptr) -{ - char *start = ptr; - - if (*ptr != '"') - { - fprintf(stderr, "%d: I'm confused: \"%s\"\n", g_lineno, start); - exit(5); - } - ptr++; - - ptr = skip_space(ptr); - if (*ptr == '\n' || *ptr == '\0') - { - return NULL; - } - else if (*ptr != ',') - { - fprintf(stderr, "%d: Expected ',': \"%s\"\n", g_lineno, start); - exit(6); - } - ptr++; - - ptr = skip_space(ptr); - if (*ptr != '"') - { - fprintf(stderr, "%d: Expected \": \"%s\"\n", g_lineno, start); - exit(7); - } - ptr++; - - return ptr; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: read_line - ****************************************************************************/ - -char *read_line(FILE *stream) -{ - char *ptr; - - for (;;) - { - g_line[LINESIZE] = '\0'; - if (!fgets(g_line, LINESIZE, stream)) - { - return NULL; - } - else - { - g_lineno++; - if (g_debug) - { - printf("Line: %s\n", g_line); - } - - ptr = skip_space(g_line); - if (*ptr && *ptr != '#' && *ptr != '\n') - { - return ptr; - } - } - } -} - -/**************************************************************************** - * Name: parse_csvline - ****************************************************************************/ - -int parse_csvline(char *ptr) -{ - int nparms; - int i; - - /* Format "arg1","arg2","arg3",... Spaces will be tolerated outside of the - * quotes. Any initial spaces have already been skipped so the first thing - * should be '"'. - */ - - if (*ptr != '"') - { - fprintf(stderr, "%d: Bad line: \"%s\"\n", g_lineno, g_line); - exit(2); - } - - ptr++; - nparms = 0; - - /* Copy each comma-separated value in an array (stripping quotes from each - * of the values). - */ - - do - { - ptr = copy_parm(ptr, &g_parm[nparms][0]); - nparms++; - ptr = find_parm(ptr); - } - while (ptr); - - /* If debug is enabled, show what we got */ - - if (g_debug) - { - printf("Parameters: %d\n", nparms); - for (i = 0; i < nparms; i++) - { - printf(" Parm%d: \"%s\"\n", i+1, g_parm[i]); - } - } - - return nparms; -} diff --git a/nuttx/tools/csvparser.h b/nuttx/tools/csvparser.h deleted file mode 100644 index 872dc3c02..000000000 --- a/nuttx/tools/csvparser.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * tools/csvparser.h - * - * 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 - * 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 __TOOLS_CSVPARSER_H -#define __TOOLS_CSVPARSER_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <stdbool.h> -#include <limits.h> - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#define LINESIZE (PATH_MAX > 256 ? PATH_MAX : 256) - -#define MAX_FIELDS 16 -#define MAX_PARMSIZE 128 -#define NAME_INDEX 0 -#define HEADER_INDEX 1 -#define COND_INDEX 2 -#define RETTYPE_INDEX 3 -#define PARM1_INDEX 4 - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -extern bool g_debug; -extern char g_line[LINESIZE+1]; -extern char g_parm[MAX_FIELDS][MAX_PARMSIZE]; -extern int g_lineno; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -char *read_line(FILE *stream); -int parse_csvline(char *ptr); - -#endif /* __TOOLS_CSVPARSER_H */ diff --git a/nuttx/tools/define.bat b/nuttx/tools/define.bat deleted file mode 100644 index 13d29ac31..000000000 --- a/nuttx/tools/define.bat +++ /dev/null @@ -1,178 +0,0 @@ -@echo off - -rem tools/define.bat -rem -rem Copyright (C) 2012 Gregory Nutt. All rights reserved. -rem Author: Gregory Nutt <gnutt@nuttx.org> -rem -rem Redistribution and use in source and binary forms, with or without -rem modification, are permitted provided that the following conditions -rem are met: -rem -rem 1. Redistributions of source code must retain the above copyright -rem notice, this list of conditions and the following disclaimer. -rem 2. Redistributions in binary form must reproduce the above copyright -rem notice, this list of conditions and the following disclaimer in -rem the documentation and/or other materials provided with the -rem distribution. -rem 3. Neither the name NuttX nor the names of its contributors may be -rem used to endorse or promote products derived from this software -rem without specific prior written permission. -rem -rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -rem FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -rem COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -rem OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -rem AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -rem LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -rem ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -rem POSSIBILITY OF SUCH DAMAGE. - -rem Handle command line options -rem [-h] <compiler-path> <def1> [-val <val1>] [<def2> [-val <val2>] [<def3> [-val <val3>] ...]] -rem [-w] [-d] ignored for compatibility with define.sh - -set progname=%0 - -:ArgLoop -if "%1"=="-d" goto :NextArg -if "%1"=="-w" goto :NextArg -if "%1"=="-h" goto :ShowUsage - -goto :CheckCompilerPath - -:NextArg -shift -goto :ArgLoop - -:CheckCompilerPath - -if "%1"=="" ( - echo Missing compiler path - goto :ShowUsage -) - -set ccpath=%1 -shift - -set compiler= -for /F %%i in ("%ccpath%") do set compiler=%%~ni - -if "%1"=="" ( - echo Missing definition list - goto :ShowUsage -) - -rem Check for some well known, non-GCC Windows native tools that require -rem a special output format as well as special paths - -:GetFormat -set fmt=std -if "%compiler%"=="ez8cc" goto :SetZdsFormt -if "%compiler%"=="zneocc" goto :SetZdsFormt -if "%compiler%"=="ez80cc" goto :SetZdsFormt -goto :ProcessDefinitions - -:SetZdsFormt -set fmt=zds - -rem Now process each directory in the directory list - -:ProcessDefinitions -set response= - -:DefinitionLoop -if "%1"=="" goto :Done - -set varname=%1 -shift - -rem Handle the output depending on if there is a value for the variable or not - -if "%1"=="-val" goto :GetValue - -rem Handle the output using the selected format - -:NoValue -if "%fmt%"=="zds" goto :NoValueZDS - -:NoValueStandard -rem Treat the first definition differently - -if "%response%"=="" ( - set response=-D%varname% - goto :DefinitionLoop -) - -set response=%response% -D%varname% -goto :DefinitionLoop - -:NoValueZDS -rem Treat the first definition differently - -if "%response%"=="" ( - set response=-define:%varname% - goto :DefinitionLoop -) - -set response=%response% -define:%varname% -goto :DefinitionLoop - -rem Get value following the variable name - -:GetValue -shift -set varvalue=%1 -shift - -rem Handle the output using the selected format - -if "%fmt%"=="zds" goto :ValueZDS - -:ValueStandard -rem Treat the first definition differently - -if "%response%"=="" ( - set response=-D%varname%=%varvalue% - goto :DefinitionLoop -) - -set response=%response% -D%varname%=%varvalue% -goto :DefinitionLoop - -:ValueZds -rem Treat the first definition differently - -if "%response%"=="" ( - set response=-define:%varname%=%varvalue% - goto :DefinitionLoop -) - -set response=%response% -define:%varname%=%varvalue% -goto :DefinitionLoop - -:Done -echo %response% -goto :End - -:ShowUsage -echo %progname% is a tool for flexible generation of command line pre-processor -echo definitions arguments for a variety of diffent ccpaths in a variety of -echo compilation environments" -echo USAGE:%progname% [-h] ^<compiler-path^> [-val ^<^val1^>] [^<def2^> [-val ^<val2^>] [^<def3^> [-val ^<val3^>] ...]] -echo Where:" -echo ^<compiler-path^> -echo The full path to your ccpath -echo ^<def1^> ^<def2^> ^<def3^> ... -echo A list of pre-preprocesser variable names to be defined. -echo [-val ^<val1^>] [-val ^<val2^>] [-val ^<val3^>] ... -echo optional values to be assigned to each pre-processor variable. -echo If not supplied, the variable will be defined with no explicit value. -echo -h -echo Show this text and exit - -:End diff --git a/nuttx/tools/define.sh b/nuttx/tools/define.sh deleted file mode 100755 index dc982cc64..000000000 --- a/nuttx/tools/define.sh +++ /dev/null @@ -1,224 +0,0 @@ -#!/bin/bash -# tools/define.sh -# -# 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 -# 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. -# - -# -# Handle command line options -# - -progname=$0 -wintool=n -usage="USAGE: $progname [-w] [-d] [-h] <compiler-path> <def1>[=val1] [<def2>[=val2] [<def3>[=val3] ...]]" -advice="Try '$progname -h' for more information" - -while [ ! -z "$1" ]; do - case $1 in - -d ) - set -x - ;; - -w ) - wintool=y - ;; - -h ) - echo "$progname is a tool for flexible generation of command line pre-processor" - echo "definitions arguments for a variety of diffent compilers in a variety of" - echo "compilation environments" - echo "" - echo $usage - echo "" - echo "Where:" - echo " <compiler-path>" - echo " The full path to your compiler" - echo " <def1> <def2> [<def3> ..." - echo " A list of pre-preprocesser variable names to be defined." - echo " [=val1] [=val2] [=val3]" - echo " optional values to be assigned to each pre-processor variable." - echo " If not supplied, the variable will be defined with no explicit value." - echo " -w" - echo " The compiler is a Windows native tool and requires Windows" - echo " style pathnames like C:\\Program Files" - echo " -d" - echo " Enable script debug" - ;; - * ) - break; - ;; - esac - shift -done - -ccpath=$1 -shift -varlist=$@ - -if [ -z "$ccpath" ]; then - echo "Missing compiler path" - echo $usage - echo $advice - exit 1 -fi - -if [ -z "$varlist" ]; then - echo "Missing definition list" - echo $usage - echo $advice - exit 1 -fi - -# -# Most compilers support CFLAG options like '-D<defn>' to add pre-processor -# variable defintions. Some (like the Zilog tools), do not. This script -# makes the selection of pre-processor definitions compiler independent. -# -# Below are all known compiler names (as found in the config/*/*/Make.defs -# files). If a new compiler is used that has some unusual syntax, then -# additional logic needs to be added to this file. -# -# NAME Syntax -# $(CROSSDEV)gcc -D<def1> -D<def2> -D<def3> ... -# sdcc -D<def2> -D<def2> -D<def3> ... -# $(ZDSBINDIR)/ez8cc.exe -define:<def1> -define:<def2> -define:<def3> ... -# $(ZDSBINDIR)/zneocc.exe -define:<def1> -define:<def2> -define:<def3> ... -# $(ZDSBINDIR)/ez80cc.exe -define:<def1> -define:<def2> -define:<def3> ... -# -os=`uname -o 2>/dev/null || echo "Other"` - -# -# Let's assume that all GCC compiler paths contain the string gcc and -# no non-GCC compiler pathes include this substring -# -gcc=`echo $ccpath | grep gcc` -sdcc=`echo $ccpath | grep sdcc` - -if [ "X$os" = "XCygwin" ]; then - # - # We can treat Cygwin native toolchains just like Linux native - # toolchains in the Linux. Let's assume: - # 1. GCC or SDCC are the only possible Cygwin native compilers - # 2. If this is a Window native GCC version, then -w provided - # on the command line (wintool=y) - - if [ -z "$gcc" -a -z "$sdcc" ]; then - # - # Not GCC or SDCC, must be Windows native - # - compiler=`cygpath -u "$ccpath"` - else - if [ "X$wintool" == "Xy" ]; then - # - # It is a native GCC or SDCC compiler - # - compiler=`cygpath -u "$ccpath"` - else - # - # GCC or SDCC and not for Windows - # - compiler="$ccpath" - fi - fi -else - # - # Otherwise, we must be in a Linux environment where there are - # only Linux native toolchains - # - compiler="$ccpath" -fi -exefile=`basename "$compiler"` - -# Check for some well known, non-GCC Windows native tools that require -# a special output format as well as special paths - -if [ "X$exefile" = "Xez8cc.exe" -o "X$exefile" = "Xzneocc.exe" -o "X$exefile" = "Xez80cc.exe" ]; then - fmt=define -else - fmt=std -fi - -# Now process each definition in the definition list - -unset response -for vardef in $varlist; do - - varname=`echo $vardef | cut -d'=' -f1` - varvalue=`echo $vardef | cut -d'=' -f2` - - # Handle the output depending on if there is a value for the variable or not - - if [ -z "$varvalue" ]; then - - # Handle the output using the selected format - - if [ "X$fmt" = "Xdefine" ]; then - # Treat the first definition differently - - if [ -z "$response" ]; then - response="-define:"$varname - else - response=$response" -define:$varname" - fi - else - # Treat the first definition differently - - if [ -z "$response" ]; then - response=-D$varname - else - response=$response" -D$varname" - fi - fi - else - - # Handle the output using the selected format - - if [ "X$fmt" = "Xdefine" ]; then - # Treat the first definition differently - - if [ -z "$response" ]; then - response="-define:"$varname=$varvalue - else - response=$response" -define:$varname=$varvalue" - fi - else - # Treat the first definition differently - - if [ -z "$response" ]; then - response=-D$varname=$varvalue - else - response=$response" -D$varname=$varvalue" - fi - fi - fi -done - -echo $response - - diff --git a/nuttx/tools/discover.py b/nuttx/tools/discover.py deleted file mode 100755 index cc82a0cad..000000000 --- a/nuttx/tools/discover.py +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env python -############################################################################ -# tools/discover.py -# -# Copyright (C) 2012 Max Holtzberg. All rights reserved. -# Author: Max Holtzberg <mh@uvc.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. -# -############################################################################ - -import array -import time -from socket import * - -PORT = 96 - -DISCOVER_PROTO_ID = 0x99 -DISCOVER_ALL = 0xff # 0xff means all devices -DISCOVER_REQUEST = 0x01 -DISCOVER_RESPONSE = 0x02 -DISCOVER_REQUEST_SIZE = 4 -DISCOVER_RESPONSE_SIZE = 35 - -def check_sum(data): - chksum = 0 - for c in data[:-1]: - chksum -= c - return (chksum & 0xff) == data[-1] - -def send_discover(socket): - cmd = array.array('B', [0] * DISCOVER_REQUEST_SIZE) - cmd[0] = DISCOVER_PROTO_ID # Tag for identification of the protocol - cmd[1] = DISCOVER_REQUEST # Request command - cmd[2] = DISCOVER_ALL - chksum = 0 - for c in cmd[:3]: - chksum -= c; - cmd[3] = chksum & 0xff - - socket.sendto(cmd, ('<broadcast>', PORT)) - -def read_responses(socket): - res = [] - response = array.array('B', [0] * DISCOVER_RESPONSE_SIZE) - try: - while 1: - size, src = socket.recvfrom_into(response) - if (size == DISCOVER_RESPONSE_SIZE - and response[0] == DISCOVER_PROTO_ID - and response[1] == DISCOVER_RESPONSE - and check_sum(response)): - - dev = {} - dev['addr'] = src[0] - dev['descr'] = response[2:-1].tostring().rstrip('\0') - res.append(dev) - - except timeout: - return res - -if __name__ == '__main__': - print 'Sending discover...' - - s = socket(AF_INET, SOCK_DGRAM) - s.bind(('0.0.0.0', PORT)) - s.setsockopt(SOL_SOCKET, SO_BROADCAST, 1) - s.settimeout(1.0); - send_discover(s) - devices = read_responses(s) - socket.close(s) - - print devices diff --git a/nuttx/tools/incdir.bat b/nuttx/tools/incdir.bat deleted file mode 100755 index f7383fc9a..000000000 --- a/nuttx/tools/incdir.bat +++ /dev/null @@ -1,165 +0,0 @@ -@echo off - -rem tools/incdir.sh -rem -rem Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. -rem Author: Gregory Nutt <gnutt@nuttx.org> -rem -rem Redistribution and use in source and binary forms, with or without -rem modification, are permitted provided that the following conditions -rem are met: -rem -rem 1. Redistributions of source code must retain the above copyright -rem notice, this list of conditions and the following disclaimer. -rem 2. Redistributions in binary form must reproduce the above copyright -rem notice, this list of conditions and the following disclaimer in -rem the documentation and/or other materials provided with the -rem distribution. -rem 3. Neither the name NuttX nor the names of its contributors may be -rem used to endorse or promote products derived from this software -rem without specific prior written permission. -rem -rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -rem FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -rem COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -rem OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -rem AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -rem LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -rem ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -rem POSSIBILITY OF SUCH DAMAGE. -rem - -rem Handle command line options - -set progname=%0 -set pathtype=user - -:ArgLoop - -rem [-d] [-w] [-s] [-h]. [-w] and [-d] Ignored for compatibility with incdir.sh - -if "%1"=="-d" goto :NextArg -if "%1"=="-w" goto :NextArg -if "%1"=="-h" goto :Usage - -if "%1"=="-s" ( - set pathtype=system - goto :NextArg -) - -goto :CheckCompiler - -:NextArg -shift -goto :ArgLoop - -:CheckCompiler -if "%1"=="" ( - echo ERROR: Missing compiler name - goto :Usage -) - -set ccpath=%1 -shift - -set compiler= -for /F %%i in ("%ccpath%") do set compiler=%%~ni - -if "%1"=="" ( - echo ERROR: Missing directory paths - goto :Usage -) - -rem Check for some well known, non-GCC Windows native tools that require -rem a special output format as well as special paths - -:GetFormat -set fmt=std -if "%compiler%"=="ez8cc" goto :SetZdsFormt -if "%compiler%"=="zneocc" goto :SetZdsFormt -if "%compiler%"=="ez80cc" goto :SetZdsFormt -goto :GeneratePaths - -:SetZdsFormt -set fmt=zds - -rem Generate the compiler include path directives. - -:GeneratePaths -set response= - -:DirLoop -if "%1" == "" ( - echo %response% - goto :End -) - -if not exist %1 ( - echo ERROR: Path %1 does not exist - goto :Usage -) - -if "%fmt%"=="zds" goto :GenerateZdsPath -if "%response%"=="" goto :FirstStdPath -if "%pathtype%"=="system" goto :NextStdSystemPath - -set response=%response% -I "%1" -goto :EndOfDirLoop - -:NextStdSystemPath - -set response=%response% -isystem "%1" -goto :EndOfDirLoop - -:FirstStdPath - -if "%pathtype%"=="system" goto :FirstStdSystemPath -set response=-I "%1" -goto :EndOfDirLoop - -:FirstStdSystemPath - -set response=-isystem "%1" -goto :EndOfDirLoop - -:GenerateZdsPath - -if "%response%"=="" goto :FirstZdsPath -set response=%response%;%1 -goto :EndOfDirLoop - -:FirstZdsPath - -if "%pathtype%"=="system" goto :FirstZdsSystemPath -set response=-usrinc:%1 -goto :EndOfDirLoop - -:FirstZdsSystemPath - -set response=-stdinc:%1 - -:EndOfDirLoop -shift -goto :DirLoop - -:Usage -echo %progname% is a tool for flexible generation of include path arguments for a -echo variety of different compilers in a variety of compilation environments -echo USAGE: %progname% [-w] [-d] [-s] [-h] ^<compiler-path^> ^<dir1^> [^<dir2^> [^<dir3^> ...]] -echo Where: -echo ^<compiler-path^> -echo The full path to your compiler -echo ^<dir1^> [^<dir2^> [^<dir3^> ...]] -echo A list of include directories -echo -w, -d -echo For compatibility with incdir.sh (ignored) -echo -s -echo Generate standard, system header file paths instead of normal user -echo header file paths. -echo -h -echo Shows this help text and exits. -:End diff --git a/nuttx/tools/incdir.sh b/nuttx/tools/incdir.sh deleted file mode 100755 index 145bfe9bb..000000000 --- a/nuttx/tools/incdir.sh +++ /dev/null @@ -1,237 +0,0 @@ -#!/bin/bash -# tools/incdir.sh -# -# Copyright (C) 2008-2009, 2011 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. -# - -# Handle command line options - -progname=$0 -wintool=n -pathtype=user -usage="USAGE: $progname [-w] [-d] [-h] <compiler-path> <dir1> [<dir2> [<dir3> ...]]" -advice="Try '$progname -h' for more information" - -while [ ! -z "$1" ]; do - case $1 in - -d ) - set -x - ;; - -w ) - wintool=y - ;; - -s ) - pathtype=system - ;; - -h ) - echo "$progname is a tool for flexible generation of include path arguments for a" - echo "variety of different compilers in a variety of compilation environments" - echo "" - echo $usage - echo "" - echo "Where:" - echo " <compiler-path>" - echo " The full path to your compiler" - echo " <dir1> [<dir2> [<dir3> ...]]" - echo " A list of include directories" - echo " -w" - echo " The compiler is a Windows native tool and requires Windows" - echo " style pathnames like C:\\Program Files" - echo " -s" - echo " Generate standard, system header file paths instead of normal user" - echo " header file paths." - echo " -d" - echo " Enable script debug" - echo " -h" - echo " Shows this help text and exits." - exit 0 - ;; - * ) - break; - ;; - esac - shift -done - -ccpath=$1 -shift -dirlist=$@ - -if [ -z "$ccpath" ]; then - echo "Missing compiler path" - echo $usage - echo $advice - exit 1 -fi - -if [ -z "$dirlist" ]; then - echo "Missing include directory list" - echo $usage - echo $advice - exit 1 -fi - -# -# Most compilers support CFLAG options like '-I<dir>' to add include -# file header paths. Some (like the Zilog tools), do not. This script -# makes the selection of header file paths compiler independent. -# -# Below are all known compiler names (as found in the config/*/*/Make.defs -# files). If a new compiler is used that has some unusual syntax, then -# additional logic needs to be added to this file. -# -# NAME Syntax -# $(CROSSDEV)gcc -I<dir1> -I<dir2> -I<dir3> ... -# sdcc -I<dir2> -I<dir2> -I<dir3> ... -# $(ZDSBINDIR)/ez8cc.exe -usrinc:'<dir1>:<dir2>:<dir3>:...` -# $(ZDSBINDIR)/zneocc.exe -usrinc:'<dir1>:<dir2>:<dir3>:...` -# $(ZDSBINDIR)/ez80cc.exe -usrinc:'<dir1>:<dir2>:<dir3>:...` -# -# Furthermore, just to make matters more difficult, with Windows based -# toolchains, we have to use the full windows-style paths to the header -# files. - -os=`uname -o 2>/dev/null || echo "Other"` - -# Let's assume that all GCC compiler paths contain the string gcc or -# g++ and no non-GCC compiler pathes include these substrings - -gcc=`echo $ccpath | grep gcc` -if [ -z "${gcc}" ]; then - gcc=`echo $ccpath | grep g++` -fi - -sdcc=`echo $ccpath | grep sdcc` - -if [ "X$os" = "XCygwin" ]; then - # We can treat Cygwin native toolchains just like Linux native - # toolchains in the Linux. Let's assume: - # 1. GCC or SDCC are the only possible Cygwin native compilers - # 2. If this is a Window native GCC version, then -w must be - # provided on the command line (wintool=y) - - if [ -z "$gcc" -a -z "$sdcc" ]; then - # Not GCC or SDCC, must be Windows native - windows=yes - compiler=`cygpath -u "$ccpath"` - else - if [ "X$wintool" == "Xy" ]; then - # It is a native GCC or SDCC compiler - windows=yes - compiler=`cygpath -u "$ccpath"` - else - # GCC or SDCC and not for Windows - windows=no - compiler="$ccpath" - fi - fi -else - # Otherwise, we must be in a Linux environment where there are - # only Linux native toolchains - windows=no - compiler="$ccpath" -fi -exefile=`basename "$compiler"` - -# Check for some well known, non-GCC Windows native tools that require -# a special output format as well as special paths - -if [ "X$exefile" = "Xez8cc.exe" -o "X$exefile" = "Xzneocc.exe" -o "X$exefile" = "Xez80cc.exe" ]; then - fmt=zds -else - fmt=std -fi - -# Select system or user header file path command line option - -if [ "X$fmt" = "Xzds" ]; then - if [ "X$pathtype" = "Xsystem" ]; then - cmdarg=-stdinc: - else - cmdarg=-usrinc: - fi -else - if [ "X$pathtype" = "Xsystem" ]; then - cmdarg=-isystem - else - cmdarg=-I - fi -fi - -# Now process each directory in the directory list - -unset response -for dir in $dirlist; do - - # Verify that the include directory exists - - if [ ! -d $dir ]; then - echo "Include path '$dir' does not exist" - echo $showusage - exit 1 - fi - - # Check if the path needs to be extended for Windows-based tools under Cygwin - - if [ "X$windows" = "Xyes" ]; then - path=`cygpath -w $dir` - else - path=$dir - fi - - # Handle the output using the selected format - - if [ "X$fmt" = "Xzds" ]; then - # Treat the first directory differently - - if [ -z "$response" ]; then - response="${cmdarg}'"${path} - else - response=${response}";${path}" - fi - else - # Treat the first directory differently - - if [ -z "$response" ]; then - response="${cmdarg} \"$path\"" - else - response="${response} ${cmdarg} \"$path\"" - fi - fi -done - -if [ "X$fmt" = "Xzds" ]; then - response=$response"'" -fi - -echo $response - - diff --git a/nuttx/tools/indent.sh b/nuttx/tools/indent.sh deleted file mode 100755 index 739b791bd..000000000 --- a/nuttx/tools/indent.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/sh -############################################################################ -# tools/indent.sh -# -# Copyright (C) 2008, 2010 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. -# -############################################################################ -# -# This script uses the Linux 'indent' utility to re-format C source files -# to match the coding style that I use. It differs from my coding style in that -# -# - I normally put the trailing */ of a multi-line comment on a separate line, -# - I usually align things vertically (like '=' in assignments), -# - indent puts a bogus blank line at the top of the file, -# - I don't like the way it handles nested conditional compilation intermixed with code. -# - -# Constants - -options="-nbad -bap -bbb -nbbo -nbc -bl -bl2 -bls -nbs -cbi2 -ncdw -nce -ci2 -cli0 -cp40 -ncs -nbfda -nbfde -di1 -nfc1 -fca -i2 -l80 -lp -ppi2 -lps -npcs -pmt -nprs -npsl -saf -sai -sbi2 -saw -sc -sob -nss -nut" - -usage="USAGE: $0 <in-file> <out-file>" - -# Inputs - -infile=$1 -outfile=$2 - -# Verify inputs - -if [ -z "$infile" ]; then - echo "Missing <in-file>" - echo $usage - exit 1 -fi - -if [ ! -r $infile ]; then - echo "Readable $infile does not exist" - exit 1 -fi - -if [ -z "$outfile" ]; then - echo "Missing <out-file>" - echo $usage - exit 1 -fi - -if [ -f $outfile ]; then - echo "Removing old $outfile" - rm $outfile || { echo "Failed to remove $outfile" ; exit 1 ; } -fi - -# Perform the indentation - -indent $options $infile -o $outfile - - diff --git a/nuttx/tools/kconfig.bat b/nuttx/tools/kconfig.bat deleted file mode 100755 index db01e7515..000000000 --- a/nuttx/tools/kconfig.bat +++ /dev/null @@ -1,131 +0,0 @@ -@echo off
-
-rem tools/kconfig.bat
-rem
-rem Copyright (C) 2012 Gregory Nutt. All rights reserved.
-rem Author: Gregory Nutt <gnutt@nuttx.org>
-rem
-rem Redistribution and use in source and binary forms, with or without
-rem modification, are permitted provided that the following conditions
-rem are met:
-rem
-rem 1. Redistributions of source code must retain the above copyright
-rem notice, this list of conditions and the following disclaimer.
-rem 2. Redistributions in binary form must reproduce the above copyright
-rem notice, this list of conditions and the following disclaimer in
-rem the documentation and/or other materials provided with the
-rem distribution.
-rem 3. Neither the name NuttX nor the names of its contributors may be
-rem used to endorse or promote products derived from this software
-rem without specific prior written permission.
-rem
-rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-rem FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-rem COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-rem OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-rem AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-rem LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-rem ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-rem POSSIBILITY OF SUCH DAMAGE.
-rem
-
-rem Remember the state of the PATH variable on entry
-
-set oldpath=%PATH%
-
-rem Handle command line options
-
-set action=%1
-shift
-if "%action%"=="" goto :MissingArgument
-
-set appsdir=..\apps
-set cygwindir=C:\Cygwin
-
-:ArgLoop
-
-if "%1"=="" goto :CheckArguments
-
-if "%1"=="-a" (
- shift
- set appsdir=%1
- goto :NextArg
-)
-
-if "%1"=="-c" (
- shift
- set cygwindir=%1
- goto :NextArg
-)
-
-echo ERROR: Unrecognized option: %1
-goto :ShowUsage
-
-:NextArg
-shift
-goto :ArgLoop
-
-rem Verify that all of the paths are valid
-
-:CheckArguments
-if exist "%appsdir%" goto :CheckCygwinDir
-
-echo ERROR: %appsdir% does not exist
-goto :ShowUsage
-
-:CheckCygwinDir
-
-if exist "%cygwindir%" goto :SetPath
-
-echo ERROR: %cygwindir% does not exist
-goto :ShowUsage
-
-rem Setup some required environment variables and PATH settings
-
-:SetPath
-set PATH=%cygwindir%\usr\local\bin;%cygwindir%\usr\bin;%cygwindir%\bin;%PATH%
-set APPSDIR=%appsdir%
-
-rem Execute the requested action
-
-if "%action%"=="config" goto :DoConfig
-if "%action%"=="oldconfig" goto :DoOldConfig
-if "%action%"=="menuconfig" goto :DoMenuConfig
-
-echo ERROR: Unrecognized action: %action%
-goto :ShowUsage
-
-:DoConfig
-kconfig-conf Kconfig
-goto End
-
-:DoOldConfig
-kconfig-conf --oldconfig Kconfig
-goto End
-
-:DoMenuConfig
-kconfig-mconf Kconfig
-goto End
-
-:MissingArgument
-
-echo ERROR: Missing required argument
-
-:ShowUsage
-echo USAGE: %0 ^<action^> [-a ^<appsdir^>] [-c ^<cygwindir^>]
-echo Where:
-echo ^<action^> is one of config, oldconf, or menuconfig
-echo ^<appsdir^> is the relative path to the apps\ directory.
-echo This defaults to ..\apps
-echo ^<cygwindir^> is the relative path to the Cygwin installation
-echo directory. This defaults to C:\Cygwin
-
-rem Restore the original PATH settings
-
-:End
-set PATH=%oldpath%
-
diff --git a/nuttx/tools/link.bat b/nuttx/tools/link.bat deleted file mode 100755 index 434574ee3..000000000 --- a/nuttx/tools/link.bat +++ /dev/null @@ -1,89 +0,0 @@ -@echo off
-
-rem tools/link.bat
-rem
-rem Copyright (C) 2012 Gregory Nutt. All rights reserved.
-rem Author: Gregory Nutt <gnutt@nuttx.org>
-rem
-rem Redistribution and use in source and binary forms, with or without
-rem modification, are permitted provided that the following conditions
-rem are met:
-rem
-rem 1. Redistributions of source code must retain the above copyright
-rem notice, this list of conditions and the following disclaimer.
-rem 2. Redistributions in binary form must reproduce the above copyright
-rem notice, this list of conditions and the following disclaimer in
-rem the documentation and/or other materials provided with the
-rem distribution.
-rem 3. Neither the name NuttX nor the names of its contributors may be
-rem used to endorse or promote products derived from this software
-rem without specific prior written permission.
-rem
-rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-rem FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-rem COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-rem OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-rem AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-rem LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-rem ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-rem POSSIBILITY OF SUCH DAMAGE.
-rem
-
-set src=%1
-set link=%2
-
-rem Verify that arguments were provided
-
-if "%src%"=="" goto :MissingSrc
-if "%link%"=="" goto :MissingLink
-goto CheckSrc
-
-:MissingSrc
-
-echo Missing ^<src^> and ^<link^> arguments
-goto :ShowUsage
-
-:MissingLink
-
-echo Missing ^<link^> arguments
-goto :ShowUsage
-
-rem Verify that a directory exists at the source path
-
-:CheckSrc
-
-if exist %src% goto :CheckLink
-
-echo No directory at %src%
-goto :ShowUsage
-
-:CheckLink
-
-rem If something already exists at the destination path, remove it
-
-if not exist %link% goto :MkLink
-
-rmdir /q /s %link%
-if errorlevel 1 (
- echo Failed to remove existing object at %link%
- goto :ShowUsage
-)
-
-rem Copy the directory
-
-:MkLink
-
-/user:administrator mklink /d %src% %link%
-goto :End
-
-:ShowUsage
-echo USAGE: %0 ^<src^> ^<link^>
-echo Where:
-echo ^<src^> is the source directory to be linked
-echo ^<link^> is the link to be created
-
-:End
diff --git a/nuttx/tools/link.sh b/nuttx/tools/link.sh deleted file mode 100755 index da1e6e7ae..000000000 --- a/nuttx/tools/link.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash -############################################################################ -# tools/link.sh -# -# Copyright (C) 2008 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. -# -############################################################################ -#set -x - -src=$1 -dest=$2 - -# Verify that arguments were provided - -if [ -z "${src}" -o -z "${dest}" ]; then - echo "Missing src and/or dest arguments" - exit 1 -fi - -# Check if something already exists at the destination path replace it with -# the new link (which might be different). Note that we check for the -# the link (-h) before we check for existence (-e) because a bad link will -# report that it does not exist. - -if [ -h "${dest}" ]; then - rm -f "${dest}" -else - - # If the path exists and is a directory that contains the "fake link" - # mark, then treat it like a soft link (i.e., remove the directory) - - if [ -d "${dest}" -a -f "${dest}/.fakelnk" ]; then - rm -rf "${dest}" - else - - # Does anything exist at the destination path? - - if [ -e "${dest}" ]; then - - # It is something else (like a file) or directory that does - # not contain the "fake link" mark - - echo "${dest} already exists but is not a symbolic link" - exit 1 - fi - fi -fi - -# Verify that a directory exists at the source path - -if [ ! -d "${src}" ]; then - echo "No directory at ${src}" - exit 1 -fi - -# Create the soft link - -ln -s "${src}" "${dest}" || \ - { echo "Failed to create link: $dest" ; exit 1 ; } diff --git a/nuttx/tools/mkconfig.c b/nuttx/tools/mkconfig.c deleted file mode 100644 index a622743a0..000000000 --- a/nuttx/tools/mkconfig.c +++ /dev/null @@ -1,281 +0,0 @@ -/**************************************************************************** - * tools/mkconfig.c - * - * Copyright (C) 2007-2013 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <string.h> -#include <stdlib.h> -#include <errno.h> - -#include "cfgdefine.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#define DEFCONFIG ".config" - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - - static inline char *getfilepath(const char *name) -{ - snprintf(line, PATH_MAX, "%s/" DEFCONFIG, name); - line[PATH_MAX] = '\0'; - return strdup(line); -} - -static void show_usage(const char *progname) -{ - fprintf(stderr, "USAGE: %s <abs path to .config>\n", progname); - exit(1); -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv, char **envp) -{ - char *filepath; - FILE *stream; - - if (argc != 2) - { - fprintf(stderr, "Unexpected number of arguments\n"); - show_usage(argv[0]); - } - - filepath = getfilepath(argv[1]); - if (!filepath) - { - fprintf(stderr, "getfilepath failed\n"); - exit(2); - } - - stream = fopen(filepath, "r"); - if (!stream) - { - fprintf(stderr, "open %s failed: %s\n", filepath, strerror(errno)); - exit(3); - } - - printf("/* config.h -- Autogenerated! Do not edit. */\n\n"); - printf("#ifndef __INCLUDE_NUTTX_CONFIG_H\n"); - printf("#define __INCLUDE_NUTTX_CONFIG_H\n\n"); - printf("/* Architecture-specific options *************************/\n\n"); - generate_definitions(stream); - printf("\n/* Sanity Checks *****************************************/\n\n"); - printf("/* If this is an NXFLAT, external build, then make sure that\n"); - printf(" * NXFLAT support is enabled in the base code.\n"); - printf(" */\n\n"); - printf("#if defined(__NXFLAT__) && !defined(CONFIG_NXFLAT)\n"); - printf("# error \"NXFLAT support not enabled in this configuration\"\n"); - printf("#endif\n\n"); - printf("/* NXFLAT requires PIC support in the TCBs. */\n\n"); - printf("#if defined(CONFIG_NXFLAT)\n"); - printf("# undef CONFIG_PIC\n"); - printf("# define CONFIG_PIC 1\n"); - printf("#endif\n\n"); - printf("/* Binary format support is disabled if no binary formats are\n"); - printf(" * configured (at present, NXFLAT is the only supported binary.\n"); - printf(" * format).\n"); - printf(" */\n\n"); - printf("#if !defined(CONFIG_NXFLAT) && !defined(CONFIG_ELF) && !defined(CONFIG_BUILTIN)\n"); - printf("# undef CONFIG_BINFMT_DISABLE\n"); - printf("# define CONFIG_BINFMT_DISABLE 1\n"); - printf("#endif\n\n"); - printf("/* The correct way to disable RR scheduling is to set the\n"); - printf(" * timeslice to zero.\n"); - printf(" */\n\n"); - printf("#ifndef CONFIG_RR_INTERVAL\n"); - printf("# define CONFIG_RR_INTERVAL 0\n"); - printf("#endif\n\n"); - printf("/* The correct way to disable filesystem supuport is to set the number of\n"); - printf(" * file descriptors to zero.\n"); - printf(" */\n\n"); - printf("#ifndef CONFIG_NFILE_DESCRIPTORS\n"); - printf("# define CONFIG_NFILE_DESCRIPTORS 0\n"); - printf("#endif\n\n"); - printf("/* If a console is selected, then make sure that there are resources for\n"); - printf(" * three file descriptors and, if any streams are selected, also for three\n"); - printf(" * file streams.\n"); - printf(" *\n"); - printf(" * CONFIG_DEV_CONSOLE means that a builtin console device exists at /dev/console\n"); - printf(" * and can be opened during boot-up. Other consoles, such as USB consoles, may\n"); - printf(" * not exist at boot-upand have to be handled in a different way. Three file\n"); - printf(" * descriptors and three file streams are still needed.\n"); - printf(" */\n\n"); - printf("#if defined(CONFIG_DEV_CONSOLE) || defined(CONFIG_CDCACM_CONSOLE) || \\\n"); - printf(" defined(CONFIG_PL2303_CONSOLE)\n"); - printf("# if CONFIG_NFILE_DESCRIPTORS < 3\n"); - printf("# undef CONFIG_NFILE_DESCRIPTORS\n"); - printf("# define CONFIG_NFILE_DESCRIPTORS 3\n"); - printf("# endif\n\n"); - printf("# if CONFIG_NFILE_STREAMS > 0 && CONFIG_NFILE_STREAMS < 3\n"); - printf("# undef CONFIG_NFILE_STREAMS\n"); - printf("# define CONFIG_NFILE_STREAMS 3\n"); - printf("# endif\n\n"); - printf("/* If no console is selected, then disable all builtin console devices */\n\n"); - printf("#else\n"); - printf("# undef CONFIG_DEV_LOWCONSOLE\n"); - printf("# undef CONFIG_RAMLOG_CONSOLE\n"); - printf("#endif\n\n"); - printf("/* If priority inheritance is disabled, then do not allocate any\n"); - printf(" * associated resources.\n"); - printf(" */\n\n"); - printf("#if !defined(CONFIG_PRIORITY_INHERITANCE) || !defined(CONFIG_SEM_PREALLOCHOLDERS)\n"); - printf("# undef CONFIG_SEM_PREALLOCHOLDERS\n"); - printf("# define CONFIG_SEM_PREALLOCHOLDERS 0\n"); - printf("#endif\n\n"); - printf("#if !defined(CONFIG_PRIORITY_INHERITANCE) || !defined(CONFIG_SEM_NNESTPRIO)\n"); - printf("# undef CONFIG_SEM_NNESTPRIO\n"); - printf("# define CONFIG_SEM_NNESTPRIO 0\n"); - printf("#endif\n\n"); - printf("/* If no file descriptors are configured, then make certain no\n"); - printf(" * streams are configured either.\n"); - printf(" */\n\n"); - printf("#if CONFIG_NFILE_DESCRIPTORS == 0\n"); - printf("# undef CONFIG_NFILE_STREAMS\n"); - printf("# define CONFIG_NFILE_STREAMS 0\n"); - printf("#endif\n\n"); - printf("/* There must be at least one memory region. */\n\n"); - printf("#ifndef CONFIG_MM_REGIONS\n"); - printf("# define CONFIG_MM_REGIONS 1\n"); - printf("#endif\n\n"); - printf("/* If the end of RAM is not specified then it is assumed to be the beginning\n"); - printf(" * of RAM plus the RAM size.\n"); - printf(" */\n\n"); - printf("#ifndef CONFIG_DRAM_END\n"); - printf("# define CONFIG_DRAM_END (CONFIG_DRAM_START+CONFIG_DRAM_SIZE)\n"); - printf("#endif\n\n"); - printf("/* If no file streams are configured, then make certain that buffered I/O\n"); - printf(" * support is disabled\n"); - printf(" */\n\n"); - printf("#if CONFIG_NFILE_STREAMS == 0\n"); - printf("# undef CONFIG_STDIO_BUFFER_SIZE\n"); - printf("# define CONFIG_STDIO_BUFFER_SIZE 0\n"); - printf("#endif\n\n"); - printf("/* We are building a kernel version of the C library, then some user-space features\n"); - printf(" * need to be disabled\n"); - printf(" */\n\n"); - printf("#if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__)\n"); - printf("# undef CONFIG_STDIO_BUFFER_SIZE\n"); - printf("# define CONFIG_STDIO_BUFFER_SIZE 0\n"); - printf("# undef CONFIG_NUNGET_CHARS\n"); - printf("# define CONFIG_NUNGET_CHARS 0\n"); - printf("#endif\n\n"); - printf("/* If no standard C buffered I/O is not supported, then line-oriented buffering\n"); - printf(" * cannot be supported.\n"); - printf(" */\n\n"); - printf("#if CONFIG_STDIO_BUFFER_SIZE == 0\n"); - printf("# undef CONFIG_STDIO_LINEBUFFER\n"); - printf("#endif\n\n"); - printf("/* If the maximum message size is zero, then we assume that message queues\n"); - printf(" * support should be disabled\n"); - printf(" */\n\n"); - printf("#if CONFIG_MQ_MAXMSGSIZE <= 0 && !defined(CONFIG_DISABLE_MQUEUE)\n"); - printf("# define CONFIG_DISABLE_MQUEUE 1\n"); - printf("#endif\n\n"); - printf("/* If mountpoint support in not included, then no filesystem can be supported */\n\n"); - printf("#ifdef CONFIG_DISABLE_MOUNTPOINT\n"); - printf("# undef CONFIG_FS_FAT\n"); - printf("# undef CONFIG_FS_ROMFS\n"); - printf("# undef CONFIG_FS_NXFFS\n"); - printf("# undef CONFIG_FS_BINFS\n"); - printf("# undef CONFIG_NFS\n"); - printf("#endif\n\n"); - printf("/* Check if any readable and writable filesystem (OR USB storage) is supported */\n\n"); - printf("#undef CONFIG_FS_READABLE\n"); - printf("#undef CONFIG_FS_WRITABLE\n"); - printf("#if defined(CONFIG_FS_FAT) || defined(CONFIG_FS_ROMFS) || defined(CONFIG_USBMSC) || \\\n"); - printf(" defined(CONFIG_FS_NXFFS) || defined(CONFIG_FS_BINFS) || defined(CONFIG_NFS)\n"); - printf("# define CONFIG_FS_READABLE 1\n"); - printf("#endif\n\n"); - printf("#if defined(CONFIG_FS_FAT) || defined(CONFIG_USBMSC) || defined(CONFIG_FS_NXFFS) || \\\n"); - printf(" defined(CONFIG_NFS)\n"); - printf("# define CONFIG_FS_WRITABLE 1\n"); - printf("#endif\n\n"); - printf("/* There can be no network support with no socket descriptors */\n\n"); - printf("#if CONFIG_NSOCKET_DESCRIPTORS <= 0\n"); - printf("# undef CONFIG_NET\n"); - printf("#endif\n\n"); - printf("/* Conversely, if there is no network support, there is no need for\n"); - printf(" * socket descriptors\n"); - printf(" */\n\n"); - printf("#ifndef CONFIG_NET\n"); - printf("# undef CONFIG_NSOCKET_DESCRIPTORS\n"); - printf("# define CONFIG_NSOCKET_DESCRIPTORS 0\n"); - printf("#endif\n\n"); - printf("/* Protocol support can only be provided on top of basic network support */\n\n"); - printf("#ifndef CONFIG_NET\n"); - printf("# undef CONFIG_NET_TCP\n"); - printf("# undef CONFIG_NET_UDP\n"); - printf("# undef CONFIG_NET_ICMP\n"); - printf("#endif\n\n"); - printf("/* NFS client can only be provided on top of UDP network support */\n\n"); - printf("#if !defined(CONFIG_NET) || !defined(CONFIG_NET_UDP)\n"); - printf("# undef CONFIG_NFS\n"); - printf("#endif\n\n"); - printf("/* Verbose debug and sub-system debug only make sense if debug is enabled */\n\n"); - printf("#ifndef CONFIG_DEBUG\n"); - printf("# undef CONFIG_DEBUG_VERBOSE\n"); - printf("# undef CONFIG_DEBUG_SCHED\n"); - printf("# undef CONFIG_DEBUG_MM\n"); - printf("# undef CONFIG_DEBUG_PAGING\n"); - printf("# undef CONFIG_DEBUG_DMA\n"); - printf("# undef CONFIG_DEBUG_FS\n"); - printf("# undef CONFIG_DEBUG_LIB\n"); - printf("# undef CONFIG_DEBUG_BINFMT\n"); - printf("# undef CONFIG_DEBUG_NET\n"); - printf("# undef CONFIG_DEBUG_USB\n"); - printf("# undef CONFIG_DEBUG_GRAPHICS\n"); - printf("# undef CONFIG_DEBUG_GPIO\n"); - printf("# undef CONFIG_DEBUG_SPI\n"); - printf("# undef CONFIG_DEBUG_STACK\n"); - printf("#endif\n\n"); - printf("/* User entry point. This is provided as a fall-back to keep compatibility\n"); - printf(" * with existing code, for builds which do not define CONFIG_USER_ENTRYPOINT.\n"); - printf(" */\n\n"); - printf("#ifndef CONFIG_USER_ENTRYPOINT\n"); - printf("# define CONFIG_USER_ENTRYPOINT user_start\n"); - printf("#endif\n\n"); - printf("#endif /* __INCLUDE_NUTTX_CONFIG_H */\n"); - fclose(stream); - return 0; -} diff --git a/nuttx/tools/mkdeps.bat b/nuttx/tools/mkdeps.bat deleted file mode 100644 index 23aab0b71..000000000 --- a/nuttx/tools/mkdeps.bat +++ /dev/null @@ -1,173 +0,0 @@ -@echo off - -rem tools/mkdeps.sh -rem -rem Copyright (C) 2012 Gregory Nutt. All rights reserved. -rem Author: Gregory Nutt <gnutt@nuttx.org> -rem -rem Redistribution and use in source and binary forms, with or without -rem modification, are permitted provided that the following conditions -rem are met: -rem -rem 1. Redistributions of source code must retain the above copyright -rem notice, this list of conditions and the following disclaimer. -rem 2. Redistributions in binary form must reproduce the above copyright -rem notice, this list of conditions and the following disclaimer in -rem the documentation and/or other materials provided with the -rem distribution. -rem 3. Neither the name NuttX nor the names of its contributors may be -rem used to endorse or promote products derived from this software -rem without specific prior written permission. -rem -rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -rem FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -rem COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -rem OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -rem AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -rem LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -rem ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -rem POSSIBILITY OF SUCH DAMAGE. - -rem Accumulate CFLAGS up to "--" - -set cc= -set cflags= -set altpath= -set files= -set args= -set debug=n - -:Loop -if "%1"=="" goto Continue - -if "%1"=="--" ( - set cc=%cflags% - set cflags=%args% - set args= - goto NextParm -) - -if "%1"=="--dep-path" ( - if "%args%"=="" ( - set altpath=%altpath% %2 - ) else ( - set args=%args% %2 - ) - shift - goto NextParm -) - -if "%1"=="--dep-debug" ( -rem @echo on - set debug=y - goto NextParm -) - -if "%1"=="--help" goto Usage - -if "%args%"=="" ( - set args=%1 -) else ( - set args=%args% %1 -) - -:NextParm -shift -goto Loop -:Continue - -set files=%args% - -if "%debug%"=="y" ( - echo cc=%cc% - echo cflags=%cflags% - echo files=%files% - echo altpath=%altpath% -) - -rem Now check if we have everything - -if "%cc%"=="" ( - echo ERROR: No compiler specified - goto Usage -) - -if "%files%"=="" ( - rem Don't report an error -- this happens normally in some configurations - echo # No files specified for dependency generataion - goto End -) - -rem Then get the dependencies for each file - -if "%altpath%"=="" goto NoPaths -for %%G in (%files%) do ( - set fullpath= - set file=%%G - call :Checkpaths - if "%debug%"=="y" echo %file%: fullpath=%fullpath% - if "%fullpath%"=="" goto :NoFile - if "%debug%"=="y" echo CMD: %cc% -M %cflags% %fullpath% - %cc% -M %cflags% %fullpath% || goto DepFail -) -goto :End - -:NoPaths -for %%G in (%files%) do ( - set fullpath= - set file=%%G - call :CheckFile %%G -) -goto :End - -:CheckFile -if "%debug%"=="y" echo Checkfile: Checking %file% -if not exist %file% goto :NoFile -set fullpath=%file% - if "%debug%"=="y" echo CMD: %cc% -M %cflags% %fullpath% -%cc% -M %cflags% %fullpath% || goto DepFail -goto :EOF - -:CheckPaths -for %%H in (%altpath%) do ( - set tmppath=%%H\%file% - if "%debug%"=="y" echo Checkfile: Checking %tmppath% - if exist %tmppath% ( - set fullpath=%tmppath% - goto :EOF - ) -) -goto :EOF - -:NoFile -echo ERROR: No readable file at %file% -goto Usage - -:DepFail -echo ERROR: Failed to created dependencies for %file% - -:Usage -echo Usage: mkdeps [OPTIONS] CC -- CFLAGS -- file [file [file...]] -echo Where: -echo CC -echo A variable number of arguments that define how to execute the compiler -echo CFLAGS -echo The compiler compilation flags -echo file -echo One or more C files whose dependencies will be checked. Each file is expected -echo to reside in the current directory unless --dep-path is provided on the command line -echo And [OPTIONS] include: -echo --dep-debug -echo Enable script debug -echo --dep-path ^<path^> -echo Do not look in the current directory for the file. Instead, look in <path> to see -echo if the file resides there. --dep-path may be used multiple times to specify -echo multiple alternative location -echo --help -echo Shows this message and exits - -:End diff --git a/nuttx/tools/mkdeps.c b/nuttx/tools/mkdeps.c deleted file mode 100644 index 64d81cbd7..000000000 --- a/nuttx/tools/mkdeps.c +++ /dev/null @@ -1,721 +0,0 @@ -/**************************************************************************** - * tools/mkdeps.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 <sys/stat.h> - -#include <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <limits.h> -#include <ctype.h> -#include <errno.h> - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#define MAX_BUFFER (4096) - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -enum slashmode_e -{ - MODE_FSLASH = 0, - MODE_BSLASH = 1, - MODE_DBLBACK = 2 -}; - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static char *g_cc = NULL; -static char *g_cflags = NULL; -static char *g_files = NULL; -static char *g_altpath = NULL; -static int g_debug = 0; -static bool g_winnative = false; -#ifdef HAVE_WINPATH -static bool g_winpath = false; -static char *g_topdir = NULL; -#endif - -static char g_command[MAX_BUFFER]; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - - /* MinGW does not seem to provide strtok_r */ - -#ifndef HAVE_STRTOK_R -static char *MY_strtok_r(char *str, const char *delim, char **saveptr) -{ - char *pbegin; - char *pend = NULL; - - /* Decide if we are starting a new string or continuing from - * the point we left off. - */ - - if (str) - { - pbegin = str; - } - else if (saveptr && *saveptr) - { - pbegin = *saveptr; - } - else - { - return NULL; - } - - /* Find the beginning of the next token */ - - for (; - *pbegin && strchr(delim, *pbegin) != NULL; - pbegin++); - - /* If we are at the end of the string with nothing - * but delimiters found, then return NULL. - */ - - if (!*pbegin) - { - return NULL; - } - - /* Find the end of the token */ - - for (pend = pbegin + 1; - *pend && strchr(delim, *pend) == NULL; - pend++); - - /* pend either points to the end of the string or to - * the first delimiter after the string. - */ - - if (*pend) - { - /* Turn the delimiter into a null terminator */ - - *pend++ = '\0'; - } - - /* Save the pointer where we left off and return the - * beginning of the token. - */ - - if (saveptr) - { - *saveptr = pend; - } - return pbegin; -} - -#define strtok_r MY_strtok_r -#endif - -static void append(char **base, char *str) -{ - char *oldbase; - char *newbase; - int alloclen; - - oldbase = *base; - if (!oldbase) - { - newbase = strdup(str); - if (!newbase) - { - fprintf(stderr, "ERROR: Failed to strdup %s\n", str); - exit(EXIT_FAILURE); - } - } - else - { - alloclen = strlen(oldbase) + strlen(str) + 2; - newbase = (char *)malloc(alloclen); - if (!newbase) - { - fprintf(stderr, "ERROR: Failed to allocate %d bytes\n", alloclen); - exit(EXIT_FAILURE); - } - - snprintf(newbase, alloclen, "%s %s\n", oldbase, str); - free(oldbase); - } - - *base = newbase; -} - -static void show_usage(const char *progname, const char *msg, int exitcode) -{ - if (msg) - { - fprintf(stderr, "\n"); - fprintf(stderr, "%s:\n", msg); - } - - fprintf(stderr, "\n"); - fprintf(stderr, "%s [OPTIONS] CC -- CFLAGS -- file [file [file...]]\n", - progname); - fprintf(stderr, "\n"); - fprintf(stderr, "Where:\n"); - fprintf(stderr, " CC\n"); - fprintf(stderr, " A variable number of arguments that define how to execute the compiler\n"); - fprintf(stderr, " CFLAGS\n"); - fprintf(stderr, " The compiler compilation flags\n"); - fprintf(stderr, " file\n"); - fprintf(stderr, " One or more C files whose dependencies will be checked. Each file is expected\n"); - fprintf(stderr, " to reside in the current directory unless --dep-path is provided on the command line\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "And [OPTIONS] include:\n"); - fprintf(stderr, " --dep-debug\n"); - fprintf(stderr, " Enable script debug\n"); - fprintf(stderr, " --dep-path <path>\n"); - fprintf(stderr, " Do not look in the current directory for the file. Instead, look in <path> to see\n"); - fprintf(stderr, " if the file resides there. --dep-path may be used multiple times to specify\n"); - fprintf(stderr, " multiple alternative location\n"); - fprintf(stderr, " --winnative\n"); - fprintf(stderr, " By default, a POSIX-style environment is assumed (e.g., Linux, Cygwin, etc.) This option is\n"); - fprintf(stderr, " inform the tool that is working in a pure Windows native environment.\n"); -#ifdef HAVE_WINPATH - fprintf(stderr, " --winpaths <TOPDIR>\n"); - fprintf(stderr, " This option is useful when using a Windows native toolchain in a POSIX environment (such\n"); - fprintf(stderr, " such as Cygwin). In this case, will CC generates dependency lists using Windows paths\n"); - fprintf(stderr, " (e.g., C:\\blablah\\blabla). This switch instructs the script to use 'cygpath' to convert\n"); - fprintf(stderr, " the Windows paths to Cygwin POSIXE paths.\n"); -#endif - fprintf(stderr, " --help\n"); - fprintf(stderr, " Shows this message and exits\n"); - exit(exitcode); -} - -static void parse_args(int argc, char **argv) -{ - char *args = NULL; - int argidx; - - /* Accumulate CFLAGS up to "--" */ - - for (argidx = 1; argidx < argc; argidx++) - { - if (strcmp(argv[argidx], "--") == 0) - { - g_cc = g_cflags; - g_cflags = args; - args = NULL; - } - else if (strcmp(argv[argidx], "--dep-debug") == 0) - { - g_debug++; - } - else if (strcmp(argv[argidx], "--dep-path") == 0) - { - argidx++; - if (argidx >= argc) - { - show_usage(argv[0], "ERROR: Missing argument to --dep-path", EXIT_FAILURE); - } - - if (args) - { - append(&args, argv[argidx]); - } - else - { - append(&g_altpath, argv[argidx]); - } - } - else if (strcmp(argv[argidx], "--winnative") == 0) - { - g_winnative = true; - } -#ifdef HAVE_WINPATH - else if (strcmp(argv[argidx], "--winpath") == 0) - { - g_winpath = true; - if (g_topdir) - { - free(g_topdir); - } - - argidx++; - if (argidx >= argc) - { - show_usage(argv[0], "ERROR: Missing argument to --winpath", EXIT_FAILURE); - } - - g_topdir = strdup(argv[argidx]); - } -#endif - else if (strcmp(argv[argidx], "--help") == 0) - { - show_usage(argv[0], NULL, EXIT_SUCCESS); - } - else - { - append(&args, argv[argidx]); - } - } - - /* The final thing accumulated is the list of files */ - - g_files = args; - - /* If no paths were specified, then look in the current directory only */ - - if (!g_altpath) - { - g_altpath = strdup("."); - } - - if (g_debug) - { - fprintf(stderr, "SELECTIONS\n"); - fprintf(stderr, " CC : [%s]\n", g_cc ? g_cc : "(None)"); - fprintf(stderr, " CFLAGS : [%s]\n", g_cflags ? g_cflags : "(None)"); - fprintf(stderr, " FILES : [%s]\n", g_files ? g_files : "(None)"); - fprintf(stderr, " PATHS : [%s]\n", g_altpath ? g_altpath : "(None)"); -#ifdef HAVE_WINPATH - fprintf(stderr, " Windows Paths : [%s]\n", g_winpath ? "TRUE" : "FALSE"); - if (g_winpath) - { - fprintf(stderr, " TOPDIR : [%s]\n", g_topdir); - } -#endif - fprintf(stderr, " Windows Native : [%s]\n", g_winnative ? "TRUE" : "FALSE"); - } - - /* Check for required paramters */ - - if (!g_cc) - { - show_usage(argv[0], "ERROR: No compiler specified", EXIT_FAILURE); - } - - if (!g_files) - { - /* Don't report an error -- this happens normally in some configurations */ - - printf("# No files specified for dependency generataion\n"); - exit(EXIT_SUCCESS); - } - -#ifdef HAVE_WINPATH - if (g_winnative && g_winpath) - { - show_usage(argv[0], "ERROR: Both --winnative and --winpapth makes no sense", EXIT_FAILURE); - } -#endif -} - -static void do_dependency(const char *file, char separator) -{ - static const char moption[] = " -M "; - struct stat buf; - char *alloc; - char *altpath; - char *path; - char *lasts; - int cmdlen; - int pathlen; - int filelen; - int totallen; - int ret; - - /* Copy the compiler into the command buffer */ - - cmdlen = strlen(g_cc); - if (cmdlen >= MAX_BUFFER) - { - fprintf(stderr, "ERROR: Compiler string is too long [%d/%d]: %s\n", - cmdlen, MAX_BUFFER, g_cc); - exit(EXIT_FAILURE); - } - - strcpy(g_command, g_cc); - - /* Copy " -M " */ - - cmdlen += strlen(moption); - if (cmdlen >= MAX_BUFFER) - { - fprintf(stderr, "ERROR: Option string is too long [%d/%d]: %s\n", - cmdlen, MAX_BUFFER, moption); - exit(EXIT_FAILURE); - } - - strcat(g_command, moption); - - /* Copy the CFLAGS into the command buffer */ - - cmdlen += strlen(g_cflags); - if (cmdlen >= MAX_BUFFER) - { - fprintf(stderr, "ERROR: CFLAG string is too long [%d/%d]: %s\n", - cmdlen, MAX_BUFFER, g_cflags); - exit(EXIT_FAILURE); - } - - strcat(g_command, g_cflags); - - /* Add a space */ - - g_command[cmdlen] = ' '; - cmdlen++; - g_command[cmdlen] = '\0'; - - /* Make a copy of g_altpath. We need to do this because at least the version - * of strtok_r above does modifie it. - */ - - alloc = strdup(g_altpath); - if (!alloc) - { - fprintf(stderr, "ERROR: Failed to strdup paths\n"); - exit(EXIT_FAILURE); - } - - altpath = alloc; - - /* Try each path. This loop will continue until each path has been tried - * (failure) or until stat() finds the file - */ - - while ((path = strtok_r(altpath, " ", &lasts)) != NULL) - { - /* Create a full path to the file */ - - pathlen = strlen(path); - totallen = cmdlen + pathlen; - if (totallen >= MAX_BUFFER) - { - fprintf(stderr, "ERROR: Path is too long [%d/%d]: %s\n", - totallen, MAX_BUFFER, path); - exit(EXIT_FAILURE); - } - - strcpy(&g_command[cmdlen], path); - - if (g_command[totallen] != '\0') - { - fprintf(stderr, "ERROR: Missing NUL terminator\n"); - exit(EXIT_FAILURE); - } - - if (g_command[totallen-1] != separator) - { - g_command[totallen] = separator; - g_command[totallen+1] = '\0'; - pathlen++; - totallen++; - } - - filelen = strlen(file); - totallen += filelen; - if (totallen >= MAX_BUFFER) - { - fprintf(stderr, "ERROR: Path+file is too long [%d/%d]\n", - totallen, MAX_BUFFER); - exit(EXIT_FAILURE); - } - - strcat(g_command, file); - - /* Check that a file actually exists at this path */ - - if (g_debug) - { - fprintf(stderr, "Trying path=%s file=%s fullpath=%s\n", - path, file, &g_command[cmdlen]); - } - - ret = stat(&g_command[cmdlen], &buf); - if (ret < 0) - { - altpath = NULL; - continue; - } - - if (!S_ISREG(buf.st_mode)) - { - fprintf(stderr, "ERROR: File %s exists but is not a regular file\n", - &g_command[cmdlen]); - exit(EXIT_FAILURE); - } - - /* Okay.. we have. Create the dependency. One a failure to start the - * compiler, system() will return -1; Otherwise, the returned value - * from the compiler is in WEXITSTATUS(ret). - */ - - ret = system(g_command); -#ifdef WEXITSTATUS - if (ret < 0 || WEXITSTATUS(ret) != 0) - { - if (ret < 0) - { - fprintf(stderr, "ERROR: system failed: %s\n", strerror(errno)); - } - else - { - fprintf(stderr, "ERROR: %s failed: %d\n", g_cc, WEXITSTATUS(ret)); - } - - fprintf(stderr, " command: %s\n", g_command); - exit(EXIT_FAILURE); - } -#else - if (ret < 0) - { - fprintf(stderr, "ERROR: system failed: %s\n", strerror(errno)); - fprintf(stderr, " command: %s\n", g_command); - exit(EXIT_FAILURE); - } -#endif - - /* We don't really know that the command succeeded... Let's assume that it did */ - - free(alloc); - return; - } - - printf("# ERROR: File \"%s\" not found at any location\n", file); - exit(EXIT_FAILURE); -} - -/* Convert a Cygwin path to a Windows path */ - -#ifdef HAVE_WINPATH -static char *cywin2windows(const char *str, const char *append, enum slashmode_e mode) -{ - static const char cygdrive[] = "/cydrive"; - const char *src = src; - char *dest; - char *newpath; - char *allocpath = NULL; - int srclen = strlen(str); - int alloclen = 0; - int drive = 0; - int lastchar; - - /* Skip any leading whitespace */ - - while (isspace(*str)) str++; - - /* Were we asked to append something? */ - - if (append) - { - char *tmp; - - alloclen = sizeof(str) + sizeof(append) + 1; - allocpath = (char *)malloc(alloclen); - if (!allocpath) - { - fprintf(stderr, "ERROR: Failed to allocate %d bytes\n", alloclen); - exit(EXIT_FAILURE); - } - - snprintf(allocpath, alloclen, "%s/%s", str, append); - } - - /* Looking for path of the form /cygdrive/c/bla/bla/bla */ - - if (strcasecmp(src, cygdrive) == 0) - { - int cygsize = sizeof(cygdrive); - if (src[cygsize] == '/') - { - cygsize++; - srclen -= cygsize; - src += cygsize; - - if (srclen <= 0) - { - fprintf(stderr, "ERROR: Unhandled path: \"%s\"\n", str); - exit(EXIT_FAILURE); - } - - drive = toupper(*src); - if (drive < 'A' || drive > 'Z') - { - fprintf(stderr, "ERROR: Drive charager: \"%s\"\n", str); - exit(EXIT_FAILURE); - } - - srclen--; - src++; - alloclen = 2; - } - } - - /* Determine the size of the new path */ - - alloclen += sizeof(src) + 1; - if (mode == MODE_DBLBACK) - { - const char *tmpptr; - for (tmpptr = src; *tmpptr; tmpptr++) - { - if (*tmpptr == '/') alloclen++; - } - } - - /* Allocate memory for the new path */ - - newpath = (char *)malloc(alloclen); - if (!newpath) - { - fprintf(stderr, "ERROR: Failed to allocate %d bytes\n", alloclen); - exit(EXIT_FAILURE); - } - - dest = newpath; - - /* Copy the drive character */ - - if (drive) - { - *dest++ = drive; - *dest++ = ':'; - } - - /* Copy each character from the source, making modifications for foward - * slashes as required. - */ - - lastchar = '\0'; - for (; *src; src++) - { - if (mode != MODE_FSLASH && *src == '/') - { - if (lastchar != '/') - { - *dest++ = '\\'; - if (mode == MODE_DBLBACK) - { - *dest++ = '\\'; - } - } - } - else - { - *dest++ = *src; - } - - lastchar = *src; - } - - *dest++ = '\0'; - if (allocpath) - { - free(allocpath); - } - return dest; -} -#endif - -#ifdef HAVE_WINPATH -static void do_winpath(char *file) -{ - /* The file is in POSIX format. CC expects Windows format to generate the - * dependencies, but GNU make expect the resulting dependencies to be back - * in POSIX format. What a mess! - */ - - char *path = cywin2windows(g_topdir, file, MODE_FSLASH); - - /* Then get the dependency and perform conversions on it to make it - * palatable to the Cygwin make. - */ -#warning "Missing logic" - - free(path); -} -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv, char **envp) -{ - char *lasts; - char *files; - char *file; - - /* Parse command line parameters */ - - parse_args(argc, argv); - - /* Then generate dependencies for each path on the command line. NOTE - * strtok_r will clobber the files list. But that is okay because we are - * only going to traverse it once. - */ - - files = g_files; - while ((file = strtok_r(files, " ", &lasts)) != NULL) - { - /* Check if we need to do path conversions for a Windows-natvie tool - * being using in a POSIX/Cygwin environment. - */ - -#ifdef HAVE_WINPATH - if (g_winpath) - { - do_winpath(file); - } - else -#endif - { - do_dependency(file, g_winnative ? '\\' : '/'); - } - - files = NULL; - } - - return EXIT_SUCCESS; -} diff --git a/nuttx/tools/mkdeps.sh b/nuttx/tools/mkdeps.sh deleted file mode 100755 index 42397012b..000000000 --- a/nuttx/tools/mkdeps.sh +++ /dev/null @@ -1,200 +0,0 @@ -#!/bin/bash -############################################################################ -# tools/mkdeps.sh -# -# Copyright (C) 2007-2009, 2011-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. -# -############################################################################ - -# -# Usage: - -show_usage () -{ - echo "" - echo "$progname [OPTIONS] CC -- CFLAGS -- file [file [file...]]" - echo "" - echo "Where:" - echo " CC" - echo " A variable number of arguments that define how to execute the compiler" - echo " CFLAGS" - echo " The compiler compilation flags" - echo " file" - echo " One or more C files whose dependencies will be checked. Each file is expected" - echo " to reside in the current directory unless --dep-path is provided on the command line" - echo "" - echo "And [OPTIONS] include:" - echo " --dep-debug" - echo " Enable script debug" - echo " --dep-path <path>" - echo " Do not look in the current directory for the file. Instead, look in <path> to see" - echo " if the file resides there. --dep-path may be used multiple times to specify" - echo " multiple alternative location" - echo " --winpaths <TOPDIR>" - echo " CC generates dependency lists using Windows paths (e.g., C:\blablah\blabla). This" - echo " switch instructs the script to use 'cygpath' to convert the Windows paths to Cygwin" - echo " paths" - echo " --help" - echo " Shows this message and exits" - exit 1 -} - -dodep () -{ - unset fullpath - if [ -z "$altpath" ]; then - if [ -r $1 ]; then - fullpath=$1 - else - echo "# ERROR: No readable file at $1" - show_usage - fi - else - for path in $altpath; do - tmppath=$path/$1 - if [ -r $tmppath ]; then - fullpath=$tmppath - break; - fi - done - if [ -z "$fullpath" ]; then - if [ -r $1 ]; then - fullpath=$1 - else - echo "# ERROR: No readable file for $1 found at any location" - show_usage - fi - fi - fi - - $cc -M $cflags $fullpath || \ - ( echo "# ERROR: $cc -M $cflags $fullpath FAILED"; exit 4; ) -} - -unset cc -unset cflags -unset files -unset args -unset altpath -winpaths=n -unset topdir - -# Accumulate CFLAGS up to "--" -progname=$0 -while [ ! -z "$1" ]; do - case $1 in - -- ) - cc=$cflags - cflags=$args - args= - ;; - --dep-debug ) - if [ -z "$args" ]; then - set -x - else - args="$args $1" - fi - ;; - --dep-path ) - if [ -z "$args" ]; then - shift - altpath="$altpath $1" - else - args="$args $1" - fi - ;; - --winpaths ) - if [ -z "$args" ]; then - shift - winpaths=y - topdir=$1 - else - args="$args $1" - fi - ;; - --help ) - show_usage - ;; - *) - args="$args $1" - ;; - esac - shift -done -files=$args - -if [ -z "$cc" ]; then - echo "ERROR: No compiler specified" - show_usage - exit 1 -fi - -if [ -z "$files" ]; then - # Don't report an error -- this happens normally in some configurations - echo "# No files specified for dependency generataion" - exit 0 -fi - -# Check if this compiler generates Cygwin/Linux paths or Windows paths - -if [ "X${winpaths}" = "Xy" ]; then - # We will have to parse and modify each dependency (yech) - # Make sure a valid TOPDIR argument was provided - - if [ -z "$topdir" -o ! -d $topdir ]; then - echo "<TOPDIR> not specified or does not exist: $topdir" - show_usage - exit 1 - fi - - # Get the top dir expressed like the Windows GCC would use it, except - # with forward slashs - - wtopdir=`cygpath -w ${topdir} | sed -e "s,\\\\\\,/,g"` - - # Then get the dependency and perform conversions on it to make it - # palatable to the Cygwin make. This is probably not sufficiently - # general to work on all platforms (like if your disk is not C:). - - for file in $files ; do - dodep $file | sed -e "s,\\\,/,g" -e "s,${wtopdir},${topdir},g" \ - -e "s,/ ,\\\ ,g" -e "s,c:/,/cygdrive/c/,g" \ - -e "s,/$,\\\,g" - done -else - # For normal Cygwin/Linux GCC, the dependency paths are in the - # correct form and can simply be echoed on stdout - - for file in $files ; do - dodep $file - done -fi - diff --git a/nuttx/tools/mkexport.sh b/nuttx/tools/mkexport.sh deleted file mode 100755 index 7ddeae699..000000000 --- a/nuttx/tools/mkexport.sh +++ /dev/null @@ -1,327 +0,0 @@ -#!/bin/bash -# tools/mkexport.sh -# -# 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 -# 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. -# - -# TODO: -# 1. This script assumes the host archiver ar may not be appropriate for -# non-GCC toolchains -# 2. For the kernel build, the user libriars should be built into some -# libuser.a. The list of user libraries would have to accepted with -# some new argument, perhaps -u. - -# Get the input parameter list - -USAGE="USAGE: $0 [-d] [-z] [-w|wy|wn] -t <top-dir> [-x <lib-ext>] -l \"lib1 [lib2 [lib3 ...]]\"" -unset TOPDIR -unset LIBLIST -unset TGZ -WINTOOL=n -LIBEXT=.a - -while [ ! -z "$1" ]; do - case $1 in - -d ) - set -x - ;; - -l ) - shift - LIBLIST=$1 - ;; - -wy ) - WINTOOL=y - ;; - -w | -wn ) - WINTOOL=n - ;; - -t ) - shift - TOPDIR=$1 - ;; - -x ) - shift - LIBEXT=$1 - ;; - -z ) - TGZ=y - ;; - -h ) - echo $USAGE - exit 0 - ;; - * ) - echo "Unrecognized argument: $1" - echo $USAGE - exit 1 - ;; - esac - shift -done - -# Check arguments - -if [ -z "${TOPDIR}" -o -z "${LIBLIST}" ]; then - echo "MK: Missing required arguments" - echo $USAGE - exit 1 -fi - -if [ ! -d "${TOPDIR}" ]; then - echo "MK: Directory ${TOPDIR} does not exist" - exit 1 -fi - -# Get the version string - -if [ ! -f "${TOPDIR}/.version" ]; then - echo "MK: File ${TOPDIR}/.version does not exist" - exit 1 -fi - -source "${TOPDIR}/.version" -if [ ! -z "${CONFIG_VERSION_STRING}" -a "${CONFIG_VERSION_STRING}" != "0.0" ]; then - VERSION="-${CONFIG_VERSION_STRING}" -fi - -# Create the export directory - -EXPORTSUBDIR="nuttx-export${VERSION}" -EXPORTDIR="${TOPDIR}/${EXPORTSUBDIR}" - -# If the export directory already exists, then remove it and create a new one - -if [ -d "${EXPORTDIR}" ]; then - echo "MK: Removing old export directory" - rm -rf "${EXPORTDIR}" -fi - -# Remove any possible previous results - -rm -f "${EXPORTDIR}.tar" -rm -f "${EXPORTDIR}.zip" -rm -f "${EXPORTDIR}.tar.gz" - -# Create the export directory and some of its subdirectories - -mkdir "${EXPORTDIR}" || { echo "MK: 'mkdir ${EXPORTDIR}' failed"; exit 1; } -mkdir "${EXPORTDIR}/startup" || { echo "MK: 'mkdir ${EXPORTDIR}/startup' failed"; exit 1; } -mkdir "${EXPORTDIR}/libs" || { echo "MK: 'mkdir ${EXPORTDIR}/libs' failed"; exit 1; } -mkdir "${EXPORTDIR}/build" || { echo "MK: 'mkdir ${EXPORTDIR}/build' failed"; exit 1; } -mkdir "${EXPORTDIR}/arch" || { echo "MK: 'mkdir ${EXPORTDIR}/arch' failed"; exit 1; } - -# Verify that we have a Make.defs file. - -if [ ! -f "${TOPDIR}/Make.defs" ]; then - echo "MK: Directory ${TOPDIR}/Make.defs does not exist" - exit 1 -fi - -# Copy the Make.defs files, but disable windows path conversions - -grep -v "WINTOOL[ \t]*=[ \t]y" "${TOPDIR}/Make.defs" > "${EXPORTDIR}/Make.defs" - -# Extract information from the Make.defs file. A Makefile can do this best - -make -C "${TOPDIR}/tools" -f Makefile.export TOPDIR="${TOPDIR}" EXPORTDIR="${EXPORTDIR}" -source "${EXPORTDIR}/makeinfo.sh" -rm -f "${EXPORTDIR}/makeinfo.sh" -rm -f "${EXPORTDIR}/Make.defs" - -# Verify the build info that we got from makeinfo.sh - -if [ ! -d "${ARCHDIR}" ]; then - echo "MK: Directory ${ARCHDIR} does not exist" - exit 1 -fi - -# Is there a linker script in this configuration? - -if [ ! -z "${LDPATH}" ]; then - - # Apparently so. Verify that the script exists - - if [ ! -f "${LDPATH}" ]; then - echo "MK: File ${LDPATH} does not exist" - exit 1 - fi - - # Copy the linker script - - cp -p "${LDPATH}" "${EXPORTDIR}/build/." || \ - { echo "MK: cp ${LDPATH} failed"; exit 1; } -fi - -# Save the compilation options - -echo "ARCHCFLAGS = ${ARCHCFLAGS}" >"${EXPORTDIR}/build/Make.defs" -echo "ARCHCXXFLAGS = ${ARCHCXXFLAGS}" >>"${EXPORTDIR}/build/Make.defs" - -# Copy the NuttX include directory (retaining attributes and following symbolic links) - -cp -LR -p "${TOPDIR}/include" "${EXPORTDIR}/." || \ - { echo "MK: 'cp ${TOPDIR}/include' failed"; exit 1; } -find "${EXPORTDIR}/include" -name .svn | xargs rm -rf - -# Copy the startup object file(s) - -make -C ${ARCHDIR} export_head TOPDIR=${TOPDIR} EXPORT_DIR="${EXPORTDIR}" - -# Copy architecture-specific header files into the arch export sub-directory. -# This is tricky because each architecture does things in a little different -# way. -# -# First copy any header files in the architecture src/ sub-directory (some -# architectures keep all of the header files there, some a few, and others -# none - -cp -f "${ARCHDIR}"/*.h "${EXPORTDIR}"/arch/. 2>/dev/null - -# Then look a list of possible places where other architecture-specific -# header files might be found. If those places exist (as directories or -# as symbolic links to directories, then copy the header files from -# those directories into the EXPORTDIR - -ARCH_HDRDIRS="arm armv7-m avr avr32 board common chip mips32" -for hdir in $ARCH_HDRDIRS; do - - # Does the directory (or symbolic link) exist? - - if [ -d "${ARCHDIR}/${hdir}" -o -h "${ARCHDIR}/${hdir}" ]; then - - # Yes.. create a export sub-directory of the same name - - mkdir "${EXPORTDIR}/arch/${hdir}" || \ - { echo "MK: 'mkdir ${EXPORTDIR}/arch/${hdir}' failed"; exit 1; } - - # Then copy the header files (only) into the new directory - - cp -f "${ARCHDIR}"/${hdir}/*.h "${EXPORTDIR}"/arch/${hdir}/. 2>/dev/null - - # One architecture has low directory called "chip" that holds the - # header files - - if [ -d "${ARCHDIR}/${hdir}/chip" ]; then - - # Yes.. create a export sub-directory of the same name - - mkdir "${EXPORTDIR}/arch/${hdir}/chip" || \ - { echo "MK: 'mkdir ${EXPORTDIR}/arch/${hdir}/chip' failed"; exit 1; } - - # Then copy the header files (only) into the new directory - - cp -f "${ARCHDIR}"/${hdir}/chip/*.h "${EXPORTDIR}"/arch/${hdir}/chip/. 2>/dev/null - fi - fi -done - -# Copy OS internal header files as well. They are used by some architecture- -# specific header files. - -mkdir "${EXPORTDIR}/arch/os" || \ - { echo "MK: 'mkdir ${EXPORTDIR}/arch/${hdir}/chip' failed"; exit 1; } -cp -f "${TOPDIR}"/sched/*.h "${EXPORTDIR}"/arch/os/. 2>/dev/null - -# Add the board library to the list of libraries - -if [ -f "${ARCHDIR}/board/libboard${LIBEXT}" ]; then - LIBLIST="${LIBLIST} ${ARCHSUBDIR}/board/libboard${LIBEXT}" -fi - -# Then process each library - -AR=${CROSSDEV}ar -for lib in ${LIBLIST}; do - if [ ! -f "${TOPDIR}/${lib}" ]; then - echo "MK: Library ${TOPDIR}/${lib} does not exist" - exit 1 - fi - - # Get some shorter names for the library - - libname=`basename ${lib} ${LIBEXT}` - shortname=`echo ${libname} | sed -e "s/^lib//g"` - - # Copy the application library unmodified - - if [ "X${libname}" = "Xlibapps" ]; then - cp -p "${TOPDIR}/${lib}" "${EXPORTDIR}/libs/." || \ - { echo "MK: cp ${TOPDIR}/${lib} failed"; exit 1; } - else - - # Create a temporary directory and extract all of the objects there - # Hmmm.. this probably won't work if the archiver is not 'ar' - - mkdir "${EXPORTDIR}/tmp" || \ - { echo "MK: 'mkdir ${EXPORTDIR}/tmp' failed"; exit 1; } - cd "${EXPORTDIR}/tmp" || \ - { echo "MK: 'cd ${EXPORTDIR}/tmp' failed"; exit 1; } - if [ "X${WINTOOL}" = "Xy" ]; then - WLIB=`cygpath -w "${TOPDIR}/${lib}"` - ${AR} x "${WLIB}" - else - ${AR} x "${TOPDIR}/${lib}" - fi - - # Rename each object file (to avoid collision when they are combined) - # and add the file to libnuttx - - for file in `ls`; do - mv "${file}" "${shortname}-${file}" - if [ "X${WINTOOL}" = "Xy" ]; then - WLIB=`cygpath -w "${EXPORTDIR}/libs/libnuttx${LIBEXT}"` - ${AR} rcs "${WLIB}" "${shortname}-${file}" - else - ${AR} rcs "${EXPORTDIR}/libs/libnuttx${LIBEXT}" "${shortname}-${file}" - fi - done - - cd "${TOPDIR}" || \ - { echo "MK: 'cd ${TOPDIR}' failed"; exit 1; } - rm -rf "${EXPORTDIR}/tmp" - fi -done - -# Now tar up the whole export directory - -cd "${TOPDIR}" || \ - { echo "MK: 'cd ${TOPDIR}' failed"; exit 1; } - -if [ "X${TGZ}" = "Xy" ]; then - tar cvf "${EXPORTSUBDIR}.tar" "${EXPORTSUBDIR}" 1>/dev/null 2>&1 - gzip -f "${EXPORTSUBDIR}.tar" -else - zip -r "${EXPORTSUBDIR}.zip" "${EXPORTSUBDIR}" 1>/dev/null 2>&1 -fi - -# Clean up after ourselves - -rm -rf "${EXPORTSUBDIR}" diff --git a/nuttx/tools/mkfsdata.pl b/nuttx/tools/mkfsdata.pl deleted file mode 100755 index 589ad5f08..000000000 --- a/nuttx/tools/mkfsdata.pl +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/perl -# tools/mkfsdata.pl -# -# Extracted from uIP which has a license that is compatible with NuttX. -# There is no authorship, copyright, or licensing information in the -# original file. Possibly written by Adam Dunkels. -# -# 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. -# - -open(OUTPUT, "> httpd_fsdata.c"); - -chdir("httpd-fs"); - -opendir(DIR, "."); -@files = grep { !/^\./ && !/(CVS|~)/ } readdir(DIR); -closedir(DIR); - -print(OUTPUT "#include <apps/netutils/httpd.h>\n\n"); -print(OUTPUT "#ifndef NULL\n#define NULL 0\n#endif\n\n"); - -foreach $file (@files) { - - if(-d $file && $file !~ /^\./) { - print "Processing directory $file\n"; - opendir(DIR, $file); - @newfiles = grep { !/^\./ && !/(CVS|~)/ } readdir(DIR); - closedir(DIR); - printf "Adding files @newfiles\n"; - @files = (@files, map { $_ = "$file/$_" } @newfiles); - next; - } -} - -foreach $file (@files) { - if(-f $file) { - - print "Adding file $file\n"; - - open(FILE, $file) || die "Could not open file $file\n"; - - $file =~ s-^-/-; - $fvar = $file; - $fvar =~ s-/-_-g; - $fvar =~ s-\.-_-g; - # for AVR, add PROGMEM here - print(OUTPUT "static const unsigned char data".$fvar."[] =\n"); - print(OUTPUT "{\n /* $file */\n\n "); - for($j = 0; $j < length($file); $j++) { - printf(OUTPUT "%#02x, ", unpack("C", substr($file, $j, 1))); - } - printf(OUTPUT "0x00,\n "); - - $i = 0; - while(read(FILE, $data, 1)) { - printf(OUTPUT "%#02x, ", unpack("C", $data)); - $i++; - if($i == 10) { - print(OUTPUT "\n"); - $i = 0; - print(OUTPUT " "); - } - } - print(OUTPUT "0x00\n};\n\n"); - close(FILE); - push(@fvars, $fvar); - push(@pfiles, $file); - } -} - -for($i = 0; $i < @fvars; $i++) { - $file = $pfiles[$i]; - $fvar = $fvars[$i]; - - if($i == 0) { - $prevfile = "NULL"; - } else { - $prevfile = "file" . $fvars[$i - 1]; - } - if($i == @fvars-1) { - print(OUTPUT "const struct httpd_fsdata_file g_httpdfs_root[] =\n {{$prevfile, data$fvar, "); - } else { - print(OUTPUT "const struct httpd_fsdata_file file".$fvar."[] =\n {{$prevfile, data$fvar, "); - } - print(OUTPUT "data$fvar + ". (length($file) + 1) .", "); - print(OUTPUT "sizeof(data$fvar) - ". (length($file) + 1) ."}};\n\n"); -} - -# print(OUTPUT "#define HTTPD_FS_ROOT file$fvars[$i - 1]\n\n"); -print(OUTPUT "const int g_httpd_numfiles = $i;\n"); diff --git a/nuttx/tools/mkimage.sh b/nuttx/tools/mkimage.sh deleted file mode 100755 index f64dfde85..000000000 --- a/nuttx/tools/mkimage.sh +++ /dev/null @@ -1,289 +0,0 @@ -#!/bin/bash -# -# File: mkimage.sh -# -# Copyright (C) 2002 RidgeRun, Inc. -# Author: RidgeRun, Inc <skranz@@ridgerun.com> -# - Adapted for the Cadenux environment, 9-6-02, Gregory Nutt -# - Added --EAddr option, 6-18-03, Gregory Nutt -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. -# -# THIS SOFTWARE IS PROVIDED ``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. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 675 Mass Ave, Cambridge, MA 02139, USA. -# -######################################################## -# Description: -# ----------- -# Scenario #1 -# ----------- -# This utility was developed by RidgeRun for the -# purpose of converting a standard binary executable -# image (such as ELF) into a special format (RR -# format) suitable for quick downloads to the target -# TI925 RidgeRun Bootloader (rrload). The image is -# produced by constructing a special header which is -# then tacked onto the front of the supplied binary -# image. The resulting binary image is smaller than -# what would normally be encountered with traditional -# download formats (such as SREC or uuencoded; both -# ascii based). The special header at the front of the -# image is used to guide the target's rrload (a -# booloader developed by RidgeRun Inc). The header -# data contains a field representing the total byte -# count of the binary data following the header as -# well as a field that indicates the load address of -# run image. Additionally, a field exists in the -# header which indicates the image's entry point which -# could be called by the bootloader to invoked the -# just downloaded program. -# ----------- -# Scenario #2 -# ----------- -# If the supplied image is not a standard binary -# executagle image then that is ok too, a header is -# constructed and tacked onto the front of the supplied -# binary data forming the new binary image (in rr format). -# In this case the EntryAddr is set to 0xFFFFFFFF by -# default and the LoadAddr is set to 0x00000000 by -# default unless otherwise indicated by command line -# arguments -LEntry and -LAddr which if used are assumed -# to be in hexidecimal units. -# -# ----------- -# Scenario #3 -# ----------- -# -# Read/Write file system (like JFFS) that will not -# work if rrload stores a 20 byte header at the beginning -# of the flashed component image -# -# mkimage [--NoHeader ] <input-bin> <out-RR> -# -# Usage: -# mkimage [--LAddr h] [--EAddr h] [--NoHeader] <input-bin> <out-RR> -# -# Examples: -# $ mkimage linux linux.rr -# ..or.. -# $ mkimage -LAddr 10008000 -EAddr 10008000 vmlinux vmlinux.rr -# ..or.. -# $ mkimage --NoHeader fileSys.gz fileSys.gz.rr -# ..or.. -# $ mkimage --LAddr A00 fileSys.gz fileSys.gz.rr -# ..or.. -# $ mkimage --LAddr A00 fileSys.gz fileSys.gz.rr -# ^ -# | -# Assumed hex units. -# Please omit the -# leading "0x". -######################################################## - -if [ $# -lt 2 ] ; then - echo "Error: missing argument" - echo "Usage: mkimage [--Prefix prefix] [--LAddr n] [--EAddr n] [--NoHeader] <input-Bin> <out-RR>" - exit 1 -fi - -# Pleae Note the following formatting inconsistency. -# (Sorry, for now this is necessary) -LoadAddr="00000000" # Note: hex val *without* proceeding "0x" -EntryAddr="0xFFFFFFFF" # Note: hex val *with* procedding "0x" - -unset prefix -Header="y" -LAddrSupplied="n" -EAddrSupplied="n" -compress="n" - -while [ $# -gt 0 ] ; do - case "$1" in - --Prefix) - shift; - prefix="$1" - shift - ;; - --LAddr ) - shift - LoadAddr="$1" - # Next, make the supplied LAddr exactly 8 hex chars long. - LoadAddr="0000000${LoadAddr}" - LoadAddr=$(echo $LoadAddr | sed -e "s/^.*\(........\)$/\1/g") - LAddrSupplied="y" - shift - ;; - --EAddr ) - shift - EntryAddr="$1" - # Next, make the supplied LEntry exactly 8 hex chars long. - EntryAddr="0000000${EntryAddr}" - EntryAddr=$(echo $EntryAddr | sed -e "s/^.*\(........\)$/\1/g") - EntryAddr=0x$EntryAddr - EAddrSupplied="y" - shift - ;; - --NoHeader ) - Header="n" - shift - ;; - --compress ) - compress="y" - shift - ;; - *) - break - ;; - esac -done - -if [ ! $# -eq 2 ] ; then - echo "Error: invalid argument set." - echo "Usage: mkimage [--LAddr h] <input-Bin> <out-RR>" - exit 1 -fi - -binary=$1.stripped -outbin=$2 - -cp $1 $binary -FileTypeExec=$(${prefix}objdump -f $binary 2>/dev/null | egrep "EXEC_P") - -if [ ! -z "$FileTypeExec" ] ; then - - # ----------- - # Scenario #1 - # ----------- - # We have an executable style binary (like ELF, etc). - # So... - # --------------------------------- - # Next | Create the binary image data. - # --------------------------------- - ${prefix}strip ${binary} - ${prefix}objcopy -S -O binary $binary ${binary}.binary - # --------------------------------- - # Next | Create compress image if requested - # --------------------------------- - image_file=${binary}.binary - if [ "$compress" = "y" ] ; then - gzip -f -9 -c ${binary}.binary > ${binary}.binary.gz - image_file=${binary}.binary.gz - fi - # --------------------------------- - # Next | Create the header information (ascii) needed - # | by the TI925 bootloader. This includes the - # | load address, entry address and byte count of - # | the binary executable data which will follow it. - # --------------------------------- - if [ "$LAddrSupplied" = "n" ] ; then - # Next, Since LoadAddr not already supplied by user we'll - # derive it by consulting the binary executable file. - LoadAddr=$(${prefix}objdump -h ${binary} | grep " 0 \.") - LoadAddr=$(echo $LoadAddr | cut -d' ' -f4) # eight hex chars - fi - if [ "$EAddrSupplied" = "n" ] ; then - # Next, Since EntryAddr not already supplied by user we'll - # derive it by consulting the binary executable file. - EntryAddr=$(${prefix}objdump -f ${binary} | grep -i "start") - EntryAddr=$(echo $EntryAddr | cut -d' ' -f3) # eight hex chars - fi - # Next, Compute byte length of binary portion. - numBytes=$(wc --bytes $image_file) - numBytes=$(echo $numBytes | cut -d' ' -f1) - numBytes=$(echo 16o $numBytes p | dc) # converts to hex. - # Next, make the numBytes string exactly 8 hex chars long. - numBytes="0000000${numBytes}" - numBytes=$(echo $numBytes | sed -e "s/^.*\(........\)$/\1/g") - # --------------------------------- - # Next | Combine the ascii header information - # | with the binary image to make the - # | final downloadable *mostly* binary - # | image. - # --------------------------------- - rm -f ${outbin} - echo ">LoadAddr :0x${LoadAddr}" >> ${outbin} - if [ "${Header}" = "y" ]; then - echo ">EntryAddr:${EntryAddr}" >> ${outbin} - else - echo ">NoHeader" >> ${outbin} - fi - echo ">NumBytes :0x${numBytes}" >> ${outbin} - cat $image_file >> ${outbin} - # --------------------------------- - # Cleanup and exit - # --------------------------------- - rm -f ${binary}.binary $image_file - exit 0 - -else - - # ----------- - # Scenario #2 - # ----------- - # Just a binary image but not a standard executable - # style binary (like ELF, etc). Might be a compressed - # filesystem image, etc. - # So... - # --------------------------------- - # Next | Create the header information (ascii) needed - # | by the TI925 bootloader. This includes the - # | load address, entry address and byte count of - # | the binary file which will follow it. - # --------------------------------- - # | Create compress image if requested - # --------------------------------- - # - image_file=${binary} - if [ "$compress" = "y" ] ; then - gzip -f -9 -c ${image_file} > ${image_file}.gz - image_file=${image_file}.gz - fi - # - # Note: The LoadAddr and EntryAddr are already established - # for us at this point, but we will need to compute the - # byte length of binary portion next. - # - numBytes=$(wc --bytes ${image_file}) - numBytes=$(echo $numBytes | cut -d' ' -f1) - numBytes=$(echo 16o $numBytes p | dc) # converts to hex. - # Next, make the numBytes string exactly 8 hex chars long. - numBytes="0000000${numBytes}" - numBytes=$(echo $numBytes | sed -e "s/^.*\(........\)$/\1/g") - # - # --------------------------------- - # Next | Combine the ascii header information - # | with the binary image to make the - # | final downloadable *mostly* binary - # | image. - # --------------------------------- - # - rm -f ${outbin} - echo ">LoadAddr :0x${LoadAddr}" >> ${outbin} - if [ ${Header} = "y" ]; then - echo ">EntryAddr:${EntryAddr}" >> ${outbin} - else - echo ">NoHeader" >> ${outbin} - fi - echo ">NumBytes :0x${numBytes}" >> ${outbin} - cat ${image_file} >> ${outbin} - # --------------------------------- - # Cleanup and exit - # --------------------------------- - rm -f ${image_file}.gz - exit 0 -fi diff --git a/nuttx/tools/mknulldeps.sh b/nuttx/tools/mknulldeps.sh deleted file mode 100755 index 033205e6f..000000000 --- a/nuttx/tools/mknulldeps.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# tools/mknulldeps.sh -# -# Copyright (C) 2008 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. -# -echo "# The selected toolchain does not support dependency generation"
\ No newline at end of file diff --git a/nuttx/tools/mkromfsimg.sh b/nuttx/tools/mkromfsimg.sh deleted file mode 100755 index 8811f1953..000000000 --- a/nuttx/tools/mkromfsimg.sh +++ /dev/null @@ -1,261 +0,0 @@ -#!/bin/bash -############################################################################ -# tools/mkromfsimg.sh -# -# Copyright (C) 2008, 2011 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. -# -############################################################################ - -# Environmental stuff - -wd=`pwd` -workingdir=$wd/img -rcsfile=rcS -rcstemplate=$rcsfile.template -romfsimg=romfs.img -headerfile=nsh_romfsimg.h - -# Get the input parameters - -topdir=$1 -usage="USAGE: $0 <topdir>" - -if [ -z "$topdir" -o ! -d "$topdir" ]; then - echo "The full path to the NuttX base directory must be provided on the command line" - echo $usage - exit 1 -fi - -# Extract all values from the .config in the $topdir that contains all of the NuttX -# configuration settings. The .config file was intended to be include-able by makefiles -# and source-able by scripts. Unfortunately,there are too many syntactic differents -# to make that practical - -if [ ! -r $topdir/.config ]; then - echo "No readable file at $topdir/.config" - echo "Has NuttX been configured?" - exit 1 -fi - -romfsetc=`grep CONFIG_NSH_ROMFSETC= $topdir/.config | cut -d'=' -f2` -disablempt=`grep CONFIG_DISABLE_MOUNTPOINT= $topdir/.config | cut -d'=' -f2` -disablescript=`grep CONFIG_NSH_DISABLESCRIPT= $topdir/.config | cut -d'=' -f2` -ndescriptors=`grep CONFIG_NFILE_DESCRIPTORS= $topdir/.config | cut -d'=' -f2` -devconsole=`grep CONFIG_DEV_CONSOLE= $topdir/.config | cut -d'=' -f2` -romfs=`grep CONFIG_FS_ROMFS= $topdir/.config | cut -d'=' -f2` -romfsmpt=`grep CONFIG_NSH_ROMFSMOUNTPT= $topdir/.config | cut -d'=' -f2` -initscript=`grep CONFIG_NSH_INITSCRIPT= $topdir/.config | cut -d'=' -f2` -romfsdevno=`grep CONFIG_NSH_ROMFSDEVNO= $topdir/.config | cut -d'=' -f2` -romfssectsize=`grep CONFIG_NSH_ROMFSSECTSIZE= $topdir/.config | cut -d'=' -f2` -fatfs=`grep CONFIG_FS_FAT= $topdir/.config | cut -d'=' -f2` -fatdevno=`grep CONFIG_NSH_FATDEVNO= $topdir/.config | cut -d'=' -f2` -fatsectsize=`grep CONFIG_NSH_FATSECTSIZE= $topdir/.config | cut -d'=' -f2` -fatnsectors=`grep CONFIG_NSH_FATNSECTORS= $topdir/.config | cut -d'=' -f2` -fatmpt=`grep CONFIG_NSH_FATMOUNTPT= $topdir/.config | cut -d'=' -f2` - -# The following settings are required for general ROMFS support -# -# Mountpoint support must be enabled - -if [ "X$disablempt" = "Xy" ]; then - echo "Mountpoint support is required for this feature" - echo "Set CONFIG_DISABLE_MOUNTPOINT=n to continue" - exit 1 -fi - -# Scripting support must be enabled - -if [ "X$disablescript" = "Xy" ]; then - echo "NSH scripting support is required for this feature" - echo "Set CONFIG_NSH_DISABLESCRIPT=n to continue" - exit 1 -fi - -# We need at least 2 file descriptors 1 for the ROMFS mount and one for -# FAT mount performed in rcS. That still wouldn't be enough to to do much -# with NSH - -if [ -z "$ndescriptors" -o "$ndescriptors" -lt 2 ]; then - echo "No file descriptors have been allocated" - if [ "X$devconsole" = "Xy" ]; then - echo "Set CONFIG_NFILE_DESCRIPTORS to value greater than 4" - else - echo "Set CONFIG_NFILE_DESCRIPTORS to value greater than 1" - fi - exit 1 -fi - -# If a console is enabled, then three more file descriptors are required -# for stdin, stdout, and stderr - -if [ "X$devconsole" = "Xy" -a "$ndescriptors" -lt 5 ]; then - echo "Insufficient file descriptors have been allocated" - echo "Set CONFIG_NFILE_DESCRIPTORS to value greater than 4" -fi - -# ROMFS support is required, of course - -if [ "X$romfs" != "Xy" ]; then - echo "ROMFS support is disabled in the NuttX configuration" - echo "Set CONFIG_FS_ROMFS=y to continue" - exit 0 -fi - -# The options in the default rcS.template also require FAT FS support - -if [ "X$fatfs" != "Xy" ]; then - echo "FAT FS support is disabled in the NuttX configuration" - echo "Set CONFIG_FS_FAT=y to continue" - exit 0 -fi - -# Verify that genromfs has been installed - -genromfs -h 1>/dev/null 2>&1 || { \ - echo "Host executable genromfs not available in PATH"; \ - echo "You may need to download in from http://romfs.sourceforge.net/"; \ - exit 1; \ -} - -# Supply defaults for all un-defined ROMFS settings - -if [ -z "$romfsmpt" ]; then - romfsmpt="/etc" -fi -if [ -z "$initscript" ]; then - initscript="init.d/rcS" -fi -if [ -z "$romfsdevno" ]; then - romfsdevno=0 -fi -if [ -z "$romfssectsize" ]; then - romfssectsize=64 -fi - -# Supply defaults for all un-defined FAT FS settings - -if [ -z "$fatdevno" ]; then - fatdevno=1 -fi -if [ -z "$fatsectsize" ]; then - fatsectsize=512 -fi -if [ -z "$fatnsectors" ]; then - fatnsectors=1024 -fi -if [ -z "$fatmpt" ]; then - fatmpt="/tmp" -fi - -# Verify the mountpoint. Verify that it is an absolute path but not /, /dev, -# /., /./*, /.., or /../* - -if [ ${romfsmpt:0:1} != "\"" ]; then - echo "CONFIG_NSH_ROMFSMOUNTPT must be a string" - echo "Change it so that it is enclosed in quotes." - exit 1 -fi - -uromfsmpt=`echo $romfsmpt | sed -e "s/\"//g"` - -if [ ${uromfsmpt:0:1} != "/" ]; then - echo "CONFIG_NSH_ROMFSMOUNTPT must be an absolute path in the target FS" - echo "Change it so that it begins with the character '/'. Eg. /etc" - exit 1 -fi - -tmpdir=$uromfsmpt -while [ ${tmpdir:0:1} == "/" ]; do - tmpdir=${tmpdir:1} -done - -if [ -z "$tmpdir" -o "X$tmpdir" = "Xdev" -o "X$tmpdir" = "." -o \ - ${tmpdir:0:2} = "./" -o "X$tmpdir" = ".." -o ${tmpdir:0:3} = "../" ]; then - echo "Invalid CONFIG_NSH_ROMFSMOUNTPT selection." - exit 1 -fi - -# Verify that the path to the init file is a relative path and not ., ./*, .., or ../* - -if [ ${initscript:0:1} != "\"" ]; then - echo "CONFIG_NSH_INITSCRIPT must be a string" - echo "Change it so that it is enclosed in quotes." - exit 1 -fi - -uinitscript=`echo $initscript | sed -e "s/\"//g"` - -if [ ${uinitscript:0:1} == "/" ]; then - echo "CONFIG_NSH_INITSCRIPT must be an relative path in under $romfsmpt" - echo "Change it so that it begins with the character '/'. Eg. init.d/rcS. " - exit 1 -fi - -if [ "X$uinitscript" = "." -o ${uinitscript:0:2} = "./" -o \ - "X$uinitscript" = ".." -o ${uinitscript:0:3} = "../" ]; then - echo "Invalid CONFIG_NSH_INITSCRIPT selection. Must not begin with . or .." - exit 1 -fi - -# Create a working directory - -rm -rf $workingdir || { echo "Failed to remove the old $workingdir"; exit 1; } -mkdir -p $workingdir || { echo "Failed to created the new $workingdir"; exit 1; } - -# Create the rcS file from the rcS.template - -if [ ! -r $rcstemplate ]; then - echo "$rcstemplate does not exist" - rmdir $workingdir - exit 1 -fi - -cat $rcstemplate | \ - sed -e "s,XXXMKRDMINORXXX,$fatdevno,g" | \ - sed -e "s,XXMKRDSECTORSIZEXXX,$fatsectsize,g" | \ - sed -e "s,XXMKRDBLOCKSXXX,$fatnsectors,g" | \ - sed -e "s,XXXRDMOUNTPOUNTXXX,$fatmpt,g" >$rcsfile - -# And install it at the specified relative location - -install -D --mode=0755 $rcsfile $workingdir/$uinitscript || \ - { echo "Failed to install $rcsfile at $workingdir/$uinitscript"; rm -f $rcsfile; exit 1; } -rm -f $rcsfile - -# Now we are ready to make the ROMFS image - -genromfs -f $romfsimg -d $workingdir -V "NSHInitVol" || { echo "genromfs failed" ; exit 1 ; } -rm -rf $workingdir || { echo "Failed to remove the old $workingdir"; exit 1; } - -# And, finally, create the header file - -xxd -i $romfsimg >$headerfile || { echo "xxd of $< failed" ; rm -f $romfsimg; exit 1 ; } -rm -f $romfsimg diff --git a/nuttx/tools/mksymtab.c b/nuttx/tools/mksymtab.c deleted file mode 100644 index e401812c0..000000000 --- a/nuttx/tools/mksymtab.c +++ /dev/null @@ -1,289 +0,0 @@ -/**************************************************************************** - * tools/mksymtab.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 <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <errno.h> - -#include "csvparser.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -#define MAX_HEADER_FILES 500 -#define SYMTAB_NAME "g_symtab" - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static const char *g_hdrfiles[MAX_HEADER_FILES]; -static int nhdrfiles; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -static void show_usage(const char *progname) -{ - fprintf(stderr, "USAGE: %s <cvs-file> <symtab-file>\n\n", progname); - fprintf(stderr, "Where:\n\n"); - fprintf(stderr, " <cvs-file> : The path to the input CSV file\n"); - fprintf(stderr, " <symtab-file>: The path to the output symbol table file\n"); - fprintf(stderr, " -d : Enable debug output\n"); - exit(EXIT_FAILURE); -} - -static bool check_hdrfile(const char *hdrfile) -{ - int i; - - for (i = 0; i < nhdrfiles; i++) - { - if (strcmp(g_hdrfiles[i], hdrfile) == 0) - { - return true; - } - } - - return false; -} - -static void add_hdrfile(const char *hdrfile) -{ - if (hdrfile && strlen(hdrfile) > 0) - { - if (!check_hdrfile(hdrfile)) - { - if (nhdrfiles > MAX_HEADER_FILES) - { - fprintf(stderr, "ERROR: Too man header files. Increase MAX_HEADER_FILES\n"); - exit(EXIT_FAILURE); - } - - g_hdrfiles[nhdrfiles] = strdup(hdrfile); - nhdrfiles++; - } - } -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv, char **envp) -{ - char *csvpath; - char *symtab; - char *nextterm; - char *finalterm; - char *ptr; - bool cond; - FILE *instream; - FILE *outstream; - int ch; - int i; - - /* Parse command line options */ - - g_debug = false; - - while ((ch = getopt(argc, argv, ":d")) > 0) - { - switch (ch) - { - case 'd' : - g_debug = true; - break; - - case '?' : - fprintf(stderr, "Unrecognized option: %c\n", optopt); - show_usage(argv[0]); - - case ':' : - fprintf(stderr, "Missing option argument, option: %c\n", optopt); - show_usage(argv[0]); - - break; - fprintf(stderr, "Unexpected option: %c\n", ch); - show_usage(argv[0]); - } - } - - if (optind >= argc) - { - fprintf(stderr, "Missing <cvs-file> and <symtab-file>\n"); - show_usage(argv[0]); - } - - csvpath = argv[optind]; - optind++; - - if (optind >= argc) - { - fprintf(stderr, "Missing <symtab-file>\n"); - show_usage(argv[0]); - } - - symtab = argv[optind]; - optind++; - - if (optind < argc) - { - fprintf(stderr, "Unexpected garbage at the end of the line\n"); - show_usage(argv[0]); - } - - /* Open the CSV file for reading */ - - instream = fopen(csvpath, "r"); - if (!instream) - { - fprintf(stderr, "open %s failed: %s\n", csvpath, strerror(errno)); - exit(EXIT_FAILURE); - } - - /* Open the Symbol table file for writing */ - - outstream = fopen(symtab, "w"); - if (!outstream) - { - fprintf(stderr, "open %s failed: %s\n", csvpath, strerror(errno)); - exit(EXIT_FAILURE); - } - - /* Get all of the header files that we need to include */ - - while ((ptr = read_line(instream)) != NULL) - { - /* Parse the line from the CVS file */ - - int nargs = parse_csvline(ptr); - if (nargs < PARM1_INDEX) - { - fprintf(stderr, "Only %d arguments found: %s\n", nargs, g_line); - exit(EXIT_FAILURE); - } - - /* Add the header file to the list of header files we need to include */ - - add_hdrfile(g_parm[HEADER_INDEX]); - } - - /* Back to the beginning */ - - rewind(instream); - - /* Output up-front file boilerplate */ - - fprintf(outstream, "/* %s: Auto-generated symbol table. Do not edit */\n\n", symtab); - fprintf(outstream, "#include <nuttx/config.h>\n"); - fprintf(outstream, "#include <nuttx/binfmt/symtab.h>\n\n"); - - /* Output all of the require header files */ - - for (i = 0; i < nhdrfiles; i++) - { - fprintf(outstream, "#include <%s>\n", g_hdrfiles[i]); - } - - /* Now the symbol table itself */ - - fprintf(outstream, "\nstruct symtab_s %s[] =\n", SYMTAB_NAME); - fprintf(outstream, "{\n"); - - /* Parse each line in the CVS file */ - - nextterm = ""; - finalterm = ""; - - while ((ptr = read_line(instream)) != NULL) - { - /* Parse the line from the CVS file */ - - int nargs = parse_csvline(ptr); - if (nargs < PARM1_INDEX) - { - fprintf(stderr, "Only %d arguments found: %s\n", nargs, g_line); - exit(EXIT_FAILURE); - } - - /* Output any conditional compilation */ - - cond = (g_parm[COND_INDEX] && strlen(g_parm[COND_INDEX]) > 0); - if (cond) - { - fprintf(outstream, "%s#if %s\n", nextterm, g_parm[COND_INDEX]); - nextterm = ""; - } - - /* Output the symbol table entry */ - - fprintf(outstream, "%s { \"%s\", (FAR const void *)%s }", - nextterm, g_parm[NAME_INDEX], g_parm[NAME_INDEX]); - - if (cond) - { - nextterm = ",\n#endif\n"; - finalterm = "\n#endif\n"; - } - else - { - nextterm = ",\n"; - finalterm = "\n"; - } - } - - fprintf(outstream, "%s};\n\n", finalterm); - fprintf(outstream, "#define NSYMBOLS (sizeof(%s) / sizeof (struct symtab_s))\n", SYMTAB_NAME); - - /* Close the CSV and symbol table files and exit */ - - fclose(instream); - fclose(outstream); - return EXIT_SUCCESS; -} diff --git a/nuttx/tools/mksyscall.c b/nuttx/tools/mksyscall.c deleted file mode 100644 index 1d172a2a1..000000000 --- a/nuttx/tools/mksyscall.c +++ /dev/null @@ -1,686 +0,0 @@ -/**************************************************************************** - * tools/mksyscall.c - * - * 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 - * 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 <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <errno.h> - -#include "csvparser.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static bool g_inline; -static FILE *g_stubstream; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -static bool is_vararg(const char *type, int ndx, int nparms) -{ - if (strcmp(type,"...") == 0) - { - if (ndx != (nparms-1)) - { - fprintf(stderr, "%d: ... is not the last in the argument list\n", g_lineno); - exit(11); - } - else if (nparms < 2) - { - fprintf(stderr, "%d: Need one parameter before ...\n", g_lineno); - exit(14); - } - - return true; - } - - return false; -} - -static bool is_union(const char *type) -{ - return (strncmp(type,"union", 5) == 0); -} - -static const char *check_funcptr(const char *type) -{ - const char *str = strstr(type,"(*)"); - if (str) - { - return str + 2; - } - return NULL; -} - -static const char *check_array(const char *type) -{ - const char *str = strchr(type, '['); - if (str) - { - return str; - } - return NULL; -} - -static void print_formalparm(FILE *stream, const char *argtype, int parmno) -{ - const char *part2; - int len; - - /* Function pointers and array formal parameter types are a little more work */ - - if ((part2 = check_funcptr(argtype)) != NULL || (part2 = check_array(argtype)) != NULL) - { - len = part2 - argtype; - (void)fwrite(argtype, 1, len, stream); - fprintf(stream, "parm%d%s", parmno, part2); - } - else - { - fprintf(stream, "%s parm%d", argtype, parmno); - } -} - -static void get_formalparmtype(const char *arg, char *formal) -{ - /* The formal parm type is a pointer to everything up to the first'|' (or - * the end of the string if there is no '|' in the type description). - */ - - while (*arg != '|' && *arg != '\0') - { - *formal++ = *arg++; - } - *formal = '\0'; -} - -static void get_actualparmtype(const char *arg, char *actual) -{ - const char *pstart = strchr(arg,'|'); - if (pstart) - { - /* The actual parameter type starts after the '|' */ - - pstart++; - } - else - { - /* The actual parameter is the same as the formal parameter - * at starts at the beginning of the type string. - */ - - pstart = arg; - } - - /* The actual parm type is a pointer to everything up to the next '|' (or - * the end of the string if there is no '|' in the type description). - */ - - while (*pstart != '|' && *pstart != '\0') - { - *actual++ = *pstart++; - } - *actual = '\0'; -} - -static void get_fieldname(const char *arg, char *fieldname) -{ - char *pactual = strchr(arg,'|'); - char *pstart; - - if (pactual) - { - /* The actual parameter type starts after the '|' */ - - pactual++; - pstart = strchr(pactual,'|'); - if (pstart) - { - /* The fieldname is everything past the second '|' to the end of the string */ - - pstart++; - strncpy(fieldname, pstart, MAX_PARMSIZE); - return; - } - } - - fprintf(stderr, "%d: Missing union fieldname: %s\n", g_lineno, arg); - exit(15); -} - -static FILE *open_proxy(void) -{ - char filename[MAX_PARMSIZE+10]; - FILE *stream; - - snprintf(filename, MAX_PARMSIZE+9, "PROXY_%s.c", g_parm[NAME_INDEX]); - filename[MAX_PARMSIZE+9] = '\0'; - - stream = fopen(filename, "w"); - if (stream == NULL) - { - fprintf(stderr, "Failed to open %s: %s\n", filename, strerror(errno)); - exit(10); - } - return stream; -} - -static void generate_proxy(int nparms) -{ - FILE *stream = open_proxy(); - char formal[MAX_PARMSIZE]; - char fieldname[MAX_PARMSIZE]; - bool bvarargs = false; - int nformal; - int nactual; - int i; - - /* Generate "up-front" information, include correct header files */ - - fprintf(stream, "/* Auto-generated %s proxy file -- do not edit */\n\n", g_parm[NAME_INDEX]); - fprintf(stream, "#include <nuttx/config.h>\n"); - - /* Does this function have a variable number of parameters? If so then the - * final parameter type will be encoded as "..." - */ - - if (is_vararg(g_parm[PARM1_INDEX+nparms-1], nparms-1, nparms)) - { - nformal = nparms-1; - bvarargs = true; - fprintf(stream, "#include <stdarg.h>\n"); - } - else - { - nformal = nparms; - } - - fprintf(stream, "#include <%s>\n", g_parm[HEADER_INDEX]); - fprintf(stream, "#include <syscall.h>\n\n"); - - if (g_parm[COND_INDEX][0] != '\0') - { - fprintf(stream, "#if %s\n\n", g_parm[COND_INDEX]); - } - - /* Generate the function definition that matches standard function prototype */ - - fprintf(stream, "%s %s(", g_parm[RETTYPE_INDEX], g_parm[NAME_INDEX]); - - /* Generate the formal parameter list */ - - if (nformal <= 0) - { - fprintf(stream, "void"); - } - else - { - for (i = 0; i < nformal; i++) - { - /* The formal and actual parameter types may be encoded.. extra the - * formal parameter type. - */ - - get_formalparmtype(g_parm[PARM1_INDEX+i], formal); - - /* Arguments after the first must be separated from the preceding - * parameter with a comma. - */ - - if (i > 0) - { - fprintf(stream, ", "); - } - print_formalparm(stream, formal, i+1); - } - } - - /* Handle the end of the formal parameter list */ - - if (bvarargs) - { - fprintf(stream, ", ...)\n{\n"); - - /* Get parm variables .. some from the parameter list and others from - * the varargs. - */ - - if (nparms < 7) - { - fprintf(stream, " va_list ap;\n"); - for (i = nparms; i < 7; i++) - { - fprintf(stream, " uintptr_t parm%d;\n", i); - } - - fprintf(stream, "\n va_start(ap, parm%d);\n", nparms-1); - for (i = nparms; i < 7; i++) - { - fprintf(stream, " parm%d = va_arg(ap, uintptr_t);\n", i); - } - fprintf(stream, " va_end(ap);\n\n"); - } - } - else - { - fprintf(stream, ")\n{\n"); - } - - /* Generate the system call. Functions that do not return or return void - * are special cases. - */ - - nactual = bvarargs ? 6 : nparms; - if (strcmp(g_parm[RETTYPE_INDEX], "void") == 0) - { - fprintf(stream, " (void)sys_call%d(", nactual); - } - else - { - fprintf(stream, " return (%s)sys_call%d(", g_parm[RETTYPE_INDEX], nactual); - } - - /* Create the parameter list with the matching types. The first parameter - * is always the syscall number. - */ - - fprintf(stream, "(unsigned int)SYS_%s", g_parm[NAME_INDEX]); - - for (i = 0; i < nactual; i++) - { - /* Is the parameter a union member */ - - if (i < nparms && is_union(g_parm[PARM1_INDEX+i])) - { - /* Then we will have to pick a field name that can be cast to a - * uintptr_t. There probably should be some error handling here - * to catch the case where the fieldname was not supplied. - */ - - get_fieldname(g_parm[PARM1_INDEX+i], fieldname); - fprintf(stream, ", (uintptr_t)parm%d.%s", i+1, fieldname); - } - else - { - fprintf(stream, ", (uintptr_t)parm%d", i+1); - } - } - - /* Handle the tail end of the function. */ - - fprintf(stream, ");\n}\n\n"); - if (g_parm[COND_INDEX][0] != '\0') - { - fprintf(stream, "#endif /* %s */\n", g_parm[COND_INDEX]); - } - - fclose(stream); -} - -static FILE *open_stub(void) -{ - if (g_inline) - { - if (!g_stubstream) - { - g_stubstream = fopen("STUB.h", "w"); - if (g_stubstream == NULL) - { - fprintf(stderr, "Failed to open STUB.h: %s\n", strerror(errno)); - exit(9); - } - fprintf(g_stubstream, "/* Autogenerated STUB header file */\n\n"); - fprintf(g_stubstream, "#ifndef __STUB_H\n"); - fprintf(g_stubstream, "#define __STUB_H\n\n"); - } - - return g_stubstream; - } - else - { - char filename[MAX_PARMSIZE+8]; - FILE *stream; - - snprintf(filename, MAX_PARMSIZE+7, "STUB_%s.c", g_parm[NAME_INDEX]); - filename[MAX_PARMSIZE+7] = '\0'; - - stream = fopen(filename, "w"); - if (stream == NULL) - { - fprintf(stderr, "Failed to open %s: %s\n", filename, strerror(errno)); - exit(9); - } - return stream; - } -} - -static void stub_close(FILE *stream) -{ - if (!g_inline) - { - fclose(stream); - } -} - -static void generate_stub(int nparms) -{ - FILE *stream = open_stub(); - char formal[MAX_PARMSIZE]; - char actual[MAX_PARMSIZE]; - int i; - int j; - - /* Generate "up-front" information, include correct header files */ - - fprintf(stream, "/* Auto-generated %s stub file -- do not edit */\n\n", g_parm[0]); - fprintf(stream, "#include <nuttx/config.h>\n"); - fprintf(stream, "#include <stdint.h>\n"); - fprintf(stream, "#include <%s>\n\n", g_parm[HEADER_INDEX]); - - if (g_parm[COND_INDEX][0] != '\0') - { - fprintf(stream, "#if %s\n\n", g_parm[COND_INDEX]); - } - - /* Generate the function definition that matches standard function prototype */ - - if (g_inline) - { - fprintf(stream, "static inline "); - } - fprintf(stream, "uintptr_t STUB_%s(", g_parm[NAME_INDEX]); - - /* Generate the formal parameter list. A function received no parameters is a special case. */ - - if (nparms <= 0) - { - fprintf(stream, "void"); - } - else - { - for (i = 0; i < nparms; i++) - { - /* Treat the first argument in the list differently from the others.. - * It does not need a comma before it. - */ - - if (i > 0) - { - /* Check for a variable number of arguments */ - - if (is_vararg(g_parm[PARM1_INDEX+i], i, nparms)) - { - /* Always receive six arguments in this case */ - - for (j = i+1; j <= 6; j++) - { - fprintf(stream, ", uintptr_t parm%d", j); - } - } - else - { - fprintf(stream, ", uintptr_t parm%d", i+1); - } - } - else - { - fprintf(stream, "uintptr_t parm%d", i+1); - } - } - } - fprintf(stream, ")\n{\n"); - - /* Then call the proxied function. Functions that have no return value are - * a special case. - */ - - if (strcmp(g_parm[RETTYPE_INDEX], "void") == 0) - { - fprintf(stream, " %s(", g_parm[NAME_INDEX]); - } - else - { - fprintf(stream, " return (uintptr_t)%s(", g_parm[NAME_INDEX]); - } - - /* The pass all of the system call parameters, casting to the correct type - * as necessary. - */ - - for (i = 0; i < nparms; i++) - { - /* Get the formal type of the parameter, and get the type that we - * actually have to cast to. For example for a formal type like 'int parm[]' - * we have to cast the actual parameter to 'int*'. The worst is a union - * type like 'union sigval' where we have to cast to (union sigval)((FAR void *)parm) - * -- Yech. - */ - - get_formalparmtype(g_parm[PARM1_INDEX+i], formal); - get_actualparmtype(g_parm[PARM1_INDEX+i], actual); - - /* Treat the first argument in the list differently from the others.. - * It does not need a comma before it. - */ - - if (i > 0) - { - /* Check for a variable number of arguments */ - - if (is_vararg(actual, i, nparms)) - { - /* Always pass six arguments */ - - for (j = i+1; j <=6; j++) - { - fprintf(stream, ", parm%d", j); - } - } - else - { - if (is_union(formal)) - { - fprintf(stream, ", (%s)((%s)parm%d)", formal, actual, i+1); - } - else - { - fprintf(stream, ", (%s)parm%d", actual, i+1); - } - } - } - else - { - if (is_union(formal)) - { - fprintf(stream, "(%s)((%s)parm%d)", formal, actual, i+1); - } - else - { - fprintf(stream, "(%s)parm%d",actual, i+1); - } - } - } - - /* Tail end of the function. If the proxied function has no return - * value, just return zero (OK). - */ - - if (strcmp(g_parm[RETTYPE_INDEX], "void") == 0) - { - fprintf(stream, ");\n return 0;\n}\n\n"); - } - else - { - fprintf(stream, ");\n}\n\n"); - } - - if (g_parm[COND_INDEX][0] != '\0') - { - fprintf(stream, "#endif /* %s */\n", g_parm[COND_INDEX]); - } - stub_close(stream); -} - -static void show_usage(const char *progname) -{ - fprintf(stderr, "USAGE: %s [-p|s|i] <CSV file>\n\n", progname); - fprintf(stderr, "Where:\n\n"); - fprintf(stderr, "\t-p : Generate proxies\n"); - fprintf(stderr, "\t-s : Generate stubs\n"); - fprintf(stderr, "\t-i : Generate proxies as static inline functions\n"); - fprintf(stderr, "\t-d : Enable debug output\n"); - exit(1); -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv, char **envp) -{ - char *csvpath; - bool proxies = false; - FILE *stream; - char *ptr; - int ch; - - /* Parse command line options */ - - g_debug = false; - g_inline = false; - - while ((ch = getopt(argc, argv, ":dps")) > 0) - { - switch (ch) - { - case 'd' : - g_debug = true; - break; - - case 'p' : - proxies = true; - break; - - case 's' : - proxies = false; - break; - - case 'i' : - g_inline = true; - break; - - case '?' : - fprintf(stderr, "Unrecognized option: %c\n", optopt); - show_usage(argv[0]); - - case ':' : - fprintf(stderr, "Missing option argument, option: %c\n", optopt); - show_usage(argv[0]); - - break; - fprintf(stderr, "Unexpected option: %c\n", ch); - show_usage(argv[0]); - } - } - - if (optind >= argc) - { - fprintf(stderr, "Missing <CSV file>\n"); - show_usage(argv[0]); - } - - csvpath = argv[optind]; - if (++optind < argc) - { - fprintf(stderr, "Unexpected garbage at the end of the line\n"); - show_usage(argv[0]); - } - - /* Open the CSV file */ - - stream= fopen(csvpath, "r"); - if (!stream) - { - fprintf(stderr, "open %s failed: %s\n", csvpath, strerror(errno)); - exit(3); - } - - /* Process each line in the CVS file */ - - while ((ptr = read_line(stream)) != NULL) - { - /* Parse the line from the CVS file */ - - int nargs = parse_csvline(ptr); - if (nargs < PARM1_INDEX) - { - fprintf(stderr, "Only %d arguments found: %s\n", nargs, g_line); - exit(8); - } - - if (proxies) - { - generate_proxy(nargs - PARM1_INDEX); - } - else - { - g_stubstream = NULL; - generate_stub(nargs - PARM1_INDEX); - if (g_stubstream != NULL) - { - fprintf(g_stubstream, "\n#endif /* __STUB_H */\n"); - fclose(g_stubstream); - } - } - } - - /* Close the CSV file */ - - fclose(stream); - return 0; -} diff --git a/nuttx/tools/mkversion.c b/nuttx/tools/mkversion.c deleted file mode 100644 index c6b00c5e5..000000000 --- a/nuttx/tools/mkversion.c +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** - * tools/mkversion.c - * - * Copyright (C) 2011 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 <string.h> -#include <stdlib.h> -#include <errno.h> - -#include "cfgdefine.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -#define DEFCONFIG ".version" - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - - static inline char *getfilepath(const char *name) -{ - snprintf(line, PATH_MAX, "%s/" DEFCONFIG, name); - line[PATH_MAX] = '\0'; - return strdup(line); -} - -static void show_usage(const char *progname) -{ - fprintf(stderr, "USAGE: %s <abs path to .version>\n", progname); - exit(1); -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv, char **envp) -{ - char *filepath; - FILE *stream; - - if (argc != 2) - { - fprintf(stderr, "Unexpected number of arguments\n"); - show_usage(argv[0]); - } - - filepath = getfilepath(argv[1]); - if (!filepath) - { - fprintf(stderr, "getfilepath failed\n"); - exit(2); - } - - stream= fopen(filepath, "r"); - if (!stream) - { - fprintf(stderr, "open %s failed: %s\n", filepath, strerror(errno)); - exit(3); - } - - printf("/* version.h -- Autogenerated! Do not edit. */\n\n"); - printf("#ifndef __INCLUDE_NUTTX_VERSION_H\n"); - printf("#define __INCLUDE_NUTTX_VERSION_H\n\n"); - generate_definitions(stream); - printf("\n#define CONFIG_VERSION ((CONFIG_VERSION_MAJOR << 8) | (CONFIG_VERSION_MINOR))\n\n"); - printf("#endif /* __INCLUDE_NUTTX_VERSION_H */\n"); - fclose(stream); - return 0; -} diff --git a/nuttx/tools/pic32mx/Makefile b/nuttx/tools/pic32mx/Makefile deleted file mode 100644 index 040cf58cc..000000000 --- a/nuttx/tools/pic32mx/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -############################################################################ -# tools/pic32mx//Makefile -# -# 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 -# 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. -# -############################################################################ - -all: mkpichex -default: mkpichex -.PHONY: clean - -# Add CFLAGS=-g on the make command line to build debug versions - -CFLAGS = -O2 -Wall -I. - -# mkpichex - Convert virtual addresses in nuttx.hex to physical addresses - -mkconfig: mkpichex.c mkpichex.c - @gcc $(CFLAGS) -o mkpichex mkpichex.c - -clean: - @rm -f *.o *.a *~ .*.swp - @rm -f mkpichex mkpichex.exe diff --git a/nuttx/tools/pic32mx/mkpichex.c b/nuttx/tools/pic32mx/mkpichex.c deleted file mode 100644 index 14fefdb8c..000000000 --- a/nuttx/tools/pic32mx/mkpichex.c +++ /dev/null @@ -1,315 +0,0 @@ -/**************************************************************************** - * tools/pic32mx//mkpichex.c - * - * 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 - * 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 <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <errno.h> - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#define MAX_LINE 1024 - -/* Line offsets */ - -#define START_OFFSET 0 -#define LEN_OFFSET 1 -#define ADDR_OFFSET (LEN_OFFSET + 2) -#define TYPE_OFFSET (ADDR_OFFSET + 4) -#define PAYLOAD_OFFSET (TYPE_OFFSET + 2) -#define CHKSUM_OFFSET(n) (PAYLOAD_OFFSET+2*(n)) - -/* Record types: - * - * 00, data record, contains data and 16-bit address. The format described - * above. - * 01, End Of File record, a file termination record. No data. Has to be - * the last line of the file, only one per file permitted. Usually - * ':00000001FF'. Originally the End Of File record could contain a - * start address for the program being loaded, e.g. :00AB2F0125 - * would make a jump to address AB2F. This was convenient when programs - * were loaded from punched paper tape. - * 02, Extended Segment Address Record, segment-base address. Used when 16 - * bits are not enough, identical to 80x86 real mode addressing. The - * address specified by the 02 record is multiplied by 16 (shifted 4 - * bits left) and added to the subsequent 00 record addresses. This - * allows addressing of up to a megabyte of address space. The address - * field of this record has to be 0000, the byte count is 02 (the segment - * is 16-bit). The least significant hex digit of the segment address is - * always 0. - * 03, Start Segment Address Record. For 80x86 processors, it specifies the - * initial content of the CS:IP registers. The address field is 0000, the - * byte count is 04, the first two bytes are the CS value, the latter two - * are the IP value. - * 04, Extended Linear Address Record, allowing for fully 32 bit addressing. - * The address field is 0000, the byte count is 02. The two data bytes - * represent the upper 16 bits of the 32 bit address, when combined with - * the address of the 00 type record. - * 05, Start Linear Address Record. The address field is 0000, the byte - * count is 04. The 4 data bytes represent the 32-bit value loaded into - * the EIP register of the 80386 and higher CPU. - */ - -#define TYPE_DATA 0 -#define TYPE_EOF 1 -#define TYPE_EXTSEG 2 -#define TYPE_STARTSEG 3 -#define TYPE_EXTLIN 4 -#define TYPE_STARTLIN 5 - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -struct hex_s -{ - unsigned char len; /* Length of the data payload */ - unsigned char type; /* Record type */ - unsigned short addr; /* Lower 16-bit address */ -}; - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static char line[MAX_LINE+1]; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -static inline char *getfilepath(const char *path, const char *name, const char *extension) -{ - snprintf(line, MAX_LINE, "%s/%s.%s", path, name, extension); - line[MAX_LINE] = '\0'; - return strdup(line); -} - -static void show_usage(const char *progname) -{ - fprintf(stderr, "USAGE: %s <abs path to nuttx.hex>\n", progname); - exit(1); -} - -static unsigned char get4(char hex) -{ - if (hex >= '0' && hex <= '9') - { - return hex - '0'; - } - else if (hex >= 'a' && hex <= 'f') - { - return hex - 'a' + 10; - } - else if (hex >= 'A' && hex <= 'F') - { - return hex - 'A' + 10; - } - - fprintf(stderr, "Bad hex character code: %s\n", line); - exit(2); -} - -static unsigned char get8(const char *ptr) -{ - return get4(ptr[0]) << 4 | get4(ptr[1]); -} - -static unsigned short get16(const char *ptr) -{ - return (unsigned short)get8(&ptr[0]) << 8 | (unsigned short)get8(&ptr[2]); -} - -static int parse_line(struct hex_s *hexline) -{ - /* :LLAAAATT... */ - - if (line[START_OFFSET] != ':') - { - fprintf(stderr, "Bad start code: %s\n", line); - return 1; - } - - hexline->len = get8(&line[LEN_OFFSET]); - hexline->addr = get16(&line[ADDR_OFFSET]); - hexline->type = get8(&line[TYPE_OFFSET]); - return 0; -} - -#if 0 -static unsigned char checksum(chksum_ndx) -{ - int chksum = 0; - int ndx; - - for (ndx = 1; ndx < chksum_ndx; ndx += 2) - { - chksum += (int)get8(&line[ndx]); - } - return (unsigned char)((-chksum) & 0xff); -} -#endif - -static void adjust_extlin(struct hex_s *hexline) -{ - unsigned short segment; - int chksum; - - /* Make sure that the payload is exactly 2 bytes */ - - if (hexline->len != 2) - { - fprintf(stderr, "Bad length on extended segment address record\n"); - fprintf(stderr, " %s", line); - } - - /* And the address field is supposed to be zero */ - - if (hexline->addr != 0) - { - fprintf(stderr, "Bad address on extended segment address record\n"); - fprintf(stderr, " %s", line); - } - - /* Decode the 2 byte payload */ - - segment = get16(&line[PAYLOAD_OFFSET]); - - /* Convert the address to a 29-bit physical address */ - - segment &= 0x1fff; - - /* Recalculate the checksum and make sure that there is a null terminator - * Since len=2, addr=0, type=4, the is a trivial calculation. - */ - - chksum = (-(segment + (segment >> 8) + 6)) & 0xff; - - /* Then create the new output record */ - - snprintf(line, MAX_LINE-PAYLOAD_OFFSET, ":02000004%04X%02X\n", segment, chksum); -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv, char **envp) -{ - struct hex_s hexline; - char *srcfile; - char *destfile; - FILE *src; - FILE *dest; - - if (argc != 2) - { - fprintf(stderr, "Unexpected number of arguments\n"); - show_usage(argv[0]); - } - - srcfile = getfilepath(argv[1], "nuttx", "hex"); - if (!srcfile) - { - fprintf(stderr, "getfilepath failed\n"); - exit(2); - } - - destfile = getfilepath(argv[1], "nuttx", "tmp"); - if (!destfile) - { - fprintf(stderr, "getfilepath failed\n"); - exit(2); - } - - src = fopen(srcfile, "r"); - if (!src) - { - fprintf(stderr, "open %s failed: %s\n", srcfile, strerror(errno)); - exit(3); - } - - dest = fopen(destfile, "w"); - if (!dest) - { - fprintf(stderr, "open %s failed: %s\n", destfile, strerror(errno)); - exit(3); - } - - /* Read each line from the source file */ - - while (fgets(line, MAX_LINE, src) != NULL) - { - if (parse_line(&hexline)) - { - fprintf(stderr, "Failed to parse line\n"); - exit(1); - } - - /* Adjust 'Extended Segment Address Records'. */ - - if (hexline.type == TYPE_EXTLIN) - { - adjust_extlin(&hexline); - } - fputs(line, dest); - } - - fclose(src); - fclose(dest); - - /* Remove the original nuttx.hex file */ - - if (remove(srcfile) != 0) - { - fprintf(stderr, "Failed to remove the old '%s'\n", srcfile); - - } - - /* Rename the new nuttx.tmp file to nuttx.hex */ - - if (rename(destfile, srcfile) != 0) - { - fprintf(stderr, "Failed to rename '%s' to '%s'\n", destfile, srcfile); - } - - return 0; -} diff --git a/nuttx/tools/unlink.bat b/nuttx/tools/unlink.bat deleted file mode 100755 index 25e83bb9f..000000000 --- a/nuttx/tools/unlink.bat +++ /dev/null @@ -1,71 +0,0 @@ -@echo off
-
-rem tools/unlink.bat
-rem
-rem Copyright (C) 2012 Gregory Nutt. All rights reserved.
-rem Author: Gregory Nutt <gnutt@nuttx.org>
-rem
-rem Redistribution and use in source and binary forms, with or without
-rem modification, are permitted provided that the following conditions
-rem are met:
-rem
-rem 1. Redistributions of source code must retain the above copyright
-rem notice, this list of conditions and the following disclaimer.
-rem 2. Redistributions in binary form must reproduce the above copyright
-rem notice, this list of conditions and the following disclaimer in
-rem the documentation and/or other materials provided with the
-rem distribution.
-rem 3. Neither the name NuttX nor the names of its contributors may be
-rem used to endorse or promote products derived from this software
-rem without specific prior written permission.
-rem
-rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-rem FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-rem COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-rem OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-rem AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-rem LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-rem ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-rem POSSIBILITY OF SUCH DAMAGE.
-rem
-
-rem Verify that arguments were provided
-
-set link=%1
-if "%link%"=="" goto :MissingArgument
-
-rem Check if something already exists at the link path
-
-if exist "%link%" goto :LinkExists
-
-echo %link% does not exist
-goto :ShowUsage
-
-rem %link% make be a symbolic link or it may be a copied director (with
-rem a .fakelnk file in it). It really does not matter which: We do the
-rem same thing in either case
-
-:LinkExists
-
-rmdir /q /s %link%
-if errorlevel 1 (
- echo Failed to remove existing object at %link%
- goto :ShowUsage
-)
-
-goto :End
-
-:MissingArgument
-
-echo Missing Argument
-
-:ShowUsage
-echo USAGE: %0 ^<link^>
-echo Where:
-echo ^<link^> is the linked (or copied) directory to be removed
-
-:End
diff --git a/nuttx/tools/unlink.sh b/nuttx/tools/unlink.sh deleted file mode 100755 index 485db3691..000000000 --- a/nuttx/tools/unlink.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash -############################################################################ -# tools/unlink.sh -# -# Copyright (C) 2008 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. -# -############################################################################ - -link=$1 - -# Verify that arguments were provided - -if [ -z "${link}" ]; then - echo "Missing link argument" - exit 1 -fi - -# Check if something already exists at the link path - -if [ -e "${link}" ]; then - - # Yes, is it a symbolic link? If so, then remove it - - if [ -h "${link}" ]; then - rm -f "${link}" - else - - # If the path is a directory and contains the "fake link" mark, then - # treat it like a soft link (i.e., remove the directory) - - if [ -d "${link}" -a -f "${link}/.fakelnk" ]; then - rm -rf "${link}" - else - - # It is something else (like a file) or directory that does - # not contain the "fake link" mark - - echo "${link} already exists but is not a symbolic link" - exit 1 - fi - fi -fi
\ No newline at end of file diff --git a/nuttx/tools/version.sh b/nuttx/tools/version.sh deleted file mode 100755 index d15adb186..000000000 --- a/nuttx/tools/version.sh +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/bash -# version.sh -# -# Copyright (C) 2011 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. -# - -WD=`pwd` - -# Get command line parameters - -USAGE="USAGE: $0 [-d|-h] [-b build] -v <major.minor> <outfile-path>" -ADVICE="Try '$0 -h' for more information" - -unset VERSION -unset BUILD -unset OUTFILE - -while [ ! -z "$1" ]; do - case $1 in - -b ) - shift - BUILD=$1 - ;; - -d ) - set -x - ;; - -v ) - shift - VERSION=$1 - ;; - -h ) - echo "$0 is a tool for generation of proper version files for the NuttX build" - echo "" - echo $USAGE - echo "" - echo "Where:" - echo " -d" - echo " Enable script debug" - echo " -h" - echo " show this help message and exit" - echo " -v <major.minor>" - echo " The NuttX version number expressed a major and minor number separated" - echo " by a period" - echo " <outfile-path>" - echo " The full path to the version file to be created" - exit 0 - ;; - * ) - break; - ;; - esac - shift -done - -OUTFILE=$1 - -# Make sure we know what is going on - -if [ -z ${VERSION} ] ; then - echo "Missing versioning information" - echo $USAGE - echo $ADVICE - exit 1 -fi - -if [ -z ${OUTFILE} ] ; then - echo "Missing path to the output file" - echo $USAGE - echo $ADVICE - exit 1 -fi - -# Get the major and minor version numbers - -MAJOR=`echo ${VERSION} | cut -d'.' -f1` -if [ "X${MAJOR}" = "X${VERSION}" ]; then - echo "Missing minor version number" - echo $USAGE - echo $ADVICE - exit 2 -fi -MINOR=`echo ${VERSION} | cut -d'.' -f2` - -# Get SVN information (if not provided on the command line) - -if [ -z "${BUILD}" ]; then - SVNINFO=`svn info 2>/dev/null | fgrep 'Revision:'` - if [ -z "${SVNINFO}" ]; then - echo "SVN version information is not available" - exit 3 - fi - BUILD=`echo ${SVNINFO} | cut -d' ' -f2` - if [ -z "${BUILD}" ]; then - echo "SVN build information not found" - exit 4 - fi -fi - -# Write a version file into the NuttX directoy. The syntax of file is such that it -# may be sourced by a bash script or included by a Makefile. - -echo "#!/bin/bash" >${OUTFILE} -echo "" >>${OUTFILE} -echo "CONFIG_VERSION_STRING=\"${VERSION}\"" >>${OUTFILE} -echo "CONFIG_VERSION_MAJOR=${MAJOR}" >>${OUTFILE} -echo "CONFIG_VERSION_MINOR=${MINOR}" >>${OUTFILE} -echo "CONFIG_VERSION_BUILD=${BUILD}" >>${OUTFILE} diff --git a/nuttx/tools/xmlrpc_test.py b/nuttx/tools/xmlrpc_test.py deleted file mode 100644 index 64cc89dc9..000000000 --- a/nuttx/tools/xmlrpc_test.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python -############################################################################ -# tools/xmlrpc_test.py -# -# Copyright (C) 2012 Max Holtzberg. All rights reserved. -# Author: Max Holtzberg <mh@uvc.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. -# -############################################################################ - -import sys -import xmlrpclib - -if __name__ == '__main__': - if len(sys.argv) != 2: - print 'Usage: %s <ip address>' % sys.argv[0] - quit(1) - - server_url = 'http://%s/device' % sys.argv[1] - server = xmlrpclib.ServerProxy(server_url) - result = server.get_device_stats("username", "password", 0) - print result diff --git a/nuttx/tools/zipme.sh b/nuttx/tools/zipme.sh deleted file mode 100755 index a8cd160ab..000000000 --- a/nuttx/tools/zipme.sh +++ /dev/null @@ -1,178 +0,0 @@ -#!/bin/bash -# zipme.sh -# -# Copyright (C) 2007-2011 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. -# - -#set -x - -WD=`pwd` -VERSION=$1 - -TAR="tar cvf" -ZIP=gzip - -# Make sure we know what is going on - -if [ -z ${VERSION} ] ; then - echo "You must supply a version like xx.yy as a parameter" - exit 1; -fi - -# Find the directory we were executed from and were we expect to -# see the directories to tar up - -MYNAME=`basename $0` - -if [ -x ${WD}/${MYNAME} ] ; then - TRUNKDIR="${WD}/../.." -else - if [ -x ${WD}/tools/${MYNAME} ] ; then - TRUNKDIR="${WD}/.." - else - if [ -x ${WD}/nuttx-${VERSION}/tools/${MYNAME} ] ; then - TRUNKDIR="${WD}" - else - echo "You must cd into the NUTTX directory to execute this script." - exit 1 - fi - fi -fi - -# Get the NuttX directory names and the path to the parent directory - -NUTTX=${TRUNKDIR}/nuttx-${VERSION} -APPDIR=${TRUNKDIR}/apps-${VERSION} - -# Make sure that the versioned directory exists - -if [ ! -d ${TRUNKDIR} ]; then - echo "Directory ${TRUNKDIR} does not exist" - exit 1 -fi - -cd ${TRUNKDIR} || \ - { echo "Failed to cd to ${TRUNKDIR}" ; exit 1 ; } - -if [ ! -d nuttx-${VERSION} ] ; then - echo "Directory ${TRUNKDIR}/nuttx-${VERSION} does not exist!" - exit 1 -fi - -if [ ! -d apps-${VERSION} ] ; then - echo "Directory ${TRUNKDIR}/apps-${VERSION} does not exist!" - exit 1 -fi - -# Create the versioned tarball names - -NUTTX_TARNAME=nuttx-${VERSION}.tar -APPS_TARNAME=apps-${VERSION}.tar -NUTTX_ZIPNAME=${NUTTX_TARNAME}.gz -APPS_ZIPNAME=${APPS_TARNAME}.gz - -# Prepare the nuttx directory -- Remove editor garbage - -find ${TRUNKDIR} -name '*~' -exec rm -f '{}' ';' || \ - { echo "Removal of emacs garbage failed!" ; exit 1 ; } -find ${TRUNKDIR} -name '*.swp' -exec rm -f '{}' ';' || \ - { echo "Removal of VI garbage failed!" ; exit 1 ; } - -# Make sure that versioned copies of the certain files are in place - -cd ${NUTTX}/Documentation || \ - { echo "Failed to cd to ${NUTTX}/Documentation" ; exit 1 ; } - -cp -f ../TODO TODO.txt -cp -f ../ChangeLog ChangeLog.txt - -# Write a version file into the NuttX directoy. The syntax of file is such that it -# may be sourced by a bash script or included by a Makefile. - -VERSIONSH=${NUTTX}/tools/version.sh -if [ ! -x "${VERSIONSH}" ]; then - echo "No executable script was found at: ${VERSIONSH}" - exit 1 -fi -${VERSIONSH} -v ${VERSION} ${NUTTX}/.version || \ - { echo "${VERSIONSH} failed"; cat ${NUTTX}/.version; exit 1; } -chmod 755 ${NUTTX}/.version - -# Perform a full clean for the distribution - -cd ${TRUNKDIR} || \ - { echo "Failed to cd to ${TRUNKDIR}" ; exit 1 ; } - -make -C ${NUTTX} distclean - -# Remove any previous tarballs - -if [ -f ${NUTTX_TARNAME} ] ; then - echo "Removing ${TRUNKDIR}/${NUTTX_TARNAME}" - rm -f ${NUTTX_TARNAME} || \ - { echo "rm ${NUTTX_TARNAME} failed!" ; exit 1 ; } -fi - -if [ -f ${NUTTX_ZIPNAME} ] ; then - echo "Removing ${TRUNKDIR}/${NUTTX_ZIPNAME}" - rm -f ${NUTTX_ZIPNAME} || \ - { echo "rm ${NUTTX_ZIPNAME} failed!" ; exit 1 ; } -fi - -if [ -f ${APPS_TARNAME} ] ; then - echo "Removing ${TRUNKDIR}/${APPS_TARNAME}" - rm -f ${APPS_TARNAME} || \ - { echo "rm ${APPS_TARNAME} failed!" ; exit 1 ; } -fi - -if [ -f ${APPS_ZIPNAME} ] ; then - echo "Removing ${TRUNKDIR}/${APPS_ZIPNAME}" - rm -f ${APPS_ZIPNAME} || \ - { echo "rm ${APPS_ZIPNAME} failed!" ; exit 1 ; } -fi - -# Then tar and zip-up the directories - -cd ${TRUNKDIR} || \ - { echo "Failed to cd to ${TRUNKDIR}" ; exit 1 ; } - -${TAR} ${NUTTX_TARNAME} nuttx-${VERSION} || \ - { echo "tar of ${NUTTX_TARNAME} failed!" ; exit 1 ; } -${ZIP} ${NUTTX_TARNAME} || \ - { echo "zip of ${NUTTX_TARNAME} failed!" ; exit 1 ; } - -${TAR} ${APPS_TARNAME} apps-${VERSION} || \ - { echo "tar of ${APPS_TARNAME} failed!" ; exit 1 ; } -${ZIP} ${APPS_TARNAME} || \ - { echo "zip of ${APPS_TARNAME} failed!" ; exit 1 ; } - -cd ${NUTTX} - |