附咱写的启动文件
;<h> Stack Configuration
;<o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
Stack_Size EQU 0x00000200
AREA STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem SPACE Stack_Size
__initial_sp
;初始化栈
;<h> Heap Configuration
;<o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
Heap_Size EQU 0x00000300
AREA HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base
Heap_Mem SPACE Heap_Size
_heap_limit
PRESERVE8
THUMB
AREA RESET, DATA, READONLY
EXPORT __Vectors
__Vectors DCD __initial_sp ;Top of Stack
DCD Reset_Handler ;Reset Handler
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD WATL_1 ;IRQ0 Handler
DCD WATL_2 ;IRQ1 Handler
DCD WATL_3 ;IRQ2 Handler
AREA |.text|, CODE, READONLY
Reset_Handler PROC
GLOBAL Reset_Handler
ENTRY
IMPORT __main
LDR R0, = __main
BX R0
ENDP
WATL_1 PROC
EXPORT WATL_1 [WEAK]
IMPORT WAL1
PUSH {R0,R1,R2,LR}
BL WAL1
POP {R0,R1,R2,PC}
ENDP
WATL_2 PROC
EXPORT WATL_2 [WEAK]
IMPORT WAL2
PUSH{R0,R1,R2,LR}
BL WAL2
POP{R0,R1,R2,PC}
ENDP
WATL_3 PROC
EXPORT WATL_3 [WEAK]
IMPORT WAL3
PUSH{R0,R1,R2,LR}
BL WAL3
POP{R0,R1,R2,PC}
ENDP
;接下来为初始化堆栈,系统自动处理
ALIGN 4
IF :DEF:__MICROLIB
EXPORT __initial_sp
EXPORT __heap_base
EXPORT __Heap_limit
ELSE
IMPORT __use_two_region_memory
EXPORT __user_initial_stackheap
__user_initial_stackheap
LDR R0, = Heap_Mem
LDR R1, =(Stack_Mem + Stack_Size)
LDR R2, =(Heap_Mem + Heap_Size)
LDR R3, =Stack_Mem
BX LR
ALIGN
ENDIF
END
|