Add tools/configure.c and configure.bat

git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5478 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2013-01-04 21:37:31 +00:00
parent b66a46decc
commit 5c572a3cb5
12 changed files with 1003 additions and 43 deletions
+10 -1
View File
@@ -3861,4 +3861,13 @@
* libc/misc/Make.defs: Fix error in conditional for KBD CODEC.
* libc/Kconfig and configs/*/defconfig (several): The default
setting should be CONFIG_LIB_KBDCODEC=n
* tools/configure.c: configure.c 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).
* tools/configure.bat: 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.
+21 -10
View File
@@ -1263,23 +1263,23 @@ tools/
|-- Makefile.host
|-- Makefile.export
|-- README.txt
|-- configure.sh
|-- configure.sh / configure.bat
|-- cfgparser.c
|-- cfgparser.h
|-- copydir.sh
|-- define.sh
|-- incdir.sh
|-- copydir.sh / copydir.bat
|-- define.sh / define.bat
|-- incdir.sh / indir.bat
|-- indent.sh
|-- link.sh
|-- link.sh / link.bat
|-- mkconfig.c
|-- mkdeps.sh
|-- mkdeps.sh / mkdeps.bat
|-- mkexport.sh
|-- mkimage.sh
|-- mknulldeps.sh
|-- mkromfsimg.sh
|-- mksyscall.c
|-- mkversion.c
|-- unlink.sh
|-- unlink.sh / unlink.bat
|-- version.sh
`-- zipme.sh
</pre></ul>
@@ -1416,17 +1416,28 @@ netutils/
</p>
<ul><pre>
cd tools
./configure.sh <i>&lt;board-name&gt;</i></i>[/<i>&lt;config-dir&gt;</i>]
./configure.sh <i>&lt;board-name&gt;</i>[/<i>&lt;config-dir&gt;</i>]
</pre></ul>
<p>
And if <code>configs/</code><i>&lt;board-name&gt;</i><code>/[</code><i>&lt;config-dir&gt;</i><code>/appconfig</code>
There is an alternative Windows batch file, <code>configure.bat</code>, that can be used insteach of <code>configure.sh</code> in the windows native enironment like:
</p>
<ul><pre>
cd tools
configure.bat <i>&lt;board-name&gt;</i>[\<i>&lt;config-dir&gt;</i>]
</pre></ul>
<p>
See <code>tools/README.txt</code> for more information about these scripts.
</p>
<p>
If <code>configs/</code><i>&lt;board-name&gt;</i><code>/[</code><i>&lt;config-dir&gt;</i>]<code>/appconfig</code>
exists and your application directory is not in the standard loction (<config>../apps</config>),
then you should also specify the location of the application directory on the command line like:
</p>
<ul><pre>
cd tools
./configure.sh -a &lt;app-dir&gt; <i>&lt;board-name&gt;</i></i>[/<i>&lt;config-dir&gt;</i>]
./configure.sh -a &lt;app-dir&gt; <i>&lt;board-name&gt;</i>[/<i>&lt;config-dir&gt;</i>]
</pre></ul>
<p>
+1 -1
View File
@@ -452,7 +452,7 @@ clean_context:
# check_context
#
# This target checks if NuttX has been configured. NuttX is configured using
# the script tools\configure.sh. That script will install certain files in
# the script tools\configure.bat. That script will install certain files in
# the top-level NuttX build directory. This target verifies that those
# configuration files have been installed and that NuttX is ready to be built.
+18 -3
View File
@@ -257,6 +257,14 @@ easier. It is used as follows:
cd ${TOPDIR}/tools
./configure.sh <board-name>/<config-dir>
There is an alternative Windows batch file that can be used in the
windows native enironment like:
cd ${TOPDIR}\tools
configure.bat <board-name>\<config-dir>
See tools/README.txt for more information about these scripts.
NuttX Configuration Tool
------------------------
@@ -401,6 +409,8 @@ Converting Older Configurations to use the Configuration Tool
cd tools
./configure.sh <board>/<condfiguration>
(or configure.bat for the case of the Windows native build).
NOTE: If CONFIG_APPS_DIR is not defined in the defconfig file,
the configure.sh script will find and add the new, correct path to
the application directory (CONFIG_APPS_DIR) when it copies the
@@ -682,10 +692,15 @@ Native Windows Build
the you not install the optional MSYS components as there may be conflicts.
This capability should still be considered a work in progress because:
(1) It has not been verfied on all targets and tools, and
(2) itstill lacks some of the creature-comforts of the more mature environments
(like a functional configure.sh script and 'make menuconfig' support.
See the section "NuttX Configuration Tool under DOS" above).
(2) it still lacks some of the creature-comforts of the more mature environments
(like 'make menuconfig' support. See the section "NuttX Configuration Tool
under DOS" above).
There is an alternative to the setenv.sh script available for the Windows
native environment: tools/configure.bat. See tools/README.txt for additional
information.
Installing GNUWin32
-------------------
+1 -15
View File
@@ -19,7 +19,7 @@ nuttx/
(5) Graphics subystem (graphics/)
(1) Pascal add-on (pcode/)
(1) Documentation (Documentation/)
(8) Build system / Toolchains
(7) Build system / Toolchains
(5) Linux/Cywgin simulation (arch/sim)
(6) ARM (arch/arm/)
(1) ARM/C5471 (arch/arm/src/c5471/)
@@ -1037,20 +1037,6 @@ o Build system
Status: Open, there are some workarounds, but none are good.
Priority: High
Title: configure.sh NOT AVAILABLE IN NATIVE WINDOWS BUILD
Description: configure.sh is a Bash script and cannot be used from a Windows
CMD.exe window. I started a configure.bat script, but I do
not have the batch file programming skills to duplicate some
of the more complex operations.
I also considered adding a configure.c file that could be
compiled and then executed by configure.bat (and configure.sh?).
But I have not gone down that path yet.
The current work-around is to configure under Cygwin.
Status: Open
Priority: High
o Linux/Cywgin simulation (arch/sim)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+16 -8
View File
@@ -1960,16 +1960,24 @@ tools/configure.sh
There is a script that automates these steps. The following steps will
accomplish the same configuration:
cd tools
./configure.sh <board-name>/<config-dir>
cd tools
./configure.sh <board-name>/<config-dir>
And if configs/<board-name>/<config-dir>/appconfig exists and your
application directory is not in the standard loction (../apps), then
you should also specify the location of the application directory on the
command line like:
There is an alternative Windows batch file that can be used in the
windows native enironment like:
cd tools
./configure.sh -a <app-dir> <board-name>/<config-dir>
cd ${TOPDIR}\tools
configure.bat <board-name>\<config-dir>
See tools/README.txt for more information about these scripts.
And if configs/<board-name>/<config-dir>/appconfig exists and your
application directory is not in the standard loction (../apps), then
you should also specify the location of the application directory on the
command line like:
cd tools
./configure.sh -a <app-dir> <board-name>/<config-dir>
Building Symbol Tables
^^^^^^^^^^^^^^^^^^^^^^
@@ -1011,6 +1011,11 @@ can be selected as follow:
cd -
. ./setenv.sh
If this is a Windows native build, then configure.bat should be used
instead of configure.sh:
configure.bat STM32F4Discovery\<subdir>
Where <subdir> is one of the following:
cxxtest:
+15
View File
@@ -59,6 +59,11 @@ Configuring NuttX
setenv.bat
make
If this is a Windows native build, then configure.bat should be used
in step 1) instead of configure.sh:
configure.bat xtrs\ostest
The setenv.bat will need to be updated to include the PATH to the XTRS
hex2cmd program.
@@ -90,6 +95,11 @@ Configuring NuttX
setenv.bat
make
If this is a Windows native build, then configure.bat should be used
in step 1) instead of configure.sh:
configure.bat xtrs\nsh
The setenv.bat will need to be updated to include the PATH to the XTRS
hex2cmd program.
@@ -128,6 +138,11 @@ Configuring NuttX
setenv.bat
make
If this is a Windows native build, then configure.bat should be used
in step 1) instead of configure.sh:
configure.bat xtrs\pashello
The setenv.bat will need to be updated to include the PATH to the XTRS
hex2cmd program.
+25 -2
View File
@@ -26,12 +26,35 @@ Config.mk
override these default definitions as necessary.
configure.sh
configure.bat
configure.c, cfgparser.c, and cfgparser.h
------------
This is a bash script that is used to configure NuttX for a given
target board. See configs/README.txt or Documentation/NuttxPortingGuide.html
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
-----------
-3
View File
@@ -281,9 +281,6 @@ void parse_file(FILE *stream, struct variable_s **list)
struct variable_s *find_variable(const char *varname, struct variable_s *list)
{
char *varval1;
char *varval2;
while (list)
{
if (strcmp(varname, list->var) == 0)
+128
View File
@@ -0,0 +1,128 @@
@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
File diff suppressed because it is too large Load Diff