aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSudar <sudar@sudarmuthu.com>2013-06-29 21:40:36 +0530
committerSudar <sudar@sudarmuthu.com>2013-06-29 21:40:36 +0530
commit45f230c5c8f33c31d9d2af0d5ab629a3332c1fcb (patch)
tree6e3e586ca6283489104a61cf7e24ca0007bdbb45
parent96deb9cd06be8b90e57d141b79881c3bb24e11df (diff)
Improve avrdude and avrdude_conf path auto detection
In Arduino Linux distribution, avrdude and avrdude.conf files are placed in different path. This commit improves the autodetection of avrdude and avrdude.conf paths by considering this fact. Fix #48
-rw-r--r--HISTORY.md1
-rw-r--r--arduino-mk/Arduino.mk45
2 files changed, 27 insertions, 19 deletions
diff --git a/HISTORY.md b/HISTORY.md
index 72820d3..8c24017 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -10,6 +10,7 @@ The following is the rough list of changes that went into different versions. I
- Remove "utility" from example makefiles. Fix issue #84
- Auto detect alternate core path from sketchbook folder. Fix issue #86
- Remove redundant checks for ARDUINO_DIR
+- Improve avrdude and avrdude.conf path auto detection. Fix issue #48
### 0.12.0 (2013-06-20)
- Fix "generated_assembly" target, which got broken earlier. Fix issue #76 (https://github.com/matthijskooijman)
diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk
index 4943af0..3e98c9f 100644
--- a/arduino-mk/Arduino.mk
+++ b/arduino-mk/Arduino.mk
@@ -326,11 +326,27 @@ ifndef AVR_TOOLS_DIR
AVR_TOOLS_DIR = $(BUNDLED_AVR_TOOLS_DIR)
$(call show_config_variable,AVR_TOOLS_DIR,[BUNDLED],(in Arduino distribution))
- # if AVRDUDE_CONF is already defined, don't overwrite it
- ifndef AVRDUDE_CONF
- # The avrdude bundled with Arduino can't find it's config
- AVRDUDE_CONF = $(AVR_TOOLS_DIR)/etc/avrdude.conf
- endif
+ # In Linux distribution of Arduino, the path to avrdude and avrdude.conf are different
+ # More details at https://github.com/sudar/Arduino-Makefile/issues/48 and
+ # https://groups.google.com/a/arduino.cc/d/msg/developers/D_m97jGr8Xs/uQTt28KO_8oJ
+ ifeq ($(CURRENT_OS),LINUX)
+
+ ifndef AVRDUDE
+ AVRDUDE = $(AVR_TOOLS_DIR)/../avrdude
+ endif
+
+ ifndef AVRDUDE_CONF
+ AVRDUDE_CONF = $(AVR_TOOLS_DIR)/../avrdude.conf
+ endif
+
+ else
+
+ ifndef AVRDUDE_CONF
+ AVRDUDE_CONF = $(AVR_TOOLS_DIR)/etc/avrdude.conf
+ endif
+
+ endif
+
else
SYSTEMPATH_AVR_TOOLS_DIR := $(call dir_if_exists,$(abspath $(dir $(shell which avr-gcc))/..))
@@ -345,6 +361,10 @@ else
$(call show_config_variable,AVR_TOOLS_DIR,[USER])
endif #ndef AVR_TOOLS_DIR
+ifndef AVR_TOOLS_PATH
+ AVR_TOOLS_PATH = $(AVR_TOOLS_DIR)/bin
+endif
+
ARDUINO_LIB_PATH = $(ARDUINO_DIR)/libraries
$(call show_config_variable,ARDUINO_LIB_PATH,[COMPUTED],(from ARDUINO_DIR))
ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/arduino/cores/arduino
@@ -394,12 +414,6 @@ else
endif
-ifdef AVR_TOOLS_DIR
- ifndef AVR_TOOLS_PATH
- AVR_TOOLS_PATH = $(AVR_TOOLS_DIR)/bin
- endif
-endif
-
########################################################################
# Makefile distribution path
#
@@ -881,19 +895,12 @@ $(OBJDIR)/%.sym: $(OBJDIR)/%.elf $(COMMON_DEPS)
########################################################################
#
# Avrdude
+# If avrdude is installed separately, it can find its own config file
#
ifndef AVRDUDE
AVRDUDE = $(AVR_TOOLS_PATH)/avrdude
endif
-ifndef AVRDUDE_CONF
- ifndef AVR_TOOLS_DIR
- # The avrdude bundled with Arduino can't find its config
- AVRDUDE_CONF = $(AVR_TOOLS_DIR)/etc/avrdude.conf
- endif
- # If avrdude is installed separately, it can find its own config file
-endif
-
# Default avrdude options. -V Do not verify, -q - suppress progress output
ifndef AVRDUDE_OPTS
AVRDUDE_OPTS = -q -V