Merge branch 'update' into up-auto
This commit is contained in:
commit
bf20d7d26b
8 changed files with 230 additions and 28 deletions
31
Arduino.mk
31
Arduino.mk
|
@ -262,29 +262,6 @@ else
|
||||||
$(call show_config_variable,ARDMK_DIR,[USER])
|
$(call show_config_variable,ARDMK_DIR,[USER])
|
||||||
endif
|
endif
|
||||||
|
|
||||||
########################################################################
|
|
||||||
# Arduino Directory
|
|
||||||
|
|
||||||
ifndef ARDUINO_DIR
|
|
||||||
AUTO_ARDUINO_DIR := $(firstword \
|
|
||||||
$(call dir_if_exists,/usr/share/arduino) \
|
|
||||||
$(call dir_if_exists,/Applications/Arduino.app/Contents/Resources/Java) )
|
|
||||||
ifdef AUTO_ARDUINO_DIR
|
|
||||||
ARDUINO_DIR = $(AUTO_ARDUINO_DIR)
|
|
||||||
$(call show_config_variable,ARDUINO_DIR,[AUTODETECTED])
|
|
||||||
else
|
|
||||||
echo $(error "ARDUINO_DIR is not defined")
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
$(call show_config_variable,ARDUINO_DIR,[USER])
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CURRENT_OS),WINDOWS)
|
|
||||||
ifneq ($(shell echo $(ARDUINO_DIR) | egrep '^(/|[a-zA-Z]:\\)'),)
|
|
||||||
echo $(error On Windows, ARDUINO_DIR must be a relative path)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# Default TARGET to pwd (ex Daniele Vergini)
|
# Default TARGET to pwd (ex Daniele Vergini)
|
||||||
|
|
||||||
|
@ -1128,7 +1105,7 @@ $(OBJDIR)/libs/%.o: $(ARDUINO_LIB_PATH)/%.c
|
||||||
|
|
||||||
$(OBJDIR)/libs/%.o: $(ARDUINO_LIB_PATH)/%.cpp
|
$(OBJDIR)/libs/%.o: $(ARDUINO_LIB_PATH)/%.cpp
|
||||||
@$(MKDIR) $(dir $@)
|
@$(MKDIR) $(dir $@)
|
||||||
$(CC) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
$(CXX) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
||||||
|
|
||||||
$(OBJDIR)/libs/%.o: $(ARDUINO_LIB_PATH)/%.S
|
$(OBJDIR)/libs/%.o: $(ARDUINO_LIB_PATH)/%.S
|
||||||
@$(MKDIR) $(dir $@)
|
@$(MKDIR) $(dir $@)
|
||||||
|
@ -1140,7 +1117,7 @@ $(OBJDIR)/platformlibs/%.o: $(ARDUINO_PLATFORM_LIB_PATH)/%.c
|
||||||
|
|
||||||
$(OBJDIR)/platformlibs/%.o: $(ARDUINO_PLATFORM_LIB_PATH)/%.cpp
|
$(OBJDIR)/platformlibs/%.o: $(ARDUINO_PLATFORM_LIB_PATH)/%.cpp
|
||||||
@$(MKDIR) $(dir $@)
|
@$(MKDIR) $(dir $@)
|
||||||
$(CC) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
$(CXX) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
||||||
|
|
||||||
$(OBJDIR)/platformlibs/%.o: $(ARDUINO_PLATFORM_LIB_PATH)/%.S
|
$(OBJDIR)/platformlibs/%.o: $(ARDUINO_PLATFORM_LIB_PATH)/%.S
|
||||||
@$(MKDIR) $(dir $@)
|
@$(MKDIR) $(dir $@)
|
||||||
|
@ -1148,7 +1125,7 @@ $(OBJDIR)/platformlibs/%.o: $(ARDUINO_PLATFORM_LIB_PATH)/%.S
|
||||||
|
|
||||||
$(OBJDIR)/userlibs/%.o: $(USER_LIB_PATH)/%.cpp
|
$(OBJDIR)/userlibs/%.o: $(USER_LIB_PATH)/%.cpp
|
||||||
@$(MKDIR) $(dir $@)
|
@$(MKDIR) $(dir $@)
|
||||||
$(CC) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
$(CXX) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
||||||
|
|
||||||
$(OBJDIR)/userlibs/%.o: $(USER_LIB_PATH)/%.c
|
$(OBJDIR)/userlibs/%.o: $(USER_LIB_PATH)/%.c
|
||||||
@$(MKDIR) $(dir $@)
|
@$(MKDIR) $(dir $@)
|
||||||
|
@ -1336,7 +1313,7 @@ endif
|
||||||
AVRDUDE_ISP_OPTS = -c $(ISP_PROG) -b $(AVRDUDE_ISP_BAUDRATE)
|
AVRDUDE_ISP_OPTS = -c $(ISP_PROG) -b $(AVRDUDE_ISP_BAUDRATE)
|
||||||
|
|
||||||
ifndef $(ISP_PORT)
|
ifndef $(ISP_PORT)
|
||||||
ifneq ($(strip $(ISP_PROG)),$(filter $(ISP_PROG), usbasp usbtiny gpio))
|
ifneq ($(strip $(ISP_PROG)),$(filter $(ISP_PROG), usbasp usbtiny gpio avrispmkii))
|
||||||
AVRDUDE_ISP_OPTS += -P $(call get_isp_port)
|
AVRDUDE_ISP_OPTS += -P $(call get_isp_port)
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
|
|
23
Common.mk
23
Common.mk
|
@ -61,3 +61,26 @@ ifneq ($(TEST),)
|
||||||
ARDUINO_DIR = $(DEPENDENCIES_ARDUINO_DIR)
|
ARDUINO_DIR = $(DEPENDENCIES_ARDUINO_DIR)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# Arduino Directory
|
||||||
|
|
||||||
|
ifndef ARDUINO_DIR
|
||||||
|
AUTO_ARDUINO_DIR := $(firstword \
|
||||||
|
$(call dir_if_exists,/usr/share/arduino) \
|
||||||
|
$(call dir_if_exists,/Applications/Arduino.app/Contents/Resources/Java) )
|
||||||
|
ifdef AUTO_ARDUINO_DIR
|
||||||
|
ARDUINO_DIR = $(AUTO_ARDUINO_DIR)
|
||||||
|
$(call show_config_variable,ARDUINO_DIR,[AUTODETECTED])
|
||||||
|
else
|
||||||
|
echo $(error "ARDUINO_DIR is not defined")
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
$(call show_config_variable,ARDUINO_DIR,[USER])
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CURRENT_OS),WINDOWS)
|
||||||
|
ifneq ($(shell echo $(ARDUINO_DIR) | egrep '^(/|[a-zA-Z]:\\)'),)
|
||||||
|
echo $(error On Windows, ARDUINO_DIR must be a relative path)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
|
@ -13,6 +13,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
|
||||||
- New: Add documentation about CFLAGS_STD and CXXFLAGS_STD (Issue #234) (https://github.com/ladislas)
|
- New: Add documentation about CFLAGS_STD and CXXFLAGS_STD (Issue #234) (https://github.com/ladislas)
|
||||||
- New: Allow "make clean" target to be extended (Issue #239). (https://github.com/sej7278)
|
- New: Allow "make clean" target to be extended (Issue #239). (https://github.com/sej7278)
|
||||||
- New: Add makefile and gcc version info to config output. (https://github.com/sej7278)
|
- New: Add makefile and gcc version info to config output. (https://github.com/sej7278)
|
||||||
|
- New: Support for Teensy 3.x (https://github.com/stepcut)
|
||||||
|
|
||||||
- Tweak: Remove $(EXTRA_XXX) variables (Issue #234) (https://github.com/ladislas)
|
- Tweak: Remove $(EXTRA_XXX) variables (Issue #234) (https://github.com/ladislas)
|
||||||
- Tweak: Update Malefile-example.mk with STD flags (https://github.com/ladislas)
|
- Tweak: Update Malefile-example.mk with STD flags (https://github.com/ladislas)
|
||||||
|
@ -28,6 +29,8 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
|
||||||
- Fix: Allow user libaries/sketches to have the same name as system libs. (Issue #244, #229). (https://github.com/sej7278)
|
- Fix: Allow user libaries/sketches to have the same name as system libs. (Issue #244, #229). (https://github.com/sej7278)
|
||||||
- Fix: Remove impact of travis-ci from regular users. (Issue #258). (https://github.com/sej7278)
|
- Fix: Remove impact of travis-ci from regular users. (Issue #258). (https://github.com/sej7278)
|
||||||
- Fix: objcopy quoting issue on Windows. (Issue #272). (https://github.com/sej7278)
|
- Fix: objcopy quoting issue on Windows. (Issue #272). (https://github.com/sej7278)
|
||||||
|
- Fix: Add "avrispmkii" to the list of isp that don't have a port. (Issue #279). (https://github.com/sej7278)
|
||||||
|
- Fix: Make CXX compile .cpp files instead of CC. (Issue #285). (https://github.com/sej7278)
|
||||||
|
|
||||||
### 1.3.4 (2014-07-12)
|
### 1.3.4 (2014-07-12)
|
||||||
- Tweak: Allow spaces in "Serial.begin (....)". (Issue #190) (https://github.com/pdav)
|
- Tweak: Allow spaces in "Serial.begin (....)". (Issue #190) (https://github.com/pdav)
|
||||||
|
|
|
@ -8,6 +8,7 @@ This is a very simple Makefile which knows how to build Arduino sketches. It def
|
||||||
- Highly customizable
|
- Highly customizable
|
||||||
- Supports all official AVR-based Arduino boards
|
- Supports all official AVR-based Arduino boards
|
||||||
- Supports chipKIT
|
- Supports chipKIT
|
||||||
|
- Supports Teensy 3.x (via Teensyduino)
|
||||||
- Works on all three major OS (Mac, Linux, Windows)
|
- Works on all three major OS (Mac, Linux, Windows)
|
||||||
- Auto detects serial baud rate and libraries used
|
- Auto detects serial baud rate and libraries used
|
||||||
- Support for `*.ino` and `*.pde` sketches as well as raw `*.c` and `*.cpp`
|
- Support for `*.ino` and `*.pde` sketches as well as raw `*.c` and `*.cpp`
|
||||||
|
@ -156,6 +157,12 @@ To upload compiled files, `avrdude` is used. This Makefile tries to find `avrdud
|
||||||
AVRDUDE = /usr/bin/avrdude
|
AVRDUDE = /usr/bin/avrdude
|
||||||
AVRDUDE_CONF = /etc/avrdude.conf
|
AVRDUDE_CONF = /etc/avrdude.conf
|
||||||
|
|
||||||
|
## Teensy 3.x
|
||||||
|
|
||||||
|
For Teensy 3.x support you must first install [Teensyduino](http://www.pjrc.com/teensy/teensyduino.html).
|
||||||
|
|
||||||
|
See examples/BlinkTeensy for example usage.
|
||||||
|
|
||||||
## Versioning
|
## Versioning
|
||||||
|
|
||||||
The current version of the makefile is `1.3.4`. You can find the full history in the [HISTORY.md](HISTORY.md) file
|
The current version of the makefile is `1.3.4`. You can find the full history in the [HISTORY.md](HISTORY.md) file
|
||||||
|
|
169
Teensy.mk
Normal file
169
Teensy.mk
Normal file
|
@ -0,0 +1,169 @@
|
||||||
|
########################################################################
|
||||||
|
#
|
||||||
|
# Support for Teensy 3.x boards
|
||||||
|
#
|
||||||
|
# https://www.pjrc.com/teensy/
|
||||||
|
#
|
||||||
|
# You must install teensyduino for this Makefile to work:
|
||||||
|
#
|
||||||
|
# http://www.pjrc.com/teensy/teensyduino.html
|
||||||
|
#
|
||||||
|
# Copyright (C) 2014 Jeremy Shaw <jeremy@n-heptane.com> based on
|
||||||
|
# work that is copyright Sudar, Nicholas Zambetti, David A. Mellis
|
||||||
|
# & Hernando Barragan.
|
||||||
|
#
|
||||||
|
# This file is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU Lesser General Public License as
|
||||||
|
# published by the Free Software Foundation; either version 2.1 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# Adapted from Arduino 0011 Makefile by M J Oldfield
|
||||||
|
#
|
||||||
|
# Original Arduino adaptation by mellis, eighthave, oli.keller
|
||||||
|
#
|
||||||
|
# Refer to HISTORY.md file for complete history of changes
|
||||||
|
#
|
||||||
|
########################################################################
|
||||||
|
|
||||||
|
|
||||||
|
ifndef ARDMK_DIR
|
||||||
|
ARDMK_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
|
||||||
|
endif
|
||||||
|
|
||||||
|
# include Common.mk now we know where it is
|
||||||
|
include $(ARDMK_DIR)/Common.mk
|
||||||
|
|
||||||
|
VENDOR = teensy
|
||||||
|
ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/teensy/cores/teensy3
|
||||||
|
BOARDS_TXT = $(ARDUINO_DIR)/hardware/$(VENDOR)/boards.txt
|
||||||
|
|
||||||
|
ifndef F_CPU
|
||||||
|
F_CPU=96000000
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef PARSE_TEENSY
|
||||||
|
# result = $(call READ_BOARD_TXT, 'boardname', 'parameter')
|
||||||
|
PARSE_TEENSY = $(shell grep -v "^\#" "$(BOARDS_TXT)" | grep $(1).$(2) | cut -d = -f 2,3 )
|
||||||
|
endif
|
||||||
|
|
||||||
|
ARCHITECTURE = $(call PARSE_TEENSY,$(BOARD_TAG),build.architecture)
|
||||||
|
AVR_TOOLS_DIR = $(call dir_if_exists,$(ARDUINO_DIR)/hardware/tools/$(ARCHITECTURE))
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# command names
|
||||||
|
|
||||||
|
ifndef CC_NAME
|
||||||
|
CC_NAME := $(call PARSE_TEENSY,$(BOARD_TAG),build.command.gcc)
|
||||||
|
ifndef CC_NAME
|
||||||
|
CC_NAME := arm-none-eabi-gcc
|
||||||
|
else
|
||||||
|
$(call show_config_variable,CC_NAME,[COMPUTED])
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef CXX_NAME
|
||||||
|
CXX_NAME := $(call PARSE_TEENSY,$(BOARD_TAG),build.command.g++)
|
||||||
|
ifndef CXX_NAME
|
||||||
|
CXX_NAME := arm-none-eabi-g++
|
||||||
|
else
|
||||||
|
$(call show_config_variable,CXX_NAME,[COMPUTED])
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef AS_NAME
|
||||||
|
AS_NAME := $(call PARSE_TEENSY,$(BOARD_TAG),build.command.as)
|
||||||
|
ifndef AS_NAME
|
||||||
|
AS_NAME := arm-none-eabi-gcc-as
|
||||||
|
else
|
||||||
|
$(call show_config_variable,AS_NAME,[COMPUTED])
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef OBJCOPY_NAME
|
||||||
|
OBJCOPY_NAME := $(call PARSE_TEENSY,$(BOARD_TAG),build.command.objcopy)
|
||||||
|
ifndef OBJCOPY_NAME
|
||||||
|
OBJCOPY_NAME := arm-none-eabi-objcopy
|
||||||
|
else
|
||||||
|
$(call show_config_variable,OBJCOPY_NAME,[COMPUTED])
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef OBJDUMP_NAME
|
||||||
|
OBJDUMP_NAME := $(call PARSE_TEENSY,$(BOARD_TAG),build.command.objdump)
|
||||||
|
ifndef OBJDUMP_NAME
|
||||||
|
OBJDUMP_NAME := arm-none-eabi-objdump
|
||||||
|
else
|
||||||
|
$(call show_config_variable,OBJDUMP_NAME,[COMPUTED])
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef AR_NAME
|
||||||
|
AR_NAME := $(call PARSE_TEENSY,$(BOARD_TAG),build.command.ar)
|
||||||
|
ifndef AR_NAME
|
||||||
|
AR_NAME := arm-none-eabi-ar
|
||||||
|
else
|
||||||
|
$(call show_config_variable,AR_NAME,[COMPUTED])
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef SIZE_NAME
|
||||||
|
SIZE_NAME := $(call PARSE_TEENSY,$(BOARD_TAG),build.command.size)
|
||||||
|
ifndef SIZE_NAME
|
||||||
|
SIZE_NAME := arm-none-eabi-size
|
||||||
|
else
|
||||||
|
$(call show_config_variable,SIZE_NAME,[COMPUTED])
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef NM_NAME
|
||||||
|
NM_NAME := $(call PARSE_TEENSY,$(BOARD_TAG),build.command.nm)
|
||||||
|
ifndef NM_NAME
|
||||||
|
NM_NAME := arm-none-eabi-gcc-nm
|
||||||
|
else
|
||||||
|
$(call show_config_variable,NM_NAME,[COMPUTED])
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# processor stuff
|
||||||
|
ifndef MCU
|
||||||
|
MCU := $(call PARSE_TEENSY,$(BOARD_TAG),build.cpu)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef MCU_FLAG_NAME
|
||||||
|
MCU_FLAG_NAME=mcpu
|
||||||
|
endif
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# FLAGS
|
||||||
|
|
||||||
|
CPPFLAGS += -DLAYOUT_US_ENGLISH -DUSB_SERIAL
|
||||||
|
CPPFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.option)
|
||||||
|
|
||||||
|
CXXFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.cppoption)
|
||||||
|
ifeq ("$(call PARSE_TEENSY,$(BOARD_TAG),build.gnu0x)","true")
|
||||||
|
CXXFLAGS_STD += -std=gnu++0x
|
||||||
|
endif
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
ifneq ("$(call PARSE_TEENSY,$(BOARD_TAG),build.linkscript)",)
|
||||||
|
LDFLAGS += -T$(ARDUINO_CORE_PATH)/$(call PARSE_TEENSY,$(BOARD_TAG),build.linkscript)
|
||||||
|
endif
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# some fairly odd settings so that 'make upload' works
|
||||||
|
#
|
||||||
|
# may require additional patches for Windows support
|
||||||
|
|
||||||
|
do_upload: override get_monitor_port=""
|
||||||
|
AVRDUDE=@true
|
||||||
|
RESET_CMD = nohup $(ARDUINO_DIR)/hardware/tools/teensy_post_compile -board=$(BOARD_TAG) -tools=$(abspath $(ARDUINO_DIR)/hardware/tools) -path=$(abspath $(OBJDIR)) -file=$(TARGET) > /dev/null ; $(ARDUINO_DIR)/hardware/tools/teensy_reboot
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# automatially include Arduino.mk for the user
|
||||||
|
|
||||||
|
include $(ARDMK_DIR)/Arduino.mk
|
19
examples/BlinkTeensy/Blink.ino
Normal file
19
examples/BlinkTeensy/Blink.ino
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
/*
|
||||||
|
Blink
|
||||||
|
Turns on an LED on for one second, then off for one second, repeatedly.
|
||||||
|
|
||||||
|
This example code is in the public domain.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
// initialize the digital pin as an output.
|
||||||
|
// Pin 13 has an LED connected on most Arduino boards:
|
||||||
|
pinMode(13, OUTPUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
digitalWrite(13, HIGH); // set the LED on
|
||||||
|
delay(1000); // wait for a second
|
||||||
|
digitalWrite(13, LOW); // set the LED off
|
||||||
|
delay(1000); // wait for a second
|
||||||
|
}
|
4
examples/BlinkTeensy/Makefile
Normal file
4
examples/BlinkTeensy/Makefile
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
BOARD_TAG = teensy31
|
||||||
|
ARDUINO_LIBS =
|
||||||
|
|
||||||
|
include ../../Teensy.mk
|
|
@ -7,7 +7,7 @@ failures=()
|
||||||
# These examples cannot be tested easily at the moment as they require
|
# These examples cannot be tested easily at the moment as they require
|
||||||
# alternate cores. The MakefileExample doesn't actually contain any source code
|
# alternate cores. The MakefileExample doesn't actually contain any source code
|
||||||
# to compile.
|
# to compile.
|
||||||
NON_TESTABLE_EXAMPLES=(ATtinyBlink MakefileExample TinySoftWareSerial)
|
NON_TESTABLE_EXAMPLES=(ATtinyBlink MakefileExample TinySoftWareSerial BlinkTeensy)
|
||||||
|
|
||||||
for dir in $TESTS_DIR/*/
|
for dir in $TESTS_DIR/*/
|
||||||
do
|
do
|
||||||
|
|
Loading…
Reference in a new issue