34
34
include $(ARDMK_DIR ) /Common.mk
35
35
36
36
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
39
39
40
40
ifndef F_CPU
41
41
F_CPU =96000000
@@ -46,9 +46,20 @@ ifndef PARSE_TEENSY
46
46
PARSE_TEENSY = $(shell grep -v "^\#" "$(BOARDS_TXT ) " | grep $(1 ) .$(2 ) | cut -d = -f 2,3 )
47
47
endif
48
48
49
+ # if boards.txt gets modified, look there, else hard code it
49
50
ARCHITECTURE = $(call PARSE_TEENSY,$(BOARD_TAG ) ,build.architecture)
51
+ ifeq ($(strip $(ARCHITECTURE ) ) ,)
52
+ ARCHITECTURE = arm
53
+ endif
54
+
50
55
AVR_TOOLS_DIR = $(call dir_if_exists,$(ARDUINO_DIR ) /hardware/tools/$(ARCHITECTURE ) )
51
56
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
+
52
63
# #######################################################################
53
64
# command names
54
65
@@ -152,11 +163,30 @@ ifeq ("$(call PARSE_TEENSY,$(BOARD_TAG),build.elide_constructors)", "true")
152
163
CXXFLAGS += -felide-constructors
153
164
endif
154
165
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)
156
170
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')
160
190
161
191
# #######################################################################
162
192
# 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
171
201
# automatially include Arduino.mk for the user
172
202
173
203
include $(ARDMK_DIR ) /Arduino.mk
204
+
0 commit comments