📄 startup.s
字号:
F_Bit EQU 0x40
Mode_Svc EQU 0x13
AREA asm_code, CODE
GBLL THUMB
[ {CONFIG} = 16
THUMB SETL {TRUE}
; *********************************************************************
; * If assembling with TASM go into 32 bit mode as the Armulator will
; * start up the program in ARM state.
; *********************************************************************
CODE32
|
THUMB SETL {FALSE}
]
IMPORT C_Entry
; added by liming 2003-03-04
;IMPORT __rt_stackheap_init
;IMPORT __rt_lib_init
ENTRY
|__init|
; **********************************************************************
; * Set up the stack pointer to point to the 512K (Evaluator7T top of
; * memory).
; **********************************************************************
;set up irq stack
mov r0, #0xd2 ; make irq mode with all irqs disabled
msr cpsr_cxsf, r0
MOV sp, #0x60000
;set up svc stack
mov r0, #0xd3 ; make svc mode with all irqs disabled
msr cpsr_cxsf, r0
MOV sp, #0x80000
; **********************************************************************
; * Get the address of the C entry point.
; **********************************************************************
; added by liming 2003-03-04
;bl __rt_stackheap_init
;bl __rt_lib_init
LDR lr, =C_Entry
; **********************************************************************
; * Enable the interrupt while staying in the supervisor mode
; **********************************************************************
MOV r0, #Mode_Svc:OR:F_Bit
MSR cpsr_c, r0
[ THUMB
; **********************************************************************
; * If building a Thumb version pass control to C_entry using the BX
; * instruction so the processor will switch to THUMB state.
; **********************************************************************
BX lr
|
; **********************************************************************
; * Otherwise just pass control to C_Entry in ARM state.
; **********************************************************************
MOV pc, lr
]
END
; **********************************************************************
; * END OF startup.s
; **********************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -