这是在Keil MDK环境下的一个外部中断程序,习惯了用Keil,没有用过ADS,所以就用H-Jtag和MDK组合一起调试,感觉真的很方便,这段程序仅仅是一个大框架
IRQ_Handler PROC
EXPORT IRQ_Handler [WEAK]
SUB lr,lr,#4 ;保存返回地址
STMDB sp!,{R0-R12,lr} ;保存现场
LDR R0,=INTOFFSET ;判断中断源
LDR R0, [R0]
LDR R1,=IRQ_Vecotr ;
ADD R1,R1,R0,LSL #2 ;将对应的IRQ处理函数地址,存放于R1中
LDR LR, =int_return ;设置中断处理函数后的返回地址
MOV PC, R1
int_return
LDMIA sp!,{R0-R12,PC}^ ;保存现场,并将SPSR的内容赋给CPSR
ENDP
其中IRQ_Vecotr是中断处理函数入口的基地址,Handle_EINT0是用C实现的外部中断处理程序
void Handle_EINT0(void)
{
printf("Handle_EINT0 \n");
SRCPND=0x01; //清除中断标志
INTPND=INTPND;
}
IRQ_Vecotr
EINT0_Handle B Handle_EINT0 ;added by nick
EINT1_Handle B EINT1_Handle ;added by nick
EINT2_Handle B EINT2_Handle ;added by nick
EINT3_Handle B EINT3_Handle ;added by nick
EINT4_7_Handle B EINT4_7_Handle ;added by nick
EINT8_23_Handle B EINT8_23_Handle ;added by nick
CAM_Handle B CAM_Handle
BATFLT_Handle B BATFLT_Handle
TICK_Handle B TICK_Handle
WDT_AC97_Handle B WDT_AC97_Handle
ISR_TIMER0_Handle B OSTickISR ;added by nick
ISR_TIMER1_Handle B ISR_TIMER1_Handle ;added by nick
ISR_TIMER2_Handle B ISR_TIMER2_Handle ;added by nick
ISR_TIMER3_Handle B ISR_TIMER3_Handle ;added by nick
ISR_TIMER4_Handle B ISR_TIMER4_Handle ;added by nick
ISR_UART2_Handle B ISR_UART2_Handle ;added by nick
ISR_LCD_Handle B ISR_LCD_Handle ;added by nick
ISR_DMA0_Handle B ISR_DMA0_Handle ;added by nick
ISR_DMA1_Handle B ISR_DMA1_Handle ;added by nick
ISR_DMA2_Handle B ISR_DMA2_Handle ;added by nick
ISR_DMA3_Handle B ISR_DMA3_Handle ;added by nick
ISR_SDI_Handle B ISR_SDI_Handle ;added by nick
ISR_SPI0_Handle B ISR_SPI0_Handle ;added by nick
ISR_UART1_Handle B ISR_UART1_Handle ;added by nick
ISR_NFCON_Handle B ISR_NFCON_Handle ;added by nick
ISR_USBD_Handle B ISR_USBD_Handle ;added by nick
ISR_USBH_Handle B ISR_USBH_Handle ;added by nick
ISR_IIC_Handle B ISR_IIC_Handle ;added by nick
ISR_UART0_Handle B ISR_UART0_Handle ;added by nick
ISR_SPI1_Handle B ISR_SPI1_Handle ;added by nick
ISR_RTC_Handle B ISR_RTC_Handle ;added by nick
ISR_ADC_Handle B ISR_ADC_Handle ;added by nick
IRQ_Vecotr
EINT0_Handle B Handle_EINT0 ;added by nick
EINT1_Handle B EINT1_Handle ;added by nick
EINT2_Handle B EINT2_Handle ;added by nick
EINT3_Handle B EINT3_Handle ;added by nick
EINT4_7_Handle B EINT4_7_Handle ;added by nick
EINT8_23_Handle B EINT8_23_Handle ;added by nick
CAM_Handle B CAM_Handle
BATFLT_Handle B BATFLT_Handle
TICK_Handle B TICK_Handle
WDT_AC97_Handle B WDT_AC97_Handle
ISR_TIMER0_Handle B OSTickISR ;added by nick
ISR_TIMER1_Handle B ISR_TIMER1_Handle ;added by nick
ISR_TIMER2_Handle B ISR_TIMER2_Handle ;added by nick
ISR_TIMER3_Handle B ISR_TIMER3_Handle ;added by nick
ISR_TIMER4_Handle B ISR_TIMER4_Handle ;added by nick
ISR_UART2_Handle B ISR_UART2_Handle ;added by nick
ISR_LCD_Handle B ISR_LCD_Handle ;added by nick
ISR_DMA0_Handle B ISR_DMA0_Handle ;added by nick
ISR_DMA1_Handle B ISR_DMA1_Handle ;added by nick
ISR_DMA2_Handle B ISR_DMA2_Handle ;added by nick
ISR_DMA3_Handle B ISR_DMA3_Handle ;added by nick
ISR_SDI_Handle B ISR_SDI_Handle ;added by nick
ISR_SPI0_Handle B ISR_SPI0_Handle ;added by nick
ISR_UART1_Handle B ISR_UART1_Handle ;added by nick
ISR_NFCON_Handle B ISR_NFCON_Handle ;added by nick
ISR_USBD_Handle B ISR_USBD_Handle ;added by nick
ISR_USBH_Handle B ISR_USBH_Handle ;added by nick
ISR_IIC_Handle B ISR_IIC_Handle ;added by nick
ISR_UART0_Handle B ISR_UART0_Handle ;added by nick
ISR_SPI1_Handle B ISR_SPI1_Handle ;added by nick
ISR_RTC_Handle B ISR_RTC_Handle ;added by nick
ISR_ADC_Handle B ISR_ADC_Handle ;added by nick