⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 startup.s

📁 AT91所有开发板的资料 AT91所有开发板的资料
💻 S
字号:
; *********************************************************************
; *
; * ARM Strategic Support Group
; *
; *********************************************************************

; *********************************************************************
; *
; * Module		: startup.s
; * Description : startup code to initialize the embedded C library and 
; *		  		  setup PCB for task B.
; * Tool Chain	: ARM Developer Suite v1.0
; * Platform	: Evaluator7T
; * History		:
; *		
; *			990416 ASloss
; *			- alter stack to point to 0x20000 (128k)
; *			- added headers
; *		
; *		 	990909 ASloss
; *			- added initialization of Task B Process
; *			control block (PCB)
; *	
; *			2000-03-26 Andrew N. Sloss
; *			- ported to Evaluator7T
; *			- changed top of memory for Evaluator7T to 0x80000		
; *
; *
; * Notes 	: none...
; *
; *********************************************************************
	
	IMPORT	taskb_process
	IMPORT  handler_taskbpcb_str
	IMPORT	handler_currenttaskid_str

	AREA asm_code, CODE

; *********************************************************************	
; * If assembled with TASM the variable {CONFIG} will be set to 16
; * If assembled with ARMASM the variable {CONFIG} will be set to 32
; * Set the variable THUMB to TRUE or false depending on whether the
; * file is being assembled with TASM or ARMASM.
; *********************************************************************	

	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
	
	ENTRY
|__init|

; **********************************************************************
; * Set up the stack pointer to point to the 512K (Evaluator7T top of 
; * memory).
; **********************************************************************
;
; Start Up TASKA User Mode stack
;

	;
	; -- set up USER stack for TASKA .................
	;
	MOV 	sp, #0x80000

; -- pcb_start ---------------------------------------------------------
;
; Description: Sets up TASK B Processor Control Block
; 
; Setting up TASK B PCB
;
; taskb[-4]  = "PCB R14" = &taskb_process
; taskb[-8]  = "PCB SP"  = TASKA SP - 4048;
; taskb[-60] = "LR"      = &taskb_process 
; taskb[-64] = "SPSR"	 = %nzcvift_User32 = 0x10
;

startup_pcb

	LDR		r0, =taskb_process
	LDR		r1, =handler_taskbpcb_str
	SUB		r1,r1,#4
	STR		r0,[r1]	

	; -- set up USER stack for TASKB .................

	SUB		r1,r1,#4
	SUB		r0,sp,#4048
	STR		r0,[r1]

	; -- set up link register ............................

	SUB		r1,r1,#56
	LDR		r0,=taskb_process
	STR		r0,[r1]

	; -- set up SPSR .....................................

	SUB		r1,r1,#4
	MOV		r0,#0x10 
	STR		r0,[r1]

	; -- set the current ID to TASKA

	LDR		r0, =handler_currenttaskid_str
	MOV		r1, #0
	STR		r1, [r0]

; -- startup initialization complete ...........................

	LDR 	lr, =C_Entry
	[ 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 + -