Skip to content

Commit 2c1155e

Browse files
authored
Merge pull request #468 from georgeharker/master
Update to work with Arduino 1.6.12 and Teensyduino 1.30
2 parents 23556d7 + 7d564b6 commit 2c1155e

File tree

4 files changed

+58
-8
lines changed

4 files changed

+58
-8
lines changed

Arduino.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ endif
12931293
$(OBJDIR)/%.eep: $(OBJDIR)/%.elf $(COMMON_DEPS)
12941294
@$(MKDIR) $(dir $@)
12951295
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom='alloc,load' \
1296-
--change-section-lma .eeprom=0 -O ihex $< $@
1296+
--no-change-warnings --change-section-lma .eeprom=0 -O ihex $< $@
12971297

12981298
$(OBJDIR)/%.lss: $(OBJDIR)/%.elf $(COMMON_DEPS)
12991299
@$(MKDIR) $(dir $@)
@@ -1439,7 +1439,7 @@ pre-build:
14391439
$(call runscript_if_exists,$(PRE_BUILD_HOOK))
14401440

14411441
$(TARGET_ELF): $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS)
1442-
$(CC) $(LDFLAGS) -o $@ $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS) -lc -lm $(LINKER_SCRIPTS)
1442+
$(CC) $(LDFLAGS) -o $@ $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS) $(OTHER_LIBS) -lc -lm $(LINKER_SCRIPTS)
14431443

14441444
$(CORE_LIB): $(CORE_OBJS) $(LIB_OBJS) $(PLATFORM_LIB_OBJS) $(USER_LIB_OBJS)
14451445
$(AR) rcs $@ $(CORE_OBJS) $(LIB_OBJS) $(PLATFORM_LIB_OBJS) $(USER_LIB_OBJS)

HISTORY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
1212
- Fix: ARDUINO_VERSION can cope with the longer 1.6.10 version string (issue #444) (https://github.com/sej7278)
1313
- Fix: Changed PARSE_BOARD to handle colons in e.g. CORE or VARIANT (issue #461) (https://github.com/sej7278)
1414
- Tweak: Documentation for Windows updated to include installation of PySerial (https://github.com/sovcik)
15+
- FIX: Changed Teensy.mk to support Arduino 1.6.12 and Teensyduino 1.30 (issues #383 , #431) (https://github.com/georgeharker)
1516

1617
### 1.5.1 (Debian version: 1.5-3) (2016-02-22)
1718

Teensy.mk

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ endif
3434
include $(ARDMK_DIR)/Common.mk
3535

3636
ARDMK_VENDOR = teensy
37-
ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/teensy/cores/teensy3
38-
BOARDS_TXT = $(ARDUINO_DIR)/hardware/$(ARDMK_VENDOR)/boards.txt
37+
ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/teensy/avr/cores/teensy3
38+
BOARDS_TXT = $(ARDUINO_DIR)/hardware/$(ARDMK_VENDOR)/avr/boards.txt
3939

4040
ifndef F_CPU
4141
F_CPU=96000000
@@ -46,9 +46,20 @@ ifndef PARSE_TEENSY
4646
PARSE_TEENSY = $(shell grep -v "^\#" "$(BOARDS_TXT)" | grep $(1).$(2) | cut -d = -f 2,3 )
4747
endif
4848

49+
# if boards.txt gets modified, look there, else hard code it
4950
ARCHITECTURE = $(call PARSE_TEENSY,$(BOARD_TAG),build.architecture)
51+
ifeq ($(strip $(ARCHITECTURE)),)
52+
ARCHITECTURE = arm
53+
endif
54+
5055
AVR_TOOLS_DIR = $(call dir_if_exists,$(ARDUINO_DIR)/hardware/tools/$(ARCHITECTURE))
5156

57+
# define plaform lib dir ignoring teensy's oversight on putting it all in avr
58+
ifndef ARDUINO_PLATFORM_LIB_PATH
59+
ARDUINO_PLATFORM_LIB_PATH = $(ARDUINO_DIR)/hardware/$(ARDMK_VENDOR)/avr/libraries
60+
$(call show_config_variable,ARDUINO_PLATFORM_LIB_PATH,[COMPUTED],(from ARDUINO_DIR))
61+
endif
62+
5263
########################################################################
5364
# command names
5465

@@ -152,11 +163,30 @@ ifeq ("$(call PARSE_TEENSY,$(BOARD_TAG),build.elide_constructors)", "true")
152163
CXXFLAGS += -felide-constructors
153164
endif
154165

155-
LDFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.linkoption) $(call PARSE_TEENSY,$(BOARD_TAG),build.additionalobject)
166+
CXXFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.common)
167+
CXXFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.cpu)
168+
CXXFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.defs)
169+
CXXFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.cpp)
156170

157-
ifneq ("$(call PARSE_TEENSY,$(BOARD_TAG),build.linkscript)",)
158-
LDFLAGS += -T$(ARDUINO_CORE_PATH)/$(call PARSE_TEENSY,$(BOARD_TAG),build.linkscript)
159-
endif
171+
CFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.common)
172+
CFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.cpu)
173+
CFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.defs)
174+
175+
ASFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.common)
176+
ASFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.cpu)
177+
ASFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.defs)
178+
ASFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.S)
179+
180+
LDFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.cpu)
181+
182+
AMCU := $(call PARSE_TEENSY,$(BOARD_TAG),build.mcu)
183+
LDFLAGS += -Wl,--gc-sections,--relax
184+
LINKER_SCRIPTS = -T${ARDUINO_CORE_PATH}/${AMCU}.ld
185+
OTHER_LIBS = $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.libs)
186+
187+
CPUFLAGS = $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.cpu)
188+
# usually defined as per teensy31.build.mcu=mk20dx256 but that isn't valid switch
189+
MCU := $(shell echo ${CPUFLAGS} | sed -n -e 's/.*-mcpu=\([a-zA-Z0-9_-]*\).*/\1/p')
160190

161191
########################################################################
162192
# some fairly odd settings so that 'make upload' works
@@ -171,3 +201,4 @@ RESET_CMD = nohup $(ARDUINO_DIR)/hardware/tools/teensy_post_compile -board=$(BOA
171201
# automatially include Arduino.mk for the user
172202

173203
include $(ARDMK_DIR)/Arduino.mk
204+

arduino-mk-vars.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,24 @@ OPTIMIZATION_LEVEL = 3
888888

889889
----
890890

891+
### OTHER_LIBS
892+
893+
**Description:**
894+
895+
Additional Linker lib flags, for platform support
896+
897+
Defaults to ""
898+
899+
**Example:**
900+
901+
```Makefile
902+
OTHER_LIBS = -lsomeplatformlib
903+
```
904+
905+
**Requirement:** *Optional*
906+
907+
----
908+
891909
### CFLAGS_STD
892910

893911
**Description:**

0 commit comments

Comments
 (0)