From b351ab375d09c3890635552fe3535da66d29cde1 Mon Sep 17 00:00:00 2001 From: Lorenzo Delana Date: Sat, 13 Oct 2018 02:21:47 +0200 Subject: [PATCH 1/2] Update arduino-mk-vars.md --- arduino-mk-vars.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arduino-mk-vars.md b/arduino-mk-vars.md index b6b9b37..7434316 100644 --- a/arduino-mk-vars.md +++ b/arduino-mk-vars.md @@ -1281,6 +1281,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:** From ec1947a7cda724b4de7783a1f74abf31ae59e955 Mon Sep 17 00:00:00 2001 From: Lorenzo Delana Date: Sat, 13 Oct 2018 02:28:32 +0200 Subject: [PATCH 2/2] allow to enable AVRDUDE_AUTOERASE_FLASH --- Arduino.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Arduino.mk b/Arduino.mk index 0f34a82..2e324e5 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -1490,7 +1490,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