From 511348fb13e24689d7a463973a17baa168fb382b Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Wed, 6 Jun 2012 19:10:52 +0000 Subject: [PATCH] Improve ATPROGRAM build module to support UC3 devices and use intelligent erase for XMEGA and UC3. --- LUFA/Build/lufa.atprogram.in | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/LUFA/Build/lufa.atprogram.in b/LUFA/Build/lufa.atprogram.in index f42354c193..48d1e5c1f4 100644 --- a/LUFA/Build/lufa.atprogram.in +++ b/LUFA/Build/lufa.atprogram.in @@ -63,13 +63,27 @@ ifneq ($(ATPROGRAM_PORT),) BASE_ATPROGRAM_FLAGS += --port $(ATPROGRAM_PORT) endif -atprogram: $(TARGET).hex $(MAKEFILE_LIST) +# Construct the flags to use for the various memory spaces +ifeq ($(ARCH), AVR8) + ATPROGRAM_FLASH_FLAGS := --chiperase --flash + ATPROGRAM_EEPROM_FLAGS := --eeprom +else ifeq ($(ARCH), XMEGA) + ATPROGRAM_FLASH_FLAGS := --erase --flash + ATPROGRAM_EEPROM_FLAGS := --eeprom +else ifeq ($(ARCH), UC3) + ATPROGRAM_FLASH_FLAGS := --erase + ATPROGRAM_EEPROM_FLAGS := --eeprom +else + $(error Unsupported architecture "$(ARCH)") +endif + +atprogram: $(TARGET).elf $(MAKEFILE_LIST) @echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" FLASH using \"$(ATPROGRAM_PROGRAMMER)\" - atprogram $(BASE_ATPROGRAM_FLAGS) program --chiperase --flash --file $(TARGET).hex + atprogram $(BASE_ATPROGRAM_FLAGS) program $(ATPROGRAM_FLASH_FLAGS) --file $< -atprogram-ee: $(TARGET).eep $(MAKEFILE_LIST) +atprogram-ee: $(TARGET).elf $(MAKEFILE_LIST) @echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" EEPROM using \"$(ATPROGRAM_PROGRAMMER)\" - atprogram $(BASE_ATPROGRAM_FLAGS) program --eeprom --file $(TARGET).eep + atprogram $(BASE_ATPROGRAM_FLAGS) program $(ATPROGRAM_EEPROM_FLAGS) --file $< # Phony build targets for this module .PHONY: atprogram atprogram-ee