19
19
# program name should not be changed...
22
# The default behavior is to build using tools that are in the users
23
# current path variables, but we can also build using an installed
24
# Arduino user IDE setup, or the Arduino source tree.
25
# Uncomment this next lines to build within the arduino environment,
26
# using the arduino-included avrgcc toolset (mac and pc)
22
33
# enter the parameters for the avrdude isp tool
25
36
ISPSPEED = -b 115200
27
38
MCU_TARGET = atmega168
28
LDSECTION = --section-start=.text=0x3e00
39
LDSECTIONS = -Wl,--section-start=.text=0x3e00 -Wl,--section-start=.version=0x3ffe
42
# Start of some ugly makefile-isms to allow optiboot to be built
43
# in several different environments. See the README.TXT file for
49
ifeq ($(ENV), arduino)
50
# For Arduino, we assume that we're connected to the optiboot directory
51
# included with the arduino distribution, which means that the full set
52
# of avr-tools are "right up there" in standard places.
53
TOOLROOT = ../../../tools
54
GCCROOT = $(TOOLROOT)/avr/bin/
55
AVRDUDE_CONF = -C$(TOOLROOT)/avr/etc/avrdude.conf
58
# On windows, SOME of the tool paths will need to have backslashes instead
59
# of forward slashes (because they use windows cmd.exe for execution instead
60
# of a unix/mingw shell?) We also have to ensure that a consistent shell
61
# is used even if a unix shell is installed (ie as part of WINAVR)
62
fixpath = $(subst /,\,$1)
66
else ifeq ($(ENV), arduinodev)
67
# Arduino IDE source code environment. Use the unpacked compilers created
68
# by the build (you'll need to do "ant build" first.)
70
TOOLROOT = ../../../../build/macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools
73
TOOLROOT = ../../../../build/windows/work/hardware/tools
76
GCCROOT = $(TOOLROOT)/avr/bin/
77
AVRDUDE_CONF = -C$(TOOLROOT)/avr/etc/avrdude.conf
84
# End of build environment code.
30
87
# the efuse should really be 0xf8; since, however, only the lower
31
88
# three bits of that byte are used on the atmega168, avrdude gets
96
173
pro16_isp: TARGET = pro_16MHz
97
pro16_isp: HFUSE = DD # 2.7V brownout
98
pro16_isp: LFUSE = C6 # Full swing xtal (20MHz) 258CK/14CK+4.1ms
99
pro16_isp: EFUSE = 02 # 512 byte boot
175
pro16_isp: HFUSE = DD
176
# Full swing xtal (20MHz) 258CK/14CK+4.1ms
177
pro16_isp: LFUSE = C6
179
pro16_isp: EFUSE = 04
102
# Diecimila and NG use identical bootloaders
182
# Diecimila, Duemilanove with m168, and NG use identical bootloaders
183
# Call it "atmega168" for generality and clarity, keep "diecimila" for
184
# backward compatibility of makefile
186
atmega168: TARGET = atmega168
187
atmega168: MCU_TARGET = atmega168
188
atmega168: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
189
atmega168: AVR_FREQ = 16000000L
190
atmega168: $(PROGRAM)_atmega168.hex
191
atmega168: $(PROGRAM)_atmega168.lst
193
atmega168_isp: atmega168
194
atmega168_isp: TARGET = atmega168
196
atmega168_isp: HFUSE = DD
197
# Low power xtal (16MHz) 16KCK/14CK+65ms
198
atmega168_isp: LFUSE = FF
200
atmega168_isp: EFUSE = 04
104
203
diecimila: TARGET = diecimila
204
diecimila: MCU_TARGET = atmega168
105
205
diecimila: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
106
206
diecimila: AVR_FREQ = 16000000L
107
207
diecimila: $(PROGRAM)_diecimila.hex
110
210
diecimila_isp: diecimila
111
211
diecimila_isp: TARGET = diecimila
112
diecimila_isp: HFUSE = DD # 2.7V brownout
113
diecimila_isp: LFUSE = FF # Low power xtal (16MHz) 16KCK/14CK+65ms
114
diecimila_isp: EFUSE = 02 # 512 byte boot
213
diecimila_isp: HFUSE = DD
214
# Low power xtal (16MHz) 16KCK/14CK+65ms
215
diecimila_isp: LFUSE = FF
217
diecimila_isp: EFUSE = 04
115
218
diecimila_isp: isp
117
220
atmega328: TARGET = atmega328
118
221
atmega328: MCU_TARGET = atmega328p
119
222
atmega328: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
120
223
atmega328: AVR_FREQ = 16000000L
121
atmega328: LDSECTION = --section-start=.text=0x7e00
224
atmega328: LDSECTIONS = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe
122
225
atmega328: $(PROGRAM)_atmega328.hex
123
226
atmega328: $(PROGRAM)_atmega328.lst
125
228
atmega328_isp: atmega328
126
229
atmega328_isp: TARGET = atmega328
127
230
atmega328_isp: MCU_TARGET = atmega328p
128
atmega328_isp: HFUSE = DE # 512 byte boot
129
atmega328_isp: LFUSE = FF # Low power xtal (16MHz) 16KCK/14CK+65ms
130
atmega328_isp: EFUSE = 05 # 2.7V brownout
231
# 512 byte boot, SPIEN
232
atmega328_isp: HFUSE = DE
233
# Low power xtal (16MHz) 16KCK/14CK+65ms
234
atmega328_isp: LFUSE = FF
236
atmega328_isp: EFUSE = 05
131
237
atmega328_isp: isp
239
# Sanguino has a minimum boot size of 1024 bytes, so enable extra functions
241
sanguino: TARGET = atmega644p
242
sanguino: MCU_TARGET = atmega644p
243
sanguino: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' '-DBIGBOOT'
244
sanguino: AVR_FREQ = 16000000L
245
sanguino: LDSECTIONS = -Wl,--section-start=.text=0xfc00
246
sanguino: $(PROGRAM)_atmega644p.hex
247
sanguino: $(PROGRAM)_atmega644p.lst
249
sanguino_isp: sanguino
250
sanguino_isp: TARGET = atmega644p
251
sanguino_isp: MCU_TARGET = atmega644p
253
sanguino_isp: HFUSE = DE
254
# Low power xtal (16MHz) 16KCK/14CK+65ms
255
sanguino_isp: LFUSE = FF
257
sanguino_isp: EFUSE = 05
260
# Mega has a minimum boot size of 1024 bytes, so enable extra functions
261
#mega: TARGET = atmega1280
262
mega: MCU_TARGET = atmega1280
263
mega: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' '-DBIGBOOT'
264
mega: AVR_FREQ = 16000000L
265
mega: LDSECTIONS = -Wl,--section-start=.text=0x1fc00
266
mega: $(PROGRAM)_atmega1280.hex
267
mega: $(PROGRAM)_atmega1280.lst
270
mega_isp: TARGET = atmega1280
271
mega_isp: MCU_TARGET = atmega1280
274
# Low power xtal (16MHz) 16KCK/14CK+65ms
282
atmega8: TARGET = atmega8
283
atmega8: MCU_TARGET = atmega8
284
atmega8: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
285
atmega8: AVR_FREQ = 16000000L
286
atmega8: LDSECTIONS = -Wl,--section-start=.text=0x1e00 -Wl,--section-start=.version=0x1ffe
287
atmega8: $(PROGRAM)_atmega8.hex
288
atmega8: $(PROGRAM)_atmega8.lst
291
atmega8_isp: TARGET = atmega8
292
atmega8_isp: MCU_TARGET = atmega8
293
# SPIEN, CKOPT, Bootsize=512B
294
atmega8_isp: HFUSE = CC
295
# 2.7V brownout, Low power xtal (16MHz) 16KCK/14CK+65ms
296
atmega8_isp: LFUSE = BF
301
atmega88: TARGET = atmega88
302
atmega88: MCU_TARGET = atmega88
303
atmega88: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
304
atmega88: AVR_FREQ = 16000000L
305
atmega88: LDSECTIONS = -Wl,--section-start=.text=0x1e00 -Wl,--section-start=.version=0x1ffe
306
atmega88: $(PROGRAM)_atmega88.hex
307
atmega88: $(PROGRAM)_atmega88.lst
309
atmega88_isp: atmega88
310
atmega88_isp: TARGET = atmega88
311
atmega88_isp: MCU_TARGET = atmega88
313
atmega88_isp: HFUSE = DD
314
# Low power xtal (16MHz) 16KCK/14CK+65ms
315
atemga88_isp: LFUSE = FF
317
atmega88_isp: EFUSE = 04
133
321
# 8MHz clocked platforms
135
323
# These are capable of 115200 baud
138
326
lilypad: TARGET = lilypad
139
lilypad: CFLAGS += '-DLED_START_FLASHES=3' '-DSOFT_UART' '-DBAUD_RATE=115200'
327
lilypad: MCU_TARGET = atmega168
328
lilypad: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
140
329
lilypad: AVR_FREQ = 8000000L
141
330
lilypad: $(PROGRAM)_lilypad.hex
142
331
lilypad: $(PROGRAM)_lilypad.lst
144
333
lilypad_isp: lilypad
145
334
lilypad_isp: TARGET = lilypad
146
lilypad_isp: HFUSE = DD # 2.7V brownout
147
lilypad_isp: LFUSE = E2 # Internal 8MHz osc (8MHz) Slow rising power
148
lilypad_isp: EFUSE = 02 # 512 byte boot
336
lilypad_isp: HFUSE = DD
337
# Internal 8MHz osc (8MHz) Slow rising power
338
lilypad_isp: LFUSE = E2
340
lilypad_isp: EFUSE = 04
151
343
lilypad_resonator: TARGET = lilypad_resonator
152
lilypad_resonator: CFLAGS += '-DLED_START_FLASHES=3' '-DSOFT_UART' '-DBAUD_RATE=115200'
344
lilypad_resonator: MCU_TARGET = atmega168
345
lilypad_resonator: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
153
346
lilypad_resonator: AVR_FREQ = 8000000L
154
347
lilypad_resonator: $(PROGRAM)_lilypad_resonator.hex
155
348
lilypad_resonator: $(PROGRAM)_lilypad_resonator.lst
157
350
lilypad_resonator_isp: lilypad_resonator
158
351
lilypad_resonator_isp: TARGET = lilypad_resonator
159
lilypad_resonator_isp: HFUSE = DD # 2.7V brownout
160
lilypad_resonator_isp: LFUSE = C6 # Full swing xtal (20MHz) 258CK/14CK+4.1ms
161
lilypad_resonator_isp: EFUSE = 02 # 512 byte boot
353
lilypad_resonator_isp: HFUSE = DD
354
# Full swing xtal (20MHz) 258CK/14CK+4.1ms
355
lilypad_resonator_isp: LFUSE = C6
357
lilypad_resonator_isp: EFUSE = 04
162
358
lilypad_resonator_isp: isp
164
360
pro8: TARGET = pro_8MHz
165
pro8: CFLAGS += '-DLED_START_FLASHES=3' '-DSOFT_UART' '-DBAUD_RATE=115200'
361
pro8: MCU_TARGET = atmega168
362
pro8: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
166
363
pro8: AVR_FREQ = 8000000L
167
364
pro8: $(PROGRAM)_pro_8MHz.hex
168
365
pro8: $(PROGRAM)_pro_8MHz.lst
171
368
pro8_isp: TARGET = pro_8MHz
172
pro8_isp: HFUSE = DD # 2.7V brownout
173
pro8_isp: LFUSE = C6 # Full swing xtal (20MHz) 258CK/14CK+4.1ms
174
pro8_isp: EFUSE = 02 # 512 byte boot
371
# Full swing xtal (20MHz) 258CK/14CK+4.1ms
177
377
atmega328_pro8: TARGET = atmega328_pro_8MHz
178
378
atmega328_pro8: MCU_TARGET = atmega328p
179
379
atmega328_pro8: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
180
380
atmega328_pro8: AVR_FREQ = 8000000L
181
atmega328_pro8: LDSECTION = --section-start=.text=0x7e00
381
atmega328_pro8: LDSECTIONS = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe
182
382
atmega328_pro8: $(PROGRAM)_atmega328_pro_8MHz.hex
183
383
atmega328_pro8: $(PROGRAM)_atmega328_pro_8MHz.lst
185
385
atmega328_pro8_isp: atmega328_pro8
186
386
atmega328_pro8_isp: TARGET = atmega328_pro_8MHz
187
387
atmega328_pro8_isp: MCU_TARGET = atmega328p
188
atmega328_pro8_isp: HFUSE = DE # 512 byte boot
189
atmega328_pro8_isp: LFUSE = FF # Low power xtal (16MHz) 16KCK/14CK+65ms
190
atmega328_pro8_isp: EFUSE = 05 # 2.7V brownout
388
# 512 byte boot, SPIEN
389
atmega328_pro8_isp: HFUSE = DE
390
# Low power xtal (16MHz) 16KCK/14CK+65ms
391
atmega328_pro8_isp: LFUSE = FF
393
atmega328_pro8_isp: EFUSE = 05
191
394
atmega328_pro8_isp: isp
193
396
# 1MHz clocked platforms