aboutsummaryrefslogtreecommitdiff
path: root/arduino-mk/Arduino.mk
diff options
context:
space:
mode:
authorSudar <sudar@sudarmuthu.com>2013-06-15 19:23:26 +0530
committerSudar <sudar@sudarmuthu.com>2013-06-15 19:23:26 +0530
commit78f2363dd5c8e2e60bc82a3dd7ac68edc3ec0408 (patch)
tree5c98e2524543478b3943e1a040446f7d1a488788 /arduino-mk/Arduino.mk
parentac5a0879822be6785e1808d0a2b83f9ff286e5cc (diff)
Handle cases where certain fuse bits are not present
Introduce two new variables AVRDUDE_ISP_FUSES_PRE and AVRDUDE_ISP_FUSES_POST which are set based on whether the fuse bits are present or not. avrdude is invoked to set fuse bits only if these new variables are not empty. Fix #61
Diffstat (limited to 'arduino-mk/Arduino.mk')
-rw-r--r--arduino-mk/Arduino.mk43
1 files changed, 35 insertions, 8 deletions
diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk
index 825aa95..bb95bf3 100644
--- a/arduino-mk/Arduino.mk
+++ b/arduino-mk/Arduino.mk
@@ -818,6 +818,34 @@ ifndef AVRDUDE_ISP_BAUDRATE
AVRDUDE_ISP_BAUDRATE = 19200
endif
+# Pre fuse settings
+ifndef AVRDUDE_ISP_FUSES_PRE
+
+ ifneq ($(strip $(ISP_LOCK_FUSE_PRE)),)
+ AVRDUDE_ISP_FUSES_PRE += -U lock:w:$(ISP_LOCK_FUSE_PRE):m
+ endif
+
+ ifneq ($(strip $(ISP_HIGH_FUSE)),)
+ AVRDUDE_ISP_FUSES_PRE += -U hfuse:w:$(ISP_HIGH_FUSE):m
+ endif
+
+ ifneq ($(strip $(ISP_LOW_FUSE)),)
+ AVRDUDE_ISP_FUSES_PRE += -U lfuse:w:$(ISP_LOW_FUSE):m
+ endif
+
+ ifneq ($(strip $(ISP_EXT_FUSE)),)
+ AVRDUDE_ISP_FUSES_PRE += -U efuse:w:$(ISP_EXT_FUSE):m
+ endif
+
+endif
+
+# Post fuse settings
+ifndef AVRDUDE_ISP_FUSES_POST
+ ifneq ($(strip $(ISP_LOCK_FUSE_POST)),)
+ AVRDUDE_ISP_FUSES_POST += -U lock:w:$(ISP_LOCK_FUSE_POST):m
+ endif
+endif
+
AVRDUDE_ISP_OPTS = -c $(ISP_PROG) -b $(AVRDUDE_ISP_BAUDRATE) -P $(call get_isp_port)
ifndef ISP_EEPROM
@@ -902,15 +930,14 @@ reset_stty:
$$STTYF $(call get_arduino_port) -hupcl
ispload: $(TARGET_EEP) $(TARGET_HEX) verify_size
- $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) -e \
- -U lock:w:$(ISP_LOCK_FUSE_PRE):m \
- -U hfuse:w:$(ISP_HIGH_FUSE):m \
- -U lfuse:w:$(ISP_LOW_FUSE):m \
- -U efuse:w:$(ISP_EXT_FUSE):m
- $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) -D \
- $(AVRDUDE_ISPLOAD_OPTS)
+ifdef AVRDUDE_ISP_FUSES_PRE
+ $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) -e $(AVRDUDE_ISP_FUSES_PRE)
+endif
$(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) \
- -U lock:w:$(ISP_LOCK_FUSE_POST):m
+ $(AVRDUDE_ISPLOAD_OPTS)
+ifdef AVRDUDE_ISP_FUSES_POST
+ $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) $(AVRDUDE_ISP_FUSES_POST)
+endif
clean:
$(REMOVE) $(LOCAL_OBJS) $(CORE_OBJS) $(LIB_OBJS) $(CORE_LIB) $(TARGETS) $(DEPS) $(USER_LIB_OBJS) ${OBJDIR}