After all this noise about the Butterfly bootloader failures, I took the liberty to disassemble the official "butterfly_boot_rev03.hex", where I think I have found a few minor inconsistencies and a lot of code bloating, of course.
I have written from scratch a new bootloader for the Butterfly unit, being guided by the structure of the dissasembled file above, and using the program flow of my fully functioning bootloader libraries.
I believe that you will be impressed, firstly by the firmware size: It is 938 Bytes only, or 469 Program Memory Words!
If you wish, you can safely dedicate another one kilobyte of program memory to your application code! You can set it free by presetting the bootstart at the third position (512W, at address 0x1E00) instead of the standard fourth position (1024W, at address 0x1C00), by changing the boot fuses.
This bootloader supports all the programming modes (Word mode and Block mode) at 19200bps for both the memories (FLASH and EERPOM), and responds faster than the original one. I have only disabled the Lock-bits writing routines, to ensure that nothing can go wrong, but they can be re-enabled by uncommenting the related code at the source file.
You might wonder why this file has half the size only of the original one. I have not removed any functionality from this bootloader. I have just written this piece of software in assembly. Please, don't get me wrong but I am not trying to start another one of those legendary, delectable though, Assembly vs. C wars, we always manage to have over here...
Unfortunately, I did not have a Butterfly unit available or an m169 chip, so I have not been able to test this piece of code properly. I have successfully tested though a slightly modified version of this code for the m162, which is the most related chip to the m169, I had in hand.
Please, let me know if you can see any strange behaviour or malfunctions. Provide me with the details in order to fix them.
I hope you will find this piece of software handy. Download your copy of the Butterfly bootloader and have fun!
EDIT 1 (2006.Mar.06): Bug-fix update. "ButterflyBoot v1.1.hex" released.
Although the "ButterflyBoot v1.0" worked fine using the AVRProg front-end, it would not work properly using the Avrdude: Fixed.
The Write_Lock_bit command has been disabled, therefore the chip cannot be locked.
The firmware size is below the 512W barrier: Only 471W long!
EDIT 2 (2006.Mar.12): Major enhancements. "ButterflyBoot v1.2.hex" released: Low power consumption, and better programming engine.
Based on the "ButterflyBoot v1.1", using extensively the sleep modes to minimize the power consumption.
The Rev1.2 improved programming-engine must now eliminate the known 0x940C bug.
The Read/Write_Lock_Bits and the Write_Fuse_Bits routines have been disabled: They gave way to the power management routines.
Green operation: Extended battery life! Tests have been done resulted to lower power consumption: Down to 40% of the Rev1.1 and the official firmwares.
The firmware size is still below the 512W barrier.
EDIT 3 (2006.Mar.13): Note: I will have to withdraw the "ButterflyBoot v1.2" firmware release, until I receive the Butterfly unit I am expecting to, to test this new bootloader thoroughly.
Thank you for your support. I will keep you posted.