summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-08-29 14:27:58 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-08-29 14:27:58 +0000
commit3701c8c5e72d862fcec6c3ee4419215622418237 (patch)
tree57283df037129ab49ab6c4155ae6d6383ec2fccb
parentb31aeb387646c04061abf1e0544d39c92744f1f1 (diff)
downloadpx4-nuttx-3701c8c5e72d862fcec6c3ee4419215622418237.tar.gz
px4-nuttx-3701c8c5e72d862fcec6c3ee4419215622418237.tar.bz2
px4-nuttx-3701c8c5e72d862fcec6c3ee4419215622418237.zip
Two pass build for on-demand paging now works
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2896 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/ChangeLog16
-rw-r--r--nuttx/Documentation/NuttX.html20
-rw-r--r--nuttx/Documentation/NuttxPortingGuide.html44
-rw-r--r--nuttx/Makefile37
-rw-r--r--nuttx/configs/README.txt29
-rwxr-xr-xnuttx/configs/ea3131/locked/Makefile28
-rw-r--r--nuttx/configs/ea3131/locked/ld-locked.script7
-rwxr-xr-xnuttx/configs/ea3131/pgnsh/defconfig4
-rwxr-xr-xnuttx/configs/ea3131/pgnsh/ld.script10
9 files changed, 158 insertions, 37 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index a424504ad..9aa4e40fa 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -1231,3 +1231,19 @@
the arch/arm/src/Makefile for now.
* arch/arm/src/lpc17xx/lpc17_internal.h - Add missing parentheses in
macros definitions (patch submitted by Tiago Maluta).
+ * Documents/NuttxPortingGuide.html, configs/README.txt, etc. -
+ Replaced CONFIG_EXAMPLE with CONFIG_APP_DIR (see documents for
+ desciption). This allows NuttX application code to be built
+ outside of the examples/ directory.
+
+ For people who have their own configurations and/or Makefiles,
+ you will need to make a couple of changes:
+
+ - Replace all occurrences of CONFIG_EXAMPLE=foobar with
+ CONFIG_APP_DIR=examples/foobar in all of the configuration
+ files.
+ - Replace any occurrences of examples/$(CONFIG_EXAMPLE) with
+ $(CONFIG_APP_DIR)
+ - Replace any occurrences of lib$(CONFIG_EXAMPLE)$(LIBEXT)
+ with libapp$(LIBEXT) in your Makefiles.
+ - Check any other occurrences of CONFIG_EXAMPLE.
diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html
index f7f2e499c..80b7d5bd1 100644
--- a/nuttx/Documentation/NuttX.html
+++ b/nuttx/Documentation/NuttX.html
@@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
- <p>Last Updated: August 27, 2010</p>
+ <p>Last Updated: August 28, 2010</p>
</td>
</tr>
</table>
@@ -1903,8 +1903,22 @@ nuttx-5.10 2010-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
the arch/arm/src/Makefile for now.
* arch/arm/src/lpc17xx/lpc17_internal.h - Add missing parentheses in
macros definitions (patch submitted by Tiago Maluta).
-
-pascal-2.1 2010-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
+ * Documents/NuttxPortingGuide.html, configs/README.txt, etc. -
+ Replaced CONFIG_EXAMPLE with CONFIG_APP_DIR (see documents for
+ desciption). This allows NuttX application code to be built
+ outside of the examples/ directory.
+
+ For people who have their own configurations and/or Makefiles,
+ you will need to make a couple of changes:
+
+ - Replace all occurrences of CONFIG_EXAMPLE=foobar with
+ CONFIG_APP_DIR=examples/foobar in all of the configuration
+ files.
+ - Replace any occurrences of examples/$(CONFIG_EXAMPLE) with
+ $(CONFIG_APP_DIR)
+ - Replace any occurrences of lib$(CONFIG_EXAMPLE)$(LIBEXT)
+ with libapp$(LIBEXT) in your Makefiles.
+ - Check any other occurrences of CONFIG_EXAMPLE.pascal-2.1 2010-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
buildroot-1.9 2010-xx-xx <spudmonkey@racsa.co.cr>
</pre></ul>
diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html
index 0df789699..2f3d8af8f 100644
--- a/nuttx/Documentation/NuttxPortingGuide.html
+++ b/nuttx/Documentation/NuttxPortingGuide.html
@@ -12,7 +12,7 @@
<h1><big><font color="#3c34ec">
<i>NuttX RTOS Porting Guide</i>
</font></big></h1>
- <p>Last Updated: August 27, 2010</p>
+ <p>Last Updated: August 29, 2010</p>
</td>
</tr>
</table>
@@ -2178,6 +2178,7 @@ extern void up_ledoff(int led);
The start address of DRAM (virtual)</li>
</ul>
+<h2>Build Options</h2>
<p>
General build options:
</p>
@@ -2206,9 +2207,9 @@ extern void up_ledoff(int led);
have been defined in the configurations <code>Make.defs</code> file.
</li>
</ul>
-
-<h2>General OS setup</h2>
-
+<p>
+ Building application code:
+</p>
<ul>
<li>
<p>
@@ -2261,6 +2262,38 @@ build
It can be used, for example, to include makefile fragments (e.g., <code>.config</code> or <code>Make.defs</code>) or to set up include file paths.
</p>
</li>
+</ul>
+<p>
+ Two-pass Build Options.
+ If the 2 pass build option is selected, then these options configure the make system build a extra link object.
+ This link object is assumed to be an incremental (relative) link object, but could be a static library (archive)
+ (some modification to this Makefile would be required if CONFIG_PASS1_OBJECT is an archive).
+ Pass 1 1ncremental (relative) link objects should be put into the processor-specific source directory
+ where other link objects will be created - ff the pass1 obect is an archive, it could go anywhere.
+</p>
+<ul>
+ <li>
+ <code>CONFIG_BUILD_2PASS</code>:
+ Enables the two pass build options.
+ </li>
+</ul>
+<p>
+ When the two pass build option is enabled, the following also apply:
+</p>
+<ul>
+ <li>
+ <code>CONFIG_PASS1_OBJECT</code>: The name of the first pass object.
+ </li>
+ <li><code>CONFIG_PASS1_BUILDIR</code>:
+ The path, relative to the top NuttX build directory to directory that contains the Makefile to build the first pass object.
+ The Makefile must support the following targets:
+ <ul>
+ <li>The special target <code>arch/$(CONFIG_ARCH)/src/$(CONFIG_PASS1_OBJECT)</code>, and</li>
+ <li>The usual depend, clean, and distclean targets.</li>
+ </ul>
+</ul>
+
+<h2>General OS setup</h2>
<li>
<code>CONFIG_DEBUG</code>: enables built-in debug options
</li>
@@ -2434,7 +2467,8 @@ build
</ul>
<p>
- If CONFIG_PAGING is selected, then the following also apply:
+ If CONFIG_PAGING is selected, then you will probabaly need <code>CONFIG_BUILD_2PASS</code> to correctly position
+ the code and the following configuration options also apply:
</p>
<ul>
<li>
diff --git a/nuttx/Makefile b/nuttx/Makefile
index 90bd2f202..7b71b7298 100644
--- a/nuttx/Makefile
+++ b/nuttx/Makefile
@@ -101,10 +101,15 @@ MAKEDIRS += $(FSDIRS)
endif
#
-# Extra objects used in the final link
+# Extra objects used in the final link.
+#
+# Pass 1 1ncremental (relative) link objects should be put into the
+# processor-specific source directory (where other link objects will
+# be created). If the pass1 obect is an archive, it could go anywhere.
ifeq ($(CONFIG_BUILD_2PASS),y)
-EXTRA_OBJS = $(TOPDIR)/$(CONFIG_PASS1_DIR)/$(CONFIG_PASS1_LIB)
+#EXTRA_OBJS = $(TOPDIR)/$(CONFIG_PASS1_BUILDIR)/$(CONFIG_PASS1_OBJECT)
+EXTRA_OBJS += $(CONFIG_PASS1_OBJECT)
endif
# LINKLIBS is the list of NuttX libraries that is passed to the
@@ -256,25 +261,31 @@ graphics/libgraphics$(LIBEXT): context
$(CONFIG_APP_DIR)/libapp$(LIBEXT): context
@$(MAKE) -C $(CONFIG_APP_DIR) TOPDIR="$(TOPDIR)" libapp$(LIBEXT)
+# If the 2 pass build option is selected, then this pass1 target is
+# configured be build a extra link object. This is assumed to be an
+# incremental (relative) link object, but could be a static library
+# (archive); some modification to this Makefile would be required if
+# CONFIG_PASS1_OBJECT is an archive.
+
pass1:
ifeq ($(CONFIG_BUILD_2PASS),y)
- @if [ -z "$(CONFIG_PASS1_LIB)" ]; then \
- echo "ERROR: CONFIG_PASS1_LIB not defined"; \
+ @if [ -z "$(CONFIG_PASS1_OBJECT)" ]; then \
+ echo "ERROR: CONFIG_PASS1_OBJECT not defined"; \
exit 1; \
fi
- @if [ -z "$(CONFIG_PASS1_DIR)" ]; then \
- echo "ERROR: CONFIG_PASS1_DIR not defined"; \
+ @if [ -z "$(CONFIG_PASS1_BUILDIR)" ]; then \
+ echo "ERROR: CONFIG_PASS1_BUILDIR not defined"; \
exit 1; \
fi
- @if [ ! -d "$(CONFIG_PASS1_DIR)" ]; then \
- echo "ERROR: CONFIG_PASS1_DIR does not exist"; \
+ @if [ ! -d "$(CONFIG_PASS1_BUILDIR)" ]; then \
+ echo "ERROR: CONFIG_PASS1_BUILDIR does not exist"; \
exit 1; \
fi
- @if [ ! -f "$(CONFIG_PASS1_DIR)/Makefile" ]; then \
- echo "ERROR: No Makefile in CONFIG_PASS1_DIR"; \
+ @if [ ! -f "$(CONFIG_PASS1_BUILDIR)/Makefile" ]; then \
+ echo "ERROR: No Makefile in CONFIG_PASS1_BUILDIR"; \
exit 1; \
fi
- @$(MAKE) -C $(CONFIG_PASS1_DIR) TOPDIR="$(TOPDIR)" LINKLIBS="$(LINKLIBS)" $(CONFIG_PASS1_LIB)
+ @$(MAKE) -C $(CONFIG_PASS1_BUILDIR) TOPDIR="$(TOPDIR)" LINKLIBS="$(LINKLIBS)" "$(ARCH_SRC)/$(CONFIG_PASS1_OBJECT)"
endif
$(BIN): context depend $(LINKLIBS) pass1
@@ -312,7 +323,7 @@ subdir_clean:
@$(MAKE) -C tools -f Makefile.mkconfig TOPDIR="$(TOPDIR)" clean
@$(MAKE) -C mm -f Makefile.test TOPDIR="$(TOPDIR)" clean
ifeq ($(CONFIG_BUILD_2PASS),y)
- @$(MAKE) -C $(CONFIG_PASS1_DIR) TOPDIR="$(TOPDIR)" clean
+ @$(MAKE) -C $(CONFIG_PASS1_BUILDIR) TOPDIR="$(TOPDIR)" clean
endif
clean: subdir_clean
@@ -328,5 +339,5 @@ subdir_distclean:
distclean: clean subdir_distclean clean_context
@rm -f Make.defs setenv.sh .config
ifeq ($(CONFIG_BUILD_2PASS),y)
- @$(MAKE) -C $(CONFIG_PASS1_DIR) TOPDIR="$(TOPDIR)" distclean
+ @$(MAKE) -C $(CONFIG_PASS1_BUILDIR) TOPDIR="$(TOPDIR)" distclean
endif
diff --git a/nuttx/configs/README.txt b/nuttx/configs/README.txt
index c1b73b310..6603c9848 100644
--- a/nuttx/configs/README.txt
+++ b/nuttx/configs/README.txt
@@ -139,7 +139,7 @@ defconfig -- This is a configuration file similar to the Linux
CONFIG_DRAM_START - The start address of DRAM (physical)
CONFIG_DRAM_VSTART - The start address of DRAM (virtual)
- General build options
+ General build options:
CONFIG_RRLOAD_BINARY - make the rrload binary format used with
BSPs from www.ridgerun.com using the tools/mkimage.sh script.
@@ -157,7 +157,7 @@ defconfig -- This is a configuration file similar to the Linux
COMPILEXX have been defined in the configuratins Make.defs
file.
- General OS setup
+ Building application code:
CONFIG_APP_DIR - Identifies the directory that builds the
application to link with NuttX. This symbol must be assigned
@@ -201,6 +201,28 @@ defconfig -- This is a configuration file similar to the Linux
example, to include makefile fragments (e.g., .config or Make.defs)
or to set up include file paths.
+ Two-pass build options. If the 2 pass build option is selected, then these
+ options configure the make system build a extra link object. This link object
+ is assumed to be an incremental (relative) link object, but could be a static
+ library (archive) (some modification to this Makefile would be required if
+ CONFIG_PASS1_OBJECT is an archive). Pass 1 1ncremental (relative) link objects
+ should be put into the processor-specific source directory (where other
+ link objects will be created). If the pass1 obect is an archive, it could
+ go anywhere.
+
+ CONFIG_BUILD_2PASS - Enables the two pass build options.
+
+ When the two pass build option is enabled, the following also apply:
+
+ CONFIG_PASS1_OBJECT - The name of the first pass object.
+ CONFIG_PASS1_BUILDIR - The path, relative to the top NuttX build
+ directory to directory that contains the Makefile to build the
+ first pass object. The Makefile must support the following targets:
+ - The special target arch/$(CONFIG_ARCH)/src/$(CONFIG_PASS1_OBJECT)
+ - and the usual depend, clean, and distclean targets.
+
+ General OS setup
+
CONFIG_DEBUG - enables built-in debug options
CONFIG_DEBUG_VERBOSE - enables verbose debug output
CONFIG_DEBUG_SYMBOLS - build without optimization and with
@@ -308,7 +330,8 @@ defconfig -- This is a configuration file similar to the Linux
enable the on-demand paging feature as described in
http://www.nuttx.org/NuttXDemandPaging.html.
- If CONFIG_PAGING is selected, then the following also apply:
+ If CONFIG_PAGING is selected, then you will probabaly need CONFIG_BUILD_2PASS to
+ correctly position the code and the following configuration options also apply:
CONFIG_PAGING_PAGESIZE - The size of one managed page. This must
be a value supported by the processor's memory management unit.
diff --git a/nuttx/configs/ea3131/locked/Makefile b/nuttx/configs/ea3131/locked/Makefile
index b4566ae40..26a62a683 100755
--- a/nuttx/configs/ea3131/locked/Makefile
+++ b/nuttx/configs/ea3131/locked/Makefile
@@ -36,10 +36,18 @@
-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs
-# Remove the application library (libapp) from the list of libraries.
+# Board-specific directory, board library, and application library
+PASS1_SRCDIR = arch/$(CONFIG_ARCH)/src
+PASS1_BOARDDIR = $(PASS1_SRCDIR)/board
+PASS1_LIBBOARD = $(PASS1_BOARDDIR)/libboard$(LIBEXT)
PASS1_LIBAPP = $(CONFIG_APP_DIR)/libapp$(LIBEXT)
+
+# Remove the application library (libapp) from the list of libraries. Add
+# the boad library (liboard)
+
PASS1_LINKLIBS = $(filter-out $(PASS1_LIBAPP),$(LINKLIBS))
+PASS1_LINKLIBS += $(PASS1_LIBBOARD)
# Get the paths to the libraries and the links script path in format that
# is appropriate for the host OS
@@ -58,8 +66,12 @@ PASS1_LDFLAGS = -r $(PASS1_LDSCRIPT)
PASS1_LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(PASS1_LINKLIBS))))
PASS1_LIBGCC = "${shell $(CC) -print-libgcc-file-name}"
+# Targets:
+
all: locked.r
+.PHONY: depend clean distclean
+
# Create include-able linker script that specifies all of the symbols to be
# resolved in the locked.r file.
@@ -67,18 +79,26 @@ ld-locked.inc: mklocked.sh $(TOPDIR)/.config
@echo "MK: ld-locked.inc"
@./mklocked.sh "$(TOPDIR)"
+# Make the board library. This is normally done in arch/arm/src/Makefile.
+# However, we need it earlier here when doing a two-pass build so that libboard.a
+# is available to link against.
+
+$(PASS1_LIBBOARD):
+ @$(MAKE) -C $(TOPDIR)/configs/ea3131/src TOPDIR="$(TOPDIR)" libboard$(LIBEXT)
+
# Create the locked.r file containing all of the code (except the start-up code)
# that needs to lie in the locked text region.
-locked.r: ld-locked.inc
+locked.r: ld-locked.inc $(PASS1_LIBBOARD)
@echo "LD: locked.r"
@$(LD) -o $@ $(PASS1_LDFLAGS) $(PASS1_LIBPATHS) --start-group $(PASS1_LDLIBS) --end-group $(PASS1_LIBGCC)
- @echo "NM: locked.map"
@$(NM) $@ > locked.map
@fgrep " U " locked.map | grep -v os_start
- @echo "SZ:"
@$(CROSSDEV)size $@
+$(PASS1_SRCDIR)/locked.r: locked.r
+ @cp -a locked.r $(TOPDIR)/$(PASS1_SRCDIR)/locked.r
+
.depend:
depend: .depend
diff --git a/nuttx/configs/ea3131/locked/ld-locked.script b/nuttx/configs/ea3131/locked/ld-locked.script
index f89d8549f..5b5feeb1a 100644
--- a/nuttx/configs/ea3131/locked/ld-locked.script
+++ b/nuttx/configs/ea3131/locked/ld-locked.script
@@ -37,8 +37,7 @@ INCLUDE ld-locked.inc
OUTPUT_ARCH(arm)
SECTIONS
{
- .locked : {
- *(.vectors)
- *(.text .text.*)
- }
+ .text.locked : { *(.text .text.*) }
+ .data : { *(.data) }
+ .bss : { *(.bss) *(COMMON) }
} \ No newline at end of file
diff --git a/nuttx/configs/ea3131/pgnsh/defconfig b/nuttx/configs/ea3131/pgnsh/defconfig
index db542a647..58480f875 100755
--- a/nuttx/configs/ea3131/pgnsh/defconfig
+++ b/nuttx/configs/ea3131/pgnsh/defconfig
@@ -202,8 +202,8 @@ CONFIG_HAVE_LIBM=n
# Setup for a two-pass build
#
CONFIG_BUILD_2PASS=y
-CONFIG_PASS1_DIR=configs/ea3131/locked
-CONFIG_PASS1_LIB=locked.r
+CONFIG_PASS1_BUILDIR=configs/ea3131/locked
+CONFIG_PASS1_OBJECT=locked.r
#
# General OS setup
diff --git a/nuttx/configs/ea3131/pgnsh/ld.script b/nuttx/configs/ea3131/pgnsh/ld.script
index 0dc768257..131ee62f9 100755
--- a/nuttx/configs/ea3131/pgnsh/ld.script
+++ b/nuttx/configs/ea3131/pgnsh/ld.script
@@ -32,7 +32,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
-
+
/* The LPC3131 has 192Kb of ISRAM beginning at virtual address 0x1102:8000.
* LPC313x boot ROM expects the boot image be compiled with entry point at
* 0x1102:9000. A 128b header will appear at this address (applied by
@@ -45,6 +45,10 @@
* locked - Pages locked in memory. Start: 0x1102 8000 Size: 36Kb
* paged - Pages in nonvolatile store. Start: 0x1103 1000 Size: 384Kb
* data - .data/.bss/heap. Start: 0x1109 1000 Size: 44Kb
+ *
+ * These region sizes must match the size in pages specified for each region
+ * in the NuttX configuration file: CONFIG_PAGING_NLOCKED, CONFIG_PAGING_NVPAGED,
+ * and CONFIG_PAGING_NDATA.
*/
MEMORY
@@ -61,10 +65,10 @@ SECTIONS
.locked : {
_slocked = ABSOLUTE(.);
*(.vectors)
- *(.locked)
+ locked.r (.text)
_elocked = ABSOLUTE(.);
} >locked
- _eronly = ABSOLUTE(.); /* See below */
+ _eronly = ABSOLUTE(.);
.paged : {
_spaged = ABSOLUTE(.);