Update to apps/build

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3391 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2011-03-18 17:22:50 +00:00
parent 78296cad79
commit bb9b1d536d
7 changed files with 220 additions and 98 deletions

View File

@ -12,7 +12,7 @@
<h1><big><font color="#3c34ec">
<i>NuttX RTOS Porting Guide</i>
</font></big></h1>
<p>Last Updated: March 16, 2011</p>
<p>Last Updated: March 18, 2011</p>
</td>
</tr>
</table>
@ -564,14 +564,20 @@
|-- <i>&lt;config1-dir&gt;</i>
| |-- Make.defs
| |-- defconfig
| |-- appconfig<sup>1</sup>
| `-- setenv.sh
|-- <i>&lt;config2-dir&gt;</i>
| |-- Make.defs
| |-- defconfig
| |-- appconfig<sup>1</sup>
| `-- setenv.sh
| ...
`-- <i>(other board-specific configuration sub-directories)</i>/
</pre></ul>
</pre>
<p><small>
<sup>1</sup>Optional
</small></p>
</ul>
<h3><a name="summaryofconfigfiles">2.3.2 Summary of Files</a></h3>
<h4><a name="boardlogic">2.3.2.1 Board Specific Logic</a></h4>
@ -628,24 +634,35 @@
</p>
</li>
<li>
<code>defconfig</code>: This is a configuration file similar to the Linux
configuration file. In contains variable/value pairs like:
<p>
<code>defconfig</code>: This is a configuration file similar to the Linux
configuration file. In contains variable/value pairs like:
</p>
<ul>
<li><code>CONFIG_VARIABLE</code>=value</li>
</ul>
<p>
This configuration file will be used at build time:
</p>
<ol>
<p><ol>
<li>As a makefile fragment included in other makefiles, and</li>
<li>to generate <code>include/nuttx/config.h</code> which is included by
most C files in the system.</li>
</ol>
</ol></p>
</li>
<li>
<code>setenv.sh</code>: This is a script that you can include that will be installed at
the top level of the directory structure and can be sourced to set any
necessary environment variables.
<p>
<code>appconfig</code>: This is another configuration file that is specific to the
application. This file is copied into the application build directory
when NuttX is configured. See <code>../apps/README.txt</code> for further details.
</p>
</li>
<li>
<p>
<code>setenv.sh</code>: This is a script that you can include that will be installed at
the top level of the directory structure and can be sourced to set any
necessary environment variables.
</p>
</li>
</ul>
@ -942,6 +959,7 @@ tools/
|-- mkdeps.sh
|-- mkimage.sh
|-- mknulldeps.sh
|-- mkromfsimg.sh
|-- unlink.sh
|-- winlink.sh
`-- zipme
@ -974,12 +992,24 @@ tools/
<li>Copy <code>configs/</code><i>&lt;board-name&gt;</i><code>/[</code><i>&lt;config-dir&gt;</i><code>/]setenv.sh</code> to <code>${TOPDIR}/setenv.sh</code>, and</li>
<li>Copy <code>configs/</code><i>&lt;board-name&gt;</i><code>/[</code><i>&lt;config-dir&gt;</i><code>/]defconfig</code> to <code>${TOPDIR}/.config</code></li>
</ul>
<p>
And if <code>configs/</code><i>&lt;board-name&gt;</i><code>/[</code><i>&lt;config-dir&gt;</i><code>/appconfig</code> exists in the board configuration directory:
</p>
<ul>
<li>Copy <code>configs/</code><i>&lt;board-name&gt;</i><code>/[</code><i>&lt;config-dir&gt;</i><code>/appconfig</code> to &lt;app-dir&gt;<code>/.config</code></li>
<li><code>echo &quot;CONFIG_BUILTIN_APPS=y" &gt;&gt; "${TOPDIR}/.config&quot;</code></li>
<li><code>echo &quot;APPS_LOC=\"&lt;app-dir&gt;\"" &gt;&gt; "${TOPDIR}/.config&quot;</code></li>
</ul>
</p>
<p>
Where <i>&lt;board-name&gt;</i> is the name of one of the sub-directories of the
NuttX <a href="#DirStructConfigs"><code>configs/</code></a> directory.
This sub-directory name corresponds to one of the supported boards
identified <a href="#supportedboards">above</a>.
And &lt;config-dir&gt; is the optional, specific configuration directory for the board.
&lt;config-dir&gt; is the optional, specific configuration directory for the board.
And &lt;app-dir&gt; is the location of the optonal application directory.
</p>
<p>
<b>Automated Configuration</b>.
@ -988,7 +1018,17 @@ tools/
</p>
<ul><pre>
cd tools
./configure.sh <i>&lt;board-name&gt;</i></i><code>[/</code><i>&lt;config-dir&gt;</i><code>]</code>
./configure.sh <i>&lt;board-name&gt;</i></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>
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>]
</pre></ul>
<p>

View File

@ -64,8 +64,10 @@ BOARD_DIR = configs/$(CONFIG_ARCH_BOARD)
#
# APPS_LOC can be over-ridden from the command line:
ifeq ($(CONFIG_BUILTIN_APPS_NUTTX),y)
ifeq ($(CONFIG_BUILTIN_APPS),y)
ifeq ($(APP_LOC),)
APPS_LOC = ../apps
endif
APPS_DIR := ${shell if [ -r $(APPS_LOC)/Makefile ]; then echo "$(APPS_LOC)"; fi}
endif
@ -138,12 +140,8 @@ endif
# Always compile the framework which includes exec_nuttapp if users
# or nuttX applications are to be included.
ifeq ($(CONFIG_BUILTIN_APPS_NUTTX),y)
ifeq ($(CONFIG_BUILTIN_APPS),y)
LINKLIBS += $(APPS_DIR)/libapps$(LIBEXT)
else
ifeq ($(CONFIG_BUILTIN_APPS_USER),y)
LINKLIBS += $(APPS_DIR)/libapps$(LIBEXT)
endif
endif
# Add libraries for network support

View File

@ -58,12 +58,17 @@ following characteristics:
|-- <config1-dir>
| |-- Make.defs
| |-- defconfig
| |-- appconfig*
| `-- setenv.sh
|-- <config2-dir>
| |-- Make.defs
| |-- defconfig
| |-- appconfig*
| `-- setenv.sh
...
*optional
Summary of Files
^^^^^^^^^^^^^^^^
@ -913,6 +918,10 @@ defconfig -- This is a configuration file similar to the Linux
CONFIG_HEAP_BASE - The beginning of the heap
CONFIG_HEAP_SIZE - The size of the heap
appconfig -- This is another configuration file that is specific to the
application. This file is copied into the application build directory
when NuttX is configured. See ../apps/README.txt for further details.
setenv.sh -- This is a script that you can include that will be installed at
the toplevel of the directory structure and can be sourced to set any
necessary environment variables.
@ -1098,9 +1107,24 @@ Configuring NuttX requires only copying
configs/<board-name>/<config-dir>/setenv.sh to ${TOPDIR}/setenv.sh
configs/<board-name>/<config-dir>/defconfig to ${TOPDIR}/.config
And if configs/<board-name>/<config-dir>/appconfig exists in the board
configuration directory:
Copy configs/<board-name>/<config-dir>/appconfig to <app-dir>/.config
echo "CONFIG_BUILTIN_APPS=y" >> "${TOPDIR}/.config"
echo "APPS_LOC=\"<app-dir>\"" >> "${TOPDIR}/.config"
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>
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>

40
configs/vsn/nsh/appconfig Executable file
View File

@ -0,0 +1,40 @@
############################################################################
# configs/vsn/nsh/defconfig
#
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Copyright (c) 2011 Uros Platise. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
# Uros Platise <uros.platise@isotel.eu>
#
# 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.
#
############################################################################
# Add the list of built-in apps needed by this configuration
CONFIGURED_APPS += hello/.built_always poweroff/.built_always jvm/.built_always

View File

@ -139,6 +139,18 @@ CONFIG_STM32_TIM8=n
CONFIG_STM32_USART1=y
CONFIG_STM32_ADC3=n
#
# STM32 JTAG Options
#
# CONFIG_STM32_JTAG_FULL_ENABLE -- Full JTAG Enable (Parallel and Serial)
# CONFIG_STM32_JTAG_NOJNTRST_ENABLE -- Full but without the JNTRST pin
# CONFIG_STM32_JTAG_SW_ENABLE - Serial (SWJ) dual pin only which, can
# coexist besides the FRAM on SPI3
#
CONFIG_STM32_JTAG_FULL_ENABLE=n
CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
CONFIG_STM32_JTAG_SW_ENABLE=n
#
# STM32F103Z specific serial device driver settings
#
@ -357,7 +369,7 @@ CONFIG_SCHED_WORKPRIORITY=50
CONFIG_SCHED_WORKPERIOD=(50*1000)
CONFIG_SCHED_WORKSTACKSIZE=1024
CONFIG_SIG_SIGWORK=4
CONFIG_SCHED_WAITPID=y
#
# The following can be used to disable categories of
# APIs supported by the OS. If the compiler supports
@ -725,6 +737,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
# CONFIG_EXAMPLES_NSH_FATNSECTORS - FAT FS number of sectors
# CONFIG_EXAMPLES_NSH_FATMOUNTPT - FAT FS mountpoint
#
CONFIG_EXAMPLES_NSH_BUILTIN_APPS=y
CONFIG_EXAMPLES_NSH_FILEIOSIZE=512
CONFIG_EXAMPLES_NSH_STRERROR=n
CONFIG_EXAMPLES_NSH_LINELEN=64
@ -816,52 +829,3 @@ CONFIG_PTHREAD_STACK_MIN=256
CONFIG_PTHREAD_STACK_DEFAULT=2048
CONFIG_HEAP_BASE=
CONFIG_HEAP_SIZE=
########################################################################
# STM32 JTAG Options
#
# Full JTAG Enable (Parallel and Serial)
CONFIG_STM32_JTAG_FULL_ENABLE=n
# Full but without the JNTRST pin
CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
# Serial (SWJ) dual pin only which, can coexist besides the FRAM on SPI3
CONFIG_STM32_JTAG_SW_ENABLE=n
########################################################################
#
# Applications to be included within the NuttX binary as described
# under the ../apps/README.txt
#
# Set thi config parameter above to: CONFIG_TASK_NAME_SIZE=16
# In order to enable argv[0]=<task name> argument set the option
# CONFIG_TASK_NAME_SIZE=16
#
# Include builtin NuttX applications (general option)
CONFIG_BUILTIN_APPS_NUTTX=y
# Invoke the following application after NuttX starts
#CONFIG_BUILTIN_APP_START="hello"
# Individual selection of built-in applications:
# Hello world provide a simple skeleton/demo application
CONFIG_BUILTIN_APPS_HELLO=y
# Provide poweroff command to switch off the board
CONFIG_BUILTIN_APPS_POWEROFF=y
# Provide JAVA Virtual Machine (the Darjeeling JVM)
CONFIG_BUILTIN_APPS_JVM=n
# CONFIG_EXAMPLES_NSH_BUILTIN_APPS - Enable invocation of all builtin
# apps from nsh command line. See apps/README for more information.
#
CONFIG_EXAMPLES_NSH_BUILTIN_APPS=y
CONFIG_SCHED_WAITPID=y
#
########################################################################

View File

@ -54,7 +54,7 @@
#ifdef CONFIG_SCHED_WORKQUEUE
# include "work_internal.h"
#endif
#ifdef CONFIG_BUILTIN_APPS_NUTTX
#ifdef CONFIG_BUILTIN_APPS
# include "nuttx/nuttapp.h"
#endif
@ -153,7 +153,7 @@ int os_bringup(void)
svdbg("Starting init thread\n");
#if defined(CONFIG_BUILTIN_APPS_NUTTX) && defined(CONFIG_BUILTIN_APP_START)
#if defined(CONFIG_BUILTIN_APPS) && defined(CONFIG_BUILTIN_APP_START)
init_taskid = exec_nuttapp(CONFIG_BUILTIN_APP_START, (const char **)NULL);
#else
init_taskid = START_TASK("init", SCHED_PRIORITY_DEFAULT,

View File

@ -31,26 +31,54 @@
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#set -x
BOARD=$1
WD=`pwd`
TOPDIR="${WD}/.."
USAGE="${0} [-d] [-a <app-dir>] <board-name>"
function show_usage ()
{
echo "${0} <board-name>"
exit 1
}
# Parse command arguments
if [ "${BOARD}X" = "X" ]; then
echo "Missing argument"
show_usage
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
BOARDDIR=${TOPDIR}/configs/${BOARD}
if [ ! -d "${BOARDDIR}" ]; then
echo "Directory ${BOARDDIR} does not exist. Options are:"
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`
@ -59,29 +87,57 @@ if [ ! -d "${BOARDDIR}" ]; then
echo " $config"
done
echo ""
show_usage
echo "$USAGE"
exit 3
fi
if [ ! -r "${BOARDDIR}/Make.defs" ]; then
echo "File ${BOARDDIR}/Make.defs does not exist"
exit 1
if [ ! -r "${configpath}/Make.defs" ]; then
echo "File ${configpath}/Make.defs does not exist"
exit 4
fi
if [ ! -r "${BOARDDIR}/setenv.sh" ]; then
echo "File ${BOARDDIR}/setenv.sh does not exist"
exit 1
if [ ! -r "${configpath}/setenv.sh" ]; then
echo "File ${configpath}/setenv.sh does not exist"
exit 5
fi
if [ ! -r "${BOARDDIR}/defconfig" ]; then
echo "File ${BOARDDIR}/defconfig does not exist"
exit 1
if [ ! -r "${configpath}/defconfig" ]; then
echo "File ${configpath}/defconfig does not exist"
exit 6
fi
cp -f "${BOARDDIR}/Make.defs" "${TOPDIR}/." || \
{ echo "Failed to copy ${BOARDDIR}/Make.defs" ; exit 1 ; }
cp -f "${BOARDDIR}/setenv.sh" "${TOPDIR}/." || \
{ echo "Failed to copy ${BOARDDIR}/setenv.sh" ; exit 1 ; }
# Check for the apps/ dir in the usual place if appdir was not provided
if [ -z "${appdir}" ]; then
if [ -d "${TOPDIR}/../apps" ]; then
appdir="${TOPDIR}/../apps"
fi
fi
# Okay... setup the configuration
cp -f "${configpath}/Make.defs" "${TOPDIR}/." || \
{ echo "Failed to copy ${configpath}/Make.defs" ; exit 7 ; }
cp -f "${configpath}/setenv.sh" "${TOPDIR}/." || \
{ echo "Failed to copy ${configpath}/setenv.sh" ; exit 8 ; }
chmod 755 "${TOPDIR}/setenv.sh"
cp -f "${BOARDDIR}/defconfig" "${TOPDIR}/.config" || \
{ echo "Failed to copy ${BOARDDIR}/defconfig" ; exit 1 ; }
cp -f "${configpath}/defconfig" "${TOPDIR}/.config" || \
{ echo "Failed to copy ${configpath}/defconfig" ; exit 9 ; }
# Copy option appconfig
if [ ! -z "${appdir}" ]; then
if [ ! -r "${configpath}/appconfig" ]; then
echo "NOTE: No readable appconfig file found in ${configpath}"
else
cp -f "${configpath}/appconfig" "${appdir}/.config" || \
{ echo "Failed to copy ${configpath}/appconfig" ; exit 10 ; }
echo "" >> "${TOPDIR}/.config"
echo "# Application configuration" >> "${TOPDIR}/.config"
echo "" >> "${TOPDIR}/.config"
echo "CONFIG_BUILTIN_APPS=y" >> "${TOPDIR}/.config"
echo "APPS_LOC=\"$appdir\"" >> "${TOPDIR}/.config"
fi
fi