Switch StaticAnalysisTest build test to use the new build system CPPCHECK module...
[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 AVRDUDE Programmer 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 ifeq ($(MCU),)
46 $(error Makefile MCU option cannot be blank)
47 endif
48 ifeq ($(TARGET),)
49 $(error Makefile TARGET option cannot be blank)
50 endif
51
52 # Default values of optionally user-supplied variables
53 AVRDUDE_PROGRAMMER ?= jtagicemkii
54 AVRDUDE_PORT ?= usb
55 AVRDUDE_FLAGS ?=
56
57 # Output Messages
58 MSG_AVRDUDE_CMD := ' [AVRDUDE] :'
59
60 AVRDUDE_FLASH_FLAGS = -U flash:w:$< $(AVRDUDE_FLAGS)
61 AVRDUDE_EEP_FLAGS = -U eeprom:w:$< $(AVRDUDE_FLAGS)
62
63 program: $(TARGET).hex $(MAKEFILE_LIST)
64 @echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" with settings \"$(AVRDUDE_FLASH_FLAGS)\" using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\"
65 avrdude -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) $(AVRDUDE_FLASH_FLAGS)
66
67 program-ee: $(TARGET).eep $(MAKEFILE_LIST)
68 @echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" with settings \"$(AVRDUDE_EEP_FLAGS)\" using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\"
69 avrdude -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) $(AVRDUDE_EEP_FLAGS)
70
71 # Phony build targets for this module
72 .PHONY: program program-ee