I'm working on an implementation of AVR109, where the bootloader times out after two seconds if a given series of bytes aren't received on the serial port, and then starts the main application using a function pointer to address 0.
The bootloader is working fine, and I'm able to program the AVR via serial port. But when the AVR only contains the bootloader, and the flash memory at location 0 is empty, it takes two seconds in addition to the bootloader timeout every time the AVR restarts. Why isn't this instantaneous? Why isn't the AVR resetting immediately when the bootloader sets the pointer to an empty area in the flash? Is this something I can configure?
EDIT: My bootloader conundrum actually proved to be caused by PEBCAK. An error in the initial timing loop in the bootloader caused the extra two second delay, and was fixed. When jumping to the start of a blank/erased flash memory, it actually only took a few milliseconds before the bootloader started up again, i.e. not a big problem. But the best approach is to check the flash memory location before jumping there. If it's erased, just restart the bootloader instead of jumping to the empty area.