make it work with modern arduino and teensyduino scripts

This commit is contained in:
George Harker 2016-11-04 11:21:02 -07:00
parent 23556d759c
commit 1d7773938c
2 changed files with 24 additions and 8 deletions

View file

@ -1293,7 +1293,7 @@ endif
$(OBJDIR)/%.eep: $(OBJDIR)/%.elf $(COMMON_DEPS)
@$(MKDIR) $(dir $@)
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom='alloc,load' \
--change-section-lma .eeprom=0 -O ihex $< $@
--no-change-warnings --change-section-lma .eeprom=0 -O ihex $< $@
$(OBJDIR)/%.lss: $(OBJDIR)/%.elf $(COMMON_DEPS)
@$(MKDIR) $(dir $@)
@ -1439,7 +1439,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 $(LINKER_SCRIPTS)
$(CC) $(LDFLAGS) -o $@ $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS) $(OTHER_LIBS) -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)

View file

@ -34,8 +34,8 @@ endif
include $(ARDMK_DIR)/Common.mk
ARDMK_VENDOR = teensy
ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/teensy/cores/teensy3
BOARDS_TXT = $(ARDUINO_DIR)/hardware/$(ARDMK_VENDOR)/boards.txt
ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/teensy/avr/cores/teensy3
BOARDS_TXT = $(ARDUINO_DIR)/hardware/$(ARDMK_VENDOR)/avr/boards.txt
ifndef F_CPU
F_CPU=96000000
@ -152,11 +152,26 @@ ifeq ("$(call PARSE_TEENSY,$(BOARD_TAG),build.elide_constructors)", "true")
CXXFLAGS += -felide-constructors
endif
LDFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.linkoption) $(call PARSE_TEENSY,$(BOARD_TAG),build.additionalobject)
CXXFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.common)
CXXFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.cpu)
CXXFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.defs)
CXXFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.cpp)
ifneq ("$(call PARSE_TEENSY,$(BOARD_TAG),build.linkscript)",)
LDFLAGS += -T$(ARDUINO_CORE_PATH)/$(call PARSE_TEENSY,$(BOARD_TAG),build.linkscript)
endif
CFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.common)
CFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.cpu)
CFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.defs)
ASFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.common)
ASFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.cpu)
ASFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.defs)
ASFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.S)
LDFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.cpu)
AMCU := $(call PARSE_TEENSY,$(BOARD_TAG),build.mcu)
LDFLAGS += -Wl,--gc-sections,--relax
LINKER_SCRIPTS = -T${ARDUINO_CORE_PATH}/${AMCU}.ld
OTHER_LIBS = $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.libs)
########################################################################
# some fairly odd settings so that 'make upload' works
@ -171,3 +186,4 @@ RESET_CMD = nohup $(ARDUINO_DIR)/hardware/tools/teensy_post_compile -board=$(BOA
# automatially include Arduino.mk for the user
include $(ARDMK_DIR)/Arduino.mk