aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Arduino.mk6
-rw-r--r--Teensy.mk2
-rw-r--r--arduino-mk-vars.md18
3 files changed, 24 insertions, 2 deletions
diff --git a/Arduino.mk b/Arduino.mk
index f7011de..a403342 100644
--- a/Arduino.mk
+++ b/Arduino.mk
@@ -1546,7 +1546,11 @@ endif
# -D - Disable auto erase for flash memory
# Note: -D is needed for Mega boards.
# (See https://github.com/sudar/Arduino-Makefile/issues/114#issuecomment-25011005)
-AVRDUDE_ARD_OPTS = -D -c $(AVRDUDE_ARD_PROGRAMMER) -b $(AVRDUDE_ARD_BAUDRATE) -P
+ifeq ($(AVRDUDE_AUTOERASE_FLASH), yes)
+else
+ AVRDUDE_ARD_OPTS = -D
+endif
+AVRDUDE_ARD_OPTS += -c $(AVRDUDE_ARD_PROGRAMMER) -b $(AVRDUDE_ARD_BAUDRATE) -P
ifeq ($(CURRENT_OS), WINDOWS)
# get_monitor_port checks to see if the monitor port exists, assuming it is
# a file. In Windows, avrdude needs the port in the format 'com1' which is
diff --git a/Teensy.mk b/Teensy.mk
index d4f23bc..35107ac 100644
--- a/Teensy.mk
+++ b/Teensy.mk
@@ -114,7 +114,7 @@ LDFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.cpu)
AMCU := $(call PARSE_BOARD,$(BOARD_TAG),build.mcu)
LDFLAGS += -Wl,--gc-sections,--relax
-LINKER_SCRIPTS = -T${ARDUINO_CORE_PATH}/${AMCU}.ld
+LINKER_SCRIPTS ?= -T${ARDUINO_CORE_PATH}/${AMCU}.ld
OTHER_LIBS = $(call PARSE_BOARD,$(BOARD_TAG),build.flags.libs)
CPUFLAGS = $(call PARSE_BOARD,$(BOARD_TAG),build.flags.cpu)
diff --git a/arduino-mk-vars.md b/arduino-mk-vars.md
index 3ee05d0..85fbd9f 100644
--- a/arduino-mk-vars.md
+++ b/arduino-mk-vars.md
@@ -1308,6 +1308,24 @@ AVRDUDE_CONF = /usr/share/arduino/hardware/tools/avrdude.conf
----
+### AVRDUDE_AUTOERASE_FLASH
+
+**Description:**
+
+Enable autoerase flash.
+
+By default disabled.
+
+**Example:**
+
+```Makefile
+AVRDUDE_AUTOERASE_FLASH = yes
+```
+
+**Requirement:** *Optional*
+
+----
+
### AVR_TOOLS_PATH
**Description:**