add initial support for the crisarchitecture used on foxboards to openwrt
[openwrt/staging/dedeckeh.git] / target / linux / etrax-2.6 / image / e100boot / src / doc / e100boot.pod
1 =head1 NAME
2
3 e100boot - Network and serial port bootloader for the ETRAX100 CPU.
4
5 =head1 SYNOPSIS
6
7 B<e100boot> [B<--device> I<devicename>]
8 [B<--file> I<filename>|- I<addr> [I<size>]]
9 [B<--flash> I<ram-source> I<flash-offset> I<size>] [B<--pause> I<iter>]
10 [B<--memtest> I<addr> I<addr>] [B<--memclear> I<addr> I<addr>]
11 [B<--memdump> I<addr> I<addr>] [B<--setreg> I<addr>|I<regname> I<val>]
12 [B<--getreg> I<addr>|I<regname>] [B<--verify> I<addr> I<val>]
13 [B<--label> I<label>] [B<--loop> I<addr> I<label>] [B<--5400>] [B<--5600>]
14 [B<--testcard>] [B<--devboard>] [B<--testcardlx>] [B<--network>] [B<--serial>]
15 [B<--baudrate> I<baudrate>] [B<--bootfile> I<file>] [B<--jump> I<addr>]
16 [B<--tofiles>] [B<--cmdsonly>] [B<--images>] [B<--noleds>] [B<--help>]
17
18 =head1 DESCRIPTION
19
20 This boot loader facilitates loading of files over the network or a
21 serial port to an ETRAX100. It can also be used for fairly extensive
22 hardware debugging as you can read and write to any memory addresses,
23 including the ETRAX100 registers. You can also perform memory checks
24 and dumps and copy data to flash memories.
25
26 The first packet (or the first 784 bytes in the case of serial boot)
27 sent to Etrax100 is loaded into the cache. The code in this packet is
28 executed and loads the rest of the boot loader into the cache. The
29 cache is the only thing we can be sure of exists on all ETRAX100
30 products, so the boot loader is limited to the size of the cache,
31 8KB. If further boot loading code is needed you have to set up
32 external memory and load another boot loader into it, but this is
33 rarely needed.
34
35 Two programs are involved in this boot loading, one is the program on
36 your workstation that sends the packets to ETRAX100, this is called
37 the server boot loader or SBL. The other program is the one in
38 ETRAX100 that receives packets from the SBL and acts upon the data
39 therein, this is called the client boot loader or CBL.
40
41 We don't want to edit and recompile the CBL each time we want to load
42 level two to different parts of memory, like we do on different
43 products. We also want to change things like the setup of external
44 memory before we load data into it. To make the boot loading as
45 flexible as possible and separate the CBL from level two we send a
46 configuration packet to it. After this packet we load other files, if
47 we want to.
48
49 The configuration packet can contain information to the CBL which lets
50 you: initialize external memory, read and write to all ETRAX100
51 registers, read and write to any part of memory, load as many other
52 files as you like to any part of memory you like, etc. The
53 configuration packet is generated on the fly by the SBL.
54
55 Since the CBL is unaware of which product it will be loaded on, it
56 doesn't do product specific initialization like setting up the
57 memory. This must be done with the configuration packet.
58
59 =head2 Debugging printout
60
61 When doing network boot the debugging printout from the CBL in ETRAX
62 is transmitted back over the network and printed by e100boot. When
63 doing serial boot that interface will be used. So in either case you
64 will not need any other software or hardware to receive the debugging
65 printout.
66
67 =head2 Creating binaries
68
69 The files containing code to be loaded on the ETRAX100 must be
70 stripped using the standard GCC binutils.
71
72 =head2 How it works, things you don't want to know.
73
74 ack, timeout bla, bla... RTFS.
75
76 =head2 Compilation and code
77
78 Noteworthy is that two separate ETRAX100 binaries are created, one for
79 network boot and one for serial boot. They actually contain exactly
80 the same code, but linked in different order. This is because the code
81 to load the rest of the bootloader over a specific interface must be
82 contained in the first data sent to the ETRAX100 and it is too
83 difficult to cram the code for both interfaces in the beginning of the
84 same binary. Hence two files.
85
86 Other stuff you don't want to know is that the cache is mapped from
87 0x380000f0 to 0x380020f0. Code starts at the first address followed by
88 data up to the symbol I<Ebss>. At the other end is the buffer for boot
89 commands (addresses defined by I<IO_BUF_START> and I<IO_BUF_END> below
90 which the stack lies and hopefully the stack and I<Ebss> will never
91 meet...
92
93 The serial data is loaded from 0x380000f0 to 0x380003ff before
94 execution starts.
95
96 =head1 OPTIONS
97
98 The options are done in the order specified on the command line, so
99 you probably want to do any memory setup before loading a file to the
100 memory, and you probably do not want to perform a memory test after
101 you have loaded a file to that memory.
102
103 All addresses and sizes must be in hex with optional '0x' prefix, or a
104 ETRAX100 register name. Since the B<--setreg> and B<--getreg> options
105 only can be performed on dword aligned dwords only the registers that
106 conform to this can be named.
107
108 Note also that all addresses must be in uncached memory (bit 31 set),
109 as the bootloader lies in the cache. If you access any uncached
110 address during boot, the bootloader will be destroyed without warning.
111
112 It is also possible to specify an address as I<+address>, in which
113 case it is considered to be relative to I<IO_BUF_START>. This is
114 especially useful in combination with the B<--loop> option below.
115
116 =over 4
117
118 =item B<--baudrate> I<baudrate>
119
120 Set baudrate for files loaded after the boot loader.
121
122 =item B<--bootfile> I<filename>
123
124 Which boot image to send to ETRAX instead of the default ones.
125
126 =item B<--cmdsonly>
127
128 Write the commands to file e100boot.cmds.
129
130 =item B<--devboard>
131
132 Sets registers for the developer board.
133
134 =item B<--device> I<devicename>
135
136 Which device to send packets on. For network boot the default is
137 eth0. For serial boot it is ttyS0.
138
139 =item B<--file> I<filename>|- I<address> [I<size>]
140
141 The file to load and the address to load it to. If file is loaded on
142 stdin, specify filename '-' followed by a size. Size need only be
143 given in this case. You can load as many files as you want, each
144 specified with a B<--file>.
145
146 =item B<--flash> I<ram-source flash-offset size>
147
148 Copies the specified RAM area to the flash.
149
150 =item B<--getreg> I<address>|I<regname>
151
152 Print value of memory location. Must be uncached address.
153
154 =item B<--help>
155
156 Print the help information.
157
158 =item B<--images>
159
160 Print information about the internal boot images, then exit.
161
162 =item B<--jump> I<address>
163
164 Jump to specified address.
165
166 =item B<--label> I<label>
167
168 Define a label to be used as target by the B<--loop> command. This
169 command is only used by the SBL to calculate the address for the
170 B<--loop> and does not take up any space in the configuration packet.
171
172 =item B<--loop> I<check-address label>
173
174 If the contents of check-address is nonzero it is decremented and the
175 command parser continues parsing at the label.
176
177 If no external memory is initialized yet it can be convenient to use
178 an address in the area occupied by the configuration packet. Run
179 e100boot with B<--help> to see which addresses the commands are stored
180 at. The size of the commands are four bytes for each command plus four
181 bytes per argument to the command.
182
183 =item B<--memclear> I<start-address end-address>
184
185 Clears the specified memory area.
186
187 =item B<--memdump> I<start-address end-address>
188
189 Prints the contents of the specified memory area.
190
191 =item B<--memtest> I<start-address end-address>
192
193 Does a fairly extensive test of the specified memory area. Not only
194 catches defect memories but also catches things like wrong memory
195 setups where memory addresses are mirrored onto each other.
196
197 =item B<--network>
198
199 Perform a network boot.
200
201 =item B<--noleds>
202
203 When using the internal images use a version that does not toggle
204 general port PA or PB in ETRAX during the boot procedure.
205
206 =item B<--pause> I<iterations>
207
208 How many I<iterations> to do of an empty loop.
209
210 =item B<--serial>
211
212 Do a serial boot.
213
214 =item B<--setreg> I<address>|I<regname> I<value>
215
216 Load dword to dword aligned memory location.
217
218 =item B<--testcard>
219
220 Configures the memories for the ETRAX 100 testcard.
221
222 =item B<--testcardlx>
223
224 Configures the memories for the ETRAX100 LX testcard.
225
226 =item B<--tofiles>
227
228 Write packets to files e100boot.seq[0..]. Does not transmit the data.
229
230 =item B<--verify> I<address value>
231
232 Verify that memory contains dword. If not loader will stop. This is to
233 avoid booting the wrong unit. If you have the units ethernet address
234 in the flash memory you can check for that.
235
236 =item B<--5400>
237
238 Sets R_WAITSTATES, R_DRAM_TIMING and R_DRAM_CONFIG for the 5400
239 printserver.
240
241 =item B<--5600>
242
243 Sets R_WAITSTATES, R_DRAM_TIMING and R_DRAM_CONFIG for the 5600
244 printserver.
245
246 =back
247
248 =head1 EXAMPLES
249
250 If you have a stripped binary (file.ima) linked to 0x08000000 that you want
251 to boot via the network, do this:
252
253 B<e100boot --file file.ima 88000000 --jump 08000000>
254
255 Or something like this. Sets waitstates to zero and loads two files,
256 the first from stdin:
257
258 B<cat file.ima | e100boot --memtest 88000000 8801ffff --memclear
259 88000000 8801ffff --setreg b0000000 0 --getreg b0000000 --file -
260 88000000 a000 --file file2.ima 88010000 --memdump 88000000 880000ff
261 --jump 08000000>
262
263 Or this, enables 16 bit parallel port and flashes the led on PA0:
264
265 B<e100boot --testcardlx --setreg R_PORT_PA_SET 0x00000000 --setreg
266 R_GEN_CONFIG 0x80000004 --setreg R_PAR0_CONFIG 0x00000200 --setreg
267 R_PORT_G_DATA 0x00000000 --pause 0x02000000 --setreg R_PORT_G_DATA
268 0xffffffff --pause 0x02000000 --setreg R_PORT_G_DATA 0x00000000 --loop
269 0x38001e0b 0x38001e60>
270
271 Setup the memory, test the SRAM, print the contents of the first 256
272 bytes of SRAM, clear SRAM, test the DRAM, print R_DMA_CH0_CMD, load a
273 file to SRAM, load another file to SRAM, load file to DRAM, jump to
274 code in SRAM.
275
276 B<e100boot --setreg b0000000 1000 --setreg b0000008 00006543 --setreg
277 b000000c 12966060 --memtest 88000000 80000 --memdump 88000000 880000ff
278 --memclear 88000000 80000 --memtest c0000000 400000 --getreg b00001d0
279 --file file1.ima 88000000 --file file2.ima 88010000 --file file3.ima
280 c0000000 --jump 88000000>
281
282 Boot Linux on the testcard.
283
284 B<e100boot --setreg b0000000 1000 --setreg b0000008 6557 --setreg
285 b000000c 1b988080 --file timage c0000500 --jump 40000500>
286
287 Booting over serial port and using labels to flash the leds on port
288 PA.
289
290 B<e100boot --serial --device /dev/ttyS1 --baudrate 9600 --label first
291 --setreg 0x380020e0 00000001 --setreg R_PORT_PA_SET 0x0000ff00 --pause
292 0x02000000 --setreg R_PORT_PA_SET 0x0000ffff --pause 0x02000000 --loop
293 0x380020e0 first>
294
295 =head1 BUGS
296
297 You're kidding, right? Check L<AUTHOR|"AUTHOR"> below. The only thing
298 would be the hubris of the author, but that I consider a feature. If
299 you find any other 'features' report them to
300 technology@axis.com. Don't bother the author directly, he is busy
301 playing PlayStation2.
302
303 =head1 COPYING
304
305 Copyright © 1996-2002 Axis Communications AB.
306
307 =head1 AUTHOR
308
309 Written by Ronny Ranerup.
310
311 =head1 SEE ALSO
312
313 The fine source, which you can get at http://developer.axis.com.
314