X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/bbd45c46a75edd930486980c0d6a94c52d8cf403..refs/tags/hexrel-6.4:/avr/main.c diff --git a/avr/main.c b/avr/main.c index 5a0d792..3852e75 100644 --- a/avr/main.c +++ b/avr/main.c @@ -7,6 +7,7 @@ #include "common.h" #include +#include #include #include @@ -25,11 +26,9 @@ #include "rtc.h" #include "debug.h" -static uint8_t mcusr; +uint8_t mcusr __attribute__ ((section (".noinit"))); -/*--------------------------------------------------------------------------*/ #if DEBUG - __attribute__ ((naked)) __attribute__ ((section (".init3"))) void preset_ram (void) { @@ -37,6 +36,21 @@ void preset_ram (void) *p = 0xdd; } +#endif + +__attribute__ ((naked)) __attribute__ ((section (".init3"))) +void get_mcusr (void) +{ + /* save and clear reset reason(s) */ + /* TODO: move to init section? */ + mcusr = MCUSR; + MCUSR = 0; + + wdt_disable(); +} + +/*--------------------------------------------------------------------------*/ +#if DEBUG static const FLASH char * const FLASH rreasons[] = { FSTR("Power on"), @@ -78,13 +92,6 @@ ISR(INT6_vect) static void setup_avr(void) { - /* save and clear reset reason(s) */ - /* TODO: move to init section? */ - mcusr = MCUSR; - MCUSR = 0; - - /* WD */ - /* CPU */ /* Disable JTAG Interface regardless of the JTAGEN fuse setting. */