📄 cstartup.arm
字号:
;------------------------------------------------------------------------------
;- ATMEL Microcontroller Software Support - ROUSSET -
;------------------------------------------------------------------------------
; The software is delivered "AS IS" without warranty or condition of any
; kind, either express, implied or statutory. This includes without
; limitation any warranty or condition with respect to merchantability or
; fitness for any particular purpose, or against the infringements of
; intellectual property rights of others.
;-----------------------------------------------------------------------------
;- File source : cstartup.arm
;- Object : C startup for EB55
;-
;- 1.0 05/11/00 EL : Creation Green Hills
;------------------------------------------------------------------------------
INCLUDE ../../targets/eb55/eb55.inc
; *****************************************************************************
; Angel Rom Monitor Method
;- Preprocessor Flag can be set : SEMIHOSTING
; *****************************************************************************
IF :DEF:AT91_DEBUG_ANGEL; {
INCLUDE ../../targets/cstartup_angel.arm
;----------------------------------------------------------------------
; Call __low_level_init to perform initialization before initializing
; AIC and calling main.
; Diasable all peripherial clock
;----------------------------------------------------------------------
__low_level_init
mov pc,r14 ; Return
ENDIF ; AT91_DEBUG_ANGEL }
; *****************************************************************************
; ICE or Sram Method
;- Preprocessor Flag can be set : SEMIHOSTING
; *****************************************************************************
IF :DEF:AT91_DEBUG_ICE; {
INCLUDE ../../targets/cstartup_ice.arm
;----------------------------------------------------------------------
; Call __low_level_init to perform initialization before initializing
; AIC and calling main.
; Disable all peripherial clock
;----------------------------------------------------------------------
__low_level_init
mvn r0,#0 ; R0<- 0xFFFFFFFF
ldr r1,=APMC_BASE ; Get Power saving configuartion
str r0,[r1,#APMC_PCDR] ; Diasable all peripherial clock
mov pc,r14 ; Return
ENDIF ; AT91_DEBUG_ICE }
; *****************************************************************************
; Flash Method
; *****************************************************************************
IF :DEF:AT91_DEBUG_NONE; {
INCLUDE ../../tools/boot_loader/loader_eb55/cstartup_flash.arm
;----------------------------------------------------------------------
; Call __low_level_init to perform initialization before initializing
; AIC and calling main.
; Pll Initialization
;----------------------------------------------------------------------
__low_level_init
;- Speed up the System Frequency.
;---------------------------------
ldr r0, =0x002F0002 ; MOSCEN = 1, OSCOUNT = 47 (1.4ms/30祍)
ldr r1, =APMC_BASE ; Get the APMC Base Address
str r0, [r1, #APMC_CGMR] ; Store the configuration of the Clock Generator
;- Reading the APMC Status register to detect when the oscillator is stabilized
;------------------------------------------------------------------------------
mov r4, #APMC_MOSCS
MoscsLoop
ldr r2, [r1, #APMC_SR]
and r2, r4,r2
cmp r2, #APMC_MOSCS
bne MoscsLoop
;- Commuting from Slow Clock to Main Oscillator (16Mhz)
;------------------------------------------------------
ldr r0, =0x002F4002 ; MOSCEN = 1, OSCOUNT = 47 (1.4ms/30祍)
str r0, [r1, #APMC_CGMR] ; Store the configuration of the Clock Generator
;-Setup the PLL
;---------------
ldr r0, =0x032F4102 ; MUL = 1, PLLCOUNT = 3, CSS = 1
str r0, [r1, #APMC_CGMR] ; Store the configuration of the Clock Generator
;- Reading the APMC Status register to detect when the PLL is stabilized
;-----------------------------------------------------------------------
mov r4, #APMC_PLL_LOCK
Pll_Loop
ldr r3, [r1, #APMC_SR]
and r3, r4,r3
cmp r3, #APMC_PLL_LOCK
bne Pll_Loop
;- Commuting from 16Mhz to PLL @ 32MHz
;--------------------------------------
ldr r0, =0x032F8102 ; CSS = 2, MUL = 1
str r0, [r1, #APMC_CGMR] ; Store the configuration of the Clock Generator
;- Now the Master clock is the output of PLL @ 32MHz
;----------------------------------------------------
mov pc,r14 ; Return
ENDIF ; AT91_DEBUG_NONE }
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -