alexforencich / xboot

XBoot Extensible Bootloader
125 stars 69 forks source link

All reset flags cleared by xboot #23

Open stevemarple opened 8 years ago

stevemarple commented 8 years ago

Clearing all reset flags in MCUSR (for ATmega devices) prevents the user application from finding out the cause of the MCU reset.

I have some hardware where an LED displays some debugging information for a few minutes following a reset, but only if the reset was caused by a human (power-on, JTAG and external resets). To preserve battery life resets caused by the watchdog timer and brown-outs do not enable the LED. Pull request #22 preserves all reset flags except the watchdog which must be cleared. However when all flags are zero the user application can deduce that the cause was the watchdog timer.