From cbe3011711c2db8c7159cb66574173fcf80e4f43 Mon Sep 17 00:00:00 2001 From: Simon John Date: Mon, 21 Apr 2014 00:56:11 +0200 Subject: [PATCH 1/9] Added easier instructions to workaround ccache on Fedora. Prettified. --- packaging/fedora/README.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/packaging/fedora/README.md b/packaging/fedora/README.md index 726dc87..f024a20 100644 --- a/packaging/fedora/README.md +++ b/packaging/fedora/README.md @@ -24,12 +24,16 @@ Then compile. This will create a binary and source RPM: Fedora's AVR compilers use ccache, so you may have to override some of the paths to the AVR tools in your sketch's Makefile, for example: - OVERRIDE_EXECUTABLES = 1 - CC = /usr/lib64/ccache/$(CC_NAME) - CXX = /usr/lib64/ccache/$(CXX_NAME) - AS = /usr/bin/$(AS_NAME) - OBJCOPY = /usr/bin/$(OBJCOPY_NAME) - OBJDUMP = /usr/bin/$(OBJDUMP_NAME) - AR = /usr/bin/$(AR_NAME) - SIZE = /usr/bin/$(SIZE_NAME) - NM = /usr/bin/$(NM_NAME) +```Makefile +OVERRIDE_EXECUTABLES = 1 +CC = /usr/lib64/ccache/$(CC_NAME) +CXX = /usr/lib64/ccache/$(CXX_NAME) +AS = /usr/bin/$(AS_NAME) +OBJCOPY = /usr/bin/$(OBJCOPY_NAME) +OBJDUMP = /usr/bin/$(OBJDUMP_NAME) +AR = /usr/bin/$(AR_NAME) +SIZE = /usr/bin/$(SIZE_NAME) +NM = /usr/bin/$(NM_NAME) +``` + +Or if you don't want to use ccache, then just set ```AVR_TOOLS_PATH=/usr``` and none of the above will be necessary. From fc6ff0f041ca85b2904ff3663f7e0ea3d91727dc Mon Sep 17 00:00:00 2001 From: Simon John Date: Mon, 21 Apr 2014 19:42:23 +0200 Subject: [PATCH 2/9] fixed typo - should be ARDUINO_SKETCHBOOK not ARDUINO_VERSION --- arduino-mk-vars.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arduino-mk-vars.md b/arduino-mk-vars.md index b18aa2b..57bf2c2 100644 --- a/arduino-mk-vars.md +++ b/arduino-mk-vars.md @@ -129,7 +129,7 @@ ARDUINO_VERSION = 105 ---- -### ARDUINO_VERSION +### ARDUINO_SKETCHBOOK **Description:** @@ -140,7 +140,7 @@ Usually can be auto-detected from the Arduino `preferences.txt` file or the defa **Example:** ```Makefile -ARDUINO_VERSION = ~/sketches +ARDUINO_SKETCHBOOK = ~/sketches ``` **Requirement:** *Optional* From 041d54d9ab815c78e61fad09ef2980a2794e9965 Mon Sep 17 00:00:00 2001 From: hrobeers Date: Fri, 25 Apr 2014 08:53:50 +0200 Subject: [PATCH 3/9] Add support for assembler code in libraries Fix #195 --- Arduino.mk | 16 ++++++++++++++-- HISTORY.md | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Arduino.mk b/Arduino.mk index 2448c03..e31bee7 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -784,12 +784,16 @@ SYS_INCLUDES = $(patsubst %,-I%,$(SYS_LIBS)) USER_INCLUDES = $(patsubst %,-I%,$(USER_LIBS)) LIB_C_SRCS = $(wildcard $(patsubst %,%/*.c,$(SYS_LIBS))) LIB_CPP_SRCS = $(wildcard $(patsubst %,%/*.cpp,$(SYS_LIBS))) +LIB_AS_SRCS = $(wildcard $(patsubst %,%/*.S,$(SYS_LIBS))) USER_LIB_CPP_SRCS = $(wildcard $(patsubst %,%/*.cpp,$(USER_LIBS))) USER_LIB_C_SRCS = $(wildcard $(patsubst %,%/*.c,$(USER_LIBS))) +USER_LIB_AS_SRCS = $(wildcard $(patsubst %,%/*.S,$(USER_LIBS))) LIB_OBJS = $(patsubst $(ARDUINO_LIB_PATH)/%.c,$(OBJDIR)/libs/%.o,$(LIB_C_SRCS)) \ - $(patsubst $(ARDUINO_LIB_PATH)/%.cpp,$(OBJDIR)/libs/%.o,$(LIB_CPP_SRCS)) + $(patsubst $(ARDUINO_LIB_PATH)/%.cpp,$(OBJDIR)/libs/%.o,$(LIB_CPP_SRCS)) \ + $(patsubst $(ARDUINO_LIB_PATH)/%.S,$(OBJDIR)/libs/%.o,$(LIB_AS_SRCS)) USER_LIB_OBJS = $(patsubst $(USER_LIB_PATH)/%.cpp,$(OBJDIR)/libs/%.o,$(USER_LIB_CPP_SRCS)) \ - $(patsubst $(USER_LIB_PATH)/%.c,$(OBJDIR)/libs/%.o,$(USER_LIB_C_SRCS)) + $(patsubst $(USER_LIB_PATH)/%.c,$(OBJDIR)/libs/%.o,$(USER_LIB_C_SRCS)) \ + $(patsubst $(USER_LIB_PATH)/%.S,$(OBJDIR)/libs/%.o,$(USER_LIB_AS_SRCS)) # Dependency files DEPS = $(LOCAL_OBJS:.o=.d) $(LIB_OBJS:.o=.d) $(USER_LIB_OBJS:.o=.d) $(CORE_OBJS:.o=.d) @@ -925,6 +929,10 @@ $(OBJDIR)/libs/%.o: $(ARDUINO_LIB_PATH)/%.cpp @$(MKDIR) $(dir $@) $(CC) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@ +$(OBJDIR)/libs/%.o: $(ARDUINO_LIB_PATH)/%.S + @$(MKDIR) $(dir $@) + $(CC) -MMD -c $(CPPFLAGS) $(ASFLAGS) $< -o $@ + $(OBJDIR)/libs/%.o: $(USER_LIB_PATH)/%.cpp @$(MKDIR) $(dir $@) $(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@ @@ -933,6 +941,10 @@ $(OBJDIR)/libs/%.o: $(USER_LIB_PATH)/%.c @$(MKDIR) $(dir $@) $(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@ +$(OBJDIR)/libs/%.o: $(USER_LIB_PATH)/%.S + @$(MKDIR) $(dir $@) + $(CC) -MMD -c $(CPPFLAGS) $(ASFLAGS) $< -o $@ + ifdef COMMON_DEPS COMMON_DEPS := $(COMMON_DEPS) $(MAKEFILE_LIST) else diff --git a/HISTORY.md b/HISTORY.md index 21ca01e..9300c72 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -6,6 +6,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it ### 1.3.4 (In development) - Tweak: Allow spaces in "Serial.begin (....)". (Issue #190) (https://github.com/pdav) +- Add: Add support for compiling assembler code. (Issue #195) (https://github.com/hrobeers) ### 1.3.3 (2014-04-12) - Fix: Make a new manpage for ard-reset-arduino. Fixes issue #188 (https://github.com/sej7278) From dbf252e9c5bf24a33e6fe7a065052c37dfc6861a Mon Sep 17 00:00:00 2001 From: Simon John Date: Sat, 26 Apr 2014 00:26:15 +0200 Subject: [PATCH 4/9] Fixed lintian "hyphen-used-as-minus-sign" warning in manpage --- ard-reset-arduino.1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ard-reset-arduino.1 b/ard-reset-arduino.1 index 818b66c..923e8b4 100644 --- a/ard-reset-arduino.1 +++ b/ard-reset-arduino.1 @@ -1,7 +1,7 @@ .TH ARD-RESET-ARDUINO "1" "April 2014" "ard-reset-arduino 1.3.3" "Arduino CLI Reset" .SH NAME -ard-reset-arduino \- Reset Arduino board +ard-reset-arduino - Reset Arduino board .SH SYNOPSIS .B ard-reset-arduino @@ -12,21 +12,21 @@ To reset Arduinos, we either pulse the DTR line or open the USB port at 1200 baud and close it again. .SH OPTIONS -.B --verbose +.B \-\-verbose Watch what's going on on STDERR. -.B --period +.B \-\-period Specify the DTR pulse width in seconds. -.B --caterina +.B \-\-caterina Reset a Leonardo, Micro, Robot, LilyPadUSB or similar 32u4-based device. .SH EXAMPLES ard-reset-arduino /dev/ttyACM0 .PP -ard-reset-arduino --verbose --period=0.1 /dev/cu.usb* +ard-reset-arduino \-\-verbose \-\-period=0.1 /dev/cu.usb* .PP -ard-reset-arduino --verbose --caterina /dev/ttyUSB0 +ard-reset-arduino \-\-verbose \-\-caterina /dev/ttyUSB0 .SH BUGS There are no known bugs in this application. Please report problems From 70dfdcc7eb6a4a820533c2c0f58203f4f4ae6da4 Mon Sep 17 00:00:00 2001 From: Chris Patuzzo Date: Sat, 3 May 2014 01:36:42 +0100 Subject: [PATCH 5/9] If no port is specified, try to guess it from wildcards Fix #197 --- Arduino.mk | 8 +++++++- HISTORY.md | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Arduino.mk b/Arduino.mk index e31bee7..a352628 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -866,8 +866,14 @@ ifeq ($(CURRENT_OS), WINDOWS) COM_PORT_ID = $(subst com,,$(MONITOR_PORT)) COM_STYLE_MONITOR_PORT = com$(COM_PORT_ID) DEVICE_PATH = /dev/ttyS$(shell awk 'BEGIN{ print $(COM_PORT_ID) - 1 }') -else +endif + +ifdef ARDUINO_PORT DEVICE_PATH = $(MONITOR_PORT) +else + # If no port is specified, try to guess it from wildcards. + DEVICE_PATH = $(firstword $(wildcard \ + /dev/ttyACM? /dev/ttyUSB? /dev/tty.usbserial* /dev/tty.usbmodem*)) endif # Returns the Arduino port (first wildcard expansion) if it exists, otherwise it errors. diff --git a/HISTORY.md b/HISTORY.md index 9300c72..d20f7da 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -7,6 +7,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it ### 1.3.4 (In development) - Tweak: Allow spaces in "Serial.begin (....)". (Issue #190) (https://github.com/pdav) - Add: Add support for compiling assembler code. (Issue #195) (https://github.com/hrobeers) +- Add: Try to guess port from wildcards if not specified. (Issue #197) (https://github.com/tuzz) ### 1.3.3 (2014-04-12) - Fix: Make a new manpage for ard-reset-arduino. Fixes issue #188 (https://github.com/sej7278) From 9a45b800179efca8177678740ce9020390c0fd0e Mon Sep 17 00:00:00 2001 From: Simon John Date: Mon, 19 May 2014 22:09:00 +0100 Subject: [PATCH 6/9] Check that on windows ARDUINO_DIR (and MPIDE_DIR) is a relative path. Checks for paths starting with / e.g. /cydrive/arduino or a drive letter e.g. C:\Program Files\Arduino Fix #201 Fix #202 --- Arduino.mk | 6 ++++++ HISTORY.md | 1 + chipKIT.mk | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/Arduino.mk b/Arduino.mk index a352628..42dfef0 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -279,6 +279,12 @@ 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) diff --git a/HISTORY.md b/HISTORY.md index d20f7da..632753a 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -8,6 +8,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it - Tweak: Allow spaces in "Serial.begin (....)". (Issue #190) (https://github.com/pdav) - Add: Add support for compiling assembler code. (Issue #195) (https://github.com/hrobeers) - Add: Try to guess port from wildcards if not specified. (Issue #197) (https://github.com/tuzz) +- Fix: Check that on windows ARDUINO_DIR (and MPIDE_DIR) is a relative path. (Issue #201 and #202) (https://github.com/sej7278) ### 1.3.3 (2014-04-12) - Fix: Make a new manpage for ard-reset-arduino. Fixes issue #188 (https://github.com/sej7278) diff --git a/chipKIT.mk b/chipKIT.mk index 19a4a4a..06d85e3 100644 --- a/chipKIT.mk +++ b/chipKIT.mk @@ -47,6 +47,12 @@ else $(call show_config_variable,MPIDE_DIR,[USER]) endif +ifeq ($(CURRENT_OS),WINDOWS) + ifneq ($(shell echo $(ARDUINO_DIR) | egrep '^(/|[a-zA-Z]:\\)'),) + echo $(error On Windows, MPIDE_DIR must be a relative path) + endif +endif + ifndef MPIDE_PREFERENCES_PATH AUTO_MPIDE_PREFERENCES_PATH := $(firstword \ $(call dir_if_exists,$(HOME)/.mpide/preferences.txt) \ From 634bd9bc9ce75bfb1dc1585cd1cf8393fecc6ca6 Mon Sep 17 00:00:00 2001 From: Simon John Date: Wed, 21 May 2014 00:14:46 +0100 Subject: [PATCH 7/9] Some language clean up --- Arduino.mk | 2 +- README.md | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Arduino.mk b/Arduino.mk index 42dfef0..e66dfee 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -648,7 +648,7 @@ LOCAL_OBJ_FILES = $(LOCAL_C_SRCS:.c=.o) $(LOCAL_CPP_SRCS:.cpp=.o) \ LOCAL_OBJS = $(patsubst %,$(OBJDIR)/%,$(LOCAL_OBJ_FILES)) ifeq ($(words $(LOCAL_SRCS)), 0) - $(error Atleast one source file (*.ino, *.pde, *.cpp, *c, *cc, *.S) is needed) + $(error At least one source file (*.ino, *.pde, *.cpp, *c, *cc, *.S) is needed) endif ifeq ($(strip $(NO_CORE)),) diff --git a/README.md b/README.md index 4044e69..7f4b8e8 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ in the build process. Changes in `*.h` files lead to recompilation of sources wh ### Through package If you're using FreeBSD, Debian or Ubuntu, you can find this in the `arduino-mk` -package and can be installed using `apt-get` or `aptitude`. +package which can be installed using `apt-get` or `aptitude`. ### From source @@ -55,7 +55,7 @@ On Mac using MacPorts: On Windows: -You need to install Cygwin and its packages for Make, Perl and the next Serial library. +You need to install Cygwin and its packages for Make, Perl and the following Serial library. pySerial can be downloaded from PyPi @@ -71,7 +71,7 @@ On other systems: You can also find more [detailed instructions in this guide](http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile). -You can also checkout the sample makefiles inside the `examples/` folder or take a look at a *real* [Makefile-example](examples/MakefileExample/Makefile-example.mk). +You can also checkout the sample makefiles inside the `examples/` directory, e.g. [Makefile-example](examples/MakefileExample/Makefile-example.mk). Download a copy of this repo some where in your system or install it through a package. @@ -95,23 +95,23 @@ On Windows (using cygwin), you might want to set: MONITOR_PORT = com3 BOARD_TAG = mega2560 -It is recommended in Windows that you create a symbolic link directory for avoiding problem with folder naming conventions on Windows. Specially if your your Arduino folder is in: +It is recommended in Windows that you create a symbolic link to avoid problems with file naming conventions on Windows. For example, if your your Arduino directory is in: -c:\Program Files (x86)\Arduino + c:\Program Files (x86)\Arduino -You will get problem for the special characters on the folder name. More details about this can be found on https://github.com/sudar/Arduino-Makefile/issues/94 +You will get problems with the special characters on the directory name. More details about this can be found in [issue #94](https://github.com/sudar/Arduino-Makefile/issues/94) -For creating a symbolic link you have to use the command “mklink” on Windows, e.g. +To create a symbolic link, you can use the command “mklink” on Windows, e.g. -mklink /d c:\Arduino c:\Program Files (x86)\Arduino + mklink /d c:\Arduino c:\Program Files (x86)\Arduino -At the end the variables end up being. +After which, the variables should be: -ARDUINO_DIR=../../../../../Arduino + ARDUINO_DIR=../../../../../Arduino -Instead of +Instead of: -ARDUINO_DIR=../../../../../Program\ Files\ \(x86\)/Arduino + ARDUINO_DIR=../../../../../Program\ Files\ \(x86\)/Arduino @@ -132,10 +132,10 @@ You can specify space separated list of libraries that are needed for your sketc The libraries will be searched in the following places in the following order. -- `/libraries` folder inside your sketchbook folder. Sketchbook folder will be auto detected from your Arduino preference file. You can also manually set it through `ARDUINO_SKETCHBOOK`. -- `/libraries` folder inside your Arduino folder, which is read from `ARDUINO_DIR`. +- `/libraries` directory inside your sketchbook directory. Sketchbook directory will be auto detected from your Arduino preference file. You can also manually set it through `ARDUINO_SKETCHBOOK`. +- `/libraries` directory inside your Arduino directory, which is read from `ARDUINO_DIR`. -The libraries inside user folder will take precedence over libraries present in Arduino core folder. +The libraries inside user directories will take precedence over libraries present in Arduino core directory. The makefile can autodetect the libraries that are included from your sketch and can include them automatically. But it can't detect libraries that are included from other libraries. (see [issue #93](https://github.com/sudar/Arduino-Makefile/issues/93)) From 82afb2769f83b68cacd18cc64d7057144393be64 Mon Sep 17 00:00:00 2001 From: Simon John Date: Thu, 22 May 2014 23:35:43 +0100 Subject: [PATCH 8/9] "make show_boards" now lists the board name as well as board tag. also is alphabetically sorted by tag now. Fixes #204 --- Arduino.mk | 2 +- HISTORY.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Arduino.mk b/Arduino.mk index e66dfee..3e29e9d 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -1251,7 +1251,7 @@ size: $(TARGET_HEX) $(call avr_size,$(TARGET_ELF),$(TARGET_HEX)) show_boards: - @$(CAT) $(BOARDS_TXT) | grep -E "^[[:alnum:]]" | cut -d . -f 1 | uniq + @$(CAT) $(BOARDS_TXT) | grep -E "^[[:alnum:]]+.name" | sort -u | sed 's/.name=/:/' | column -s: -t monitor: $(MONITOR_CMD) $(call get_monitor_port) $(MONITOR_BAUDRATE) diff --git a/HISTORY.md b/HISTORY.md index 632753a..fe5b408 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -9,6 +9,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it - Add: Add support for compiling assembler code. (Issue #195) (https://github.com/hrobeers) - Add: Try to guess port from wildcards if not specified. (Issue #197) (https://github.com/tuzz) - Fix: Check that on windows ARDUINO_DIR (and MPIDE_DIR) is a relative path. (Issue #201 and #202) (https://github.com/sej7278) +- Add: List board name as well as tag in `make show_boards`. (Issue #204) (https://github.com/sej7278) ### 1.3.3 (2014-04-12) - Fix: Make a new manpage for ard-reset-arduino. Fixes issue #188 (https://github.com/sej7278) From f5efbe55339efd383bed1cb454a3d1695cfa2906 Mon Sep 17 00:00:00 2001 From: Simon John Date: Fri, 23 May 2014 09:29:41 +0100 Subject: [PATCH 9/9] Fixed alpha sort on those crazy Macs ;-) --- Arduino.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Arduino.mk b/Arduino.mk index 3e29e9d..04e5a8e 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -1251,7 +1251,7 @@ size: $(TARGET_HEX) $(call avr_size,$(TARGET_ELF),$(TARGET_HEX)) show_boards: - @$(CAT) $(BOARDS_TXT) | grep -E "^[[:alnum:]]+.name" | sort -u | sed 's/.name=/:/' | column -s: -t + @$(CAT) $(BOARDS_TXT) | grep -E "^[[:alnum:]]+.name" | sort -uf | sed 's/.name=/:/' | column -s: -t monitor: $(MONITOR_CMD) $(call get_monitor_port) $(MONITOR_BAUDRATE)