最近研究TI的bootloader的代码:
export __Vectors
__Vectors
dcd g_pulStack + (_STACK_SIZE * 4) ; Offset 00: Initial stack pointer
dcd Reset_Handler ; Offset 04: Reset handler
dcd NmiSR + 0x20000000 ; Offset 08: NMI handler
dcd FaultISR + 0x20000000 ; Offset 0C: Hard fault handler
dcd IntDefaultHandler + 0x20000000 ; Offset 10: MPU fault handler
dcd IntDefaultHandler + 0x20000000 ; Offset 14: Bus fault handler
dcd IntDefaultHandler + 0x20000000 ; Offset 18: Usage fault handler
dcd 0 ; Offset 1C: Reserved
dcd 0 ; Offset 20: Reserved
dcd 0 ; Offset 24: Reserved
dcd 0 ; Offset 28: Reserved
dcd UpdateHandler ; Offset 2C: SVCall handler
UpdateHandler
;
; Initialize the processor.
;
bl ProcessorInit
;
; Load the stack pointer from the vector table.
;
movs r0, #0x00000000
ldr r0, [r0]
mov sp, r0
;
; Branch to the update handler.
;
if :def:_ENET_ENABLE_UPDATE
b UpdateBOOTP
else
b Updater
endif
通过上面的代码,发现UpdateHandler应该是由应用程序SVC调用bootloader进行直接升级的途径,但是应用程序如何执行这个SVC呢?应用的中断向量已经不再是0x00000000这个地方了。 |