Microchip Application Libraries include pretty good HID Bootloader made by Microchip developers. It is fairly small and works even on small devices like 18F2550. Microchip also (inside the MAL) provides the application to upload HEX files to the microcontroller using bootloader. This is all nice and all works good, except that if you don’t have windows there is not much you can do with the hid bootloader as there is no linux version.

As I use Linux only (64bit Fedora Linux – currently v10 and v14 are used in my home) I decided to rewrite the bootloader code to work on Linux. I managed to get it working inside few hours. It is just a small shell application that you run passing it single parameter (your hex file), it will erase mcu and upload hex. It uses libusb-1.0 library and the project is using CMAKE (kdevelop4 is used as IDE).

You can download source code (and linux 64bit binary) of desktop application to upload firmware using hid bootloader here

[arhimed@luckey build]$ ./hid_bootloader ../cdc.hex
nasao
Family: PIC18
ERASED
PROGRAMMED
[arhimed@luckey build]$

If you use PIC18F2550 here you can download HEX file with the boot loader firmware. Note that I changed default behaviour of the boot loader so now you enter boot loader if PGC and PGD are connected instead by tying B4 to the Vss. I did this because all my boards have ICSP connector on them so it is easier to add a jumper over PGC/PGD then to waste a B4 pin to boot loader.