Skip to content

Commit e2812ef

Browse files
committed
This is a relatively significant edit that brings the Arduino copy of
optiboot up-to-date with the optiboot source repository as of Jun-2011 (the last changes made in the optiboot repository were in Oct-2010) This adds support for several plaforms, fixes the "30k bug", and refactors the source to have separate stk500.h, boot.h, and pin_defs.h These are the arduino opticode issues fixed: http://code.google.com/p/arduino/issues/detail?id=380 optiboot has problems upload sketches bigger than 30 KB http://code.google.com/p/arduino/issues/detail?id=556 update optiboot to the point of the latest optiboot project sources. These are issues that had been solved in the optiboot source aready: http://code.google.com/p/arduino/issues/detail?id=364 optiboot leaves timer1 configured when starting app, breaks PWM on pin 9 and 10. (fixed with a workaround in arduino core.) aka http://code.google.com/p/optiboot/source/detail?r=c778fbe72df6ac13ef730c25283358c3c970f73e Support for ATmega8 and mega88. Fix fuse settings for mega168 _ISP targets Additional new platforms (mega, sanguino) http://code.google.com/p/optiboot/issues/detail?id=26 Set R1 to 0 (already in arduino code) http://code.google.com/p/optiboot/issues/detail?id=36&can=1 Fails to build correctly for mega88 After this commit, the only differences between the Arduino optiboot.c and the optiboot repository optiboot.c are cosmetic.
1 parent 6840b77 commit e2812ef

23 files changed

+4141
-2756
lines changed

hardware/arduino/bootloaders/optiboot/Makefile

+114-11
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,23 @@ OBJDUMP = $(call fixpath,$(GCCROOT)avr-objdump)
123123

124124
SIZE = $(GCCROOT)avr-size
125125

126+
# Test platforms
127+
# Virtual boot block test
128+
virboot328: TARGET = atmega328
129+
virboot328: MCU_TARGET = atmega328p
130+
virboot328: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' '-DVIRTUAL_BOOT'
131+
virboot328: AVR_FREQ = 16000000L
132+
virboot328: LDSECTION = --section-start=.text=0x7e00
133+
virboot328: $(PROGRAM)_atmega328.hex
134+
virboot328: $(PROGRAM)_atmega328.lst
135+
126136
# 20MHz clocked platforms
127137
#
128138
# These are capable of 230400 baud, or 115200 baud on PC (Arduino Avrdude issue)
129139
#
130140

131141
pro20: TARGET = pro_20mhz
142+
pro20: MCU_TARGET = atmega168
132143
pro20: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
133144
pro20: AVR_FREQ = 20000000L
134145
pro20: $(PROGRAM)_pro_20mhz.hex
@@ -141,7 +152,7 @@ pro20_isp: HFUSE = DD
141152
# Full swing xtal (20MHz) 258CK/14CK+4.1ms
142153
pro20_isp: LFUSE = C6
143154
# 512 byte boot
144-
pro20_isp: EFUSE = 02
155+
pro20_isp: EFUSE = 04
145156
pro20_isp: isp
146157

147158
# 16MHz clocked platforms
@@ -150,6 +161,7 @@ pro20_isp: isp
150161
#
151162

152163
pro16: TARGET = pro_16MHz
164+
pro16: MCU_TARGET = atmega168
153165
pro16: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
154166
pro16: AVR_FREQ = 16000000L
155167
pro16: $(PROGRAM)_pro_16MHz.hex
@@ -162,12 +174,13 @@ pro16_isp: HFUSE = DD
162174
# Full swing xtal (20MHz) 258CK/14CK+4.1ms
163175
pro16_isp: LFUSE = C6
164176
# 512 byte boot
165-
pro16_isp: EFUSE = 02
177+
pro16_isp: EFUSE = 04
166178
pro16_isp: isp
167179

168180
# Diecimila and NG use identical bootloaders
169181
#
170182
diecimila: TARGET = diecimila
183+
diecimila: MCU_TARGET = atmega168
171184
diecimila: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
172185
diecimila: AVR_FREQ = 16000000L
173186
diecimila: $(PROGRAM)_diecimila.hex
@@ -180,7 +193,7 @@ diecimila_isp: HFUSE = DD
180193
# Low power xtal (16MHz) 16KCK/14CK+65ms
181194
diecimila_isp: LFUSE = FF
182195
# 512 byte boot
183-
diecimila_isp: EFUSE = 02
196+
diecimila_isp: EFUSE = 04
184197
diecimila_isp: isp
185198

