I'm trying to find an example of how to program the FLASH of a XC161-CJ Microcontroller. I'm using the KEIL-ULINK kit to debug, which works fine, and I can download a program from bootstrap mode via the Infinion MemTool program. But I want the end user to be able to upgrade the software and he has no access to the hardware. He can in other words not put the microprocessor in bootstrap mode. I was thinking of putting a boot code into FLASH, move it into RAM and run it from there when it's time to upgrade the FLASH, and then get back to executing the code in FLASH. With some care I think I get acceptable security not to erase the boot code by mistake. I have however not found any valid examples on how to do it on a XC161. Does anyone have any suggestions on the concept or ideas on where to find any examples?