Remove space padding on the current time when automatically generating AVR Studio...
[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 # Sanity-check values of mandatory user-supplied variables
40 MCU ?= $(error Makefile MCU value not set.)
41 TARGET ?= $(error Makefile TARGET value not set.)
42
43 # Output Messages
44 MSG_COPY_CMD = ' [CP] :'
45 MSG_REMOVE_CMD = ' [RM] :'
46 MSG_DFU_CMD = ' [DFU] :'
47
48 flip: $(TARGET).hex
49 @echo $(MSG_DFU_CMD) Programming FLASH with batchisp using \"$(TARGET).hex\"
50 batchisp -hardware usb -device $(MCU) -operation erase f
51 batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
52 batchisp -hardware usb -device $(MCU) -operation start reset 0
53
54 flip-ee: $(TARGET).eep
55 @echo $(MSG_DFU_CMD) Copying EEP file to temporary file \"$(TARGET)eep.hex\"
56 cp $(TARGET).eep $(TARGET)eep.hex
57 @echo $(MSG_DFU_CMD) Programming EEPROM with batchisp using \"$(TARGET).eep\"
58 batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
59 batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
60 batchisp -hardware usb -device $(MCU) -operation start reset 0
61 @echo $(MSG_DFU_CMD) Removing temporary file \"$(TARGET)eep.hex\"
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