Strange problem uploading a sketch after flashing bootloader

Hi all,

I’ve run into a rather strange problem. If I re-flash the bootloader on my UNO R3 board (using the stock Optiboot that comes with IDE version 1.0.2), then try to upload a sketch, it fails with this message:

Binary sketch size: 6,268 bytes (of a 32,256 byte maximum)
avrdude: verification error, first mismatch at byte 0x0000
0x0c != 0xff
avrdude: verification error; content mismatch

A hex dump of the flash memory shows the difference:

root@michael:~/Documents# diff fail.hex good.hex
1,4c1,4
< :20000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00
< :20002000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0
< :20004000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC0
< :20006000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA0

:200000000C94F2000C941A010C941A010C941A010C941A010C941A010C941A010C941A0131
:200020000C941A010C941A010C941A010C941A010C941A010C941A010C941A010C941A01E8
:200040000C9485080C941A010C94C6090C940D0A0C941A010C941A010C941A010C941A01A6
:200060000C941A010C941A010D0A002020002D2000202020202020202020202B30202B314F

It seems as though the first 128 bytes are not being programmed.

However, clicking “Upload” again succeeds.

I tried it on three different UNO boards and they all do the same thing.

By the way, if it matters, I reflash the bootloader with an AVRISP MKII programmer.

Also, here are the fuse settings that I use:

uno.bootloader.low_fuses=0xF7
uno.bootloader.high_fuses=0xDE
uno.bootloader.extended_fuses=0x05
uno.bootloader.unlock_bits=0x3F
uno.bootloader.lock_bits=0x2F

Anyone have any ideas - I would appreciate it.

– Roger