ac5edeadce679beb31531c2981f3c083b0342156
[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 # Output Messages
40 MSG_DFU_CMD = ' [DFU] :'
41
42 # Sanity check the user MCU and TARGET makefile options
43 ifeq ($(MCU),)
44 $(error Makefile MCU value not set.)
45 endif
46 ifeq ($(TARGET),)
47 $(error Makefile TARGET value not set.)
48 endif
49
50 flip: $(TARGET).hex
51 @echo $(MSG_DFU_CMD) Programming FLASH with batchisp using \"$(TARGET).hex\"
52 batchisp -hardware usb -device $(MCU) -operation erase f
53 batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
54 batchisp -hardware usb -device $(MCU) -operation start reset 0
55
56 flip-ee: $(TARGET).eep
57 cp $(TARGET).eep $(TARGET)eep.hex
58 @echo $(MSG_DFU_CMD) Programming EEPROM with batchisp using \"$(TARGET).eep\"
59 batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
60 batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
61 batchisp -hardware usb -device $(MCU) -operation start reset 0
62 rm $(TARGET)eep.hex
63
64 dfu: $(TARGET).hex
65 @echo $(MSG_DFU_CMD) Programming FLASH with dfu-programmer using \"$(TARGET).hex\"
66 dfu-programmer $(MCU) erase
67 dfu-programmer $(MCU) flash $(TARGET).hex
68 dfu-programmer $(MCU) reset
69
70 dfu-ee: $(TARGET).hex $(TARGET).eep
71 @echo $(MSG_DFU_CMD) Programming EEPROM with dfu-programmer using \"$(TARGET).eep\"
72 dfu-programmer $(MCU) eeprom-flash $(TARGET).eep
73 dfu-programmer $(MCU) reset