summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-09-05 16:05:29 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-09-05 16:05:29 -0600
commit2dc9308e9154086f30ad320f67be5bf6ecbd310b (patch)
tree02d2f3b453d54e3f9ed5e9dbf6e6b084d02eca1f
parent5c571020f21f0127929621ed1c7afc290f1d5077 (diff)
downloadnuttx-2dc9308e9154086f30ad320f67be5bf6ecbd310b.tar.gz
nuttx-2dc9308e9154086f30ad320f67be5bf6ecbd310b.tar.bz2
nuttx-2dc9308e9154086f30ad320f67be5bf6ecbd310b.zip
Need to add CRT0 to every Makefile in apps/examples/tests
-rw-r--r--apps/examples/elf/tests/errno/Makefile7
-rw-r--r--apps/examples/elf/tests/hello/Makefile6
-rw-r--r--apps/examples/elf/tests/helloxx/Makefile18
-rw-r--r--apps/examples/elf/tests/longjmp/Makefile6
-rw-r--r--apps/examples/elf/tests/mutex/Makefile6
-rw-r--r--apps/examples/elf/tests/pthread/Makefile6
-rw-r--r--apps/examples/elf/tests/signal/Makefile6
-rw-r--r--apps/examples/elf/tests/struct/Makefile6
-rw-r--r--apps/examples/elf/tests/task/Makefile6
-rw-r--r--apps/import/Make.defs16
-rw-r--r--nuttx/configs/sama5d4-ek/kernel/Make.defs2
11 files changed, 50 insertions, 35 deletions
diff --git a/apps/examples/elf/tests/errno/Makefile b/apps/examples/elf/tests/errno/Makefile
index b9029e163..89e3f2bfd 100644
--- a/apps/examples/elf/tests/errno/Makefile
+++ b/apps/examples/elf/tests/errno/Makefile
@@ -66,17 +66,17 @@ endif
BIN = errno
SRCS = $(BIN).c
-OBJS = $(SRCS:.c=.o)
+OBJS = $(SRCS:.c=$(OBJEXT))
all: $(BIN)
-$(OBJS): %.o: %.c
+$(OBJS): %$(OBJEXT): %.c
@echo "CC: $<"
$(Q) $(CC) -c $(CELFFLAGS) $< -o $@
$(BIN): $(OBJS)
@echo "LD: $<"
- $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS)
+ $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
clean:
$(call DELFILE, $(BIN))
@@ -85,4 +85,3 @@ clean:
install:
$(Q) mkdir -p $(ROMFS_DIR)
$(Q) install $(BIN) $(ROMFS_DIR)/$(BIN)
-
diff --git a/apps/examples/elf/tests/hello/Makefile b/apps/examples/elf/tests/hello/Makefile
index 2fb1fdce4..f89759a66 100644
--- a/apps/examples/elf/tests/hello/Makefile
+++ b/apps/examples/elf/tests/hello/Makefile
@@ -66,17 +66,17 @@ endif
BIN = hello
SRCS = $(BIN).c
-OBJS = $(SRCS:.c=.o)
+OBJS = $(SRCS:.c=$(OBJEXT))
all: $(BIN)
-$(OBJS): %.o: %.c
+$(OBJS): %$(OBJEXT): %.c
@echo "CC: $<"
$(Q) $(CC) -c $(CELFFLAGS) $< -o $@
$(BIN): $(OBJS)
@echo "LD: $<"
- $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS)
+ $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
clean:
$(call DELFILE, $(BIN))
diff --git a/apps/examples/elf/tests/helloxx/Makefile b/apps/examples/elf/tests/helloxx/Makefile
index f16ef7e6f..cd153bd52 100644
--- a/apps/examples/elf/tests/helloxx/Makefile
+++ b/apps/examples/elf/tests/helloxx/Makefile
@@ -72,18 +72,18 @@ endif
ALL_BIN = $(BIN1) $(BIN2) $(BIN3) $(BIN4)
SRCS1 = $(BIN1).c
-OBJS1 = $(SRCS1:.c=.o)
+OBJS1 = $(SRCS1:.c=$(OBJEXT))
SRCS2 = $(BIN2).c
-OBJS2 = $(SRCS2:.c=.o)
+OBJS2 = $(SRCS2:.c=$(OBJEXT))
ifeq ($(CONFIG_BINFMT_CONSTRUCTORS),y)
SRCS3 = $(BIN3).c
-OBJS3 = $(SRCS3:.c=.o)
+OBJS3 = $(SRCS3:.c=$(OBJEXT))
endif
#SRCS4 = $(BIN4).c
-#OBJS4 = $(SRCS4:.c=.o)
+#OBJS4 = $(SRCS4:.c=$(OBJEXT))
SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4)
OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4)
@@ -93,7 +93,7 @@ LDLIBSTDC_STUBS_LIB = $(LDLIBSTDC_STUBS_DIR)/liblibxx.a
all: $(BIN1) $(BIN2) $(BIN3) $(BIN4)
-$(OBJS): %.o: %.cpp
+$(OBJS): %$(OBJEXT): %.cpp
@echo "CC: $<"
$(Q) $(CXX) -c $(CXXELFFLAGS) $< -o $@
@@ -110,18 +110,18 @@ $(LDLIBSTDC_STUBS_LIB):
$(BIN1): $(OBJS1)
@echo "LD: $<"
- $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS)
+ $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
$(BIN2): $(OBJS2)
@echo "LD: $<"
- $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS)
+ $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
# BIN3 is equivalent to BIN2 except that is uses static initializers
ifeq ($(CONFIG_BINFMT_CONSTRUCTORS),y)
$(BIN3): $(OBJS3)
@echo "LD: $<"
- $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS)
+ $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
endif
# BIN4 is similar to BIN3 except that it uses the streams code from libstdc++
@@ -130,7 +130,7 @@ endif
#
#$(BIN4): $(OBJS4)
# @echo "LD: $<"
-# $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS)
+# $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
clean:
$(call DELFILE, $(BIN1))
diff --git a/apps/examples/elf/tests/longjmp/Makefile b/apps/examples/elf/tests/longjmp/Makefile
index 9cc3a9922..26fa393bd 100644
--- a/apps/examples/elf/tests/longjmp/Makefile
+++ b/apps/examples/elf/tests/longjmp/Makefile
@@ -66,17 +66,17 @@ endif
BIN = longjmp
SRCS = $(BIN).c
-OBJS = $(SRCS:.c=.o)
+OBJS = $(SRCS:.c=$(OBJEXT))
all: $(BIN)
-$(OBJS): %.o: %.c
+$(OBJS): %$(OBJEXT): %.c
@echo "CC: $<"
$(Q) $(CC) -c $(CELFFLAGS) $< -o $@
$(BIN): $(OBJS)
@echo "LD: $<"
- $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS)
+ $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
clean:
$(call DELFILE, $(BIN))
diff --git a/apps/examples/elf/tests/mutex/Makefile b/apps/examples/elf/tests/mutex/Makefile
index d7ce09041..f8ce4f613 100644
--- a/apps/examples/elf/tests/mutex/Makefile
+++ b/apps/examples/elf/tests/mutex/Makefile
@@ -66,17 +66,17 @@ endif
BIN = mutex
SRCS = $(BIN).c
-OBJS = $(SRCS:.c=.o)
+OBJS = $(SRCS:.c=$(OBJEXT))
all: $(BIN)
-$(OBJS): %.o: %.c
+$(OBJS): %$(OBJEXT): %.c
@echo "CC: $<"
$(Q) $(CC) -c $(CELFFLAGS) $< -o $@
$(BIN): $(OBJS)
@echo "LD: $<"
- $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS)
+ $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
clean:
$(call DELFILE, $(BIN))
diff --git a/apps/examples/elf/tests/pthread/Makefile b/apps/examples/elf/tests/pthread/Makefile
index 0b34c8f8a..9d4ce496b 100644
--- a/apps/examples/elf/tests/pthread/Makefile
+++ b/apps/examples/elf/tests/pthread/Makefile
@@ -66,17 +66,17 @@ endif
BIN = pthread
SRCS = $(BIN).c
-OBJS = $(SRCS:.c=.o)
+OBJS = $(SRCS:.c=$(OBJEXT))
all: $(BIN)
-$(OBJS): %.o: %.c
+$(OBJS): %$(OBJEXT): %.c
@echo "CC: $<"
$(Q) $(CC) -c $(CELFFLAGS) $< -o $@
$(BIN): $(OBJS)
@echo "LD: $<"
- $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS)
+ $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
clean:
$(call DELFILE, $(BIN))
diff --git a/apps/examples/elf/tests/signal/Makefile b/apps/examples/elf/tests/signal/Makefile
index 93f7bc183..c442ae9c6 100644
--- a/apps/examples/elf/tests/signal/Makefile
+++ b/apps/examples/elf/tests/signal/Makefile
@@ -66,17 +66,17 @@ endif
BIN = signal
SRCS = $(BIN).c
-OBJS = $(SRCS:.c=.o)
+OBJS = $(SRCS:.c=$(OBJEXT))
all: $(BIN)
-$(OBJS): %.o: %.c
+$(OBJS): %$(OBJEXT): %.c
@echo "CC: $<"
$(Q) $(CC) -c $(CELFFLAGS) $< -o $@
$(BIN): $(OBJS)
@echo "LD: $<"
- $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS)
+ $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
clean:
$(call DELFILE, $(BIN))
diff --git a/apps/examples/elf/tests/struct/Makefile b/apps/examples/elf/tests/struct/Makefile
index 4dec5e51e..8fe7cf710 100644
--- a/apps/examples/elf/tests/struct/Makefile
+++ b/apps/examples/elf/tests/struct/Makefile
@@ -67,17 +67,17 @@ endif
BIN = struct
SRCS = struct_main.c struct_dummy.c
-OBJS = $(SRCS:.c=.o)
+OBJS = $(SRCS:.c=$(OBJEXT))
all: $(BIN)
-$(OBJS): %.o: %.c
+$(OBJS): %$(OBJEXT): %.c
@echo "CC: $<"
$(Q) $(CC) -c $(CELFFLAGS) $< -o $@
$(BIN): $(OBJS)
@echo "LD: $<"
- $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS)
+ $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
clean:
$(call DELFILE, $(BIN))
diff --git a/apps/examples/elf/tests/task/Makefile b/apps/examples/elf/tests/task/Makefile
index 13d07e18a..572d1072e 100644
--- a/apps/examples/elf/tests/task/Makefile
+++ b/apps/examples/elf/tests/task/Makefile
@@ -66,17 +66,17 @@ endif
BIN = task
SRCS = $(BIN).c
-OBJS = $(SRCS:.c=.o)
+OBJS = $(SRCS:.c=$(OBJEXT))
all: $(BIN)
-$(OBJS): %.o: %.c
+$(OBJS): %$(OBJEXT): %.c
@echo "CC: $<"
$(Q) $(CC) -c $(CELFFLAGS) $< -o $@
$(BIN): $(OBJS)
@echo "LD: $<"
- $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $^ $(LDLIBS)
+ $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
clean:
$(call DELFILE, $(BIN))
diff --git a/apps/import/Make.defs b/apps/import/Make.defs
index 3d12fd368..4ac269f19 100644
--- a/apps/import/Make.defs
+++ b/apps/import/Make.defs
@@ -155,10 +155,12 @@ ifeq ($(WINTOOL),y)
# Windows-native toolchains
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)$(DELIM)include}"
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)$(DELIM)include}" -isystem "${shell cygpath -w $(TOPDIR)$(DELIM)include$(DELIM)cxx}"
+ ARCHCRT0OBJ = "${shell cygpath -w $(TOPDIR)$(DELIM)startup$(DELIM)crt0$(OBJEXT)}"
else
# Linux/Cygwin-native toolchain
ARCHINCLUDES = -I. -isystem $(TOPDIR)$(DELIM)include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)$(DELIM)include -isystem $(TOPDIR)$(DELIM)include$(DELIM)cxx
+ ARCHCRT0OBJ = $(TOPDIR)$(DELIM)startup$(DELIM)crt0$(OBJEXT)
endif
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
@@ -167,6 +169,11 @@ CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+# ELF module definitions
+
+CELFFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
+CXXELFFLAGS = $(CXXFLAGS) -mlong-calls # --target1-abs
+
# C Pre-processor
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
@@ -192,3 +199,12 @@ ifneq ($(LIBGCC),)
LDLIBPATH += -L ${shell dirname $(LIBGCC)}
LDLIBS += -lgcc
endif
+
+# ELF module definitions
+
+LDELFFLAGS = -r -e _start -Bstatic
+ifeq ($(WINTOOL),y)
+ LDELFFLAGS += -T "${shell cygpath -w $(TOPDIR)/scripts/gnu-elf.ld}"
+else
+ LDELFFLAGS += -T $(TOPDIR)/scripts/gnu-elf.ld
+endif
diff --git a/nuttx/configs/sama5d4-ek/kernel/Make.defs b/nuttx/configs/sama5d4-ek/kernel/Make.defs
index a8af35935..88c4130f7 100644
--- a/nuttx/configs/sama5d4-ek/kernel/Make.defs
+++ b/nuttx/configs/sama5d4-ek/kernel/Make.defs
@@ -1,5 +1,5 @@
############################################################################
-# configs/sama5d4-ek/elf/Make.defs
+# configs/sama5d4-ek/kernel/Make.defs
#
# Copyright (C) 2014 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>