This commit extends support for the two-pass build. Its primary purpose is to incorporate source logic generated by applications into the kernel phase of the build.

In the two pass build, the application logic is built during the first phase, pass 1.  In that phase, the application may generate and install source files in the pass1/directory.  The operating system is built during phase 2 of the build.  At that time, those source files in the pass1/ directory will be built and incorporated into the kernel address space.

The primary purpose of the pass1/ directory is to such application-generated kernel symbol tables.  For an example of the use of this feature, look at apps/examples/module/drivers/Makefile.  Kernel symbol tables are needed to support kernel modules.  Of course, addition board-specific logic in, say, configs/<board>/src would have to be included to make use of the application-installed symbol tables.
This commit is contained in:
Gregory Nutt
2018-08-07 08:30:17 -06:00
parent de5e633785
commit 4becaea8e3
10 changed files with 157 additions and 2 deletions

View File

@@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NuttX README Files</i></font></big></h1>
<p>Last Updated: July 24, 2018</p>
<p>Last Updated: August 7, 2018</p>
</td>
</tr>
</table>
@@ -408,6 +408,8 @@ nuttx/
| |- sixlowpan/
| | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/net/sixlowpan/README.txt" target="_blank"><b><i>README.txt</i></b></a>
| `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/net/README.txt" target="_blank"><b><i>README.txt</i></b></a>
|- pass1/
| `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/pass1/README.txt" target="_blank"><b><i>README.txt</i></b></a>
|- syscall/
| `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/syscall/README.txt" target="_blank"><b><i>README.txt</i></b></a>
`- tools/

View File

@@ -2081,6 +2081,8 @@ nuttx/
| |- sixlowpan
| | `- README.txt
| `- README.txt
|- pass1/
| `- README.txt
|- syscall/
| `- README.txt
`- tools/

View File

@@ -1,5 +1,5 @@
############################################################################
# nxflat/Makefile
# binfmt/Makefile
#
# Copyright (C) 2007-2009, 2012-2016, 2018 Gregory Nutt. All rights
# reserved.

11
pass1/.gitignore vendored Normal file
View File

@@ -0,0 +1,11 @@
/*.c
/Make.dep
/.depend
/*.asm
/*.obj
/*.rel
/*.lst
/*.sym
/*.adb
/*.lib
/*.src

86
pass1/Makefile Normal file
View File

@@ -0,0 +1,86 @@
############################################################################
# pass1/Makefile
#
# Copyright (C) 2018 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)/Make.defs
DELIM ?= $(strip /)
ifeq ($(WINTOOL),y)
INCDIROPT = -w
endif
DEPPATH = --dep-path .
ASRCS = $(wildcard *.S)
CSRCS = $(wildcard *.c)
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
VPATH = .
BIN = libpass1$(LIBEXT)
all: $(BIN)
.PHONY: depend clean distclean
$(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
$(BIN): $(OBJS)
$(call ARCHIVE, $@, $(OBJS))
.depend: Makefile $(SRCS)
$(Q) $(MKDEP) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
$(Q) touch $@
depend: .depend
clean:
$(call DELFILE, $(BIN))
$(call CLEAN)
distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
$(call DELFILE, *.c)
$(call DELFILE, *.S)
-include Make.dep

23
pass1/README.txt Normal file
View File

@@ -0,0 +1,23 @@
README
======
This directory provides support for the two-pass build. Its primary
purpose is to incorporate source logic generated by applications into the
kernel phase of the build.
In the two pass build, the application logic is built during the first
phase, pass 1. In that phase, the application may generate and install
source files in the pass1/directory.
The operating system is built during phase 2 of the build. At that time,
those source files in the pass1/ directory will be built and incorporated
into the kernel address space.
The primary purpose of the pass1/ directory is to such application-
generated kernel symbol tables. For an example of the use of this
feature, look at apps/examples/module/drivers/Makefile. Kernel symbol
tables are needed to support kernel modules.
Of course, addition board-specific logic in, say, configs/<board>/src
would have to be included to make use of the application-installed symbol
tables.

View File

@@ -60,11 +60,20 @@ NUTTXLIBS += staging$(DELIM)libconfigs$(LIBEXT)
NUTTXLIBS += staging$(DELIM)libc$(LIBEXT) staging$(DELIM)libmm$(LIBEXT)
NUTTXLIBS += staging$(DELIM)libarch$(LIBEXT)
ifeq ($(CONFIG_LIB_SYSCALL),y)
NUTTXLIBS += staging$(DELIM)libstubs$(LIBEXT)
USERLIBS += staging$(DELIM)libproxies$(LIBEXT)
endif
# Add libraries for two pass build support. The special directory pass1
# may be populated so that application generated logic can be included into
# the kernel build
ifeq ($(CONFIG_BUILD_2PASS),y)
NUTTXLIBS += staging$(DELIM)libpass1$(LIBEXT)
endif
# Add libraries for C++ support. CXX, CXXFLAGS, and COMPILEXX must
# be defined in Make.defs for this to work!

View File

@@ -64,6 +64,14 @@ NUTTXLIBS += staging$(DELIM)libkmm$(LIBEXT) staging$(DELIM)libkarch$(LIBEXT)
USERLIBS += staging$(DELIM)libproxies$(LIBEXT) staging$(DELIM)libuc$(LIBEXT)
USERLIBS += staging$(DELIM)libumm$(LIBEXT) staging$(DELIM)libuarch$(LIBEXT)
# Add libraries for two pass build support. The special directory pass1
# may be populated so that application generated logic can be included into
# the kernel build
ifeq ($(CONFIG_BUILD_2PASS),y)
NUTTXLIBS += staging$(DELIM)libpass1$(LIBEXT)
endif
# Add libraries for C++ support. CXX, CXXFLAGS, and COMPILEXX must
# be defined in Make.defs for this to work!

View File

@@ -64,6 +64,12 @@ $(ARCH_SRC)$(DELIM)libkarch$(LIBEXT): context
staging$(DELIM)libkarch$(LIBEXT): $(ARCH_SRC)$(DELIM)libkarch$(LIBEXT)
$(Q) $(call INSTALL_LIB,$<,$@)
pass1$(DELIM)libpass1$(LIBEXT): context
$(Q) $(MAKE) -C pass1 TOPDIR="$(TOPDIR)" libpass1$(LIBEXT) KERNEL=y EXTRADEFINES=$(KDEFINE)
staging$(DELIM)libpass1$(LIBEXT): pass1$(DELIM)libpass1$(LIBEXT)
$(Q) $(call INSTALL_LIB,$<,$@)
sched$(DELIM)libsched$(LIBEXT): context
$(Q) $(MAKE) -C sched TOPDIR="$(TOPDIR)" libsched$(LIBEXT) KERNEL=y EXTRADEFINES=$(KDEFINE)

View File

@@ -65,6 +65,14 @@ NUTTXLIBS += staging$(DELIM)libkmm$(LIBEXT) staging$(DELIM)libkarch$(LIBEXT)
USERLIBS += staging$(DELIM)libproxies$(LIBEXT) staging$(DELIM)libuc$(LIBEXT)
USERLIBS += staging$(DELIM)libumm$(LIBEXT) staging$(DELIM)libuarch$(LIBEXT)
# Add libraries for two pass build support. The special directory pass1
# may be populated so that application generated logic can be included into
# the kernel build
ifeq ($(CONFIG_BUILD_2PASS),y)
NUTTXLIBS += staging$(DELIM)libpass1$(LIBEXT)
endif
# Add libraries for C++ support. CXX, CXXFLAGS, and COMPILEXX must
# be defined in Make.defs for this to work!