56F8013 Serial Bootloader

Started by emespina April 17, 2009
I am starting to develop a serial bootloader for the 56F8013 and I have come across with the documentation of the bootloader that is "pre-loaded" on the 56F8013.

From my understanding, the bootloader copies itself from Flash to RAM, then runs out of the RAM to erase the Flash and write the Application code. However, it "erases" itself in the process which would prevent further bootloading.

However, I need to always have a bootloader present since the unit must re-programmable on the field.

I can imagine 2 ways to do the bootloader right now:

1. Do it the same way as above, however, include a bootloader in the Application code such that even if the bootloader erases itself, it would be "brought in again" by the just loaded Application.

2. Make sure that the bootloader doesn't erase itself. The DSP jumps to the bootloader at reset. It can run out of the Flash if sector erase/write is allowed (No need to run out of RAM which could limit the bootloader size). Then, DSP jumps to the Application code once bootload is done. If a re-program request is received, it jumps back to the bootloader to load a new Application.

Any opinions on which approach is better? Or, any other suggestions or comments on your bootloader experience is most welcome. Thanks in advance!