186199
atmega328: TARGET = atmega328
@@ -194,21 +207,104 @@ atmega328: $(PROGRAM)_atmega328.lst
194207
atmega328_isp: atmega328
195208
atmega328_isp: TARGET = atmega328
196209
atmega328_isp: MCU_TARGET = atmega328p
197-
# 512 byte boot
210+
# 512 byte boot, SPIEN
198211
atmega328_isp: HFUSE = DE
199212
# Low power xtal (16MHz) 16KCK/14CK+65ms
200213
atmega328_isp: LFUSE = FF
201214
# 2.7V brownout
202215
atmega328_isp: EFUSE = 05
203216
atmega328_isp: isp
204217

218+
# Sanguino has a minimum boot size of 1024 bytes, so enable extra functions
219+
#
220+
sanguino: TARGET = atmega644p
221+
sanguino: MCU_TARGET = atmega644p
222+
sanguino: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' '-DBIGBOOT'
223+
sanguino: AVR_FREQ = 16000000L
224+
sanguino: LDSECTION = --section-start=.text=0xfc00
225+
sanguino: $(PROGRAM)_atmega644p.hex
226+
sanguino: $(PROGRAM)_atmega644p.lst
227+
228+
sanguino_isp: sanguino
229+
sanguino_isp: TARGET = atmega644p
230+
sanguino_isp: MCU_TARGET = atmega644p
231+
# 1024 byte boot
232+
sanguino_isp: HFUSE = DE
233+
# Low power xtal (16MHz) 16KCK/14CK+65ms
234+
sanguino_isp: LFUSE = FF
235+
# 2.7V brownout
236+
sanguino_isp: EFUSE = 05
237+
sanguino_isp: isp
238+
239+
# Mega has a minimum boot size of 1024 bytes, so enable extra functions
240+
#mega: TARGET = atmega1280
241+
mega: MCU_TARGET = atmega1280
242+
mega: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' '-DBIGBOOT'
243+
mega: AVR_FREQ = 16000000L
244+
mega: LDSECTION = --section-start=.text=0x1fc00
245+
mega: $(PROGRAM)_atmega1280.hex
246+
mega: $(PROGRAM)_atmega1280.lst
247+
248+
mega_isp: mega
249+
mega_isp: TARGET = atmega1280
250+
mega_isp: MCU_TARGET = atmega1280
251+
# 1024 byte boot
252+
mega_isp: HFUSE = DE
253+
# Low power xtal (16MHz) 16KCK/14CK+65ms
254+
mega_isp: LFUSE = FF
255+
# 2.7V brownout
256+
mega_isp: EFUSE = 05
257+
mega_isp: isp
258+
259+
# ATmega8
260+
#
261+
atmega8: TARGET = atmega8
262+
atmega8: MCU_TARGET = atmega8
263+
atmega8: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
264+
atmega8: AVR_FREQ = 16000000L
265+
atmega8: LDSECTION = --section-start=.text=0x1e00
266+
atmega8: $(PROGRAM)_atmega8.hex
267+
atmega8: $(PROGRAM)_atmega8.lst
268+
269+
atmega8_isp: atmega8
270+
atmega8_isp: TARGET = atmega8
271+
atmega8_isp: MCU_TARGET = atmega8
272+
# SPIEN, CKOPT, Bootsize=512B
273+
atmega8_isp: HFUSE = CC
274+
# 2.7V brownout, Low power xtal (16MHz) 16KCK/14CK+65ms
275+
atmega8_isp: LFUSE = BF
276+
atmega8_isp: isp
277+
278+
# ATmega88
279+
#
280+
atmega88: TARGET = atmega88
281+
atmega88: MCU_TARGET = atmega88
282+
atmega88: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
283+
atmega88: AVR_FREQ = 16000000L
284+
atmega88: LDSECTION = --section-start=.text=0x1e00
285+
atmega88: $(PROGRAM)_atmega88.hex
286+
atmega88: $(PROGRAM)_atmega88.lst
287+
288+
atmega88_isp: atmega88
289+
atmega88_isp: TARGET = atmega88
290+
atmega88_isp: MCU_TARGET = atmega88
291+
# 2.7V brownout
292+
atmega88_isp: HFUSE = DD
293+
# Low power xtal (16MHz) 16KCK/14CK+65ms
294+
atemga88_isp: LFUSE = FF
295+
# 512 byte boot
296+
atmega88_isp: EFUSE = 04
297+
atmega88_isp: isp
298+
299+
205300
# 8MHz clocked platforms
206301
#
207302
# These are capable of 115200 baud
208303
#
209304

