874f829ab17b1fa54679adec01f5d0831bf8b7c3
[openocd.git] / tcl / board / mini2440.cfg
1 #-------------------------------------------------------------------------
2 # Mini2440 Samsung s3c2440A Processor with 64MB DRAM, 64MB NAND, 2 MB N0R
3 # NOTE: Configured for NAND boot (switch S2 in NANDBOOT)
4 # 64 MB NAND (Samsung K9D1208V0M)
5 # B Findlay 08/09
6 #
7 # ----------- Important notes to help you on your way ----------
8 # README:
9 # NOR/NAND Boot Switch - I have not read the vivi source, but from
10 # what I could tell from reading the registers it appears that vivi
11 # loads itself into DRAM and then flips NFCONT (0x4E000004) bits
12 # Mode (bit 0 = 1), and REG_nCE (bit 1 = 0) which maps the NAND
13 # FLASH at the bottom 64MB of memory. This essentially takes the
14 # NOR Flash out of the circuit so you can't trash it.
15 #
16 # I adapted the samsung_s3c2440.cfg file which is why I did not
17 # include "source [find target/samsung_s3c2440.cfg]". I believe
18 # the -work-area-phys 0x200000 is incorrect, but also had to pad
19 # some additional resets. I didn't modify it as if it is working
20 # for someone, the work-area-phys is not used by most.
21 #
22 # JTAG ADAPTER SPECIFIC
23 # IMPORTANT! Any JTAG device that uses ADAPTIVE CLOCKING will likely
24 # FAIL as the pin RTCK on the mini2440 10 pin JTAG Conn doesn't exist.
25 # This is Pin 11 (RTCK) on 20 pin JTAG connector. Therefore it is
26 # necessary to FORCE setting the clock. Normally this should be configured
27 # in the openocd.cfg file, but was placed here as it can be a tough
28 # problem to figure out. THIS MAY NOT FIX YOUR PROBLEM.. I modified
29 # the openOCD driver jlink.c and posted it here. It may eventually end
30 # up changed in openOCD, but its a hack in the driver and really should
31 # be in the jtag layer (core.c me thinks), but haven't done it yet. My
32 # hack for jlink.c may be found here.
33 #
34 # http://forum.sparkfun.com/viewtopic.php?t=16763&sid=946e65abdd3bab39cc7d90dee33ff135
35 #
36 # Note: Also if you have a USB JTAG, you will need the USB library installed
37 # on your system "libusb-dev" or the make of openocd will fail. I *think*
38 # it's apt-get install libusb-dev. When I made my config I only included
39 # --enable-jlink and --enable-usbdevs
40 #
41 # I HAVE NOT Tested this throughly, so there could still be problems.
42 # But it should get you way ahead of the game from where I started.
43 # If you find problems (and fixes) please post them to
44 # openocd-development@lists.berlios.de and join the developers and
45 # check in fixes to this and anything else you find. I do not
46 # provide support, but if you ask really nice and I see anything
47 # obvious I will tell you.. mostly just dig, fix, and submit to openocd.
48 #
49 # best! brfindla@yahoo.com Nashua, NH USA
50 #
51 # Recommended resources:
52 # - first two are the best Mini2440 resources anywhere
53 # - maintained by buserror... thanks guy!
54 #
55 # http://bliterness.blogspot.com/
56 # http://code.google.com/p/mini2440/
57 #
58 # others....
59 #
60 # http://forum.sparkfun.com/viewforum.php?f=18
61 # http://labs.kernelconcepts.de/Publications/Micro24401/
62 # http://www.friendlyarm.net/home
63 # http://www.amontec.com/jtag_pinout.shtml
64 #
65 #-------------------------------------------------------------------------
66 #
67 #
68 # Your openocd.cfg file should contain:
69 # source [find interface/<yourjtag>.cfg]
70 # source [find board/mini2440.cfg]
71 #
72 #
73 #
74
75 # FIXME use some standard target config, maybe create one from this
76 #
77 # source [find target/...cfg]
78
79 #-------------------------------------------------------------------------
80 # Target configuration for the Samsung 2440 system on chip
81 # Tested on a S3C2440 Evaluation board by keesj
82 # Processor : ARM920Tid(wb) rev 0 (v4l)
83 # Info: JTAG tap: s3c2440.cpu tap/device found: 0x0032409d
84 # (Manufacturer: 0x04e, Part: 0x0324, Version: 0x0)
85 #-------------------------------------------------------------------------
86
87 if { [info exists CHIPNAME] } {
88 set _CHIPNAME $CHIPNAME
89 } else {
90 set _CHIPNAME s3c2440
91 }
92
93 if { [info exists ENDIAN] } {
94 set _ENDIAN $ENDIAN
95 } else {
96 # this defaults to a bigendian
97 set _ENDIAN little
98 }
99
100 if { [info exists CPUTAPID] } {
101 set _CPUTAPID $CPUTAPID
102 } else {
103 set _CPUTAPID 0x0032409d
104 }
105
106 #jtag scan chain
107 jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0x0f -expected-id $_CPUTAPID
108
109 set _TARGETNAME $_CHIPNAME.cpu
110 target create $_TARGETNAME arm920t -endian $_ENDIAN -chain-position $_TARGETNAME
111 $_TARGETNAME configure -work-area-phys 0x40000000 -work-area-size 0x4000 -work-area-backup 1
112
113 #reset configuration
114 adapter_nsrst_delay 100
115 jtag_ntrst_delay 100
116 reset_config trst_and_srst
117
118 #-------------------------------------------------------------------------
119 # JTAG ADAPTER SPECIFIC
120 # IMPORTANT! See README at top of this file.
121 #-------------------------------------------------------------------------
122
123 adapter_khz 12000
124 jtag interface
125
126 #-------------------------------------------------------------------------
127 # GDB Setup
128 #-------------------------------------------------------------------------
129
130 gdb_breakpoint_override hard
131
132 #------------------------------------------------
133 # ARM SPECIFIC
134 #------------------------------------------------
135
136 targets
137 # arm7_9 dcc_downloads enable
138 # arm7_9 fast_memory_access enable
139
140
141 nand device s3c2440 0
142
143 adapter_nsrst_delay 100
144 jtag_ntrst_delay 100
145 reset_config trst_and_srst
146 init
147
148 echo " "
149 echo "-------------------------------------------"
150 echo "--- login with - telnet localhost 4444 ---"
151 echo "--- then type help_2440 ---"
152 echo "-------------------------------------------"
153 echo " "
154
155
156
157 #------------------------------------------------
158 # Processor Initialialization
159 # Note: Processor writes can only occur when
160 # the state is in SYSTEM. When you call init_2440
161 # one of the first lines will tell you what state
162 # you are in. If a linux image is booting
163 # when you run this, it will not work
164 # a vivi boot loader will run with this just
165 # fine. The reg values were obtained by a combination
166 # of figuring them out fromt the manual, and looking
167 # at post vivi values with the debugger. Don't
168 # place too much faith in them, but seem to work.
169 #------------------------------------------------
170
171 proc init_2440 { } {
172
173 halt
174 s3c2440.cpu curstate
175
176 #-----------------------------------------------
177 # Set Processor Clocks - mini2440 xtal=12mHz
178 # we set main clock for 405mHZ
179 # we set the USB Clock for 48mHz
180 # OM2 OM3 pulled to ground so main clock and
181 # usb clock are off 12mHz xtal
182 #-----------------------------------------------
183
184 mww phys 0x4C000014 0x00000005 ;# Clock Divider control Reg
185 mww phys 0x4C000000 0xFFFFFFFF ;# LOCKTIME count register
186 mww phys 0x4C000008 0x00038022 ;# UPPLCON USB clock config Reg
187 mww phys 0x4C000004 0x0007F021 ;# MPPLCON Proc clock config Reg
188
189 #-----------------------------------------------
190 # Configure Memory controller
191 # BWSCON configures all banks, NAND, NOR, DRAM
192 # DRAM - 64MB - 32 bit bus, uses BANKCON6 BANKCON7
193 #-----------------------------------------------
194
195 mww phys 0x48000000 0x22111112 ;# BWSCON - Bank and Bus Width
196 mww phys 0x48000010 0x00001112 ;# BANKCON4 - ?
197 mww phys 0x4800001c 0x00018009 ;# BANKCON6 - DRAM
198 mww phys 0x48000020 0x00018009 ;# BANKCON7 - DRAM
199 mww phys 0x48000024 0x008E04EB ;# REFRESH - DRAM
200 mww phys 0x48000028 0x000000B2 ;# BANKSIZE - DRAM
201 mww phys 0x4800002C 0x00000030 ;# MRSRB6 - DRAM
202 mww phys 0x48000030 0x00000030 ;# MRSRB7 - DRAM
203
204 #-----------------------------------------------
205 # Now port configuration for enables for memory
206 # and other stuff.
207 #-----------------------------------------------
208
209 mww phys 0x56000000 0x007FFFFF ;# GPACON
210
211 mww phys 0x56000010 0x00295559 ;# GPBCON
212 mww phys 0x56000018 0x000003FF ;# GPBUP (PULLUP ENABLE)
213 mww phys 0x56000014 0x000007C2 ;# GPBDAT
214
215 mww phys 0x56000020 0xAAAAA6AA ;# GPCCON
216 mww phys 0x56000028 0x0000FFFF ;# GPCUP
217 mww phys 0x56000024 0x00000020 ;# GPCDAT
218
219 mww phys 0x56000030 0xAAAAAAAA ;# GPDCON
220 mww phys 0x56000038 0x0000FFFF ;# GPDUP
221
222 mww phys 0x56000040 0xAAAAAAAA ;# GPECON
223 mww phys 0x56000048 0x0000FFFF ;# GPEUP
224
225 mww phys 0x56000050 0x00001555 ;# GPFCON
226 mww phys 0x56000058 0x0000007F ;# GPFUP
227 mww phys 0x56000054 0x00000000 ;# GPFDAT
228
229 mww phys 0x56000060 0x00150114 ;# GPGCON
230 mww phys 0x56000068 0x0000007F ;# GPGUP
231
232 mww phys 0x56000070 0x0015AAAA ;# GPHCON
233 mww phys 0x56000078 0x000003FF ;# GPGUP
234
235 }
236
237
238
239 proc flash_config { } {
240
241 #-----------------------------------------
242 # Finish Flash Configuration
243 #-----------------------------------------
244
245 halt
246
247 #flash configuration (K9D1208V0M: 512Mbit, x8, 3.3V, Mode: Normal, 1st gen)
248 nand probe 0
249 nand list
250 }
251
252 proc flash_uboot { } {
253
254 # flash the u-Boot binary and reboot into it
255 init_2440
256 flash_config
257 nand erase 0 0x0 0x40000
258 nand write 0 /tftpboot/u-boot-nand512.bin 0 oob_softecc_kw
259 resume
260 }
261
262
263 proc load_uboot { } {
264 echo " "
265 echo " "
266 echo "----------------------------------------------------------"
267 echo "---- Load U-Boot into RAM and execute it. ---"
268 echo "---- NOTE: loads, partially runs, and hangs ---"
269 echo "---- U-Boot is fine, this image runs from vivi. ---"
270 echo "---- I burned u-boot into NAND so I didn't finish ---"
271 echo "---- debugging it. I am leaving this here as it is ---"
272 echo "---- part of the way there if you want to fix it. ---"
273 echo "---- ---"
274 echo "---- mini2440 U-boot here: ---"
275 echo "---- http://repo.or.cz/w/u-boot-openmoko/mini2440.git ---"
276 echo "---- Also this: ---"
277 echo "---- http://code.google.com/p/mini2440/wiki/MiniBringup --"
278 echo "----------------------------------------------------------"
279
280 init_2440
281 echo "Loading /tftpboot/u-boot-nand512.bin"
282 load_image /tftpboot/u-boot-nand512.bin 0x33f80000 bin
283 echo "Verifying image...."
284 verify_image /tftpboot/u-boot-nand512.bin 0x33f80000 bin
285 echo "jumping to u-boot"
286 #bp 0x33f80068 4 hw
287 reg 0 0
288 reg 1 0
289 reg 2 0
290 reg 3 0
291 reg 4 0x33f80000
292 resume 0x33f80000
293 }
294
295 # this may help a little bit debugging the load_uboot
296 proc s {} {
297 step
298 reg
299 arm disassemble 0x33F80068 0x10
300 }
301
302 proc help_2440 {} {
303 echo " "
304 echo " "
305 echo "-----------------------------------------------------------"
306 echo "---- The following mini2440 funcs are supported ----"
307 echo "---- init_2440 - initialize clocks, DRAM, IO ----"
308 echo "---- flash_config - configures nand flash ----"
309 echo "---- load_uboot - loads uboot into ram ----"
310 echo "---- flash_uboot - flashes uboot to nand (untested) ----"
311 echo "---- help_2440 - this help display ----"
312 echo "-----------------------------------------------------------"
313 echo " "
314 echo " "
315 }
316
317
318 #----------------------------------------------------------------------------
319 #----------------------------------- END ------------------------------------
320 #----------------------------------------------------------------------------

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)