Ситуация: ewarm-4.20a + wiggler. Отлаживаю uCOS-II для Olimex LPC E2124 . В случае, если ОС запускается из флэш - таймер тикает.
Когда отлаживаюсь из C-spy один раз срабатывает прерывание от таймера0 и прерывание не сбрасывается.
Вот код обработчика:
Код
void Tmr_TickISR_Handler (void)
{
T0IR = 0xFF; /* Clear timer #0 interrupt */
OSTimeTick(); /* If the interrupt is from the tick source, call OSTimeTick() */
#ifdef DEBUG_IAR_SIM_EN
VICVectAddr = (INT32U)Tmr_TickISR_Handler;
#else
VICVectAddr = 0; /* */
#endif
}
{
T0IR = 0xFF; /* Clear timer #0 interrupt */
OSTimeTick(); /* If the interrupt is from the tick source, call OSTimeTick() */
#ifdef DEBUG_IAR_SIM_EN
VICVectAddr = (INT32U)Tmr_TickISR_Handler;
#else
VICVectAddr = 0; /* */
#endif
}
Код настройки таймера:
Код
void Tmr_TickInit (void)
{
/* VIC TIMER #0 Initialization */
VICIntSelect &= ~(1 << VIC_TIMER0); /* Enable interrupts */
VICVectAddr2 = (INT32U)Tmr_TickISR_Handler; /* Set the vector address */
#ifdef DEBUG_IAR_SIM_EN
VICVectAddr = (INT32U)Tmr_TickISR_Handler; // Simulate VIC
#endif
VICVectCntl2 = 0x20 | VIC_TIMER0; /* Enable vectored interrupts */
VICIntEnable = (1 << VIC_TIMER0); /* Enable Interrupts */
T0TCR = 0; /* Disable timer 0. */
T0PC = 0; /* Prescaler is set to no division. */
T0MR0 = CPU_PERIPHERAL_CLK_FREQ / OS_TICKS_PER_SEC; /* Count up to this value. */
T0MCR = 3; /* Reset and interrupt on MR0 (match register 0). */
T0CCR = 0; /* Capture is disabled. */
T0EMR = 0; /* No external match output. */
T0TCR = 1; /* Enable timer 0 */
}
{
/* VIC TIMER #0 Initialization */
VICIntSelect &= ~(1 << VIC_TIMER0); /* Enable interrupts */
VICVectAddr2 = (INT32U)Tmr_TickISR_Handler; /* Set the vector address */
#ifdef DEBUG_IAR_SIM_EN
VICVectAddr = (INT32U)Tmr_TickISR_Handler; // Simulate VIC
#endif
VICVectCntl2 = 0x20 | VIC_TIMER0; /* Enable vectored interrupts */
VICIntEnable = (1 << VIC_TIMER0); /* Enable Interrupts */
T0TCR = 0; /* Disable timer 0. */
T0PC = 0; /* Prescaler is set to no division. */
T0MR0 = CPU_PERIPHERAL_CLK_FREQ / OS_TICKS_PER_SEC; /* Count up to this value. */
T0MCR = 3; /* Reset and interrupt on MR0 (match register 0). */
T0CCR = 0; /* Capture is disabled. */
T0EMR = 0; /* No external match output. */
T0TCR = 1; /* Enable timer 0 */
}
В чём жучок?