3 # Copyright (C) Dean Camera, 2012.
5 # dean [at] fourwalledcubicle [dot] com
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
14 # -----------------------------------------------------------------------------
15 # LUFA DFU Bootloader Buildsystem Makefile Module.
16 # -----------------------------------------------------------------------------
18 # Provides a set of targets to re-program a device using the open source
20 # -----------------------------------------------------------------------------
23 # program - Program target with application using avr-dude
25 # MANDATORY PARAMETERS:
27 # MCU - Microcontroller device model name
28 # TARGET - Application name
30 # OPTIONAL PARAMETERS:
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
36 # -----------------------------------------------------------------------------
39 MSG_AVRDUDE_CMD = ' [AVRDUDE] :'
41 # Default values of user-supplied variables
42 AVRDUDE_PROGRAMMER ?= jtagicemkii
44 AVRDUDE_FLAGS ?= -U flash:w:$(TARGET).hex
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.)
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)