📄 startup.lst
字号:
ARM GAS /cygdrive/c/DOCUME~1/HOWARD~1/LOCALS~1/Temp/ccwLGWPA.s page 1 1 # 1 "startup.S" 2 # 1 "/cygdrive/c/tmp/basic/startup//" 1 #
1 ... 0 0 2 # *** Startup Code (executed after Reset) ***
3 #
4
5 #include "config.h"
1 /******************************************************************************
2 *
3 * Copyright:
4 * (C) 2000 - 2005 Embedded Artists AB
5 *
6 * Description:
6
7 # Standard definitions of Mode bits and Interrupt (I & F) flags in PSRs
8
9 .equ Mode_USR, 0x10
10 .equ Mode_FIQ, 0x11
11 .equ Mode_IRQ, 0x12
12 .equ Mode_SVC, 0x13
13 .equ Mode_ABT, 0x17
14 .equ Mode_UND, 0x1B
15 .equ Mode_SYS, 0x1F
16
17 .equ I_Bit, 0x80 /* when I bit is set, IRQ is disabled */
18 .equ F_Bit, 0x40 /* when F bit is set, FIQ is disabled */
19
20 .equ sram_bottom, SRAM_SADDR
21 .equ sram_top, SRAM_TOP
22 .equ stackTop, SRAM_TOP
23
24 #define VAL_PLLCFG_MSEL ((PLL_MUL - 1) << 0)
25 #if (PLL_DIV == 1)
26 #define PLL_DIV_VALUE 0x00
27 #elif (PLL_DIV == 2)
28 #define PLL_DIV_VALUE 0x01
29 #elif (PLL_DIV == 4)
30 #define PLL_DIV_VALUE 0x10
31 #elif (PLL_DIV == 8)
32 #define PLL_DIV_VALUE 0x11
33 #endif
34 #define VAL_PLLCFG_PSEL (PLL_DIV_VALUE << 5)
35 #define VAL_PLLCFG (VAL_PLLCFG_MSEL | VAL_PLLCFG_PSEL)
36
37 # Phase Locked Loop (PLL) definitions
38 .equ PLL_BASE, 0xE01FC080 /* PLL Base Address */
39 .equ PLLCON_OFS, 0x00 /* PLL Control Offset*/
40 .equ PLLCFG_OFS, 0x04 /* PLL Configuration Offset */
41 .equ PLLSTAT_OFS, 0x08 /* PLL Status Offset */
42 .equ PLLFEED_OFS, 0x0C /* PLL Feed Offset */
43 .equ PLLCON_PLLE, (1<<0) /* PLL Enable */
44 .equ PLLCON_PLLC, (1<<1) /* PLL Connect */
45 .equ PLLSTAT_PLOCK, (1<<10) /* PLL Lock Status */
46
ARM GAS /cygdrive/c/DOCUME~1/HOWARD~1/LOCALS~1/Temp/ccwLGWPA.s page 2 47 #define HANDLER(HandlerLabel,HandleLabel) \
48 HandlerLabel: ;\
49 sub sp, sp, #4 ;\
50 stmfd sp!, {r0} ;\
51 ldr r0, =HandleLabel ;\
52 ldr r0, [r0] ;\
53 str r0, [sp,#4] ;\
54 ldmfd sp!, {r0,pc}
55
56 # Starupt Code must be linked first at Address at which it expects to run.
57
58 .text
59 .arm
60 # ******************************************************************************
61 # Declare external function
62 # ******************************************************************************
63 .extern lowLevelInit
64 .extern exceptionHandlerInit
65
66 .global _startup
67 .func _startup
68 _startup:
69
70 # Exception Vectors
71 # Mapped to Address 0.
72
73 Vectors:
74 _vectors:
75 # If vectors are in FLASH, starting at 0x00000000
76 #if (MAM_MAP == 1)
77:startup.S **** B handleReset /* jump to reset code */
78:startup.S **** B HandlerUndef /* handlerUndef */
79:startup.S **** B HandlerSWI /* SWI interrupt handler */
80:startup.S **** B HandlerPabort /* handlerPAbort */
81:startup.S **** B HandlerDabort /* handlerDAbort */
82:startup.S **** NOP /* Reserved Vector */
83 #if (IRQ_HANDLER == 0)
84 B HandlerIRQ /* handlerIRQ */
85 #else
86:startup.S **** LDR PC,[PC,#-0xFF0] /* jump to address supplied by VIC */
87 #endif
88:startup.S **** B HandlerFIQ /* handlerFIQ */
89
90 # Create handlers
91:startup.S **** HANDLER(HandlerUndef, HandleUndef)
92:startup.S **** HANDLER(HandlerSWI, HandleSWI)
93:startup.S **** HANDLER(HandlerPabort, HandlePabort)
94:startup.S **** HANDLER(HandlerDabort, HandleDabort)
95 #if (IRQ_HANDLER == 0)
96 HANDLER(HandlerIRQ, HandleIRQ)
97 #endif
98:startup.S **** HANDLER(HandlerFIQ, HandleFIQ)
99
100 # If vectors are in RAM, starting at 0x40000000
101 #else
102 LDR PC,[PC,#resetHandlerAddress - . - 8] /* handle reset */ 103 LDR PC,[PC,#undefHandlerAddress - . - 8] /* handlerUndef */ARM GAS /cygdrive/c/DOCUME~1/HOWARD~1/LOCALS~1/Temp/ccwLGWPA.s page 3 104 LDR PC,[PC,#swiHandlerAddress - . - 8] /* SWI interrupt handler */ 105 LDR PC,[PC,#pabortHandlerAddress - . - 8] /* handlerPAbort */ 106 LDR PC,[PC,#dabortHandlerAddress - . - 8] /* handlerDAbort */ 107 NOP /* Reserved Vector */ 108 #if (IRQ_HANDLER == 0)
109 LDR PC,[PC,#irqHandlerAddress - . - 8] /* jump to common irq handler */ 110 #else
111 LDR PC,[PC,#-0xFF0] /* jump to address supplied from VIC */ 112 #endif
113 LDR PC,[PC,#fiqHandlerAddress - . - 8] /* handlerFIQ */ 114
115 resetHandlerAddress:
116 .word handleReset
117
118 undefHandlerAddress:
119 .word 0
120
121 swiHandlerAddress:
122 .word 0
123
124 pabortHandlerAddress:
125 .word 0
126
127 dabortHandlerAddress:
128 .word 0
129
130 irqHandlerAddress:
131 .word 0
132
133 fiqHandlerAddress:
134 .word 0
135
136 #endif
137
138 # Reset Handler
139 handleReset:
140
141 #if (USE_PLL == 1)
142:startup.S **** LDR R0, =PLL_BASE
143:startup.S **** MOV R1, #0xAA
144:startup.S **** MOV R2, #0x55
145
146 # Disable PLL before programming (in case it was enabled before)
147:startup.S **** MOV R3, #0
148:startup.S **** STR R3, [R0, #PLLCON_OFS]
149:startup.S **** STR R1, [R0, #PLLFEED_OFS]
150:startup.S **** STR R2, [R0, #PLLFEED_OFS]
151
152 # Wait for
153 # Configure and Enable PLL
154:startup.S **** MOV R3, #VAL_PLLCFG
155:startup.S **** STR R3, [R0, #PLLCFG_OFS]
156:startup.S **** MOV R3, #PLLCON_PLLE
157:startup.S **** STR R3, [R0, #PLLCON_OFS]
158:startup.S **** STR R1, [R0, #PLLFEED_OFS]
159:startup.S **** STR R2, [R0, #PLLFEED_OFS]
160
ARM GAS /cygdrive/c/DOCUME~1/HOWARD~1/LOCALS~1/Temp/ccwLGWPA.s page 4 161 # Wait until PLL Locked
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -