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
This commit is contained in:
patacongo 2010-08-29 14:27:58 +00:00
parent 8ff4e26a23
commit b50752f076
5 changed files with 62 additions and 16 deletions

View File

@ -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.

View File

@ -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

View File

@ -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) }
}

View File

@ -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

View File

@ -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(.);