diff --git a/Documentation/README.html b/Documentation/README.html index 6b8c31bc956..937273f8278 100644 --- a/Documentation/README.html +++ b/Documentation/README.html @@ -8,7 +8,7 @@

NuttX README Files

-

Last Updated: July 24, 2018

+

Last Updated: August 7, 2018

@@ -408,6 +408,8 @@ nuttx/ | |- sixlowpan/ | | `- README.txt | `- README.txt + |- pass1/ + | `- README.txt |- syscall/ | `- README.txt `- tools/ diff --git a/README.txt b/README.txt index 6595410aa03..15fd038a474 100644 --- a/README.txt +++ b/README.txt @@ -2081,6 +2081,8 @@ nuttx/ | |- sixlowpan | | `- README.txt | `- README.txt + |- pass1/ + | `- README.txt |- syscall/ | `- README.txt `- tools/ diff --git a/binfmt/Makefile b/binfmt/Makefile index 091276c860f..43cb3640c20 100644 --- a/binfmt/Makefile +++ b/binfmt/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# nxflat/Makefile +# binfmt/Makefile # # Copyright (C) 2007-2009, 2012-2016, 2018 Gregory Nutt. All rights # reserved. diff --git a/pass1/.gitignore b/pass1/.gitignore new file mode 100644 index 00000000000..96b14288228 --- /dev/null +++ b/pass1/.gitignore @@ -0,0 +1,11 @@ +/*.c +/Make.dep +/.depend +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/pass1/Makefile b/pass1/Makefile new file mode 100644 index 00000000000..5eaacb8c562 --- /dev/null +++ b/pass1/Makefile @@ -0,0 +1,86 @@ +############################################################################ +# pass1/Makefile +# +# Copyright (C) 2018 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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 diff --git a/pass1/README.txt b/pass1/README.txt new file mode 100644 index 00000000000..9e3e2f64765 --- /dev/null +++ b/pass1/README.txt @@ -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//src + would have to be included to make use of the application-installed symbol + tables. diff --git a/tools/FlatLibs.mk b/tools/FlatLibs.mk index 4602a0c8ea1..6b15d3d1cc1 100644 --- a/tools/FlatLibs.mk +++ b/tools/FlatLibs.mk @@ -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! diff --git a/tools/KernelLibs.mk b/tools/KernelLibs.mk index b77e5a8503d..fe79a3e6872 100644 --- a/tools/KernelLibs.mk +++ b/tools/KernelLibs.mk @@ -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! diff --git a/tools/LibTargets.mk b/tools/LibTargets.mk index f05a7d6e97b..188e4fb4030 100644 --- a/tools/LibTargets.mk +++ b/tools/LibTargets.mk @@ -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) diff --git a/tools/ProtectedLibs.mk b/tools/ProtectedLibs.mk index 1ee16b46418..01320c887a9 100644 --- a/tools/ProtectedLibs.mk +++ b/tools/ProtectedLibs.mk @@ -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!