1、Bootstrap中启用看门狗
注释掉源码\Bootstrap-v1.15\board\at91sam9260ek\at91sam9260ek.c中hw_init()函数里的以下红色语句:
void hw_init(void){
.........................................................
.........................................................
/* Disable watchdog */
//writel(AT91C_WDTC_WDDIS, AT91C_BASE_WDTC + WDTC_WDMR);
/* At this stage the main oscillator is supposed to be enabled
* PCK = MCK = MOSC */
.........................................................
.........................................................
}
2、Uboot中喂狗
(1)在源码/u-boot-1.3.4/include/configs/at91sam9260ek.h中添加使用看门狗宏定义:
#CONFIG_HW_WATCHDOG 1
(2)在源码/u-boot-1.3.4/board/atmel/at91sam9260ek.c中添加看门狗相关宏定义和喂狗函数hw_watchdog_reset(),如以下代码所示:
#define AT91_WDT (0xfffffd40 - AT91_BASE_SYS)
#define AT91_WDT_CR (AT91_WDT + 0x00) /* Watchdog Control Register */
#define AT91_WDT_WDRSTT (1 << 0) /* Restart */
#define AT91_WDT_KEY (0xa5 << 24) /* KEY Password */
#ifdef CONFIG_HW_WATCHDOG