|
楼主 |
发表于 2015-4-3 15:39:48
|
显示全部楼层
我感觉start()这个函数没有被调用,因为执行以下代码时,main()函数依然能够执行(通过蓝色LED闪烁得出的结论),这是什么原因呢?
void start(void)
{
/* Disable the watchdog timer but enable update */
//WDOG_DisableWDOGEnableUpdate();
while(1);
#ifndef __GNUC__
#ifndef KEIL
/* Copy any vector or data sections that need to be in RAM */
common_startup();
#endif
#endif
/* Jump to main process */
main();
/* No actions to perform after this so wait forever */
while(1);
}
int main (void)
{
WDOG_ConfigType sWDOGConfig = {0}; /*! < watchdog configuration structure */
int i;
/* Perform processor initialization */
sysinit();
for(i = 0; i<10; i++) {
DelayUS(50000);
}
sWDOGConfig.sBits.bWaitEnable = TRUE;
sWDOGConfig.sBits.bStopEnable = TRUE;
sWDOGConfig.sBits.bDbgEnable = TRUE;
sWDOGConfig.sBits.bUpdateEnable = FALSE;
sWDOGConfig.sBits.bDisable = FALSE; /* enable WDOG */
//sWDOGConfig.sBits.bPrescaler = FALSE; //Watchdog Prescalar -> 256
sWDOGConfig.sBits.bClkSrc = WDOG_CLK_INTERNAL_1KHZ;
//sWDOGConfig.sBits.bClkSrc = WDOG_CLK_EXTERNAL;
//sWDOGConfig.sBits.bClkSrc = WDOG_CLK_BUS;
sWDOGConfig.u16TimeOut = 1000; /*< 1s */
sWDOGConfig.u16WinTime = 0;
WDOG_Init(&sWDOGConfig);
printf("\nRunning the wdog_feed_demo project.\n");
if(WDOG_IsReset()) /*!< check if wathdog reset happens */
{
/*! watchdog happens. */
LED0_Init(); /*!< initialize red light */
while(1)
{
LED0_Toggle(); /*!< flash red light if watchdog reset occurs */
WDOG_Feed();
DelayUS(50000); /*!< delay around 50ms */
}
}
/*! watchdog does not happens, then flash blue led. */
LED2_Init(); /*!< initialize blue light */
while(1)
{
LED2_Toggle(); /*!< flash blue light if no watchdog reset occurs */
//WDOG_Feed();
DelayUS(50000); /*!< delay around 50ms */
}
} |
|