Add compile time warnings for experimental architectures, for those that don't read...
[pub/USBasp.git] / LUFA / Build / lufa.dfu.in
1 #
2 # LUFA Library
3 # Copyright (C) Dean Camera, 2012.
4 #
5 # dean [at] fourwalledcubicle [dot] com
6 # www.lufa-lib.org
7 #
8
9 LUFA_BUILD_MODULES += DFU
10 LUFA_BUILD_TARGETS += flip flip-ee dfu dfu-ee
11 LUFA_BUILD_MANDATORY_VARS += MCU TARGET
12 LUFA_BUILD_OPTIONAL_VARS +=
13
14 # -----------------------------------------------------------------------------
15 # LUFA DFU Bootloader Buildsystem Makefile Module.
16 # -----------------------------------------------------------------------------
17 # DESCRIPTION:
18 # Provides a set of targets to re-program a device currently running a DFU
19 # class bootloader with a project's FLASH and EEPROM files.
20 # -----------------------------------------------------------------------------
21 # TARGETS:
22 #
23 # flip - Program FLASH into target via Atmel FLIP
24 # flip-ee - Program EEPROM into target via Atmel FLIP
25 # dfu - Program FLASH into target via dfu-programmer
26 # dfu-ee - Program EEPROM into target via dfu-programmer
27 #
28 # MANDATORY PARAMETERS:
29 #
30 # MCU - Microcontroller device model name
31 # TARGET - Application name
32 #
33 # OPTIONAL PARAMETERS:
34 #
35 # (None)
36 #
37 # -----------------------------------------------------------------------------
38
39 ERROR_IF_UNSET = $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
40 ERROR_IF_EMPTY = $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
41 ERROR_IF_NONBOOL = $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
42
43 # Sanity-check values of mandatory user-supplied variables
44 $(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
45 $(call ERROR_IF_EMPTY, MCU)
46 $(call ERROR_IF_EMPTY, TARGET)
47
48 # Output Messages
49 MSG_COPY_CMD := ' [CP] :'
50 MSG_REMOVE_CMD := ' [RM] :'
51 MSG_DFU_CMD := ' [DFU] :'
52
53 flip: $(TARGET).hex $(MAKEFILE_LIST)
54 @echo $(MSG_DFU_CMD) Programming FLASH with batchisp using \"$<\"
55 batchisp -hardware usb -device $(MCU) -operation erase f
56 batchisp -hardware usb -device $(MCU) -operation loadbuffer $< program
57 batchisp -hardware usb -device $(MCU) -operation start reset 0
58
59 flip-ee: $(TARGET).eep $(MAKEFILE_LIST)
60 @echo $(MSG_DFU_CMD) Copying EEP file to temporary file \"$<.hex\"
61 cp $< $<.hex
62 @echo $(MSG_DFU_CMD) Programming EEPROM with batchisp using \"$<.hex\"
63 batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
64 batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $<.hex program
65 batchisp -hardware usb -device $(MCU) -operation start reset 0
66 @echo $(MSG_DFU_CMD) Removing temporary file \"$<.hex\"
67 rm $<.hex
68
69 dfu: $(TARGET).hex $(MAKEFILE_LIST)
70 @echo $(MSG_DFU_CMD) Programming FLASH with dfu-programmer using \"$<\"
71 dfu-programmer $(MCU) erase
72 dfu-programmer $(MCU) flash $<
73 dfu-programmer $(MCU) reset
74
75 dfu-ee: $(TARGET).eep $(MAKEFILE_LIST)
76 @echo $(MSG_DFU_CMD) Programming EEPROM with dfu-programmer using \"$<\"
77 dfu-programmer $(MCU) eeprom-flash $<
78 dfu-programmer $(MCU) reset
79
80 # Phony build targets for this module
81 .PHONY: flip flip-ee dfu dfu-ee