2019-04-17

【小记】

  APP的IAR工程中的中断向量表偏移是在系统库中的 __iar_program_start 处实现的

学习STM32F769DK-OTA例程之APP中断向量表重映射-LMLPHP

  启动代码 stm32f769xx.s

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Default interrupt handlers.
;;
THUMB
PUBWEAK Reset_Handler
SECTION .text:CODE:NOROOT:REORDER()
Reset_Handler LDR R0, =SystemInit
BLX R0
LDR R0, =__iar_program_start
BX R0 PUBWEAK NMI_Handler
SECTION .text:CODE:NOROOT:REORDER()

  经调试看到 __iar_program_start 的反汇编

 Reset_Handler:
0x80385d0: 0x4801 LDR.N R0, [PC, #0x4] ; SystemInit
BLX R0
0x80385d2: 0x4780 BLX R0
LDR R0, =__iar_program_start
0x80385d4: 0x4801 LDR.N R0, [PC, #0x4] ; __iar_program_start
BX R0
0x80385d6: 0x4700 BX R0
SECTION .text:CODE:NOROOT:REORDER()
0x80385d8: 0x0802586d DC32 SystemInit
SECTION .text:CODE:NOROOT:REORDER()
0x80385dc: 0x080385f9 DC32 __iar_program_start
0x80385e0: 0x70636573 DC32 0x70636573 ()
0x80385e4: 0x72363532 DC32 0x72363532 ()
0x80385e8: 0x00000031 DC32 0x31 ()
0x80385ec: 0x72617453 DC32 0x72617453 ()
0x80385f0: 0x00000074 DC32 0x74 ()
0x80385f4: 0x00544f49 DC32 0x544f49 ()
__iar_program_start:
0x80385f8: 0xf3af 0x8000 NOP.W
0x80385fc: 0xf7ff 0xff90 BL __iar_init_vfp ; 0x8038520
0x8038600: 0xf7ff 0xffb0 BL ?main ; 0x8038564
APBPrescTable:
0x8038604: 0x00000000 DC32 0x0 ()
0x8038608: 0x04030201 DC32 0x4030201 ()
0x803860c: 0x002e0000 DC32 0x2e0000 ()
0x8038610: 0x0043 DC16 ; 'C.'
B WWDG_IRQHandler
 __iar_init_vfp:
0x8038520: 0xf64e 0x5188 MOVW R1, # ; 0xed88
0x8038524: 0xf2ce 0x0100 MOVT R1, # ; 0xe000
0x8038528: 0x6808 LDR R0, [R1]
0x803852a: 0xf440 0x0070 ORR.W R0, R0, # ; 0xf00000
0x803852e: 0x6008 STR R0, [R1]
0x8038530: 0xf3bf 0x8f4f DSB
0x8038534: 0xf3bf 0x8f6f ISB
0x8038538: 0xf04f 0x7000 MOV.W R0, # ; 0x2000000
0x803853c: 0xeee1 0x0a10 VMSR FPSCR, R0
0x8038540: 0x4770 BX LR
0x8038542: 0x0000 MOVS R0, R0
Region$$Table$$Base:
0x8038544: 0xfffdb3e7 DC32 0xfffdb3e7 (-)
0x8038548: 0x000220dc DC32 0x220dc ()
0x803854c: 0x20000204 DC32 xStart
0x8038550: 0x00000000 DC32 0x0 ()
0x8038554: 0xfffdb2b7 DC32 0xfffdb2b7 (-)
0x8038558: 0x00000262 DC32 0x262 ()
0x803855c: 0x000001a2 DC32 0x1a2 ()
0x8038560: 0x20000000 DC32 global_hooks
?main:
Region$$Table$$Limit:
__cmain:
0x8038564: 0xf000 0xf80d BL __low_level_init ; 0x8038582
0x8038568: 0x2800 CMP R0, #
0x803856a: 0xd001 BEQ.N _call_main ; 0x8038570
0x803856c: 0xf7ff 0xffb2 BL __iar_data_init3 ; 0x80384d4
04-28 00:46