Although what you want is possible, I can't think of why you would want to do such a thing.


If you have the original source, then you can find out where the routines are by looking at the ASM file.

And the resuting .HEX file also contains the information (in the first few bytes of each line) of where the data will be written. But you can't just write to FLASH indiscriminately. You have to erase it first, and you can only erase and write whole 'blocks' at a time (your device datasheet will give you the size of the erase and write blocks). And of course, you have to start on a block boundary. There is virtually no chance that your routine will #1. Be contiguous, #2. Fit in one block, #3. Begin and end on a block boundary.

This sounds like way too much trouble. Is there some reason why you can't simply write the whole chip? A good bootloader can write a 'big' chip (128KB of FLASH) in less than 2 minutes.