diff options
author | Leo C | 2015-05-18 10:06:49 +0200 |
---|---|---|
committer | Leo C | 2015-05-18 10:06:49 +0200 |
commit | 0c728c8de88d86247d2a75348e71f5af37838c28 (patch) | |
tree | a4aca5b87864e5974e08ca5151db1d15479c0dbe /avr/main.c | |
parent | 7d60b20bb8d675edafdb14638fee5001987c78c1 (diff) | |
parent | c748023ede9e7d8bdbf81ce8c8be2a437607a9e4 (diff) | |
download | z180-stamp-0c728c8de88d86247d2a75348e71f5af37838c28.zip |
Merge branch 'test-fboot-support'
Diffstat (limited to 'avr/main.c')
-rw-r--r-- | avr/main.c | 27 |
1 files changed, 17 insertions, 10 deletions
@@ -7,6 +7,7 @@ #include "common.h" #include <avr/interrupt.h> +#include <avr/wdt.h> #include <stdlib.h> #include <stdio.h> @@ -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. */ |