出去注释外,我们关心如下几行:
28 #include <config.h>
29 #include <version.h>
30
31
32 /*
33 *************************************************************************
34 *
35 * Jump vector table as in table 3.1 in [1]
36 *
37 *************************************************************************
38 */
39
40
41 .globl _start
42 _start: b reset
43 ldr pc, _undefined_instruction
44 ldr pc, _software_interrupt
45 ldr pc, _prefetch_abort
46 ldr pc, _data_abort
47 ldr pc, _not_used
48 ldr pc, _irq
49 ldr pc, _fiq
当然我比较差就暂时不关心43~49行。
110 reset:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
111 /*
112 * set the cpu to SVC32 mode
113 */
114 mrs r0,cpsr
115 bic r0,r0,#0x1f
116 orr r0,r0,#0xd3
117 msr cpsr,r0
118
119 /* turn off the watchdog */
120 #if defined(CONFIG_S3C2400)
121 # define pWTCON 0x15300000
122 # define INTMSK 0x14400008 /* Interupt-Controller base addresses */
123 # define CLKDIVN 0x14800014 /* clock divisor register */
124 #elif defined(CONFIG_S3C2410)
125 # define pWTCON 0x53000000
126 # define INTMSK 0x4A000008 /* Interupt-Controller base addresses */
127 # define INTSUBMSK 0x4A00001C
128 # define CLKDIVN 0x4C000014 /* clock divisor register */
129 #elif defined(CONFIG_S3C2440) //add by yannzi
130 # define pWTCON 0x53000000
131 # define INTMSK 0x4A000008 /* Interupt-Controller base addresses */
132 # define INTSUBMSK 0x4A00001C
133 # define CLKDIVN 0x4C000014 /* clock divisor register */
134 #endif
这几行是define 一些寄存器的地址。
可能是初生牛犊不怕虎吧,我自己加上了129~133几句。
暂时还没测试,以移植我的S3C2440。
接下来是turn off the watchdog 。
136 #if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)
137 ldr r0, =pWTCON
138 mov r1, #0x0 //disable watchdog yz
139 str r1, [r0]
140
141 /*
142 * mask all IRQs by setting all bits in the INTMR - default
143 */
然后是mask all IRQs by setting all bits in the INTMR - default
144 mov r1, #0xffffffff
145 ldr r0, =INTMSK
146 str r1, [r0]
147 # if defined(CONFIG_S3C2410)
148 ldr r1, =0x3ff
149 ldr r0, =INTSUBMSK
150 str r1, [r0]
151 # endif
152 # if defined(CONFIG_S3C2440) //add by yannzi
153 ldr r1, =0x7fff
154 ldr r0, =INTSUBMSK
155 str r1, [r0]
156 # endif
157
设置FCLK:HCLK:PCLK
158 /* FCLK:HCLK:PCLK = 1:2:4 */
159 /* default FCLK is 120 MHz ! */
160 ldr r0, =CLKDIVN
161 mov r1, #3 //the same as 2440 yz
162 str r1, [r0]
这里忘了当HDIVN非0,要改变CPU总线模式了。我下午去改。改了后,163~167如下:
163 # if defined (CONFIG_S3C2440) //MMU_SetAsyncBusMode add by yannzi
164 mrc p15, 0, r0, c1, c0, 0
165 orr r0, r0, #R1_nF:OR:R1_iA
166 mcr p15, 0, r0, c1, c0, 0
167 #endif
168 #endif /* CONFIG_S3C2400 || CONFIG_S3C2410 || CONFIG_S3C2440 */
yannzi 2009-2-17 23:43
用户741296 2009-2-17 15:30