fdc5bc1d7879f7fa6fd71ba534e217756fa4c534
[pub/USBasp.git] / LUFA / Build / lufa.avrdude.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 += AVRDUDE
10 LUFA_BUILD_TARGETS += program
11 LUFA_BUILD_MANDATORY_VARS += MCU TARGET
12 LUFA_BUILD_OPTIONAL_VARS += AVRDUDE_PROGRAMMER AVRDUDE_PORT AVRDUDE_FLAGS
13
14 # -----------------------------------------------------------------------------
15 # LUFA DFU Bootloader Buildsystem Makefile Module.
16 # -----------------------------------------------------------------------------
17 # DESCRIPTION:
18 # Provides a set of targets to re-program a device using the open source
19 # avr-dude utility.
20 # -----------------------------------------------------------------------------
21 # TARGETS:
22 #
23 # program - Program target with application using avr-dude
24 #
25 # MANDATORY PARAMETERS:
26 #
27 # MCU - Microcontroller device model name
28 # TARGET - Application name
29 #
30 # OPTIONAL PARAMETERS:
31 #
32 # AVRDUDE_PROGRAMMER - Name of programming hardware to use
33 # AVRDUDE_PORT - Name of communication port to use
34 # AVRDUDE_FLAGS - Flags to pass to avr-dude
35 #
36 # -----------------------------------------------------------------------------
37
38 # Output Messages
39 MSG_AVRDUDE_CMD = ' [AVRDUDE] :'
40
41 # Default values of user-supplied variables
42 AVRDUDE_PROGRAMMER ?= jtagicemkii
43 AVRDUDE_PORT ?= usb
44 AVRDUDE_FLAGS ?= -U flash:w:$(TARGET).hex
45
46 # Sanity check the user MCU and TARGET makefile options
47 MCU ?= $(error Makefile MCU value not set.)
48 TARGET ?= $(error Makefile TARGET value not set.)
49
50 program: $(TARGET).hex
51 @echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" with settings \"$(AVRDUDE_FLAGS)\" using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\"
52 avrdude -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) $(AVRDUDE_FLAGS)