possible error in optiboot.c ... ???

oric_dan:
EDIT: BTW, as an aside, do you know if there's a way to use the Arduino IDE to compile the boot loader .C source files, or do I have to do a separate install of AVR Studio?

The IDE should have no problem compiling the source file. However, the IDE will not compile the source file with the correct compile options and it most certainly will not use the correct link options so the image will be unusable.

A makefile is included with Optiboot that works correctly with Arduino 1.0.x. Under Windows just navigate to the correct directory and run omake. There are a handful of parameters for tuning the image. This is an example from my computer where I built Optiboot with: no LED, 1000000 baud rate, m1284 processor...

C:\Arduino\arduino-1.0.5\hardware\maniacbug-mighty-1284p-68ed99c\bootloaders\optiboot >omake LED_START_FLASHES=0 BAUD_RATE=1000000 atmega1284

C:\Arduino\arduino-1.0.5\hardware\maniacbug-mighty-1284p-68ed99c\bootloaders\optiboot >..\..\..\tools\avr\utils\bin\make OS=windows ENV=arduino LED_START_FLASHES=0 BAUD_RATE=1000000 atmega1284
BAUD RATE CHECK: Desired: 1000000, Real: 1000000, UBRRL = 1, Error=0.0%
../../../tools/avr/bin/avr-gcc -g -Wall -Os -fno-inline-small-functions -fno-split-wide-types -mshort-calls -mmcu=atmega1284p -DF_CPU=16000000L  -DBAUD_RATE=1000000 -DLED_START_FLASHES=0      -DBIGBOO
T     -c -o optiboot.o optiboot.c
optiboot.c:307: warning: 'flash_led' declared 'static' but never defined
../../../tools/avr/bin/avr-gcc -g -Wall -Os -fno-inline-small-functions -fno-split-wide-types -mshort-calls -mmcu=atmega1284p -DF_CPU=16000000L  -DBAUD_RATE=1000000 -DLED_START_FLASHES=0      -DBIGBOO
T   -Wl,--section-start=.text=0x1fc00 -Wl,--section-start=.version=0x1fffe -Wl,--relax -nostartfiles -nostdlib -o optiboot_atmega1284p.elf optiboot.o
../../../tools/avr/bin/avr-size optiboot_atmega1284p.elf
   text    data     bss     dec     hex filename
    446       0       0     446     1be optiboot_atmega1284p.elf
../../../tools/avr/bin/avr-objcopy -j .text -j .data -j .version --set-section-flags .version=alloc,load -O ihex optiboot_atmega1284p.elf optiboot_atmega1284p.hex
..\..\..\tools\avr\bin\avr-objdump -h -S optiboot_atmega1284p.elf > optiboot_atmega1284p.lst
rm optiboot_atmega1284p.elf optiboot.o

C:\Arduino\arduino-1.0.5\hardware\maniacbug-mighty-1284p-68ed99c\bootloaders\optiboot >