Ensure build tests use the system provided $(MAKE) variable to determine the command...
[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 program_ee
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 FLASH with application using
24 # avrdude
25 # program_ee - Program target EEPROM with application data
26 # using avrdude
27 #
28 # MANDATORY PARAMETERS:
29 #
30 # MCU - Microcontroller device model name
31 # TARGET - Application name
32 #
33 # OPTIONAL PARAMETERS:
34 #
35 # AVRDUDE_PROGRAMMER - Name of programming hardware to use
36 # AVRDUDE_PORT - Name of communication port to use
37 # AVRDUDE_FLAGS - Flags to pass to avr-dude
38 #
39 # -----------------------------------------------------------------------------
40
41 # Sanity-check values of mandatory user-supplied variables
42 MCU ?= $(error Makefile MCU value not set.)
43 TARGET ?= $(error Makefile TARGET value not set.)
44
45 # Default values of optionally user-supplied variables
46 AVRDUDE_PROGRAMMER ?= jtagicemkii
47 AVRDUDE_PORT ?= usb
48 AVRDUDE_FLAGS ?=
49
50 # Output Messages
51 MSG_AVRDUDE_CMD = ' [AVRDUDE] :'
52
53 AVRDUDE_FLASH_FLAGS = -U flash:w:$< $(AVRDUDE_FLAGS)
54 AVRDUDE_EEP_FLAGS = -U eeprom:w:$< $(AVRDUDE_FLAGS)
55
56 program: $(TARGET).hex
57 @echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" with settings \"$(AVRDUDE_FLASH_FLAGS)\" using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\"
58 avrdude -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) $(AVRDUDE_FLASH_FLAGS)
59
60 program_ee: $(TARGET).eep
61 @echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" with settings \"$(AVRDUDE_EEP_FLAGS)\" using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\"
62 avrdude -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) $(AVRDUDE_EEP_FLAGS)