dl_start.s
来自「在高通的手机平台下,一个下载手机.bin文件到手机的flash中的工具,包含PC」· S 代码 · 共 140 行
S
140 行
;//===================================================
; Edit History
; Date Name Description
;12/26/05 wufei.lin Initial the stack register and the memory
;
;
;//=================================================================
;//============================================================================
;//
;// REGISTER DEFINITIONS
;//
;//============================================================================
;CPSR Control Masks
PSR_Fiq_Mask EQU 0x40
PSR_Irq_Mask EQU 0x80
; Processor mode definitions
PSR_Supervisor EQU 0x13
;/*============================================================================
;
; STACK DEFINITIONS
;
;============================================================================*/
; Stack sizes
SVC_Stack_Size EQU 0x200
IMPORT |Load$$CODE$$Base|
IMPORT |Image$$CODE$$Base|
IMPORT |Image$$CODE$$Length|
IMPORT |Image$$CODE$$ZI$$Base|
IMPORT |Image$$CODE$$ZI$$Length|
IMPORT svc_stack
IMPORT process_packets
IMPORT boot_ram_init
EXPORT Load__CODE__Base
EXPORT Image__CODE__Base
EXPORT Image__CODE__Length
EXPORT Image__CODE__ZI__Base
EXPORT Image__CODE__ZI__Length
;/*============================================================================
;
; STARTUP CODE
;
;============================================================================*/
IMPORT process_packets
EXPORT __main
AREA StartHere, CODE, READONLY
CODE32
__main
ENTRY
;////////////////////////////////////////////////////////////////////////////////
;//
;// Name: blatox
;//
;// Description: Calls a function from ARM state without having to know whether that
;// that function is ARM or Thumb state code.
;//
;// Arguments:
;// destreg - The register that contains the address of the function to be called.
;//
;// Registers modified: lr
;//
;// MODE: Any
;// STATE: ARM. Can call either ARM or Thumb state functions.
;//
;////////////////////////////////////////////////////////////////////////////////
; // call a function without knowing if it is ARM or THUMB code
MACRO
blatox $destreg
ROUT
tst $destreg, #0x01 ;// Test for thumb mode call.
ldrne lr, =%1
ldreq lr, =%2
bx $destreg
1
CODE16
bx pc
ALIGN
CODE32
2
MEND
;//============================================================================
; Enter C code execution
;wufei.lin add to initialize the stack
msr CPSR_c, #PSR_Supervisor:OR:PSR_Irq_Mask:OR:PSR_Fiq_Mask
ldr r13, =svc_stack+SVC_Stack_Size
;wufei.lin add to Initial variable in ram
ldr r4, =boot_ram_init
blatox r4
ldr a1, =process_packets
blatox a1
AREA BOOTSYS_DATA, DATA, READONLY
; The $$ convention used by the linker is replaced to avoid the need
; for the -pcc option required by the ARM compiler when symbols that
; include $$ are used in 'C' code.
Load__CODE__Base
DCD |Load$$CODE$$Base|
Image__CODE__Base
DCD |Image$$CODE$$Base|
Image__CODE__Length
DCD |Image$$CODE$$Length|
Image__CODE__ZI__Base
DCD |Image$$CODE$$ZI$$Base|
Image__CODE__ZI__Length
DCD |Image$$CODE$$ZI$$Length|
END
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?