If it is useful for you, you can modify the bootloader after it is installed. Your program can erase FLASH (with the ERASECODE) instruction.

You have to look at the erase block size for your chip (probably 64 bytes), and (in this case) start on a 64 byte boundary. That will erase 64 sequential bytes. Then you write back the new data with the WRITECODE instruction. The WRITE block size may or may not be the same size as the ERASE block size.


I had a customer who felt that the bootloader was a security breach, and wanted to run it only when a jumper was installed. The boards were installed and couldn't be returned. I had very few free pins.

My code wrote to the CONFIG register and turned MCLR into an in input, then it read and changed the jump vector at location 0 to a point in memory ABOVE MCLoader. There, I had a routine that checked for the the MCLR line to be low, if it was, I jumped to the MCLOADER entry point, if not, I jumped back to my program and bypassed the bootloader.

I know this isn't a forum for "war stories" but my wife and friends don't understand any of this!