aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSudar <sudar@sudarmuthu.com>2014-11-23 15:46:53 +0530
committerSudar <sudar@sudarmuthu.com>2014-11-23 15:46:53 +0530
commit4b7d99907308ea416d1a295e38411ce06813c9cc (patch)
tree4fe911f4b3c616cd3224cc44d9b9b3c02ea1fd1f
parent605381783366df0df3a8c71dc61e9f8a1234db21 (diff)
parent5f1a5a2ac04b1795715d16dc1e45206c8ebe8930 (diff)
Merge pull request #297 from PeterMosmans/cygwincom
Improved Windows (Cygwin/MSYS) support
-rw-r--r--Arduino.mk44
-rw-r--r--HISTORY.md1
2 files changed, 29 insertions, 16 deletions
diff --git a/Arduino.mk b/Arduino.mk
index e90d9f0..c42c2dd 100644
--- a/Arduino.mk
+++ b/Arduino.mk
@@ -691,9 +691,17 @@ ifndef RESET_CMD
ARD_RESET_ARDUINO = $(ARDMK_DIR)/bin/ard-reset-arduino
endif
ifneq ($(CATERINA),)
- RESET_CMD = $(ARD_RESET_ARDUINO) --caterina $(ARD_RESET_OPTS) $(call get_monitor_port)
+ ifneq (,$(findstring CYGWIN,$(shell uname -s)))
+ RESET_CMD = $(ARD_RESET_ARDUINO) --caterina $(ARD_RESET_OPTS) $(DEVICE_PATH)
+ else
+ RESET_CMD = $(ARD_RESET_ARDUINO) --caterina $(ARD_RESET_OPTS) $(call get_monitor_port)
+ endif
else
- RESET_CMD = $(ARD_RESET_ARDUINO) $(ARD_RESET_OPTS) $(call get_monitor_port)
+ ifneq (,$(findstring CYGWIN,$(shell uname -s)))
+ RESET_CMD = $(ARD_RESET_ARDUINO) $(ARD_RESET_OPTS) $(DEVICE_PATH)
+ else
+ RESET_CMD = $(ARD_RESET_ARDUINO) $(ARD_RESET_OPTS) $(call get_monitor_port)
+ endif
endif
endif
@@ -991,20 +999,20 @@ SIZEFLAGS ?= --mcu=$(MCU) -C
# instead of MONITOR_PORT
MONITOR_PORT ?= $(ARDUINO_PORT)
-ifeq ($(CURRENT_OS), WINDOWS)
- # Expect MONITOR_PORT to be '1' or 'com1' for COM1 in Windows. Split it up
- # into the two styles required: /dev/ttyS* for ard-reset-arduino and com*
- # for avrdude. This also could work with /dev/com* device names and be more
- # consistent, but the /dev/com* is not recommended by Cygwin and doesn't
- # always show up.
- 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 }')
-endif
-
ifneq ($(strip $(MONITOR_PORT)),)
- # set DEVICE_PATH based on user-defined MONITOR_PORT or ARDUINO_PORT
- DEVICE_PATH = $(MONITOR_PORT)
+ ifeq ($(CURRENT_OS), WINDOWS)
+ # Expect MONITOR_PORT to be '1' or 'com1' for COM1 in Windows. Split it up
+ # into the two styles required: /dev/ttyS* for ard-reset-arduino and com*
+ # for avrdude. This also could work with /dev/com* device names and be more
+ # consistent, but the /dev/com* is not recommended by Cygwin and doesn't
+ # always show up.
+ 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
+ # set DEVICE_PATH based on user-defined MONITOR_PORT or ARDUINO_PORT
+ DEVICE_PATH = $(MONITOR_PORT)
+ endif
$(call show_config_variable,DEVICE_PATH,[COMPUTED],(from MONITOR_PORT))
else
# If no port is specified, try to guess it from wildcards.
@@ -1015,7 +1023,11 @@ else
endif
# Returns the Arduino port (first wildcard expansion) if it exists, otherwise it errors.
-get_monitor_port = $(if $(wildcard $(DEVICE_PATH)),$(firstword $(wildcard $(DEVICE_PATH))),$(error Arduino port $(DEVICE_PATH) not found!))
+ifeq ($(CURRENT_OS), WINDOWS)
+ get_monitor_port = $(COM_STYLE_MONITOR_PORT)
+else
+ get_monitor_port = $(if $(wildcard $(DEVICE_PATH)),$(firstword $(wildcard $(DEVICE_PATH))),$(error Arduino port $(DEVICE_PATH) not found!))
+endif
# Returns the ISP port (first wildcard expansion) if it exists, otherwise it errors.
get_isp_port = $(if $(wildcard $(ISP_PORT)),$(firstword $(wildcard $(ISP_PORT))),$(if $(findstring Xusb,X$(ISP_PORT)),$(ISP_PORT),$(error ISP port $(ISP_PORT) not found!)))
diff --git a/HISTORY.md b/HISTORY.md
index c1229bf..0d9426e 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -22,6 +22,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
- Tweak: Update travis-ci to test against Arduino 1.0.6. (https://github.com/sej7278)
- Tweak: Updated package instructions for Arch/Fedora/Raspbian. (https://github.com/sej7278)
+- Fix: Improved Windows (Cygwin/MSYS) support (https://github.com/PeterMosmans)
- Fix: Change "tinyladi" username to "ladislas" in HISTORY.md. (https://github.com/ladislas)
- Fix: Make avr-g++ use CXXFLAGS instead of CFLAGS. (https://github.com/sej7278)
- Fix: Allow the use of CFLAGS_STD and CXXFLAGS_STD and set defaults (Issue #234) (https://github.com/ladislas)