View Single Post
Old 10-08-2009, 08:18 AM   #2384 (permalink)
ga2500ev
EcoModding Lurker
 
Join Date: Nov 2008
Location: Georgia
Posts: 19
Thanks: 1
Thanked 4 Times in 3 Posts
Quote:
Originally Posted by bones007 View Post
I have a question about how the bootloader works. When you use the bootloader to re-program the microcontroller does your new code have to include the bootloader itself each time?
No. The bootloader is static.
Quote:
Or is the bootloader protected somehow such that you can upload a program with flaws, fix the program and upload again without screwing up the bootloader.
It depends. With some controllers you can mark an area of memory as unwritable. An external programmer is used to load the bootloader into that area and then the memory is protected. In that instance virtually nothing programmatic will cause the bootloader to be overwritten.

If that's no available, then the backup is to have the bootloader software check to see where the target memory is located. If it's in the bootloader, then the bootloader won't overwrite itself. But there's nothing to prevent a loaded program from overwriting the bootloader in that case.

The bottom line is that without hardware memory protection, there is a chance that the bootloader can be overwritten. But in my experience, the advantage of not having to have an external programmer makes it worth the risk.

ga2500ev
  Reply With Quote