Start bootloader from within program?

Hi, I would like to be able to update firmware without having the physical unit. I was wondering if there is a way to call the bootloader, or reset the microcontroller, from within my code? This way, the PC software could trigger a reset, then launch the command-line upload program with the new ROM.


I tried to accomplish a reset using the watchdog timer. This will not work. You will end up in an infinite reset loop as the bootloader doesn’t tickle the watchdog and it stays enabled when it goes off.

In software the best you can do is jump to the reset vector (the instruction at 0x0000) after initializing all the important registers (at least turn off all the outputs and set all the digitalWrite()s to 0 to kill the pull up resistors). I had the code somewhere, but I think I ripped it out since I didn’t trust my ability to find and initialize all the registers.

If you have an extra pin, you could wire it to the reset pin and pull it low to make a real reset.