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

📄 crt0.s

📁 ADC图形图像例子
💻 S
字号:
##==============================================================================
##      crt0.S
##      SE3208 startup code
##==============================================================================
## Copyright (c) 1995, 1996, 1997, 1998 Cygnus Solutions
## The authors hereby grant permission to use, copy, modify, distribute,
## and license this software and its documentation for any purpose, provided
## that existing copyright notices are retained in all copies and that this
## notice is included verbatim in any distributions. No written agreement,
## license, or royalty fee is required for any of the authorized uses.
## Modifications to this software may be copyrighted by their authors
## and need not follow the licensing terms described here, provided that
## the new terms are clearly indicated on the first page of each file where
## they apply.
##==============================================================================

    .file   "crt0.S"
    .section .text
    .global _start
_start:
    ldi     _stack-8, %r3   # Load up the stack pointer and allocate stack=0x020f:ffff
    lea     (%r3),    %sp   # our current frame.
################################################################################
# PLL Register Set
####################
    ldi     0x01804000, %R6     # RAMDAC & PLL Control Register
    ldi     0x00000004, %R7
    st      %R7, (%R6,0)

    ldi     0x01804004, %R6     # PLL Program Reigster
    ldi     0x0000573c, %R7     # 80Mhz
    st      %R7, (%R6,0)
################################################################################
# LOCAL ROM CFG
####################
    ldi     0x01800400, %R6 # Local DRAM Control Register
    ldi     0x00000087, %R7
    st      %R7, (%R6,0)
################################################################################
# Expansion ROM CFG
####################
    ldi		0x01800008,	%R6	# Expansion ROM Control Register
    ldi		0x00000103,	%R7
    st      %R7, (%R6,0)
################################################################################
# LOCAL RAM CFG
####################
# Sync DRAM
    ldi     0x01800408, %R6     # Local DRAM Control Register
    ldi     0x00141347, %R7     # data=0 0001 0100 0001 0011 0100 0111
    st      %R7, (%R6,0)
#FRAME & MEMORY ACTIVE
    ldi     0x03000104, %R6 
    ldi     0x0af20af2, %R7
    st      %R7, (%R6,0)

    ldi     0x03000108, %R6 
    ldi     0x00000af2, %R7
    st      %R7, (%R6,0)
    
    ldi     0x03000100, %R6 
    ldi     0x0000800a, %R7
    st      %R7, (%R6,0)
##################################################################################
       
    ldi     0x01802414, %R6     # nPCS5
    ldi     0x00000884, %R7
    st      %R7, (%R6,0)

    ldi     0x01802418, %R6     # nPCS6
    ldi     0x00000884, %R7
    st      %R7, (%R6,0)

################################################################################
# Cache Inintialize
################################################################################
cache_invalidate_set:
    ldi     0x01, %R0
    mvtc    0, %CR5
    
Cache_invalidate_check:
    mvfc    0, %CR6
    and     %R0, 0x00100000, %R0
    jnz     Cache_invalidate_check

Cache_mode_set:
    ldi     0x80, %R0
    mvtc    0, %CR3
    
Cache_active_set:
    ldi     0x1801, %r0 
    mvtc    0, %CR7
    
##################################################################################
ROMDATA_COPY:
    ldi     _etext, %r3         # ROM has data at end of text; copy it.
    ldi     _data_reload, %r1
    cmp     %r3, %r1
    jz      .L2                 # If no data, then do nothing
    ldi     _edata, %r4
    cmp     %r4, %r1
    jz      .L2
    
    sub		%r4, %r1, %r6
    add		%r3, %r6, %r3
.L3:
    sub		%r3, 1, %r3
    sub		%r4, 1, %r4
    ldb		(%r3), %r2
    stb		%r2, (%r4)
    sub		%r6, 1, %r6
    jnz		.L3
    
################################################################################
BSS_INIT:
.L2:
    ldi     _edata, %r3         # Get the start/end of bss
    ldi     _end, %r1

    cmp     %r3, %r1            # If no bss, then do nothing
    jz      .L0

    ldi     0, %r2              # clear %r2
.L1:
    stb     %r2, (%r3)          # Clear a byte and bump pointer
    add     %r3, 1, %r3
    cmp     %r3, %r1
    jnz     .L1
.L0:
    call    _main               # Call main program
	jmp		_exit
._exit:
    .section ._stack
_stack: .long   1

⌨️ 快捷键说明

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