Clean up bootloader makefile comments.
[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 # Construct the flags to use for the various memory spaces
67 ifeq ($(ARCH), AVR8)
68 ATPROGRAM_FLASH_FLAGS := --chiperase --flash
69 ATPROGRAM_EEPROM_FLAGS := --eeprom
70 else ifeq ($(ARCH), XMEGA)
71 ATPROGRAM_FLASH_FLAGS := --erase --flash
72 ATPROGRAM_EEPROM_FLAGS := --eeprom
73 else ifeq ($(ARCH), UC3)
74 ATPROGRAM_FLASH_FLAGS := --erase
75 ATPROGRAM_EEPROM_FLAGS := --eeprom
76 else
77 $(error Unsupported architecture "$(ARCH)")
78 endif
79
80 atprogram: $(TARGET).elf $(MAKEFILE_LIST)
81 @echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" FLASH using \"$(ATPROGRAM_PROGRAMMER)\"
82 atprogram $(BASE_ATPROGRAM_FLAGS) program $(ATPROGRAM_FLASH_FLAGS) --file $<
83
84 atprogram-ee: $(TARGET).elf $(MAKEFILE_LIST)
85 @echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" EEPROM using \"$(ATPROGRAM_PROGRAMMER)\"
86 atprogram $(BASE_ATPROGRAM_FLAGS) program $(ATPROGRAM_EEPROM_FLAGS) --file $<
87
88 # Phony build targets for this module
89 .PHONY: atprogram atprogram-ee