From ea8008927b222724b0f460f33f34db83a2462e87 Mon Sep 17 00:00:00 2001 From: hhgarnes Date: Mon, 1 Jun 2015 20:30:03 +0200 Subject: [PATCH] Update Arduino.mk Update the mcu decoupling to enable local overrides. Update the -D code to only turn it off for attiny84. --- Arduino.mk | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Arduino.mk b/Arduino.mk index d8bf51b..9c973b2 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -1284,20 +1284,22 @@ endif # Decouple the mcu between the compiler options (-mmcu) and the avrdude options (-p). # This is needed to be able to compile for attiny84a but specify the upload mcu as attiny84. -ifeq ($(MCU), attiny84a) - AVRDUDE_MCU = attiny84 -else +# We default to picking the -mmcu flag, but you can override this by setting +# AVRDUDE_MCU in your makefile. +ifndef AVRDUDE_MCU AVRDUDE_MCU = $(MCU) endif # -D - Disable auto erase for flash memory # -D is needed for Mega boards. (See https://github.com/sudar/Arduino-Makefile/issues/114#issuecomment-25011005) -# -D must not be present for attiny84a (unknown for attiny84) -ifneq ($(AVRDUDE_MCU), attiny84) - AVRDUDE_OPTS += -D +# -D must NOT be present for attiny84a (unknown for attiny84) +ifeq ($(AVRDUDE_MCU), attiny84) + AVRDUDE_ERASE_FLASH_OPT = +else + AVRDUDE_ERASE_FLASH_OPT = -D endif -AVRDUDE_COM_OPTS = $(AVRDUDE_OPTS) -p $(AVRDUDE_MCU) +AVRDUDE_COM_OPTS = $(AVRDUDE_OPTS) $(AVRDUDE_ERASE_FLASH_OPT) -p $(AVRDUDE_MCU) ifdef AVRDUDE_CONF AVRDUDE_COM_OPTS += -C $(AVRDUDE_CONF) endif