diff --git a/arch/avr/src/at90usb/at90usb_head.S b/arch/avr/src/at90usb/at90usb_head.S index a9ec75700cb..e5b729a23ac 100755 --- a/arch/avr/src/at90usb/at90usb_head.S +++ b/arch/avr/src/at90usb/at90usb_head.S @@ -119,7 +119,7 @@ ****************************************************************************/ .macro vector name - jmp \name + rjmp \name .endm /**************************************************************************** diff --git a/arch/avr/src/atmega/atmega_head.S b/arch/avr/src/atmega/atmega_head.S index cc3027658c6..0fcdf6c28a0 100755 --- a/arch/avr/src/atmega/atmega_head.S +++ b/arch/avr/src/atmega/atmega_head.S @@ -116,7 +116,7 @@ ****************************************************************************/ .macro vector name - jmp \name + rjmp \name .endm /**************************************************************************** diff --git a/arch/avr/src/atmega/atmega_lowinit.c b/arch/avr/src/atmega/atmega_lowinit.c index 9361e26b067..4720161bf47 100644 --- a/arch/avr/src/atmega/atmega_lowinit.c +++ b/arch/avr/src/atmega/atmega_lowinit.c @@ -47,6 +47,28 @@ * Private Definitions **************************************************************************/ +#if defined(CONFIG_WDTO_15MS) +# define WDTO_VALUE WDTO_15MS +#elif defined(CONFIG_WDTO_30MS) +# define WDTO_VALUE WDTO_30MS +#elif defined(CONFIG_WDTO_60MS) +# define WDTO_VALUE WDTO_60MS +#elif defined(CONFIG_WDTO_120MS) +# define WDTO_VALUE WDTO_120MS +#elif defined(CONFIG_WDTO_1250MS) +# define WDTO_VALUE WDTO_250MS +#elif defined(CONFIG_WDTO_500MS) +# define WDTO_VALUE WDTO_500MS +#elif defined(CONFIG_WDTO_1S) +# define WDTO_VALUE WDTO_1S +#elif defined(CONFIG_WDTO_2S) +# define WDTO_VALUE WDTO_2S +#elif defined(CONFIG_WDTO_4S) +# define WDTO_VALUE WDTO_4S +#else /* if defined(CONFIG_WDTO_8S) */ +# define WDTO_VALUE WDTO_8S +#endif + /************************************************************************** * Private Types **************************************************************************/ @@ -67,6 +89,23 @@ * Private Functions **************************************************************************/ +/************************************************************************** + * Name: up_wdtinit + * + * Description: + * Initialize the watchdog per the NuttX configuration. + * + **************************************************************************/ + +static inline void up_wdtinit(void) +{ +#ifndef CONFIG_AVR_WDT + wdt_disable(); +#else + wdt_enable(WDTO_VALUE); +#endif +} + /************************************************************************** * Public Functions **************************************************************************/ @@ -83,6 +122,10 @@ void up_lowinit(void) { + /* Initialize the watchdog timer */ + + up_wdtinit(); + /* Initialize a console (probably a serial console) */ up_consoleinit();