diff --git a/Arduino.mk b/Arduino.mk index 2448c03..04e5a8e 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) @@ -642,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)),) @@ -784,12 +790,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) @@ -862,8 +872,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. @@ -925,6 +941,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 +953,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 @@ -1227,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 -uf | sed 's/.name=/:/' | column -s: -t monitor: $(MONITOR_CMD) $(call get_monitor_port) $(MONITOR_BAUDRATE) diff --git a/HISTORY.md b/HISTORY.md index 21ca01e..fe5b408 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -6,6 +6,10 @@ 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) +- 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) 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)) 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 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* 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) \ 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.