Fix mismatched aliased event and event stub function prototypes.
[pub/USBasp.git] / LUFA / Build / DMBS / DMBS / atprogram.mk
1 #
2 # DMBS Build System
3 # Released into the public domain.
4 #
5 # dean [at] fourwalledcubicle [dot] com
6 # www.fourwalledcubicle.com
7 #
8
9 DMBS_BUILD_MODULES += ATPROGRAM
10 DMBS_BUILD_TARGETS += atprogram atprogram-ee
11 DMBS_BUILD_MANDATORY_VARS += MCU TARGET
12 DMBS_BUILD_OPTIONAL_VARS += ATPROGRAM_PROGRAMMER ATPROGRAM_INTERFACE ATPROGRAM_PORT
13 DMBS_BUILD_PROVIDED_VARS +=
14 DMBS_BUILD_PROVIDED_MACROS +=
15
16 # Import the CORE module of DMBS
17 DMBS_MODULE_PATH := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
18 include $(DMBS_MODULE_PATH)/core.mk
19
20 # Default values of optionally user-supplied variables
21 ATPROGRAM_PROGRAMMER ?= atmelice
22 ATPROGRAM_INTERFACE ?= jtag
23 ATPROGRAM_PORT ?=
24
25 # Sanity check user supplied values
26 $(foreach MANDATORY_VAR, $(DMBS_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
27 $(call ERROR_IF_EMPTY, MCU)
28 $(call ERROR_IF_EMPTY, TARGET)
29 $(call ERROR_IF_EMPTY, ATPROGRAM_PROGRAMMER)
30 $(call ERROR_IF_EMPTY, ATPROGRAM_INTERFACE)
31
32 # Output Messages
33 MSG_ATPROGRAM_CMD := ' [ATPRGRM] :'
34
35 # Construct base atprogram command flags
36 BASE_ATPROGRAM_FLAGS := --tool $(ATPROGRAM_PROGRAMMER) --interface $(ATPROGRAM_INTERFACE) --device $(MCU)
37 ifneq ($(ATPROGRAM_PORT),)
38 BASE_ATPROGRAM_FLAGS += --port $(ATPROGRAM_PORT)
39 endif
40
41 # Construct the flags to use for the various memory spaces
42 ifeq ($(ARCH), AVR8)
43 ATPROGRAM_FLASH_FLAGS := --chiperase --flash
44 ATPROGRAM_EEPROM_FLAGS := --eeprom
45 else ifeq ($(ARCH), XMEGA)
46 ATPROGRAM_FLASH_FLAGS := --erase --flash
47 ATPROGRAM_EEPROM_FLAGS := --eeprom
48 else ifeq ($(ARCH), UC3)
49 ATPROGRAM_FLASH_FLAGS := --erase
50 ATPROGRAM_EEPROM_FLAGS := --eeprom
51 else
52 $(error Unsupported architecture "$(ARCH)")
53 endif
54
55 # Programs in the target FLASH memory using ATPROGRAM
56 atprogram: $(TARGET).elf $(MAKEFILE_LIST)
57 @echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" FLASH using \"$(ATPROGRAM_PROGRAMMER)\"
58 atprogram $(BASE_ATPROGRAM_FLAGS) program $(ATPROGRAM_FLASH_FLAGS) --file $<
59
60 # Programs in the target EEPROM memory using ATPROGRAM
61 atprogram-ee: $(TARGET).elf $(MAKEFILE_LIST)
62 @echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" EEPROM using \"$(ATPROGRAM_PROGRAMMER)\"
63 atprogram $(BASE_ATPROGRAM_FLAGS) program $(ATPROGRAM_EEPROM_FLAGS) --file $<
64
65 # Phony build targets for this module
66 .PHONY: $(DMBS_BUILD_TARGETS)