I am trying to modify a bootloader so that it has additional reset sources. I am working with a 328P Arduino.
The sequence I would like is as follows:
1. Perform watchdog reset in a sketch. (reference http://wiblocks.luciani.org/docs/app-notes/software-reset.html
2. Mega resets
3. Bootloader starts.
4. Determine if watchdog reset, if so goto #5.
5. Evaulate watchdog timer prescaler in WDTCSR register. Depending on value->15ms, 30ms, etc execute condition 1, 2, etc.
I haven't been able to get the timer prescale bit values in the WDTCSR register. Are these values reset when the Arduino resets? If I am unable to obtain these bit values, the only other way I can think of doing this is by writting to the EEPROM before and after reset.