Fix typo in the UC3 host pipe driver. Improve library TAR export exclusion filetype...
[pub/USBasp.git] / LUFA / Build / lufa.atprogram.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 += ATPROGRAM
10 LUFA_BUILD_TARGETS += atprogram atprogram-ee
11 LUFA_BUILD_MANDATORY_VARS += MCU TARGET
12 LUFA_BUILD_OPTIONAL_VARS += ATPROGRAM_PROGRAMMER ATPROGRAM_INTERFACE ATPROGRAM_PORT
13
14 # -----------------------------------------------------------------------------
15 # LUFA ATPROGRAM Programmer Buildsystem Makefile Module.
16 # -----------------------------------------------------------------------------
17 # DESCRIPTION:
18 # Provides a set of targets to re-program a device using the Atmel atprogram
19 # utility in AVR Studio 5.x and Atmel Studio 6.0 onwards.
20 # -----------------------------------------------------------------------------
21 # TARGETS:
22 #
23 # atprogram - Program target FLASH with application using
24 # atprogram
25 # atprogram-ee - Program target EEPROM with application data
26 # using atprogram
27 #
28 # MANDATORY PARAMETERS:
29 #
30 # MCU - Microcontroller device model name
31 # TARGET - Application name
32 #
33 # OPTIONAL PARAMETERS:
34 #
35 # ATPROGRAM_PROGRAMMER - Name of programming hardware to use
36 # ATPROGRAM_INTERFACE - Name of programming interface to use
37 # ATPROGRAM_PORT - Name of communication port to use
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 ATPROGRAM_PROGRAMMER ?= jtagice3
54 ATPROGRAM_INTERFACE ?= jtag
55 ATPROGRAM_PORT ?=
56
57 # Output Messages
58 MSG_ATPROGRAM_CMD := ' [ATPRGRM] :'
59
60 # Construct base atprogram command flags
61 BASE_ATPROGRAM_FLAGS := --tool $(ATPROGRAM_PROGRAMMER) --interface $(ATPROGRAM_INTERFACE) --device $(MCU)
62 ifneq ($(ATPROGRAM_PORT),)
63 BASE_ATPROGRAM_FLAGS += --port $(ATPROGRAM_PORT)
64 endif
65
66 atprogram: $(TARGET).hex $(MAKEFILE_LIST)
67 @echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" FLASH using \"$(ATPROGRAM_PROGRAMMER)\"
68 atprogram $(BASE_ATPROGRAM_FLAGS) program --chiperase --flash --file $(TARGET).hex
69
70 atprogram-ee: $(TARGET).eep $(MAKEFILE_LIST)
71 @echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" EEPROM using \"$(ATPROGRAM_PROGRAMMER)\"
72 atprogram $(BASE_ATPROGRAM_FLAGS) program --eeprom --file $(TARGET).eep
73
74 # Phony build targets for this module
75 .PHONY: atprogram atprogram-ee