From 28210c85a92d3f38efc98581621735605dec1ad1 Mon Sep 17 00:00:00 2001 From: Simon John Date: Thu, 9 Jul 2015 22:26:02 +0200 Subject: [PATCH] Took another couple of changes from @peplin's PR #256 for chipKIT --- Arduino.mk | 2 +- chipKIT.mk | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Arduino.mk b/Arduino.mk index 7f1060b..9c0d252 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -1407,7 +1407,7 @@ pre-build: $(call runscript_if_exists,$(PRE_BUILD_HOOK)) $(TARGET_ELF): $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS) - $(CC) $(LDFLAGS) -o $@ $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS) -lc -lm + $(CC) $(LDFLAGS) -o $@ $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS) -lc -lm $(LINKER_SCRIPTS) $(CORE_LIB): $(CORE_OBJS) $(LIB_OBJS) $(PLATFORM_LIB_OBJS) $(USER_LIB_OBJS) $(AR) rcs $@ $(CORE_OBJS) $(LIB_OBJS) $(PLATFORM_LIB_OBJS) $(USER_LIB_OBJS) diff --git a/chipKIT.mk b/chipKIT.mk index 0cf09f5..298ac96 100644 --- a/chipKIT.mk +++ b/chipKIT.mk @@ -81,7 +81,11 @@ ARDUINO_CORE_PATH = $(ALTERNATE_CORE_PATH)/cores/$(ALTERNATE_CORE) ARDUINO_PREFERENCES_PATH = $(MPIDE_PREFERENCES_PATH) ARDUINO_DIR = $(MPIDE_DIR) -CORE_AS_SRCS = $(ARDUINO_CORE_PATH)/vector_table.S +CORE_AS_SRCS = $(ARDUINO_CORE_PATH)/vector_table.S \ + $(ARDUINO_CORE_PATH)/cpp-startup.S \ + $(ARDUINO_CORE_PATH)/crti.S \ + $(ARDUINO_CORE_PATH)/crtn.S \ + $(ARDUINO_CORE_PATH)/pic32_software_reset.S ARDUINO_VERSION = 23 @@ -107,9 +111,11 @@ LDSCRIPT = $(call PARSE_BOARD,$(BOARD_TAG),ldscript) LDSCRIPT_FILE = $(ARDUINO_CORE_PATH)/$(LDSCRIPT) MCU_FLAG_NAME=mprocessor -LDFLAGS += -T $(ARDUINO_CORE_PATH)/$(LDSCRIPT) -LDFLAGS += -T $(ARDUINO_CORE_PATH)/chipKIT-application-COMMON.ld -CPPFLAGS += -mno-smart-io -fno-short-double +LDFLAGS += -mdebugger -mno-peripheral-libs -nostartfiles -Wl,--gc-sections +LINKER_SCRIPTS += -T $(ARDUINO_CORE_PATH)/$(LDSCRIPT) +LINKER_SCRIPTS += -T $(ARDUINO_CORE_PATH)/chipKIT-application-COMMON.ld +CPPFLAGS += -mno-smart-io -fno-short-double -fframe-base-loclist \ + -g3 -Wcast-align -D_BOARD_MEGA_ CFLAGS_STD = include $(ARDMK_DIR)/Arduino.mk