summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-08-28 19:46:58 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-08-28 19:46:58 +0000
commitb31aeb387646c04061abf1e0544d39c92744f1f1 (patch)
tree2e68a16ea7137a85f0f8b0c8d2bbedc90db81c07
parent54cd7d9954dc796f35c2919d4ee4c5dede15be80 (diff)
downloadnuttx-b31aeb387646c04061abf1e0544d39c92744f1f1.tar.gz
nuttx-b31aeb387646c04061abf1e0544d39c92744f1f1.tar.bz2
nuttx-b31aeb387646c04061abf1e0544d39c92744f1f1.zip
Some link improvements
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2895 42af7a65-404d-4744-a932-0658087f49c3
-rwxr-xr-xnuttx/configs/ea3131/locked/Makefile32
-rwxr-xr-xnuttx/configs/ea3131/locked/mklocked.sh9
2 files changed, 28 insertions, 13 deletions
diff --git a/nuttx/configs/ea3131/locked/Makefile b/nuttx/configs/ea3131/locked/Makefile
index db552a771..b4566ae40 100755
--- a/nuttx/configs/ea3131/locked/Makefile
+++ b/nuttx/configs/ea3131/locked/Makefile
@@ -33,38 +33,58 @@
#
############################################################################
+-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs
+# Remove the application library (libapp) from the list of libraries.
+
+PASS1_LIBAPP = $(CONFIG_APP_DIR)/libapp$(LIBEXT)
+PASS1_LINKLIBS = $(filter-out $(PASS1_LIBAPP),$(LINKLIBS))
+
+# Get the paths to the libraries and the links script path in format that
+# is appropriate for the host OS
+
ifeq ($(WINTOOL),y)
# Windows-native toolchains
- PASS1_LIBPATHS = ${shell for path in $(LINKLIBS); do dir=`dirname $(TOPDIR)/$$path`;echo "-L\"`cygpath -w $$dir`\"";done}
+ PASS1_LIBPATHS = ${shell for path in $(PASS1_LINKLIBS); do dir=`dirname $(TOPDIR)/$$path`;echo "-L\"`cygpath -w $$dir`\"";done}
PASS1_LDSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/locked/ld-locked.inc}"
else
# Linux/Cygwin-native toolchain
- PASS1_LIBPATHS = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS)))
+ PASS1_LIBPATHS = $(addprefix -L$(TOPDIR)/,$(dir $(PASS1_LINKLIBS)))
PASS1_LDSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/locked/ld-locked.inc
endif
PASS1_LDFLAGS = -r $(PASS1_LDSCRIPT)
-PASS1_LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))
+PASS1_LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(PASS1_LINKLIBS))))
PASS1_LIBGCC = "${shell $(CC) -print-libgcc-file-name}"
all: locked.r
+# Create include-able linker script that specifies all of the symbols to be
+# resolved in the locked.r file.
+
ld-locked.inc: mklocked.sh $(TOPDIR)/.config
@echo "MK: ld-locked.inc"
@./mklocked.sh "$(TOPDIR)"
-locked.r: ld-locked.inc $(OBJS)
+# 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
@echo "LD: locked.r"
- @$(LD) -o $@ $(PASS1_LDFLAGS) $(PASS1_LIBPATHS) --start-group $(PASS1_LDLIBS) --end-group -u os_start $(PASS1_LIBGCC)
+ @$(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 $@
.depend:
depend: .depend
clean:
- @rm -f locked.r *~ .*.swp
+ @rm -f locked.r locked.map *~ .*.swp
distclean: clean
@rm -f ld-locked.inc
diff --git a/nuttx/configs/ea3131/locked/mklocked.sh b/nuttx/configs/ea3131/locked/mklocked.sh
index 8bfd03da3..b15ce6321 100755
--- a/nuttx/configs/ea3131/locked/mklocked.sh
+++ b/nuttx/configs/ea3131/locked/mklocked.sh
@@ -117,13 +117,9 @@ fi
# Idle Loop
############################################################################
#
-# The IDLE loop must be forced to lie in the locked .text region. NOTE that
-# most of the IDLE loop is is os_start.c, but we don't we want to handle
-# that differently so that it does not draw in a lot of things that we do
-# not need in the locked region. However, we do need to bring in all of
-# the things called by os_start up to the point where the page fill worker
-# thread is started.
+# The IDLE loop must be forced to lie in the locked .text region.
+echo "EXTERN(os_start)" >>ld-locked.inc
echo "EXTERN(up_idle)" >>ld-locked.inc
############################################################################
@@ -133,4 +129,3 @@ echo "EXTERN(up_idle)" >>ld-locked.inc
# All of the page fill worker thread must be in the locked .text region.
echo "EXTERN(pg_worker)" >>ld-locked.inc
-