Есть пример в HI-TECH PICC-18 Compiler Introduction
############
The Microchip PIC18Fxxx processors are able to write to their own program
memory while executing from it. By taking advantage of this fact, a
bootloader program can be designed to accept new code via the serial
port (or other method) and re-program itself.