9586ae211d0c900bbe56992000e00ce93dec5f6d
[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 # Sanity-check values of mandatory user-supplied variables
39 MCU ?= $(error Makefile MCU value not set.)
40 TARGET ?= $(error Makefile TARGET value not set.)
41
42 # Default values of optionally user-supplied variables
43 AVRDUDE_PROGRAMMER ?= jtagicemkii
44 AVRDUDE_PORT ?= usb
45 AVRDUDE_FLAGS ?= -U flash:w:$(TARGET).hex
46
47 # Output Messages
48 MSG_AVRDUDE_CMD = ' [AVRDUDE] :'
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)