这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » MCU » 关于BOOT代码中建立二级中断矢量表的问题,实在费解!!路过请帮帮忙,看一下 ,

共5条 1/1 1 跳转至

关于BOOT代码中建立二级中断矢量表的问题,实在费解!!路过请帮帮忙,看一下 ,谢谢!

菜鸟
2006-08-10 01:27:33     打赏

;****************************************************
;* Setup IRQ handler *
;****************************************************
ldr r0,=(_IRQ_BASEADDRESS + 0x100)
ldr r2,=_IRQ_BASEADDRESS
add r3,r0, #0x100
0
CMP r0, r3 ;do what?
STRCC r2, [r0], #4;cc:Carry clear;save R2 to R0 address, R0 + 4=R0。
BCC %B0

;上面这段是什么意思??

ldr r1,=_IRQ_BASEADDRESS
ldr r0,=ExceptionHanlderBegin ;if there isn't 'subs pc,lr,#4' at 0x18, 0x1c'
ldr r3,=ExceptionHanlderEnd
0
CMP r0, r3 ;put the vector table at _IRQ_BASEADDRESS(0xc000000)
LDRCC r2, [r0], #4
STRCC r2, [r1], #4
BCC %B0


ldr r1,=DIsrIRQ ;put the IRQ judge program at _IRQ_BASEADDRESS+0x80(0xc000080)
ldr r0,=IsrIRQ ;if there isn't 'subs pc,lr,#4' at 0x18, 0x1c'
ldr r3,=IsrIRQEnd
0
CMP r0, r3
LDRCC r2, [r0], #4
STRCC r2, [r1], #4
BCC %B0


ldr r1, =MyHandleIRQ ;MyHandleIRQ point to DIsrIRQ
ldr r0, =ExceptionHanlderBegin
ldr r4, =_IRQ_BASEADDRESS;////
sub r0, r1, r0
;add r0, r0, #_IRQ_BASEADDRESS
add r0, r0,r4
ldr r1, =DIsrIRQ
str r1, [r0]




关键词: 关于     代码     建立     二级     中断     量表     问题     实在         

菜鸟
2006-08-10 01:51:00     打赏
2楼

还有一段 中断向量表
^ (_IRQ_BASEADDRESS)
HandleReset # 4
HandleUndef # 4
HandleSWI # 4
HandlePabort # 4
HandleDabort # 4
HandleReserved # 4
HandleIRQ # 4
HandleFIQ # 4


^ (_IRQ_BASEADDRESS+0x80)
DIsrIRQ # 4


;Don't use the label 'IntVectorTable',
;because armasm.exe cann't recognize this label correctly.
;the value is different with an address you think it may be.
;IntVectorTable
^ (_IRQ_BASEADDRESS+0x100)
HandleADC # 4
HandleRTC # 4
HandleUTXD1 # 4
HandleUTXD0 # 4
HandleSIO # 4
HandleIIC # 4
HandleURXD1 # 4
HandleURXD0 # 4
HandleTIMER5 # 4
HandleTIMER4 # 4
HandleTIMER3 # 4
HandleTIMER2 # 4
HandleTIMER1 # 4
HandleTIMER0 # 4
HandleUERR01 # 4
HandleWDT # 4
HandleBDMA1 # 4
HandleBDMA0 # 4
HandleZDMA1 # 4
HandleZDMA0 # 4
HandleTICK # 4
HandleEINT4567 # 4
HandleEINT3 # 4
HandleEINT2 # 4
HandleEINT1 # 4
HandleEINT0 # 4

^ (_ISR_STARTADDRESS-0x1400)

UserStack # 1024 ;c1(c7)fe600
SVCStack # 1024 ;c1(c7)feb00
UndefStack # 1024 ;c1(c7)ff000
AbortStack # 1024 ;c1(c7)ff500
IRQStack # 1024 ;c1(c7)ffa00
FIQStack # 0 ;c1(c7)fff00

END

想了一下,应该是把IRQ_BASEADDRESS + 0x100~IRQ_BASEADDRESS + 0x200

的内容清0,但是有什么用呢?

我认为不清0也是可以的呀!因为当你建立中断时就把地址给它了

#define pISR_ADC (*(unsigned *)(_IRQ_BASEADDRESS+0x100))

在程序中,pISR_ADC = (int) ADC_ISR;

程序执行时,自然跑到ADC_ISR执行。

难道是防止程序跑飞?


菜鸟
2006-08-10 03:31:00     打赏
3楼

没有清零,而是都写成了_IRQ_BASEADDRESS,大概是0x0c000000


菜鸟
2006-08-10 16:29:00     打赏
4楼
以下是引用ryansheng在2006-8-9 19:31:00的发言:

没有清零,而是都写成了_IRQ_BASEADDRESS,大概是0x0c000000

那有什么作用呢?


菜鸟
2006-09-08 18:32:00     打赏
5楼

我也很想知道!

有哪位大侠介绍介绍哪有关于中断处理的好帖子,谢谢了


共5条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]