sanguino/firmwares/arduino-usbserial/makefile

Thu, 07 Jul 2016 12:23:34 +0200

author
mbayer
date
Thu, 07 Jul 2016 12:23:34 +0200
changeset 2
b373b0288715
permissions
-rw-r--r--

added missing sanguino files

2
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
1 # Hey Emacs, this is a -*- makefile -*-
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
2 #----------------------------------------------------------------------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
3 # WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
4 # >> Modified for use with the LUFA project. <<
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
5 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
6 # Released to the Public Domain
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
7 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
8 # Additional material for this makefile was written by:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
9 # Peter Fleury
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
10 # Tim Henigan
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
11 # Colin O'Flynn
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
12 # Reiner Patommel
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
13 # Markus Pfaff
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
14 # Sander Pool
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
15 # Frederik Rouleau
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
16 # Carlos Lamas
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
17 # Dean Camera
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
18 # Opendous Inc.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
19 # Denver Gingerich
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
20 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
21 #----------------------------------------------------------------------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
22 # On command line:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
23 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
24 # make all = Make software.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
25 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
26 # make clean = Clean out built project files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
27 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
28 # make coff = Convert ELF to AVR COFF.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
29 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
30 # make extcoff = Convert ELF to AVR Extended COFF.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
31 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
32 # make program = Download the hex file to the device, using avrdude.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
33 # Please customize the avrdude settings below first!
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
34 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
35 # make dfu = Download the hex file to the device, using dfu-programmer (must
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
36 # have dfu-programmer installed).
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
37 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
38 # make flip = Download the hex file to the device, using Atmel FLIP (must
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
39 # have Atmel FLIP installed).
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
40 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
41 # make dfu-ee = Download the eeprom file to the device, using dfu-programmer
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
42 # (must have dfu-programmer installed).
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
43 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
44 # make flip-ee = Download the eeprom file to the device, using Atmel FLIP
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
45 # (must have Atmel FLIP installed).
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
46 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
47 # make doxygen = Generate DoxyGen documentation for the project (must have
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
48 # DoxyGen installed)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
49 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
50 # make debug = Start either simulavr or avarice as specified for debugging,
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
51 # with avr-gdb or avr-insight as the front end for debugging.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
52 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
53 # make filename.s = Just compile filename.c into the assembler code only.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
54 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
55 # make filename.i = Create a preprocessed source file for use in submitting
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
56 # bug reports to the GCC project.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
57 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
58 # To rebuild project do "make clean" then "make all".
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
59 #----------------------------------------------------------------------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
60
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
61 # MCU name(s)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
62 # Since the ATMEGA8U2 part is not directly supported by the current
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
63 # versions of either avrdude or dfu-programmer, we specify a dummy
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
64 # part; AT90USB82 which is close enough in memory size and organization
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
65 MCU = atmega8u2
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
66 MCU_AVRDUDE = at90usb82
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
67 MCU_DFU = at90usb82
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
68
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
69 # Specify the Arduino model using the assigned PID. This is used by Descriptors.c
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
70 # to set PID and product descriptor string
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
71 # Uno PID:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
72 ARDUINO_MODEL_PID = 0x0001
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
73 # Mega 2560 PID:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
74 #ARDUINO_MODEL_PID = 0x0010
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
75
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
76
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
77 # Target board (see library "Board Types" documentation, NONE for projects not requiring
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
78 # LUFA board drivers). If USER is selected, put custom board drivers in a directory called
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
79 # "Board" inside the application directory.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
80 BOARD = USER
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
81
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
82
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
83 # Processor frequency.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
84 # This will define a symbol, F_CPU, in all source code files equal to the
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
85 # processor frequency in Hz. You can then use this symbol in your source code to
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
86 # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
87 # automatically to create a 32-bit value in your source code.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
88 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
89 # This will be an integer division of F_CLOCK below, as it is sourced by
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
90 # F_CLOCK after it has run through any CPU prescalers. Note that this value
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
91 # does not *change* the processor frequency - it should merely be updated to
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
92 # reflect the processor speed set externally so that the code can use accurate
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
93 # software delays.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
94 F_CPU = 16000000
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
95
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
96
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
97 # Input clock frequency.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
98 # This will define a symbol, F_CLOCK, in all source code files equal to the
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
99 # input clock frequency (before any prescaling is performed) in Hz. This value may
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
100 # differ from F_CPU if prescaling is used on the latter, and is required as the
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
101 # raw input clock is fed directly to the PLL sections of the AVR for high speed
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
102 # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
103 # at the end, this will be done automatically to create a 32-bit value in your
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
104 # source code.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
105 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
106 # If no clock division is performed on the input clock inside the AVR (via the
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
107 # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
108 F_CLOCK = $(F_CPU)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
109
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
110
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
111 # Output format. (can be srec, ihex, binary)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
112 FORMAT = ihex
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
113
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
114
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
115 # Target file name (without extension).
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
116 TARGET = Arduino-usbserial
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
117
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
118
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
119 # Object files directory
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
120 # To put object files in current directory, use a dot (.), do NOT make
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
121 # this an empty or blank macro!
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
122 OBJDIR = .
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
123
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
124
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
125 # Path to the LUFA library
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
126 LUFA_PATH = ../..
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
127
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
128
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
129 # LUFA library compile-time options
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
130 LUFA_OPTS = -D USB_DEVICE_ONLY
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
131 LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
132 LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
133 LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
134 LUFA_OPTS += -D INTERRUPT_CONTROL_ENDPOINT
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
135 LUFA_OPTS += -D DEVICE_STATE_AS_GPIOR=0
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
136 LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
137
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
138
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
139 # Create the LUFA source path variables by including the LUFA root makefile
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
140 include $(LUFA_PATH)/LUFA/makefile
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
141
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
142
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
143 # List C source files here. (C dependencies are automatically generated.)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
144 SRC = $(TARGET).c \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
145 Descriptors.c \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
146 $(LUFA_SRC_USB) \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
147 $(LUFA_SRC_USBCLASS) \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
148 $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Device.c \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
149 $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
150 $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/HostStandardReq.c \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
151 $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
152 $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
153 $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBController.c \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
154 $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
155 $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
156 $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
157 $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
158 $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
159 $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/CDC.c \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
160 $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/CDC.c
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
161
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
162
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
163 # List C++ source files here. (C dependencies are automatically generated.)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
164 CPPSRC =
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
165
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
166
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
167 # List Assembler source files here.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
168 # Make them always end in a capital .S. Files ending in a lowercase .s
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
169 # will not be considered source files but generated files (assembler
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
170 # output from the compiler), and will be deleted upon "make clean"!
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
171 # Even though the DOS/Win* filesystem matches both .s and .S the same,
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
172 # it will preserve the spelling of the filenames, and gcc itself does
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
173 # care about how the name is spelled on its command-line.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
174 ASRC =
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
175
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
176
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
177 # Optimization level, can be [0, 1, 2, 3, s].
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
178 # 0 = turn off optimization. s = optimize for size.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
179 # (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
180 OPT = s
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
181
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
182
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
183 # Debugging format.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
184 # Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
185 # AVR Studio 4.10 requires dwarf-2.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
186 # AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
187 DEBUG = dwarf-2
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
188
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
189
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
190 # List any extra directories to look for include files here.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
191 # Each directory must be seperated by a space.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
192 # Use forward slashes for directory separators.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
193 # For a directory that has spaces, enclose it in quotes.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
194 EXTRAINCDIRS = $(LUFA_PATH)/
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
195
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
196
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
197 # Compiler flag to set the C Standard level.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
198 # c89 = "ANSI" C
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
199 # gnu89 = c89 plus GCC extensions
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
200 # c99 = ISO C99 standard (not yet fully implemented)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
201 # gnu99 = c99 plus GCC extensions
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
202 CSTANDARD = -std=gnu99
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
203
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
204
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
205 # Place -D or -U options here for C sources
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
206 CDEFS = -DF_CPU=$(F_CPU)UL
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
207 CDEFS += -DF_CLOCK=$(F_CLOCK)UL
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
208 CDEFS += -DARDUINO_MODEL_PID=$(ARDUINO_MODEL_PID)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
209 CDEFS += -DBOARD=BOARD_$(BOARD)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
210 CDEFS += $(LUFA_OPTS)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
211 CDEFS += -DAVR_RESET_LINE_PORT="PORTD"
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
212 CDEFS += -DAVR_RESET_LINE_DDR="DDRD"
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
213 CDEFS += -DAVR_RESET_LINE_MASK="(1 << 7)"
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
214 CDEFS += -DTX_RX_LED_PULSE_MS=3
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
215 CDEFS += -DPING_PONG_LED_PULSE_MS=100
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
216
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
217 # Place -D or -U options here for ASM sources
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
218 ADEFS = -DF_CPU=$(F_CPU)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
219 ADEFS += -DF_CLOCK=$(F_CLOCK)UL
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
220 ADEFS += -DBOARD=BOARD_$(BOARD)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
221 ADEFS += $(LUFA_OPTS)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
222
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
223 # Place -D or -U options here for C++ sources
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
224 CPPDEFS = -DF_CPU=$(F_CPU)UL
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
225 CPPDEFS += -DF_CLOCK=$(F_CLOCK)UL
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
226 CPPDEFS += -DBOARD=BOARD_$(BOARD)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
227 CPPDEFS += $(LUFA_OPTS)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
228 #CPPDEFS += -D__STDC_LIMIT_MACROS
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
229 #CPPDEFS += -D__STDC_CONSTANT_MACROS
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
230
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
231
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
232
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
233 #---------------- Compiler Options C ----------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
234 # -g*: generate debugging information
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
235 # -O*: optimization level
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
236 # -f...: tuning, see GCC manual and avr-libc documentation
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
237 # -Wall...: warning level
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
238 # -Wa,...: tell GCC to pass this to the assembler.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
239 # -adhlns...: create assembler listing
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
240 CFLAGS = -g$(DEBUG)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
241 CFLAGS += $(CDEFS)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
242 CFLAGS += -O$(OPT)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
243 CFLAGS += -funsigned-char
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
244 CFLAGS += -funsigned-bitfields
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
245 CFLAGS += -ffunction-sections
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
246 CFLAGS += -fno-inline-small-functions
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
247 CFLAGS += -fpack-struct
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
248 CFLAGS += -fshort-enums
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
249 CFLAGS += -fno-strict-aliasing
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
250 CFLAGS += -Wall
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
251 CFLAGS += -Wstrict-prototypes
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
252 #CFLAGS += -mshort-calls
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
253 #CFLAGS += -fno-unit-at-a-time
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
254 #CFLAGS += -Wundef
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
255 #CFLAGS += -Wunreachable-code
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
256 #CFLAGS += -Wsign-compare
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
257 CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
258 CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
259 CFLAGS += $(CSTANDARD)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
260
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
261
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
262 #---------------- Compiler Options C++ ----------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
263 # -g*: generate debugging information
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
264 # -O*: optimization level
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
265 # -f...: tuning, see GCC manual and avr-libc documentation
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
266 # -Wall...: warning level
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
267 # -Wa,...: tell GCC to pass this to the assembler.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
268 # -adhlns...: create assembler listing
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
269 CPPFLAGS = -g$(DEBUG)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
270 CPPFLAGS += $(CPPDEFS)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
271 CPPFLAGS += -O$(OPT)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
272 CPPFLAGS += -funsigned-char
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
273 CPPFLAGS += -funsigned-bitfields
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
274 CPPFLAGS += -fpack-struct
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
275 CPPFLAGS += -fshort-enums
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
276 CPPFLAGS += -fno-exceptions
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
277 CPPFLAGS += -Wall
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
278 CPPFLAGS += -Wundef
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
279 CFLAGS += -Wundef
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
280 #CPPFLAGS += -mshort-calls
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
281 #CPPFLAGS += -fno-unit-at-a-time
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
282 #CPPFLAGS += -Wstrict-prototypes
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
283 #CPPFLAGS += -Wunreachable-code
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
284 #CPPFLAGS += -Wsign-compare
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
285 CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
286 CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
287 #CPPFLAGS += $(CSTANDARD)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
288
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
289
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
290 #---------------- Assembler Options ----------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
291 # -Wa,...: tell GCC to pass this to the assembler.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
292 # -adhlns: create listing
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
293 # -gstabs: have the assembler create line number information; note that
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
294 # for use in COFF files, additional information about filenames
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
295 # and function names needs to be present in the assembler source
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
296 # files -- see avr-libc docs [FIXME: not yet described there]
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
297 # -listing-cont-lines: Sets the maximum number of continuation lines of hex
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
298 # dump that will be displayed for a given single line of source input.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
299 ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
300
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
301
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
302 #---------------- Library Options ----------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
303 # Minimalistic printf version
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
304 PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
305
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
306 # Floating point printf version (requires MATH_LIB = -lm below)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
307 PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
308
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
309 # If this is left blank, then it will use the Standard printf version.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
310 PRINTF_LIB =
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
311 #PRINTF_LIB = $(PRINTF_LIB_MIN)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
312 #PRINTF_LIB = $(PRINTF_LIB_FLOAT)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
313
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
314
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
315 # Minimalistic scanf version
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
316 SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
317
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
318 # Floating point + %[ scanf version (requires MATH_LIB = -lm below)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
319 SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
320
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
321 # If this is left blank, then it will use the Standard scanf version.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
322 SCANF_LIB =
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
323 #SCANF_LIB = $(SCANF_LIB_MIN)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
324 #SCANF_LIB = $(SCANF_LIB_FLOAT)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
325
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
326
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
327 MATH_LIB = -lm
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
328
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
329
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
330 # List any extra directories to look for libraries here.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
331 # Each directory must be seperated by a space.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
332 # Use forward slashes for directory separators.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
333 # For a directory that has spaces, enclose it in quotes.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
334 EXTRALIBDIRS =
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
335
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
336
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
337
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
338 #---------------- External Memory Options ----------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
339
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
340 # 64 KB of external RAM, starting after internal RAM (ATmega128!),
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
341 # used for variables (.data/.bss) and heap (malloc()).
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
342 #EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
343
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
344 # 64 KB of external RAM, starting after internal RAM (ATmega128!),
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
345 # only used for heap (malloc()).
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
346 #EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
347
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
348 EXTMEMOPTS =
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
349
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
350
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
351
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
352 #---------------- Linker Options ----------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
353 # -Wl,...: tell GCC to pass this to linker.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
354 # -Map: create map file
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
355 # --cref: add cross reference to map file
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
356 LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
357 LDFLAGS += -Wl,--relax
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
358 LDFLAGS += -Wl,--gc-sections
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
359 LDFLAGS += $(EXTMEMOPTS)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
360 LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
361 LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
362 #LDFLAGS += -T linker_script.x
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
363
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
364
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
365
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
366 #---------------- Programming Options (avrdude) ----------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
367
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
368 # Programming hardware
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
369 # Type: avrdude -c ?
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
370 # to get a full listing.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
371 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
372 AVRDUDE_PROGRAMMER = avrispmkii
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
373
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
374 # com1 = serial port. Use lpt1 to connect to parallel port.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
375 AVRDUDE_PORT = usb
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
376
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
377 AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
378 #AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
379
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
380
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
381 # Uncomment the following if you want avrdude's erase cycle counter.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
382 # Note that this counter needs to be initialized first using -Yn,
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
383 # see avrdude manual.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
384 #AVRDUDE_ERASE_COUNTER = -y
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
385
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
386 # Uncomment the following if you do /not/ wish a verification to be
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
387 # performed after programming the device.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
388 #AVRDUDE_NO_VERIFY = -V
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
389
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
390 # Increase verbosity level. Please use this when submitting bug
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
391 # reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
392 # to submit bug reports.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
393 #AVRDUDE_VERBOSE = -v -v
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
394
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
395 AVRDUDE_FORCE = -F
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
396
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
397 AVRDUDE_FLAGS = -p $(MCU_AVRDUDE) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
398 AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
399 AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
400 AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
401 AVRDUDE_FLAGS += $(AVRDUDE_FORCE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
402
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
403
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
404
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
405 #---------------- Debugging Options ----------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
406
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
407 # For simulavr only - target MCU frequency.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
408 DEBUG_MFREQ = $(F_CPU)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
409
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
410 # Set the DEBUG_UI to either gdb or insight.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
411 # DEBUG_UI = gdb
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
412 DEBUG_UI = insight
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
413
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
414 # Set the debugging back-end to either avarice, simulavr.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
415 DEBUG_BACKEND = avarice
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
416 #DEBUG_BACKEND = simulavr
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
417
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
418 # GDB Init Filename.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
419 GDBINIT_FILE = __avr_gdbinit
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
420
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
421 # When using avarice settings for the JTAG
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
422 JTAG_DEV = /dev/com1
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
423
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
424 # Debugging port used to communicate between GDB / avarice / simulavr.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
425 DEBUG_PORT = 4242
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
426
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
427 # Debugging host used to communicate between GDB / avarice / simulavr, normally
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
428 # just set to localhost unless doing some sort of crazy debugging when
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
429 # avarice is running on a different computer.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
430 DEBUG_HOST = localhost
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
431
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
432
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
433
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
434 #============================================================================
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
435
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
436
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
437 # Define programs and commands.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
438 SHELL = sh
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
439 CC = avr-gcc
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
440 OBJCOPY = avr-objcopy
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
441 OBJDUMP = avr-objdump
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
442 SIZE = avr-size
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
443 AR = avr-ar rcs
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
444 NM = avr-nm
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
445 AVRDUDE = avrdude
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
446 REMOVE = rm -f
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
447 REMOVEDIR = rm -rf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
448 COPY = cp
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
449 WINSHELL = cmd
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
450
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
451 # Define Messages
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
452 # English
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
453 MSG_ERRORS_NONE = Errors: none
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
454 MSG_BEGIN = -------- begin --------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
455 MSG_END = -------- end --------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
456 MSG_SIZE_BEFORE = Size before:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
457 MSG_SIZE_AFTER = Size after:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
458 MSG_COFF = Converting to AVR COFF:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
459 MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
460 MSG_FLASH = Creating load file for Flash:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
461 MSG_EEPROM = Creating load file for EEPROM:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
462 MSG_EXTENDED_LISTING = Creating Extended Listing:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
463 MSG_SYMBOL_TABLE = Creating Symbol Table:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
464 MSG_LINKING = Linking:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
465 MSG_COMPILING = Compiling C:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
466 MSG_COMPILING_CPP = Compiling C++:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
467 MSG_ASSEMBLING = Assembling:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
468 MSG_CLEANING = Cleaning project:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
469 MSG_CREATING_LIBRARY = Creating library:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
470
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
471
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
472
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
473
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
474 # Define all object files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
475 OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
476
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
477 # Define all listing files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
478 LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
479
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
480
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
481 # Compiler flags to generate dependency files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
482 GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
483
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
484
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
485 # Combine all necessary flags and optional flags.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
486 # Add target processor to flags.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
487 ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
488 ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
489 ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
490
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
491
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
492
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
493
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
494
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
495 # Default target.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
496 #all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
497 all: begin gccversion sizebefore build showliboptions showtarget sizeafter end
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
498
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
499 # Change the build target to build a HEX file or a library.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
500 build: elf hex eep lss sym asm
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
501 #build: lib
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
502
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
503
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
504 elf: $(TARGET).elf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
505 hex: $(TARGET).hex
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
506 eep: $(TARGET).eep
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
507 lss: $(TARGET).lss
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
508 sym: $(TARGET).sym
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
509 asm: $(TARGET).s
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
510 LIBNAME=lib$(TARGET).a
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
511 lib: $(LIBNAME)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
512
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
513
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
514
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
515 # Eye candy.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
516 # AVR Studio 3.x does not check make's exit code but relies on
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
517 # the following magic strings to be generated by the compile job.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
518 begin:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
519 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
520 @echo $(MSG_BEGIN)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
521
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
522 end:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
523 @echo $(MSG_END)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
524 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
525
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
526
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
527 # Display size of file.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
528 HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
529 ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
530 MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
531 FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
532
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
533 sizebefore:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
534 @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
535 2>/dev/null; echo; fi
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
536
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
537 sizeafter:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
538 @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
539 2>/dev/null; echo; fi
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
540
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
541 #$(LUFA_PATH)/LUFA/LUFA_Events.lst:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
542 # @make -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
543
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
544 #checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
545 # @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
546 # @echo Checking for invalid events...
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
547 # @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
548 # grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
549 # @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
550 # @if test -s InvalidEvents.tmp; then exit 1; fi
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
551
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
552 showliboptions:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
553 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
554 @echo ---- Compile Time Library Options ----
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
555 @for i in $(LUFA_OPTS:-D%=%); do \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
556 echo $$i; \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
557 done
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
558 @echo --------------------------------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
559
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
560 showtarget:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
561 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
562 @echo --------- Target Information ---------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
563 @echo AVR Model: $(MCU)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
564 @echo Board: $(BOARD)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
565 @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
566 @echo --------------------------------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
567
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
568
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
569 # Display compiler version information.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
570 gccversion :
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
571 @$(CC) --version
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
572
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
573
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
574 # Program the device.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
575 program: $(TARGET).hex $(TARGET).eep
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
576 $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
577
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
578 flip: $(TARGET).hex
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
579 batchisp -hardware usb -device $(MCU_DFU) -operation erase f
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
580 batchisp -hardware usb -device $(MCU_DFU) -operation loadbuffer $(TARGET).hex program
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
581 batchisp -hardware usb -device $(MCU_DFU) -operation start reset 0
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
582
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
583 dfu: $(TARGET).hex
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
584 dfu-programmer $(MCU_DFU) erase
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
585 dfu-programmer $(MCU_DFU) flash --debug 1 $(TARGET).hex
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
586 dfu-programmer $(MCU_DFU) reset
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
587
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
588
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
589 flip-ee: $(TARGET).hex $(TARGET).eep
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
590 $(COPY) $(TARGET).eep $(TARGET)eep.hex
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
591 batchisp -hardware usb -device $(MCU_DFU) -operation memory EEPROM erase
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
592 batchisp -hardware usb -device $(MCU_DFU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
593 batchisp -hardware usb -device $(MCU_DFU) -operation start reset 0
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
594 $(REMOVE) $(TARGET)eep.hex
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
595
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
596 dfu-ee: $(TARGET).hex $(TARGET).eep
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
597 dfu-programmer $(MCU_DFU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
598 dfu-programmer $(MCU_DFU) reset
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
599
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
600
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
601 # Generate avr-gdb config/init file which does the following:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
602 # define the reset signal, load the target file, connect to target, and set
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
603 # a breakpoint at main().
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
604 gdb-config:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
605 @$(REMOVE) $(GDBINIT_FILE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
606 @echo define reset >> $(GDBINIT_FILE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
607 @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
608 @echo end >> $(GDBINIT_FILE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
609 @echo file $(TARGET).elf >> $(GDBINIT_FILE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
610 @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
611 ifeq ($(DEBUG_BACKEND),simulavr)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
612 @echo load >> $(GDBINIT_FILE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
613 endif
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
614 @echo break main >> $(GDBINIT_FILE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
615
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
616 debug: gdb-config $(TARGET).elf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
617 ifeq ($(DEBUG_BACKEND), avarice)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
618 @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
619 @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
620 $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
621 @$(WINSHELL) /c pause
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
622
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
623 else
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
624 @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
625 $(DEBUG_MFREQ) --port $(DEBUG_PORT)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
626 endif
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
627 @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
628
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
629
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
630
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
631
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
632 # Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
633 COFFCONVERT = $(OBJCOPY) --debugging
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
634 COFFCONVERT += --change-section-address .data-0x800000
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
635 COFFCONVERT += --change-section-address .bss-0x800000
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
636 COFFCONVERT += --change-section-address .noinit-0x800000
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
637 COFFCONVERT += --change-section-address .eeprom-0x810000
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
638
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
639
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
640
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
641 coff: $(TARGET).elf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
642 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
643 @echo $(MSG_COFF) $(TARGET).cof
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
644 $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
645
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
646
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
647 extcoff: $(TARGET).elf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
648 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
649 @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
650 $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
651
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
652
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
653
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
654 # Create final output files (.hex, .eep) from ELF output file.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
655 %.hex: %.elf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
656 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
657 @echo $(MSG_FLASH) $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
658 $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock $< $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
659
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
660 %.eep: %.elf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
661 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
662 @echo $(MSG_EEPROM) $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
663 -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
664 --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
665
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
666 # Create extended listing file from ELF output file.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
667 %.lss: %.elf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
668 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
669 @echo $(MSG_EXTENDED_LISTING) $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
670 $(OBJDUMP) -h -S -z $< > $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
671
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
672 # Create a symbol table from ELF output file.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
673 %.sym: %.elf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
674 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
675 @echo $(MSG_SYMBOL_TABLE) $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
676 $(NM) -n $< > $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
677
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
678
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
679
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
680 # Create library from object files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
681 .SECONDARY : $(TARGET).a
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
682 .PRECIOUS : $(OBJ)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
683 %.a: $(OBJ)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
684 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
685 @echo $(MSG_CREATING_LIBRARY) $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
686 $(AR) $@ $(OBJ)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
687
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
688
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
689 # Link: create ELF output file from object files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
690 .SECONDARY : $(TARGET).elf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
691 .PRECIOUS : $(OBJ)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
692 %.elf: $(OBJ)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
693 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
694 @echo $(MSG_LINKING) $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
695 $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
696
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
697
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
698 # Compile: create object files from C source files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
699 $(OBJDIR)/%.o : %.c
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
700 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
701 @echo $(MSG_COMPILING) $<
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
702 $(CC) -c $(ALL_CFLAGS) $< -o $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
703
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
704
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
705 # Compile: create object files from C++ source files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
706 $(OBJDIR)/%.o : %.cpp
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
707 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
708 @echo $(MSG_COMPILING_CPP) $<
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
709 $(CC) -c $(ALL_CPPFLAGS) $< -o $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
710
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
711
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
712 # Compile: create assembler files from C source files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
713 %.s : %.c
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
714 $(CC) -S $(ALL_CFLAGS) $< -o $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
715
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
716
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
717 # Compile: create assembler files from C++ source files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
718 %.s : %.cpp
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
719 $(CC) -S $(ALL_CPPFLAGS) $< -o $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
720
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
721
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
722 # Assemble: create object files from assembler source files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
723 $(OBJDIR)/%.o : %.S
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
724 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
725 @echo $(MSG_ASSEMBLING) $<
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
726 $(CC) -c $(ALL_ASFLAGS) $< -o $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
727
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
728
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
729 # Create preprocessed source for use in sending a bug report.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
730 %.i : %.c
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
731 $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
732
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
733
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
734 # Target: clean project.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
735 clean: begin clean_list clean_binary end
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
736
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
737 clean_binary:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
738 $(REMOVE) $(TARGET).hex
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
739
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
740 clean_list:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
741 @echo $(MSG_CLEANING)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
742 $(REMOVE) $(TARGET).hex
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
743 $(REMOVE) $(TARGET).eep
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
744 $(REMOVE) $(TARGET).cof
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
745 $(REMOVE) $(TARGET).elf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
746 $(REMOVE) $(TARGET).map
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
747 $(REMOVE) $(TARGET).sym
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
748 $(REMOVE) $(TARGET).lss
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
749 $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
750 $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
751 $(REMOVE) $(SRC:.c=.s)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
752 $(REMOVE) $(SRC:.c=.d)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
753 $(REMOVE) $(SRC:.c=.i)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
754 $(REMOVEDIR) .dep
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
755
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
756 doxygen:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
757 @echo Generating Project Documentation...
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
758 @doxygen Doxygen.conf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
759 @echo Documentation Generation Complete.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
760
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
761 clean_doxygen:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
762 rm -rf Documentation
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
763
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
764 # Create object files directory
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
765 $(shell mkdir $(OBJDIR) 2>/dev/null)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
766
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
767
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
768 # Include the dependency files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
769 -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
770
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
771
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
772 # Listing of phony targets.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
773 .PHONY : all begin finish end sizebefore sizeafter gccversion \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
774 build elf hex eep lss sym coff extcoff doxygen clean \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
775 clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
776 debug gdb-config

mercurial