210305
lilypad: TARGET = lilypad
211-
lilypad: CFLAGS += '-DLED_START_FLASHES=3' '-DSOFT_UART' '-DBAUD_RATE=115200'
306+
lilypad: MCU_TARGET = atmega168
307+
lilypad: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
212308
lilypad: AVR_FREQ = 8000000L
213309
lilypad: $(PROGRAM)_lilypad.hex
214310
lilypad: $(PROGRAM)_lilypad.lst
@@ -220,11 +316,12 @@ lilypad_isp: HFUSE = DD
220316
# Internal 8MHz osc (8MHz) Slow rising power
221317
lilypad_isp: LFUSE = E2
222318
# 512 byte boot
223-
lilypad_isp: EFUSE = 02
319+
lilypad_isp: EFUSE = 04
224320
lilypad_isp: isp
225321

226322
lilypad_resonator: TARGET = lilypad_resonator
227-
lilypad_resonator: CFLAGS += '-DLED_START_FLASHES=3' '-DSOFT_UART' '-DBAUD_RATE=115200'
323+
lilypad_resonator: MCU_TARGET = atmega168
324+
lilypad_resonator: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
228325
lilypad_resonator: AVR_FREQ = 8000000L
229326
lilypad_resonator: $(PROGRAM)_lilypad_resonator.hex
230327
lilypad_resonator: $(PROGRAM)_lilypad_resonator.lst
@@ -236,11 +333,12 @@ lilypad_resonator_isp: HFUSE = DD
236333
# Full swing xtal (20MHz) 258CK/14CK+4.1ms
237334
lilypad_resonator_isp: LFUSE = C6
238335
# 512 byte boot
239-
lilypad_resonator_isp: EFUSE = 02
336+
lilypad_resonator_isp: EFUSE = 04
240337
lilypad_resonator_isp: isp
241338

242339
pro8: TARGET = pro_8MHz
243-
pro8: CFLAGS += '-DLED_START_FLASHES=3' '-DSOFT_UART' '-DBAUD_RATE=115200'
340+
pro8: MCU_TARGET = atmega168
341+
pro8: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
244342
pro8: AVR_FREQ = 8000000L
245343
pro8: $(PROGRAM)_pro_8MHz.hex
246344
pro8: $(PROGRAM)_pro_8MHz.lst
@@ -252,7 +350,7 @@ pro8_isp: HFUSE = DD
252350
# Full swing xtal (20MHz) 258CK/14CK+4.1ms
253351
pro8_isp: LFUSE = C6
254352
# 512 byte boot
255-
pro8_isp: EFUSE = 02
353+
pro8_isp: EFUSE = 04
256354
pro8_isp: isp
257355

258356
atmega328_pro8: TARGET = atmega328_pro_8MHz
@@ -266,7 +364,7 @@ atmega328_pro8: $(PROGRAM)_atmega328_pro_8MHz.lst
266364
atmega328_pro8_isp: atmega328_pro8
267365
atmega328_pro8_isp: TARGET = atmega328_pro_8MHz
268366
atmega328_pro8_isp: MCU_TARGET = atmega328p
269-
# 512 byte boot
367+
# 512 byte boot, SPIEN
270368
atmega328_pro8_isp: HFUSE = DE
271369
# Low power xtal (16MHz) 16KCK/14CK+65ms
272370
atmega328_pro8_isp: LFUSE = FF
@@ -299,6 +397,11 @@ luminet_isp: LFUSE = 62
299397
luminet_isp: EFUSE = FE
300398
luminet_isp: isp
301399

400+
#
401+
# Generic build instructions
402+
#
403+
#
404+
302405
isp: $(TARGET)
303406
$(ISPFUSES)
304407
$(ISPFLASH)

0 commit comments

Comments
 (0)