我的问题是 stm32如何找到中断服务程序的地址?
谢谢正点原子的例程,这里使用了例程4,我上传了一个。
其中有这么一句程序:
SCB->VTOR = NVIC_VectTab|(Offset & (u32)0x1FFFFF80);//设置NVIC的向量表偏移寄存器
这里的 SCB->VTOR 是这个东东:
Vector Table Offset Register
Use the Vector Table Offset Register to determine:
•if the vector table is in RAM or code memory
•the vector table offset.
The register address, access type, and Reset state are:
Address 0xE000ED08
Access Read/write
Reset state 0x00000000
简单的说,这条程序做了这个:SCB->VTOR =0x0800 0000
这里是stm32的flash的起始地址。
也就是说中断向量表放在了flash的起始地址。对吗?????
再看keil的仿真:
0x08000000 0208 LSLS r0,r1,#8
0x08000002 2000 MOVS r0,#0x00
0x08000004 0105 LSLS r5,r0,#4
0x08000006 0800 LSRS r0,r0,#0
0x08000008 0109 LSLS r1,r1,#4
0x0800000A 0800 LSRS r0,r0,#0
0x0800000C 010B LSLS r3,r1,#4
0x0800000E 0800 LSRS r0,r0,#0
0x08000010 010D LSLS r5,r1,#4
0x08000012 0800 LSRS r0,r0,#0
0x08000014 010F LSLS r7,r1,#4
0x08000016 0800 LSRS r0,r0,#0
0x08000018 0111 LSLS r1,r2,#4
0x0800001A 0800 LSRS r0,r0,#0
0x0800001C 0000 MOVS r0,r0
0x0800001E 0000 MOVS r0,r0
0x08000020 0000 MOVS r0,r0
0x08000022 0000 MOVS r0,r0
0x08000024 0000 MOVS r0,r0
0x08000026 0000 MOVS r0,r0
0x08000028 0000 MOVS r0,r0
0x0800002A 0000 MOVS r0,r0
0x0800002C 0113 LSLS r3,r2,#4
0x0800002E 0800 LSRS r0,r0,#0
0x08000030 0115 LSLS r5,r2,#4
0x08000032 0800 LSRS r0,r0,#0
0x08000034 0000 MOVS r0,r0
0x08000036 0000 MOVS r0,r0
0x08000038 0117 LSLS r7,r2,#4
0x0800003A 0800 LSRS r0,r0,#0
0x0800003C 0119 LSLS r1,r3,#4
0x0800003E 0800 LSRS r0,r0,#0
0x08000040 011B LSLS r3,r3,#4
0x08000042 0800 LSRS r0,r0,#0
0x08000044 011B LSLS r3,r3,#4
0x08000046 0800 LSRS r0,r0,#0
0x08000048 011B LSLS r3,r3,#4
0x0800004A 0800 LSRS r0,r0,#0
0x0800004C 011B LSLS r3,r3,#4
0x0800004E 0800 LSRS r0,r0,#0
0x08000050 011B LSLS r3,r3,#4
0x08000052 0800 LSRS r0,r0,#0
0x08000054 011B LSLS r3,r3,#4
0x08000056 0800 LSRS r0,r0,#0
0x08000058 05F5 LSLS r5,r6,#23
0x0800005A 0800 LSRS r0,r0,#0
0x0800005C 011B LSLS r3,r3,#4
0x0800005E 0800 LSRS r0,r0,#0
0x08000060 011B LSLS r3,r3,#4
0x08000062 0800 LSRS r0,r0,#0
0x08000064 011B LSLS r3,r3,#4
0x08000066 0800 LSRS r0,r0,#0
0x08000068 011B LSLS r3,r3,#4
0x0800006A 0800 LSRS r0,r0,#0
0x0800006C 011B LSLS r3,r3,#4
0x0800006E 0800 LSRS r0,r0,#0
0x08000070 011B LSLS r3,r3,#4
0x08000072 0800 LSRS r0,r0,#0
0x08000074 011B LSLS r3,r3,#4
0x08000076 0800 LSRS r0,r0,#0
0x08000078 011B LSLS r3,r3,#4
0x0800007A 0800 LSRS r0,r0,#0
0x0800007C 011B LSLS r3,r3,#4
0x0800007E 0800 LSRS r0,r0,#0
0x08000080 011B LSLS r3,r3,#4
0x08000082 0800 LSRS r0,r0,#0
0x08000084 011B LSLS r3,r3,#4
0x08000086 0800 LSRS r0,r0,#0
0x08000088 011B LSLS r3,r3,#4
0x0800008A 0800 LSRS r0,r0,#0
0x0800008C 011B LSLS r3,r3,#4
0x0800008E 0800 LSRS r0,r0,#0
0x08000090 011B LSLS r3,r3,#4
0x08000092 0800 LSRS r0,r0,#0
0x08000094 011B LSLS r3,r3,#4
0x08000096 0800 LSRS r0,r0,#0
0x08000098 011B LSLS r3,r3,#4
0x0800009A 0800 LSRS r0,r0,#0
0x0800009C 011B LSLS r3,r3,#4
0x0800009E 0800 LSRS r0,r0,#0
0x080000A0 011B LSLS r3,r3,#4
0x080000A2 0800 LSRS r0,r0,#0
0x080000A4 011B LSLS r3,r3,#4
0x080000A6 0800 LSRS r0,r0,#0
0x080000A8 011B LSLS r3,r3,#4
0x080000AA 0800 LSRS r0,r0,#0
0x080000AC 011B LSLS r3,r3,#4
0x080000AE 0800 LSRS r0,r0,#0
0x080000B0 011B LSLS r3,r3,#4
0x080000B2 0800 LSRS r0,r0,#0
0x080000B4 011B LSLS r3,r3,#4
0x080000B6 0800 LSRS r0,r0,#0
0x080000B8 011B LSLS r3,r3,#4
0x080000BA 0800 LSRS r0,r0,#0
0x080000BC 011B LSLS r3,r3,#4
0x080000BE 0800 LSRS r0,r0,#0
0x080000C0 011B LSLS r3,r3,#4
0x080000C2 0800 LSRS r0,r0,#0
0x080000C4 011B LSLS r3,r3,#4
0x080000C6 0800 LSRS r0,r0,#0
0x080000C8 011B LSLS r3,r3,#4
0x080000CA 0800 LSRS r0,r0,#0
0x080000CC 011B LSLS r3,r3,#4
0x080000CE 0800 LSRS r0,r0,#0
0x080000D0 011B LSLS r3,r3,#4
0x080000D2 0800 LSRS r0,r0,#0
0x080000D4 011B LSLS r3,r3,#4
0x080000D6 0800 LSRS r0,r0,#0
0x080000D8 011B LSLS r3,r3,#4
0x080000DA 0800 LSRS r0,r0,#0
0x080000DC 011B LSLS r3,r3,#4
0x080000DE 0800 LSRS r0,r0,#0
0x080000E0 0633 LSLS r3,r6,#24
0x080000E2 0800 LSRS r0,r0,#0
0x080000E4 011B LSLS r3,r3,#4
0x080000E6 0800 LSRS r0,r0,#0
0x080000E8 011B LSLS r3,r3,#4
0x080000EA 0800 LSRS r0,r0,#0
_main_stk:
0x080000EC F8DFD00C LDR.W sp,[pc,#12] ; @0x080000FC
_main_scatterload:
0x080000F0 F000FC3C BL.W __scatterload_rt2 (0x0800096C)
_main_init:
0x080000F4 4800 LDR r0,[pc,#0] ; @0x080000F8
0x080000F6 4700 BX r0
0x080000F8 0121 LSLS r1,r4,#4
0x080000FA 0800 LSRS r0,r0,#0
0x080000FC 0208 LSLS r0,r1,#8
0x080000FE 2000 MOVS r0,#0x00
//******************************************************************************************************问题在这里:
怎么看我的 中断向量表 在 0x0800 0000 里是怎么被安排的啊?
中断服务程序在下面:
如何由0x0800 0000 附近的表格里的数据找到0x080005F4,0x08000632的中断服务程序的呢???
//******************************************************************************************************问题
23: GPIOD->ODR|=1<<2; //PD.2输出高
0x080005D2 4608 MOV r0,r1
0x080005D4 F8D0040C LDR r0,[r0,#0x40C]
0x080005D8 F0400004 ORR r0,r0,#0x04
0x080005DC F8C1040C STR r0,[r1,#0x40C]
24: }
0x080005E0 4770 BX lr
0x080005E2 0000 MOVS r0,r0
0x080005E4 1000 ASRS r0,r0,#0
0x080005E6 4002 ANDS r2,r2,r0
0x080005E8 0804 LSRS r4,r0,#0
0x080005EA 4001 ANDS r1,r1,r0
0x080005EC 0000 MOVS r0,r0
0x080005EE 4001 ANDS r1,r1,r0
0x080005F0 1000 ASRS r0,r0,#0
0x080005F2 4001 ANDS r1,r1,r0
13: {
0x080005F4 B510 PUSH {r4,lr} 《《《《《《《《《《《《《《《-这里有1个
14: delay_ms(10);//消抖
0x080005F6 200A MOVS r0,#0x0A
0x080005F8 F7FFFDC5 BL.W delay_ms (0x08000186)
15: if(KEY2==1) //按键2
16: {
0x080005FC 4850 LDR r0,[pc,#320] ; @0x08000740
0x080005FE 6800 LDR r0,[r0,#0x00]
0x08000600 2801 CMP r0,#0x01
0x08000602 D112 BNE 0x0800062A
17: LED0=!LED0;
0x08000604 484E LDR r0,[pc,#312] ; @0x08000740
0x08000606 30A0 ADDS r0,r0,#0xA0
0x08000608 6800 LDR r0,[r0,#0x00]
0x0800060A B908 CBNZ r0,0x08000610
0x0800060C 2001 MOVS r0,#0x01
0x0800060E E000 B 0x08000612
0x08000610 2000 MOVS r0,#0x00
0x08000612 494B LDR r1,[pc,#300] ; @0x08000740
0x08000614 31A0 ADDS r1,r1,#0xA0
0x08000616 6008 STR r0,[r1,#0x00]
18: LED1=!LED1;
19: }
0x08000618 484A LDR r0,[pc,#296] ; @0x08000744
0x0800061A F8D00188 LDR r0,[r0,#0x188]
0x0800061E B908 CBNZ r0,0x08000624
0x08000620 2001 MOVS r0,#0x01
0x08000622 E000 B 0x08000626
0x08000624 2000 MOVS r0,#0x00
0x08000626 4948 LDR r1,[pc,#288] ; @0x08000748
0x08000628 6008 STR r0,[r1,#0x00]
20: EXTI->PR=1<<0; //清除LINE0上的中断标志位
0x0800062A 2001 MOVS r0,#0x01
0x0800062C 4947 LDR r1,[pc,#284] ; @0x0800074C
0x0800062E 6008 STR r0,[r1,#0x00]
21: }
22:
23: //外部中断15~10服务程序 《《《《《《《《《《《《《《《-这里有1个
24: void EXTI15_10_IRQHandler(void)
0x08000630 BD10 POP {r4,pc}
25: {
0x08000632 B510 PUSH {r4,lr}
26: delay_ms(10); //消抖
0x08000634 200A MOVS r0,#0x0A
0x08000636 F7FFFDA6 BL.W delay_ms (0x08000186)
27: if(KEY0==0) //按键0
28: {
0x0800063A 4841 LDR r0,[pc,#260] ; @0x08000740
0x0800063C 3034 ADDS r0,r0,#0x34
0x0800063E 6800 LDR r0,[r0,#0x00]
0x08000640 B950 CBNZ r0,0x08000658
29: LED0=!LED0;
0x08000642 483F LDR r0,[pc,#252] ; @0x08000740
0x08000644 30A0 ADDS r0,r0,#0xA0
0x08000646 6800 LDR r0,[r0,#0x00]
0x08000648 B908 CBNZ r0,0x0800064E
0x0800064A 2001 MOVS r0,#0x01
0x0800064C E000 B 0x08000650
0x0800064E 2000 MOVS r0,#0x00
0x08000650 493B LDR r1,[pc,#236] ; @0x08000740
0x08000652 31A0 ADDS r1,r1,#0xA0
0x08000654 6008 STR r0,[r1,#0x00]
0x08000656 E00B B 0x08000670
30: }else if(KEY1==0)//按键1
31: {
0x08000658 4839 LDR r0,[pc,#228] ; @0x08000740
0x0800065A 303C ADDS r0,r0,#0x3C
0x0800065C 6800 LDR r0,[r0,#0x00]
0x0800065E B938 CBNZ r0,0x08000670
32: LED1=!LED1;
33: }
0x08000660 4839 LDR r0,[pc,#228] ; @0x08000748
0x08000662 6800 LDR r0,[r0,#0x00]
0x08000664 B908 CBNZ r0,0x0800066A
0x08000666 2001 MOVS r0,#0x01
谢谢各位高人! |
|