From fcf04bcd0a6536870bc3c7f0e620c0640c17f03c Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Fri, 18 Nov 2011 05:13:03 +0100 Subject: build core.a with all arduino libs and use it for linking this is needed (at least for me) to get it working, if using the single object files, the arduino will get into a restart loop --- Arduino.mk | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Arduino.mk b/Arduino.mk index a70d5ce..e55b683 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -247,11 +247,12 @@ CORE_CPP_SRCS = $(wildcard $(ARDUINO_CORE_PATH)/*.cpp) CORE_OBJ_FILES = $(CORE_C_SRCS:.c=.o) $(CORE_CPP_SRCS:.cpp=.o) CORE_OBJS = $(patsubst $(ARDUINO_CORE_PATH)/%, \ $(OBJDIR)/%,$(CORE_OBJ_FILES)) +CORE_ARCHIVE = $(OBJDIR)/core.a endif endif # all the objects! -OBJS = $(LOCAL_OBJS) $(CORE_OBJS) $(LIB_OBJS) +OBJS = $(LOCAL_OBJS) $(LIB_OBJS) ######################################################################## # Rules for making stuff @@ -410,8 +411,11 @@ all: $(OBJDIR) $(TARGET_HEX) $(OBJDIR): mkdir $(OBJDIR) -$(TARGET_ELF): $(OBJS) - $(CC) $(LDFLAGS) -o $@ $(OBJS) $(SYS_OBJS) -lc +$(CORE_ARCHIVE): $(CORE_OBJS) + $(AR) rcs $@ $^ + +$(TARGET_ELF): $(OBJS) $(CORE_ARCHIVE) + $(CC) $(LDFLAGS) -o $@ $(OBJS) $(CORE_ARCHIVE) $(SYS_OBJS) -lc $(DEP_FILE): $(OBJDIR) $(DEPS) cat $(DEPS) > $(DEP_FILE) @@ -445,7 +449,7 @@ ispload: $(TARGET_HEX) -U lock:w:$(ISP_LOCK_FUSE_POST):m clean: - $(REMOVE) $(OBJS) $(TARGETS) $(DEP_FILE) $(DEPS) + $(REMOVE) $(OBJS) $(CORE_OBJS) $(TARGETS) $(DEP_FILE) $(DEPS) $(CORE_ARCHIVE) depends: $(DEPS) cat $(DEPS) > $(DEP_FILE) -- cgit v1.2.3