crt0.s

来自「coldfire5206芯片的boot程序」· S 代码 · 共 72 行

S
72
字号
;
;       src/crtcf/crt0.s: startup for an embedded environment: ColdFire
;       ---------------------------------------------------------------
;
;       Written by Tomas Evensen 1993-04-17.
;       Copyright 1993-1998 Diab Data, Inc.


	.file   "crt0.s"
	PSECT
	XDEF    start
	XDEF	_START
	ALIGN   4
	nop                     ; Debuggers may object to starting at 0.

start:
_START:
;
; Insert/modify code here to initialize (if necessary):

; - sp (stack pointer)

; - a5 (data pointer)

; - the cache
		MOVE.L  #$1000000,D0     ;// invalidate cache contents
		MOVEC   D0,CACR

		MOVE.L  #$80000000,D0    ;// enable the cache
		MOVEC   D0,CACR

		MOVE.L  #$0,D0		       ;// Disable ACR0, ACR1
		MOVEC   D0,ACR0
		MOVEC   D0,ACR1

		MOVE.L  #($400000),D0	    ;// 8K SRAM module maped to the last part of DRAM
		MOVEC   D0,RAMBAR

; - exception vectors
;
	move.l  #___SP_INIT,a7  ; Initialize stack pointer a7 to value in
				; linker command file.
	move.l  #__SDA_BASE_,a5 ; Initialize a5 to sdata (provided by linker).

	jsr     ___init_main    ; Finish initialization; call main().
	move.l  d0,-(a7)        ; Pass exit() value if returned by main().
	jsr     _exit           ; Never returns.
	jsr     _main           ; Dummy to pull in main() as soon as possible.


;------------------------------------------------------------- .init section --
	section .init$00,2,C
	XDEF    ___init         ; Entry to ___init, called by
___init:                        ; ___init_main called above.

	; Linker places .init sections from other modules, containing
	; calls to initialize global objects, here.

	section .init$99,2,C
	rts                     ; Return from ___init.

;------------------------------------------------------------- .fini section --
	section .fini$00,2,C
	XDEF    ___fini
___fini:                        ; Entry to ___fini, called by exit().

	; Linker places .fini sections from other modules, containing
	; calls to destroy global objects, here.

	section .fini$99,2,C
	rts                     ; Return from ___fini.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?