Optiboot on various boards

I have just installed successfully the Optiboot bootloader on an Arduino Pro-Mini 5V. I used Bill Westfield's Optifix sketch running on an Uno as the programmer.

Optifix contains a number of important bug-fixes not yet included in the official Optiboot package. In fact the Optiboot project maintainer seems to have gone quiet. I hope this excellent project will not fall into disrepair.

Bill, if you're reading this, could you be persuaded to publish the patched source that you used? I would like to put Optiboot on some 3.3V Pro-Mini boards, and I think it will need to be recompiled to account for the 8MHz oscillator. I would also like to experiment with including a readable version number.

My current optiboot.c and makefile are attached. Note that for the version number to be readable from a sketch, you need to change the memory protection fuses to make the bootloader section "readable."

I'm not sure that the makefile is completely current, especially WRT to the *_isp targets; I had difficulties getting atmega8 uploadable at the same time as 168/328 because of the missing EFUSE byte, and I was using an "optifix"-like utility to do my bootloader loading. It's also set up for my local development environment and has some debugging additions.

optiboot.c (19.9 KB)

makefile (11.2 KB)

Thanks for those. I'll check them against the source version I'm using later today.

Meanwhile I have now got a patched Optiboot running on both 5V-16MHz and 3.3V-8Mhz Pro-Mini boards. In order to get the 8MHz version working I needed to compile for a reduced upload baud rate. The code includes your size-reduction patch and sketch amnesia patch. I have also made the boot-loader readable and added a version number byte.

Now I need to do a bit of testing to check everything works as it should. Does any kind of check-out sketch exist already? If anybody else wants to try these bootloaders I'm happy to send them. I'm using the excellent "optifix" sketch as an ISP, which is very easy to use and avoids the auto-reset problem.

(deleted)

Drew, you can find the other source files on the Optiboot project page:
http://code.google.com/p/optiboot/

(deleted)

Yeah; you should definitely start with either the downloaded official optiboot source, or the optiboot directory of stuff that is included with the arduino distribution...

westfw:
My current optiboot.c and makefile are attached.

OK, excellent, thanks. Reassuringly my sources are almost identical, even down to the choice of version numbers! By the way, I think this code is more recent than that used to build the binary in optifix?

It looks like you've found a way to get Make to append the version digits to the binary, although I can't get this to work myself just yet. I'm using a Perl script to modify the .hex file after compilation, which is not so ideal for Windows and Mac users. The 0x2f memory lock seems to work a treat, and I can read out the bootloader memory and see the version digits. I have used just one byte to store the version numbers (as 2 hex digits), with another byte being 'O' to identify Optiboot.

Have you tested this code on an 8MHz platform? My 8MHz ATmega328 Pro-Mini boards wouldn't talk at 115200 baud, but are perfectly happy at 57600.

Anyway, this is starting to look pretty ship-shape. Any thoughts of an "official" release? The author and maintainer of Optiboot seems to have gone quiet -- is anybody in touch with him?

this code is more recent than that used to build the binary in optifix?

Yes; the version in optifix doesn't have version numbers. It was supposed to be a short-term fix to help solve the serious arduino-smd problems with watchdog initialization.

It looks like you've found a way to get Make to append the version digits to the binary, although I can't get this to work myself just yet.

I ended up single-stepping through objcopy. Magic linker commands, sort of. See this thread for details:
http://lists.nongnu.org/archive/html/avr-gcc-list/2011-02/msg00016.html

Have you tested this code on an 8MHz platform?

No. Testing of something like this, that is supposed to run on SO many different CPUs and configurations, is a significant "problem." It sort of needs a "test fixture" (software and maybe even hardware), which is an expensive and rather difficult proposition both in time and in real dollars. (personally, I have a hard time writing test code...)

Any thoughts of an "official" release?

I ... am not really willing to "release" an alternate optiboot until the current maintainer says he thinks it's a good idea. Too many versions is a bad thing; Arduino has already "forked" from the optiboot repository, and I've already done more than I consider "polite." I suspect that the current maintainer got overwhelmed by the sudden addition of the arduino user base. I expect that I could be similarly overwhelmed; it's one thing to fiddle with the source, and quite another to be an official maintainer with 100k+ users...

I've been sending all my changes to the appropriate people. I think. (version number change suggested, but not yet submitted...)