My boss asked me to set up a bootloader. Since I don't yet have the device designed I would be reprograming from I do not need to actually reflash the code at this time. For now I just want to set up the framework. What I want to do (and this part is not a problem) is given a certain condition I will set a bit in the EEPROM. Then reboot. Then, for now, I want to have the bootloader skeleton just go read that bit and if it is set, reset the EEPROM flag, and just spin. Then I could pull the power and it should reboot and notice the EEPROM flag is not set and jump back to main. Then later when I get a new programmer key designed I can just add the stuff in that loader before I reset the flag to update the application code. Then reboot...
So I already have the code to set the flag and reboot. I read through the docs and I get what I need to do to the fuses to get it to enable the boot loader. But then I get a bit lost. I have searched the forum and there is a ton of stuff scattered all over but I have not found info I can use. I have a proprietary interface not even designed yet so I can't use the ATMEL USB DFU tools or anything like that. So this is why I just want a framework to start with then I will do the heavy lifting when I get a new "Reprograming KEY".
So is there a special function like main() that the compiler knows about (perhaps bootloader()) that if I create it and set the fuses properly the system will not start at main() rather start in the bootloader start address and execute this function first?
Any good links would be appreciated as well.
Not sure this matters but my product is running on Mega 168P and 328P controlers depending on availability.