刚学arm7(at91sam7x256)几个礼拜,照着焦海波写的《嵌入式网络系统设计》一步步照着移植ucos-ii,但是调试的时候到OS_TaskIdle()之后就不行了,一直进不了中断函数OSTickISR(),书上说很可能是中断设置有问题,要检测异常向量表和中断注册的相关代码,搞来搞去都没搞明白为什么~求各位大大帮忙啊~
相关代码如下:
------------------------------------------------------------------------------------------------
main.c
------------------------------------------------------------------------------------------------
..........
#define T_LED_STKSIZE 64
OS_STK T_LED1_STK[T_LED_STKSIZE];
int main(void)
{
AT91F_PMC_EnablePeriphClock(AT91C_BASE_PMC, 1 << AT91C_ID_PIOB);
AT91F_PIO_CfgOutput(AT91C_BASE_PIOB, AT91C_PIO_PB19);
AT91F_AIC_ConfigureIt(AT91C_BASE_AIC, AT91C_ID_SYS, AT91C_AIC_PRIOR_HIGHEST, AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL,OSTickISR);
AT91C_BASE_AIC->AIC_IECR = 0x01 << AT91C_ID_SYS;
OSInit();
OSTaskCreate(T_LED1, (void*)NULL, &T_LED1_STK[T_LED_STKSIZE-1], 4);
OSStart();
return(0);
}
.........
------------------------------------------------------------------------------------------------
os_cpu_c.c
------------------------------------------------------------------------------------------------
......
void OSTickISR(void)
{
INT32U u32PIVR;
OSTimeTick();
u32PIVR = AT91C_BASE_PITC->PITC_PIVR;
}
......
------------------------------------------------------------------------------------------------
boot.s
------------------------------------------------------------------------------------------------
......
IMPORT IRQHandler
IMPORT FIQHandler
EXPORT VectorTable
VectorTable
LDR PC, [PC, #&18] ;- 软件复位
LDR PC, [PC, #&18] ;- 未定义
LDR PC, [PC, #&18] ;- SWI
LDR PC, [PC, #&18] ;- 预取终止
LDR PC, [PC, #&18] ;- 数据终止
NOP ;- 保留
; LDR PC, [PC,#-0xF20]
LDR PC, [PC, #&18] ;- IRQ
LDR PC, [PC, #&18] ;- FIQ
DCD SoftReset
DCD UndefHandler
DCD SWIHandler
DCD PrefetchAbortHandler
DCD DataAbortHandler
DCD 0
DCD IRQHandler
DCD FIQHandler
SoftReset
B ExceptionHandler
UndefHandler
B ExceptionHandler
SWIHandler
B ExceptionHandler
PrefetchAbortHandler
B ExceptionHandler
DataAbortHandler
B ExceptionHandler
ExceptionHandler
B AT91C_IFLASH
......
------------------------------------------------------------------------------------------------
os_cpu_a.s
------------------------------------------------------------------------------------------------
......
MACRO
__macIntHandler $IntVR ;- 中断处理入口,完成用户自定义的中断处理和任务调度
SUB LR, LR, #4
STMFD SP!, {R0-R3, LR}
BL OSIntEnter ;- 进入用户自定义的中断服务子函数
LDR R0, =AT91C_BASE_AIC
LDR R0, [R0, $IntVR]
LDR LR, =.+8
BX R0
BL OSIntExit ;- 退出中断,看看是否进行任务切换
LDR R0, =blIsNeedCtxSw ;- 判断是否需要任务切换
LDRB R1, [R0]
CMP R1, #1
BEQ OSIntCtxSwExt
__macEndInt R0 ;- 结束中断
LDMFD SP!, {R0-R3, PC}^
MEND
......
IRQHandler
__macIntHandler #AIC_IVR
......
我用的是keil编译的,在void OSTickISR()前加上__irq也是进不了中断函数OSTickISR啊~ |