From 5f884bba3f826f323189c1109aa3eae33d4c5a1d Mon Sep 17 00:00:00 2001 From: asterix Date: Tue, 2 Dec 2008 13:44:13 +0000 Subject: [PATCH] Trick to reset wdt on new AVR core. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1955 38d2e660-2303-0410-9eaa-f027e97ec537 --- examples/triface/boot/main.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/examples/triface/boot/main.c b/examples/triface/boot/main.c index f4f05c43..1382ab9e 100644 --- a/examples/triface/boot/main.c +++ b/examples/triface/boot/main.c @@ -61,6 +61,32 @@ #include +#include + +/* + * Watchdog disable. + * + * This function disable the watchdog timer, after a reset. + * We should do it after the software reset (do with watchdog), + * because in new AVR core do not reset the watchdog after + * a cpu reset, so the watchdog timer remain enable resetting + * every timeout time the cpu. This is necessary only with new + * AVR core, for the other core this no have effect. + * + * \{ + */ +// Function prototype of watchdog reset. +void wdt_init(void) __attribute__((naked)) __attribute__((section(".init3"))); +// Function implementation of watchdog reset. +void wdt_init(void) +{ + MCUSR = 0; + wdt_disable(); + + return; +} +/* \} */ + int main(void) { FlashAvr flash; -- 2.25.1