]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - doc/sgml/user-guide/target-setup.sgml
Initial revision
[karo-tx-redboot.git] / doc / sgml / user-guide / target-setup.sgml
1 <!-- {{{ Banner                         -->
2
3 <!-- =============================================================== -->
4 <!--                                                                 -->
5 <!--     config-tool.sgml                                            -->
6 <!--                                                                 -->
7 <!--     eCos User Guide                                             -->
8 <!--                                                                 -->
9 <!-- =============================================================== -->
10 <!-- ####COPYRIGHTBEGIN####                                          -->
11 <!--                                                                 -->
12 <!-- =============================================================== -->
13 <!-- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.  -->
14 <!-- This material may be distributed only subject to the terms      -->
15 <!-- and conditions set forth in the Open Publication License, v1.0  -->
16 <!-- or later (the latest version is presently available at          -->
17 <!-- http://www.opencontent.org/openpub/)                            -->
18 <!-- Distribution of the work or derivative of the work in any       -->
19 <!-- standard (paper) book form is prohibited unless prior           -->
20 <!-- permission obtained from the copyright holder                   -->
21 <!-- =============================================================== -->
22 <!--                                                                 -->      
23 <!-- ####COPYRIGHTEND####                                            -->
24 <!-- =============================================================== -->
25 <!-- #####DESCRIPTIONBEGIN####                                       -->
26 <!--                                                                 -->
27 <!-- ####DESCRIPTIONEND####                                          -->
28 <!-- =============================================================== -->
29
30 <!-- }}} -->
31
32
33 <appendix id="appendix-target-setup">
34 <title>Target Setup</title>
35
36 <para>
37 The following sections detail the setup of many of the targets
38 supported by eCos. 
39 </para>
40
41 <caution>
42 <para>
43 This information is presented here only temporarily. It is intended
44 that there will be separate documents detailing this information for
45 each target in future releases. Consequently not much effort has been
46 put into bringing the following documentation up to date -- much of it
47 is obsolete, bogus or just plain wrong.
48 </para>
49 </caution>
50
51 <!--
52 <para>
53 XXXXX Exactly which of these are really supported in 2.0. Can we
54 delete some of them. I'm reluctant to waste much time fixing up text
55 that is going to be largely rewritten anyway.
56 XXXXX
57 </para>
58 -->
59
60 <!-- ==================================================== -->
61
62 <SECT1 id="setup-mn10300-stdeval1">
63 <TITLE>MN10300 stdeval1 Hardware Setup</TITLE>
64 <PARA>The eCos Developer&rsquo;s Kit package comes with a pair
65 of EPROMs which provide GDB support for the Matsushita MN10300 (AM31)
66 series evaluation board using CygMon, the Cygnus ROM monitor. Images
67 of these EPROMs are also provided at <filename>BASE_DIR/loaders/mn10300-stdeval1/cygmon.bin</filename>.
68 The LSB EPROM (LROM) is installed to socket IC8 on the board and
69 the MSB EPROM (UROM) is installed to socket IC9. Attention should
70 be paid to the correct orientation of these EPROMs during installation.</PARA>
71 <PARA>The CygMon stubs allows communication with GDB by way of the
72 serial port at connector CN2. The communication parameters are fixed
73 at 38400 baud, 8 data bits, no parity bit, and 1 stop bit (8-N-1).
74 No flow control is employed. Connection to the host computer should
75 be made using a standard RS232C serial cable (not a null modem cable).
76 A gender changer may also be required.</PARA>
77 </SECT1>
78
79 <!-- ==================================================== -->
80
81 <SECT1 id="setup-mn10300-sim">
82 <TITLE>MN10300 Architectural Simulator Setup</TITLE>
83 <PARA>The MN10300 simulator is an architectural simulator for the
84 Matsushita MN10300 that implements all features of the microprocessor
85  necessary to run eCos. The current implementation provides accurate
86 simulation of the instruction set, interrupt controller, timers,
87 and  serial I/O.</PARA>
88 <PARA>In this release, you can run the same eCos binaries in the
89 simulator that can run on target hardware, if built for ROM start-up,
90 with the  exception of those that use the watchdog timer.</PARA>
91 <PARA>However, note that AM33 devices required to run eCos are not
92 simulated; therefore you cannot run eCos binaries built for the
93 AM33 under the simulator. For the AM33, the simulator is effectively
94 an instruction-set only simulator.</PARA>
95 <PARA>To simplify connection to the simulator, you are advised to
96 create a GDB macro by putting the following code in your personal
97 GDB start-up file (gdb.ini on Windows and .gdbinit on UNIX).</PARA>
98 <PROGRAMLISTING>define msim   
99  target sim --board=stdeval1 --memory-region 0x34004000,0x8
100   
101  rbreak cyg_test_exit   
102  rbreak cyg_assert_fail  
103 end</PROGRAMLISTING>
104 <PARA>You can then connect to the simulator by invoking the command <PROGRAMLISTING>msim</PROGRAMLISTING> on
105 the command line:</PARA>
106 <PROGRAMLISTING>(gdb) msim</PROGRAMLISTING>
107 <PARA>You can achieve the same effect by typing out the macro&rsquo;s
108 content on  the command line if necessary.</PARA>
109 </SECT1>
110
111 <!-- ==================================================== -->
112
113 <SECT1 id="setup-am33-stb">
114 <TITLE>AM33 STB Hardware Setup</TITLE>
115 <PARA>The Matsushita AM33 STB System Reference Board may be used
116 in two modes: via a JTAG debugger, or by means of a GDB stub ROM.</PARA>
117 <SECT2>
118 <TITLE>Use with GDB Stub ROM</TITLE>
119 <PARA>The eCos Developer&rsquo;s Kit package comes with a ROM
120 image which provides GDB support for
121 the Matsushita(R) AM33 STB System Reference Board. To install the
122 GDB stub ROM requires the use of the JTAG debugger and the Flash ROM
123 programming code available from Matsushita. An image of this ROM
124 is also provided at <filename>loaders/am33-stb/gdbload.bin</filename> under
125 the root of your eCos installation.</PARA>
126 <PARA>Ensure that there is a Flash ROM card in MAIN MEMORY SLOT &lt;0&#62;.
127 Follow the directions for programming a Flash ROM supplied with
128 the programming software.</PARA>
129 <PARA>The final programming of the ROM will need to be done with
130 a command similar to the following:</PARA>
131 <PROGRAMLISTING>fdown "gdbload.bin",0x80000000,16,1</PROGRAMLISTING>
132 <PARA>Once the ROM has been programmed, close down the JTAG debugger,
133 turn the STB off, and disconnect the JTAG cable. Ensure that the
134 hardware switches are in the following configuration:</PARA>
135 <PROGRAMLISTING>U U D D D U D D
136
137 D = lower part of rocker switch pushed in
138 U = upper part of rocker switch pushed in</PROGRAMLISTING>
139 <PARA>This is also the configuration required by the Flash programming
140 code, so it should not be necessary to change these.</PARA>
141 <PARA>Restart the STB and the stub ROM will now be able to communicate
142 with <PRODUCTNAME>GDB</PRODUCTNAME>. eCos programs should be built
143 with RAM startup.</PARA>
144 <PARA>Programs can then be downloaded via a standard RS232 null
145 modem serial cable connected to the SERIAL1 connector on the STB
146 front panel (the AM33&quot;s serial port 0). This line is programmed
147 to run at 38400 baud, 8 data bits, no parity and 1 stop bit (8-N-1)
148 with no flow control. A gender changer may also be required. Diagnostic
149 output will be output to GDB using the same connection.</PARA>
150 <PARA>This procedure also applies for programming ROM startup eCos
151 programs into ROM, given a binary format image of the program from<PROGRAMLISTING> mn10300-elf-objcopy.</PROGRAMLISTING></PARA>
152 </SECT2>
153 <SECT2>
154 <TITLE>Use with the JTAG debugger</TITLE>
155 <PARA>To use eCos from the JTAG debugger, executables must be built
156 with ROM startup and then downloaded via the JTAG debugger. For
157 this to work there must be an SDRAM memory card in SUB MEMORY SLOT &lt;0&#62; and
158 the hardware switches on the front panel set to the following: </PARA>
159 <PROGRAMLISTING>D U D D D U D D
160
161 D = lower part of rocker switch pushed in
162 U = upper part of rocker switch pushed in</PROGRAMLISTING>
163 <PARA>Connect the JTAG unit and run the debugger as described in
164 the documentation that comes with it.</PARA>
165 <PARA>eCos executables should be renamed to have a &ldquo;.out&rdquo; extension
166 and may then be loaded using the debugger&quot;s &ldquo;l&rdquo; or &ldquo;lp&rdquo; commands.</PARA>
167 <PARA>Diagnostic output generated by the program will be sent out
168 of the AM33&quot;s serial port 0 which is connected to the SERIAL1
169 connector on the STB front panel. This line is programmed to run
170 at 38400 baud, 8 data bits, no parity, and one stop bit (8-N-1)
171 with no flow control. Connection to the host computer should be
172 using a standard RS232 null modem serial cable. A gender changer
173 may also be required.</PARA>
174 </SECT2>
175 <SECT2>
176 <TITLE>Building the GDB stub ROM image</TITLE>
177 <PARA>eCos comes with a pre-built GDB stub ROM image for the AM33-STB
178 platform. This can be found at <filename>loaders/am33-stb/gdbload.bin</filename> relative
179 to the eCos installation directory.</PARA>
180 <PARA>If necessary, the ROM image can be re-built as follows:</PARA>
181 <ORDEREDLIST>
182 <LISTITEM>
183 <PARA>          On Windows hosts, open a Bash session using 
184 <EMPHASIS>Start-&#62;Programs-&#62;Red Hat eCos-&#62;eCos
185 Development Environment</EMPHASIS></PARA>
186 </LISTITEM>
187 <LISTITEM>
188 <PARA>Create a build directory and cd into it</PARA>
189 </LISTITEM>
190 <LISTITEM>
191 <PARA>Run (all as one line):
192
193 <PROGRAMLISTING>cygtclsh80 BASE_DIR/packages/pkgconf.tcl                          \
194   --target=mn10300_am33 --platform stb --startup rom              \
195   --disable-kernel --disable-uitron --disable-libc --disable-libm \
196   --disable-io --disable-io_serial --disable-wallclock
197 --disable-watchdog</PROGRAMLISTING>
198             </PARA>
199 <PARA>where BASE_DIR is the path to the eCos installation
200 directory.</PARA>
201 </LISTITEM>
202 <LISTITEM>
203 <PARA>Edit the configuration file 
204 <filename>pkgconf/hal.h</filename>
205  in the build directory tree by ensuring the following configuration
206 options are set as follows:
207
208 <PROGRAMLISTING>#define CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
209 #define CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT
210 #undef  CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT
211 #define CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT
212 #define CYG_HAL_ROM_MONITOR</PROGRAMLISTING>
213             </PARA>
214 </LISTITEM>
215 <LISTITEM>
216 <PARA>Run: make</PARA>
217 </LISTITEM>
218 <LISTITEM>
219 <PARA>Run: make -C hal/common/current/current/src/stubrom</PARA>
220 </LISTITEM>
221 <LISTITEM>
222 <PARA>The file 
223 <filename>hal/common/current/src/stubrom</filename>
224  will be an ELF format executable of the ROM image. Use mn10300-elf-objcopy to
225 convert this to the appropriate format for loading into the Matsushita
226 FLASH ROM programmer, mode &ldquo;binary&rdquo; in this case: 
227
228 <PROGRAMLISTING>$ mn10300-elf-objcopy -O binary hal/common/current/src/stubrom/ \
229   stubrom stubrom.img</PROGRAMLISTING></PARA>
230 </LISTITEM>
231 </ORDEREDLIST>
232 </SECT2>
233 </SECT1>
234
235 <!-- ==================================================== -->
236
237 <SECT1 id="setup-tx39-jmr3904">
238 <TITLE>TX39 Hardware Setup</TITLE>
239 <PARA>The eCos Developer&rsquo;s Kit package comes with a pair
240 of ROMs that provide GDB support for
241 the Toshiba JMR-TX3904 RISC processor reference board by way of CygMon. </PARA>
242 <PARA>Images of these ROMs are also provided at <filename>BASE_DIR/loaders/tx39-jmr3904/cygmon50.bin</filename> and <filename>BASE_DIR/loaders/tx39-jmr3904/cygmon66.bin</filename> for
243 50 MHz and 66 MHz boards respectively. The ROMs are installed to
244 sockets IC6 and IC7 on the memory daughterboard according to their
245 labels. Attention should be paid to the correct orientation of these
246 ROMs during installation.</PARA>
247 <PARA>The GDB stub allows communication with GDB using the serial
248 port (channel C) at connector PJ1. The communication parameters
249 are fixed at 38400 baud, 8 data bits, no parity bit, and 1 stop
250 bit (8-N-1). No handshaking is employed. Connection to the host
251 computer should be made using an RS232C null modem cable.</PARA>
252 <PARA>CygMon and eCos currently provide support for a 16Mbyte 60ns
253 72pin DRAM SIMM fitted to the PJ21 connector. Different size DRAMs
254 may require changes in the value stored in the DCCR0 register. This
255 value may be found near line 211 in <filename>hal/mips/arch/<replaceable>&Version;</replaceable>/src/vectors.S</filename>
256 in eCos, and near line 99 in
257           <filename>libstub/mips/tx39jmr/tx39jmr-power.S</filename> in
258 CygMon. eCos does not currently use the DRAM for any purpose itself,
259 so it is entirely available for application use.</PARA>
260 </SECT1>
261
262 <!-- ==================================================== -->
263
264 <SECT1 id="setup-tx39-sim">
265 <TITLE>TX39 Architectural Simulator Setup</TITLE>
266 <PARA>The TX39 simulator is an architectural simulator which implements
267 all  the features of the Toshiba TX39 needed to run eCos. The current
268 implementation provides accurate simulation of the instruction set,
269  interrupt controller, and timers, as well as having generic support
270 for diagnostic output, serial I/O, and exceptions.</PARA>
271 <PARA>In this release, you can run the same eCos binaries in the
272 simulator that can run on target hardware, if it is built for ROM
273 start-up.</PARA>
274 <PARA>To simplify connection to the simulator, you are advised to
275 create a GDB macro by putting the following code in your personal
276 GDB start-up file (gdb.ini on Windows and .gdbinit on UNIX).</PARA>
277 <PROGRAMLISTING>define tsim   
278  target sim --board=jmr3904pal --memory-region 0xffff8000,0x900 \ 
279             --memory-region 0xffffe000,0x4 \          
280             --memory-region 0xb2100000,0x4   
281  rbreak cyg_test_exit
282  rbreak cyg_assert_fail
283 end</PROGRAMLISTING>
284 <PARA>You can then connect to the simulator by invoking the command <command>tsim</command> on
285 the command line:</PARA>
286 <PROGRAMLISTING>(gdb) tsim</PROGRAMLISTING>
287 <PARA>You can achieve the same effect by typing out the macro&rsquo;s
288 content on the command line if necessary.</PARA>
289 </SECT1>
290
291 <!-- ==================================================== -->
292
293 <SECT1 id="setup-tx49-ref4955">
294 <TITLE>TX49 Hardware Setup</TITLE>
295 <PARA>The eCos installation CD contains a copy of the eCos GDB stubs
296 in  SREC format which must be programmed into the board&rsquo;s
297 FLASH memory.</PARA>
298 <SECT2>
299 <TITLE>Preparing the GDB stubs</TITLE>
300 <PARA>These stub preparation steps are not strictly necessary as
301 the eCos distribution ships with pre-compiled stubs in the directory <filename>loaders/tx49-ref4955</filename> relative
302 to the installation root.</PARA>
303 <SECT3>
304 <TITLE>Building the GDB stub image with the eCos Configuration Tool</TITLE>
305 <ORDEREDLIST>
306 <LISTITEM>
307 <PARA>            Start with a new document - selecting the 
308 <EMPHASIS>File-&#62;New</EMPHASIS>
309  menu item if necessary to do this.</PARA>
310 </LISTITEM>
311 <LISTITEM>
312 <PARA>Choose the 
313 <EMPHASIS>Build-&#62;Templates</EMPHASIS>
314  menu item, and then select the TX49 REF4955 hardware.</PARA>
315 </LISTITEM>
316 <LISTITEM>
317 <PARA>While still displaying the 
318 <EMPHASIS>Build-&#62;Templates</EMPHASIS>
319  dialog box, select the stubs package template to build a GDB stub.
320 Click 
321 <EMPHASIS>OK</EMPHASIS>.</PARA>
322 </LISTITEM>
323 <LISTITEM>
324 <PARA>Build eCos stubs using 
325 <EMPHASIS>Build-&#62;Library</EMPHASIS>.</PARA>
326 </LISTITEM>
327 <LISTITEM>
328 <PARA>When the build completes, the image files can be found
329 in the bin/ subdirectory of the install tree. GDB stub
330 images have the prefix gdb_module.</PARA>
331 </LISTITEM>
332 </ORDEREDLIST>
333 </SECT3>
334 <SECT3>
335 <TITLE> Building the GDB stub image with ecosconfig</TITLE>
336 <ORDEREDLIST>
337 <LISTITEM>
338 <PARA>            Make an empty directory to contain the build tree,
339                   and cd into it.</PARA>
340 </LISTITEM>
341 <LISTITEM>
342 <PARA>To build a GDB stub ROM image, enter the command:</PARA>
343 <PROGRAMLISTING>$ ecosconfig new ref4955 stubs </PROGRAMLISTING>
344 </LISTITEM>
345 <LISTITEM>
346 <PARA>Enter the commands:</PARA>
347 <PROGRAMLISTING>$ ecosconfig tree
348 $ make</PROGRAMLISTING>
349 </LISTITEM>
350 <LISTITEM>
351 <PARA>When the build completes, the image files can be found
352 in the bin/ subdirectory of the install tree. GDB stub
353 images have the prefix gdb_module.</PARA>
354 </LISTITEM>
355 </ORDEREDLIST>
356 </SECT3>
357 </SECT2>
358 <SECT2>
359 <TITLE> Installing GDB stubs into FLASH</TITLE>
360 <PARA>Boot into the board&rsquo;s firmware in little-endian mode:</PARA>
361 <PARA>Set the switches like this:   </PARA>
362 <PARA>SW1: 10000000 (first lever up, the rest down)   
363 SW2: 10000010</PARA>
364 <PARA>Connect serial cable on the lower connector, configure terminal
365 emulator for 38400, 8-N-1.</PARA>
366 <PARA>When booting the board, you should get this prompt:</PARA>
367 <PROGRAMLISTING>HCP5 rev 0.9B .    
368 HCP5?</PROGRAMLISTING>
369 <PARA>Select o (option), a (FLASH) and b (boot write). You should
370 see this:</PARA>
371 <PROGRAMLISTING>Boot ROM Write   
372 ROM address-ffffffffbd000000, Boot Bus-[32bit]  
373 ID2 0 4 ffffffffa002ad40  
374 zzz SS-40000 IV-1 CS-20000 CC-2   
375 Flash ROM-[28F640J5], [16bit chip] * 2 * 1
376 Block size-00040000  count-64  
377 ROM adr ffffffffbd000000-ffffffffbe000000  mask-00fc0000
378 Send Srecord file sa=00000000 size=ffffffffffffffff
379 ra=fffffffffe000000
380           </PROGRAMLISTING>
381 <PARA>Now send the stub SREC data down to the board using the terminal
382  emulator&rsquo;s &lsquo;send ASCII&rsquo; (or similar)
383 functionality. </PARA>
384 <PARA>Red Hat has experienced some sensitivity to how fast the data
385 is written to the board. Under Windows you should configure Minicom
386 to use a line delay of 100 milliseconds. Under Linux, use the slow_cat.tcl
387  script:</PARA>
388 <PROGRAMLISTING>% cd BASE_DIR/packages/hal/mips/ref4955/<replaceable>&Version;</replaceable>/misc
389 % slow_cat.tcl &lt; [path]/gdb_module.srec &#62; /dev/ttyS0</PROGRAMLISTING>
390 <PARA>Power off the board, and change it to boot the GDB stubs in
391 big-endian mode by setting the switches like this:</PARA>
392 <PARA>SW1: 00000000 (all levers down)   
393 SW2: 10001010</PARA>
394 <PARA>The GDB stubs allow communication with GDB using the serial
395 port at connector PJ7A (lower connector). The communication parameters
396 are  fixed at 38400 baud, 8 data bits, no parity bit and 1 stop
397 bit  (8-N-1). No flow control is employed. Connection to the host
398 computer should be made using a straight through serial cable.</PARA>
399 </SECT2>
400 </SECT1>
401
402 <!-- ==================================================== -->
403
404 <SECT1 id="setup-vr4300-vrc4373">
405 <TITLE>VR4300 Hardware Setup</TITLE>
406 <PARA>The eCos Developer&rsquo;s Kit package comes with an EPROM
407 which provides GDB support for the NEC
408 VRC4373 evaluation board. An image of this EPROM is also provided
409 at <filename>loaders/vr4300-vrc4373/gdbload.bin</filename> under
410 the root of your eCos installation.</PARA>
411 <PARA>The EPROM is installed to socket U12 on the board. Attention
412 should be paid to the correct orientation of the EPROM during installation.
413 Only replace the board&quot;s existing ROM using a proper PLCC
414 extraction tool, as the socket would otherwise risk getting damaged. </PARA>
415 <PARA>The GDB stub in the EPROM allows communication with GDB using
416 the serial port at connector J1. The communication parameters are
417 fixed at 38400 baud, 8 data bits, no parity bit and 1 stop bit (8-N-1).
418 No flow control is employed. Connection to the host computer should
419 be made using a straight-through serial cable. </PARA>
420 </SECT1>
421 <SECT1 id="setup-vr4300-vrc4375">
422 <TITLE>VRC4375 Hardware Setup</TITLE>
423 <PARA>For information about setting up the VRC4375 to run with RedBoot,
424 consult the RedBoot User&quot;s Guide. If using serial debugging,
425 the serial line runs at 38400 baud 8-N-1 and should be connected
426 to the debug host using the cable supplied with the board.</PARA>
427 </SECT1>
428 <SECT1 id="setup-mips-atlasmalta">
429 <TITLE>Atlas/Malta Hardware Setup</TITLE>
430 <PARA>For information about setting up the Atlas and Malta boards to
431 run with RedBoot, consult the RedBoot User&quot;s Guide.</PARA>
432 </SECT1>
433 <SECT1 id="setup-ppc-cogent">
434 <TITLE>PowerPC Cogent Hardware Setup</TITLE>
435 <PARA>The eCos Developer&rsquo;s Kit package comes with an EPROM
436 which provides GDB support for the Cogent
437 evaluation board. An image of this EPROM is also provided at
438           <filename>loaders/powerpc-cogent/gdbload.bin</filename> under
439 the root of your eCos installation. The same EPROM and image can
440 be used on all three supported daughterboards: CMA287-23 (MPC823),
441 CMA287-50 (MPC850), and CMA286-60 (MPC860).</PARA>
442 <PARA>The EPROM is installed to socket U4 on the board. Attention
443 should be paid to the correct orientation of the EPROM during installation. </PARA>
444 <PARA>If you are going to burn a new EPROM using the binary image,
445 be careful to get the byte order correct. It needs to be big-endian.
446 If the EPROM burner software has a hex-editor, check that the first
447 few bytes of the image look like: </PARA>
448 <PROGRAMLISTING>00000000: 3c60 fff0 6063 2000 7c68 03a6 4e80 0020 &lt;&grave;..&grave;c.|h..N.. </PROGRAMLISTING>
449 <PARA>If the byte order is wrong you will see 603c instead of 3c60
450 etc. Use the EPROM burner software to make a byte-swap before you
451 burn to image to the EPROM. </PARA>
452 <PARA>If the GDB stub EPROM you burn does not work, try reversing
453 the byte-order, even if you think you have it the right way around.
454 At least one DOS-based EPROM burner program is known to have the
455 byte-order upside down.</PARA>
456 <PARA>The GDB stub in the EPROM allows communication with GDB using
457 the serial port at connector P12 (CMA101) or P3 (CMA102). The communication parameters
458 are fixed at 38400 baud, 8 data bits, no parity bit and 1 stop bit
459 (8-N-1). No flow control is employed. Connection to the host computer
460 should be made using a dedicated serial cable as specified in the
461 Cogent CMA manual.</PARA>
462 <SECT2>
463 <TITLE>Installing the Stubs into ROM</TITLE>
464 <SECT3>
465 <TITLE>Preparing the Binaries</TITLE>
466 <PARA>These two binary preparation steps are not strictly necessary
467 as the eCos distribution ships with pre-compiled binaries in the
468 directory <filename>loaders/powerpc-cogent</filename> relative to the installation
469 root.</PARA>
470 <SECT4>
471 <TITLE>Building the ROM images with the eCos Configuration Tool</TITLE>
472 <ORDEREDLIST>
473 <LISTITEM>
474 <PARA>Start with a new document - selecting the 
475 <EMPHASIS>File-&#62;New</EMPHASIS>
476  menu item if necessary to do this.</PARA>
477 </LISTITEM>
478 <LISTITEM>
479 <PARA>Choose the 
480 <EMPHASIS>Build-&#62;Templates</EMPHASIS>
481  menu item, and then select the PowerPC    CMA28x hardware.</PARA>
482 </LISTITEM>
483 <LISTITEM>
484 <PARA>While still displaying the 
485 <EMPHASIS>Build-&#62;Templates</EMPHASIS>
486  dialog box, select the &ldquo;stubs&rdquo; package template
487 to build a GDB stub. Click 
488 <EMPHASIS>OK</EMPHASIS>.</PARA>
489 </LISTITEM>
490 <LISTITEM>
491 <PARA>Build eCos using 
492 <EMPHASIS>Build-&#62;Library</EMPHASIS>.</PARA>
493 </LISTITEM>
494 <LISTITEM>
495 <PARA>When the build completes, the image files can be found
496 in the bin/ subdirectory of the install tree. GDB stub
497 ROM images have the  prefix &ldquo;gdb_module&rdquo;.</PARA>
498 </LISTITEM>
499 </ORDEREDLIST>
500 </SECT4>
501 <SECT4>
502 <TITLE>Building the ROM images with ecosconfig</TITLE>
503 <ORDEREDLIST>
504 <LISTITEM>
505 <PARA>Make an empty directory to contain the build tree,
506 and cd into it.</PARA>
507 </LISTITEM>
508 <LISTITEM>
509 <PARA>To build a GDB stub ROM image, enter the command: 
510   
511 <PROGRAMLISTING>$ ecosconfig new cma28x stubs </PROGRAMLISTING></PARA>
512 </LISTITEM>
513 <LISTITEM>
514 <PARA>Enter the commands: 
515
516 <PROGRAMLISTING>$ ecosconfig tree
517 $ make</PROGRAMLISTING>
518  </PARA>
519 </LISTITEM>
520 <LISTITEM>
521 <PARA>When the build completes, the image files can be found
522 in the bin/ subdirectory of the install tree. GDB stub
523 ROM images have the prefix &ldquo;gdb_module&rdquo;.</PARA>
524 </LISTITEM>
525 </ORDEREDLIST>
526 </SECT4>
527 </SECT3>
528 <SECT3>
529 <TITLE> Installing the Stubs into ROM or FLASH</TITLE>
530 <ORDEREDLIST>
531 <LISTITEM>
532 <PARA>Program the binary image file gdb_module.bin
533 into ROM or FLASH referring to the instructions of your ROM programmer.</PARA>
534 </LISTITEM>
535 <LISTITEM>
536 <PARA> Plug the ROM/FLASH into socket U4 as described
537 at the beginning of this <EMPHASIS>Hardware Setup</EMPHASIS> section.</PARA>
538 </LISTITEM>
539 </ORDEREDLIST>
540 </SECT3>
541 </SECT2>
542 </SECT1>
543 <SECT1 id="setup-ppc-mbx860">
544 <TITLE>PowerPC MBX860 Hardware Setup</TITLE>
545 <PARA>The eCos Developer&rsquo;s Kit package comes with an EPROM
546 which provides GDB support for the Motorola
547 PowerPC MBX860 evaluation board. An image of this EPROM is also
548 provided at <filename>loaders/powerpc-mbx/gdbload.bin</filename> under
549 the root of your eCos installation.</PARA>
550 <PARA>The EPROM is installed to socket XU1 on the board. Attention
551 should be paid to the correct orientation of the EPROM during installation.
552 Only replace the board&quot;s existing ROM using a proper PLCC
553 extraction tool, as the socket would otherwise risk getting damaged.</PARA>
554 <PARA>The GDB stub in the EPROM allows communication with GDB using
555 the serial port at connector SMC1/COM1. The communication
556 parameters are fixed at 38400 baud, 8 data bits, no parity bit and
557 1 stop bit (8-N-1). No flow control is employed. Connection to the
558 host computer should be made using a suitable serial cable.</PARA>
559 <PARA>In order to make the board execute the EPROM that you just
560 installed (rather than the on-board FLASH memory), it may be necessary
561 move some links on the board. Specifically, ensure that link J4
562 is in position 1-2. If in doubt, refer to the MBX documentation
563 from Motorola, ensuring that Boot Port Size=8 Bits/ROM
564 for BOOT (CS#7), in their terminology.</PARA>
565 <SECT2>
566 <TITLE>Installing the Stubs into FLASH</TITLE>
567 <SECT3>
568 <TITLE>Preparing the Binaries</TITLE>
569 <PARA>These two binary preparation steps are not strictly necessary
570 as the eCos distribution ships with pre-compiled binaries in the
571 directory <filename>loaders/powerpc-mbx</filename> relative to the installation
572 root.</PARA>
573 <SECT4>
574 <TITLE>Building the ROM images with the eCos Configuration Tool</TITLE>
575 <ORDEREDLIST>
576 <LISTITEM>
577 <PARA>Start with a new document - selecting the 
578 <EMPHASIS>File-&#62;New</EMPHASIS>
579  menu item if necessary to do this.</PARA>
580 </LISTITEM>
581 <LISTITEM>
582 <PARA>Choose the 
583 <EMPHASIS>Build-&#62;Templates</EMPHASIS>
584  menu item, and then select the PowerPC    Motorola MBX860/821
585 hardware.</PARA>
586 </LISTITEM>
587 <LISTITEM>
588 <PARA>While still displaying the 
589 <EMPHASIS>Build-&#62;Templates</EMPHASIS>
590  dialog box, select the &ldquo;stubs&rdquo; package template
591 to build a GDB stub. Click 
592 <EMPHASIS>OK</EMPHASIS>.</PARA>
593 </LISTITEM>
594 <LISTITEM>
595 <PARA>Build eCos using 
596 <EMPHASIS>Build-&#62;Library</EMPHASIS>. </PARA>
597 </LISTITEM>
598 <LISTITEM>
599 <PARA>When the build completes, the image files can be found
600 in the bin/ subdirectory of the install tree. GDB stub
601 ROM images have the prefix &ldquo;gdb_module&rdquo;.</PARA>
602 </LISTITEM>
603 </ORDEREDLIST>
604 </SECT4>
605 <SECT4>
606 <TITLE>Building the ROM images with ecosconfig</TITLE>
607 <ORDEREDLIST>
608 <LISTITEM>
609 <PARA>Make an empty directory to contain the build tree,
610 and cd into it.</PARA>
611 </LISTITEM>
612 <LISTITEM>
613 <PARA>To build a GDB stub ROM image, enter the command: 
614   
615 <PROGRAMLISTING>$ ecosconfig new mbx stubs </PROGRAMLISTING></PARA>
616 </LISTITEM>
617 <LISTITEM>
618 <PARA>Enter the commands: 
619     
620 <PROGRAMLISTING>$ ecosconfig tree
621 $ make </PROGRAMLISTING></PARA>
622 </LISTITEM>
623 <LISTITEM>
624 <PARA>When the build completes, the image files can be found
625 in the bin/ subdirectory of the install tree. GDB stub
626 ROM images have the prefix &ldquo;gdb_module&rdquo;.</PARA>
627 </LISTITEM>
628 </ORDEREDLIST>
629 </SECT4>
630 </SECT3>
631 <SECT3>
632 <TITLE> Installing the Stubs into ROM</TITLE>
633 <ORDEREDLIST>
634 <LISTITEM>
635 <PARA> Program the binary image file gdb_module.bin
636 into ROM or FLASH referring to the instructions of your ROM programmer.</PARA>
637 </LISTITEM>
638 <LISTITEM>
639 <PARA> Plug the ROM/FLASH into socket XU1 as described
640 near the beginning of this <EMPHASIS>Hardware Setup</EMPHASIS> section.</PARA>
641 </LISTITEM>
642 </ORDEREDLIST>
643 </SECT3>
644 <SECT3>
645 <TITLE>Installing the Stubs into FLASH</TITLE>
646 <PARA>This assumes you have EPPC-Bug in the on-board FLASH. This
647 can be determined by setting up the board according to the below
648 instructions and powering up the board. The EPPC-Bug prompt should
649 appear on the SMC1 connector at 9600 baud, 8N1.</PARA>
650 <ORDEREDLIST>
651 <LISTITEM>
652 <PARA>Set jumper 3 to 2-3     [allow XU2 FLASH to
653 be programmed]</PARA>
654 </LISTITEM>
655 <LISTITEM>
656 <PARA>Set jumper 4 to 2-3     [boot EPPC-Bug]</PARA>
657 </LISTITEM>
658 </ORDEREDLIST>
659 <SECT4>
660 <TITLE> Program FLASH</TITLE>
661 <ORDEREDLIST>
662 <LISTITEM>
663 <PARA> Prepare EPPC-Bug for download:</PARA>
664 <PROGRAMLISTING>EPPC-Bug&#62;lo 0</PROGRAMLISTING>
665 <PARA>At this point the monitor is ready for input. It will not return
666 the prompt until the file has been downloaded.</PARA>
667 </LISTITEM>
668 <LISTITEM>
669 <PARA>Use the terminal emulator&rsquo;s ASCII download feature
670 (or a simple clipboard     copy/paste operation) to download
671 the gdb_module.srec data.
672
673 Note that on Linux, Minicom&rsquo;s ASCII download feature seems
674 to be broken. A workaround is to load the file into Emacs (or another
675 editor) and copy the full contents to the clipboard. Then press
676 the mouse paste-button (usually the middle one) over the Minicom
677 window.</PARA>
678 </LISTITEM>
679 <LISTITEM>
680 <PARA>Program the FLASH with the downloaded data:
681     
682 <PROGRAMLISTING>EPPC-Bug&#62;pflash 40000 60000 fc000000</PROGRAMLISTING></PARA>
683 </LISTITEM>
684 <LISTITEM>
685 <PARA>Switch off the power, and change jumper 4 to 1-2. Turn
686 on the power again. The board should now boot using the newly programmed
687 stubs.</PARA>
688 </LISTITEM>
689 </ORDEREDLIST>
690 </SECT4>
691 </SECT3>
692 </SECT2>
693 </SECT1>
694 <SECT1 id="setup-ppc-sim">
695 <TITLE>PowerPC Architectural Simulator Setup</TITLE>
696 <PARA>The PowerPC simulator is an architectural simulator which
697 implements all the features of the PowerPC needed to run eCos. The
698 current implementation provides accurate simulation of the instruction
699 set and timers, as well as having generic support for diagnostic
700 output  and exceptions.</PARA>
701 <PARA>The simulator also allows devices to be simulated, but no
702 device simulation support has been defined for the serial device
703 drivers in this release.</PARA>
704 <PARA>To simplify connection to the simulator, you are advised to
705 create a GDB macro by putting the following code in your personal
706 GDB start-up file (gdb.ini on Windows and .gdbinit on UNIX).</PARA>
707 <PROGRAMLISTING>define psim   
708  target sim -o &rsquo;/iobus/pal&commat;0xf0001000/reg 0xf0001000 32&rsquo;   
709  rbreak cyg_test_exit   
710  rbreak cyg_assert_fail  
711 end</PROGRAMLISTING>
712 <PARA>You can then connect to the simulator by invoking the command <command>psim</command> on
713 the command line:</PARA>
714 <PROGRAMLISTING>(gdb) psim</PROGRAMLISTING>
715 <PARA>You can achieve the same effect by typing out the macro&rsquo;s
716 content on the command line if necessary.</PARA>
717 <NOTE>
718 <PARA>The PowerPC simulator cannot execute binaries built for any
719 of the supported hardware targets. You must generate a configuration
720 using the PowerPC simulator platform: 
721 <PROGRAMLISTING>$ ecosconfig new psim</PROGRAMLISTING>
722  or some such.</PARA>
723 </NOTE>
724 </SECT1>
725 <SECT1 id="setup-sparclite-sleb">
726 <TITLE>SPARClite Hardware Setup</TITLE>
727 <PARA>The eCos Developer&rsquo;s Kit package comes with a ROM
728 which provides GDB support for the Fujitsu SPARClite Evaluation
729 Board by way of CygMon<PRODUCTNAME>. </PRODUCTNAME></PARA>
730 <PARA>An image of this ROM is also provided at
731           <filename>BASE_DIR/loaders/sparclite-sleb/cygmon.bin.</filename> The
732 ROM is installed in socket IC9 on the evaluation board. Attention
733 should be paid to the correct orientation of the ROM during installation.</PARA>
734 <PARA>The GDB stub allows communication with GDB using a TCP channel
735 via the ethernet port at connector J5.</PARA>
736 <SECT2>
737 <TITLE><!-- <index></index> --><!-- <xref> -->Ethernet Setup</TITLE>
738 <PARA>The ethernet setup is described in the board&rsquo;s manual,
739 but here is a recapitulation.</PARA>
740 <PARA>Set the board&rsquo;s ethernet address using SW1 on the
741 motherboard:</PARA>
742 <PROGRAMLISTING>            SW1-4 SW1-3 SW1-2 SW1-1    Ethernet Address
743             ----- ----- ----- -----    ----------------
744             OFF   OFF   OFF   OFF     No ethernet, use serial
745             OFF   OFF   OFF    ON     00:00:0E:31:00:01
746             OFF   OFF    ON   OFF     00:00:0E:31:00:02
747             OFF   OFF    ON    ON     00:00:0E:31:00:03
748             OFF    ON   OFF   OFF     00:00:0E:31:00:04
749             OFF    ON   OFF    ON     00:00:0E:31:00:05
750             OFF    ON    ON   OFF     00:00:0E:31:00:06
751             OFF    ON    ON    ON     00:00:0E:31:00:07
752             ON    OFF   OFF   OFF     00:00:0E:31:00:08
753             ON    OFF   OFF    ON     00:00:0E:31:00:09
754             ON    OFF    ON   OFF     00:00:0E:31:00:0A
755             ON    OFF    ON    ON     00:00:0E:31:00:0B
756             ON     ON   OFF   OFF     00:00:0E:31:00:0C
757             ON     ON   OFF    ON     00:00:0E:31:00:0D
758             ON     ON    ON   OFF     00:00:0E:31:00:0E
759             ON     ON    ON    ON     00:00:0E:31:00:0F</PROGRAMLISTING>
760 <SECT3><!-- <index></index> -->
761 <TITLE>BOOTP/DHCP service on Linux</TITLE>
762 <PARA>Configure the BOOTP or DHCP server on the network to recognize
763 the evaluation board&rsquo;s ethernet address so it can assign
764 the board an IP address. Below is a sample DHCP server configuration
765 from a Linux system (<filename>/etc/dhcpd.conf</filename>).
766 It shows a setup for three evaluation boards.</PARA>
767 <PROGRAMLISTING>#
768 # DHCP server configuration.
769 #
770 allow bootp;
771
772 subnet 192.168.1.0 netmask 255.255.255.0 {
773   host mb831evb {
774     hardware ethernet 00:00:0e:31:00:01;
775     fixed-address mb831evb;
776   }
777   host mb832evb {
778     hardware ethernet 00:00:0e:31:00:02;
779     fixed-address mb832evb;
780   }
781   host mb833evb {
782     hardware ethernet 00:00:0e:31:00:03;
783     fixed-address mb833evb;
784   }
785 } </PROGRAMLISTING>
786 </SECT3>
787 <SECT3><!-- <index></index> -->
788 <TITLE>BOOTP/DHCP boot process</TITLE>
789 <PARA>Even when configured to use a TCP channel, CygMon will still
790 print a boot message to the serial channel. If the BOOTP process
791 was successful and an IP address was found, a message &ldquo;BOOTP
792 found xxx.xxx.xxx.xxx&rdquo; will be printed where xxx.xxx.xxx.xxx
793 is the IP address assigned by the BOOTP or DHCP server. If the BOOTP
794 process fails, a message indicating failure will be printed and
795 the serial port will be used as the debug channel.</PARA>
796 <PARA>Once the board finds an IP address it will respond to ICMP
797 echo request packets (ping). This gives a simple means to test the
798 health of the board.</PARA>
799 <PARA>As described in &ldquo;Ethernet Setup&rdquo; on&nbsp;page&nbsp;72,
800 it should now be possible to connect to the SPARClite board from
801 within GDB by using the command:</PARA>
802 <PROGRAMLISTING>(gdb) target remote &lt;host&#62;:1000</PROGRAMLISTING>
803 </SECT3>
804 </SECT2>
805 <SECT2>
806 <TITLE>Serial Setup</TITLE>
807 <PARA>The CygMon stubs also allow communication with GDB by way
808 of the serial port at connector CON1. The communication parameters
809 are fixed at 19200 baud, 8 data bits, no parity bit and 1 stop bit
810 (8-N-1). No flow control is employed. Connection to the host computer
811 should be made using a null modem cable. A gender changer may also
812 be required.</PARA>
813 </SECT2>
814 </SECT1>
815 <SECT1 id="setup-sparclite-sim">
816 <TITLE>SPARClite Architectural Simulator Setup</TITLE>
817 <PARA>The ESA SPARClite simulator is an architectural simulator
818 which implements all the features of the SPARClite needed to run
819 eCos. The current implementation provides accurate simulation of
820 the instruction set, interrupt controller, and timers, as well as
821 having generic support for diagnostic output and exceptions.</PARA>
822 <PARA>Note that the ESA SPARClite simulator is unsupported, but
823 is included in the release as a convenience.</PARA>
824 <PARA>To simplify connection to the simulator, you are advised to
825 create a GDB macro by putting the following code in your personal
826 GDB start-up file (gdb.ini on Windows and .gdbinit on UNIX).</PARA>
827 <PROGRAMLISTING>define ssim   
828  target sim -nfp -sparclite -dumbio   
829  rbreak cyg_test_exit   
830  rbreak cyg_assert_fail  
831 end</PROGRAMLISTING>
832 <PARA>You can then connect to the simulator by invoking the command <command>ssim</command> on
833 the command line:</PARA>
834 <PROGRAMLISTING>(gdb) ssim</PROGRAMLISTING>
835 <PARA>You can achieve the same effect by typing out the macro&rsquo;s
836 content on the command line if necessary.</PARA>
837 </SECT1>
838 <SECT1 ID="setup-arm-pid">
839 <TITLE><!-- <index></index> --><!-- <xref> -->ARM PID Hardware Setup</TITLE>
840 <PARA>eCos comes with two ROM images that provide GDB support for
841 the ARM PID board. The first ROM image provides a port of the CygMon
842 ROM monitor, which includes a command-line interface and a GDB remote
843 stub. The second ROM image provides a remote GDB stub only, which
844 is a minimal environment for downloading and debugging eCos programs
845 solely using GDB.</PARA>
846 <PARA>eCos, CygMon and the GDB stubs all support the PID fitted
847 with both ARM7T and ARM9 daughterboards. CygMon and the stubs can
848 be programmed into either the programmable ROM (U12) or the FLASH
849 (U13). Pre-built forms of both ROM images are provided in the directory
850 loaders/arm-pid under the root of your eCos installation,
851 along with a tool that will program the stubs into the FLASH memory on
852 the board. CygMon images are prefixed with the name 'cygmon' and
853 GDB stub ROM images are given the prefix 'gdb_module'.
854 Images may be provided in a number of formats including ELF (.img
855 extension), binary (.bin extension) and SREC (.srec extension).
856 Note that some unreliability has been experienced in downloading
857 files using Angel 1.00. Angel 1.02 appears to be more robust in
858 this application.</PARA>
859 <SECT2>
860 <TITLE>Installing the Stubs into FLASH</TITLE>
861 <SECT3>
862 <TITLE>Preparing the Binaries</TITLE>
863 <PARA>These two binary preparation steps are not strictly necessary
864 as the eCos distribution ships with pre-compiled binaries in the
865 directory loaders/arm-pid relative to the installation
866 root.</PARA>
867 </SECT3>
868 <SECT3>
869 <TITLE>Building the ROM images with the eCos Configuration Tool</TITLE>
870 <ORDEREDLIST>
871 <LISTITEM>
872 <PARA>Start with a new document - selecting the 
873 <EMPHASIS>File</EMPHASIS>-&#62;<EMPHASIS>New</EMPHASIS>
874  menu item if necessary to do this.</PARA>
875 </LISTITEM>
876 <LISTITEM>
877 <PARA>Choose the 
878 <EMPHASIS>Build</EMPHASIS>
879 -&#62;
880 <EMPHASIS>Templates</EMPHASIS>
881  menu item, and then select the ARM PID hardware.</PARA>
882 </LISTITEM>
883 <LISTITEM>
884 <PARA>While still displaying the 
885 <EMPHASIS>Build</EMPHASIS>
886 -&#62;
887 <EMPHASIS>Templates</EMPHASIS>
888  dialog box, select either the "stubs" package template to build
889 a GDB stub image, or the "cygmon" template to build the CygMon ROM
890 Monitor. Click 
891 <EMPHASIS>OK</EMPHASIS>.</PARA>
892 </LISTITEM>
893 <LISTITEM>
894 <PARA>Build eCos using 
895 <EMPHASIS>Build</EMPHASIS>
896 -&#62;
897 <EMPHASIS>Library</EMPHASIS></PARA>
898 </LISTITEM>
899 <LISTITEM>
900 <PARA>When the build completes, the image files can be found
901 in the bin/ subdirectory of the install tree. GDB stub
902 ROM images have the prefix "gdb_module". CygMon images
903 have the prefix "cygmon".</PARA>
904 </LISTITEM>
905 </ORDEREDLIST>
906 </SECT3>
907 <SECT3>
908 <TITLE>Building the ROM images with ecosconfig</TITLE>
909 <!-- <PARA>(See <XREF LINKEND="USING-ECOSCONFIG-ON-UNIX">)</PARA> -->
910 <ORDEREDLIST>
911 <LISTITEM>
912 <PARA>              Make an empty directory to contain the build tree,
913 and cd into it.</PARA>
914 </LISTITEM>
915 <LISTITEM>
916 <PARA>To build a GDB stub ROM image, enter the command:</PARA>
917 <PROGRAMLISTING>$ ecosconfig new pid stubs</PROGRAMLISTING>
918 <PARA>or to build a CygMon ROM monitor image, enter the command:</PARA>
919 <PROGRAMLISTING>$ ecosconfig new pid cygmon</PROGRAMLISTING>
920 </LISTITEM>
921 <LISTITEM>
922 <PARA>Enter the commands:</PARA>
923 <PROGRAMLISTING>$ ecosconfig tree
924 $ make</PROGRAMLISTING>
925 </LISTITEM>
926 <LISTITEM>
927 <PARA>When the build completes, the image files can be found
928 in the bin/ subdirectory of the install tree. GDB stub
929 ROM images have the prefix "gdb_module". CygMon images
930 have the prefix "cygmon".</PARA>
931 </LISTITEM>
932 </ORDEREDLIST>
933 </SECT3>
934 <SECT3>
935 <TITLE>Building the FLASH Tool with the eCos Configuration Tool</TITLE>
936 <ORDEREDLIST>
937 <LISTITEM>
938 <PARA>Start with a new document - selecting the 
939 <EMPHASIS>File</EMPHASIS>-&#62;<EMPHASIS>New</EMPHASIS>
940  menu item if necessary to do this.</PARA>
941 </LISTITEM>
942 <LISTITEM>
943 <PARA>Choose the
944 <EMPHASIS>Build</EMPHASIS>-&#62;<EMPHASIS>Templates</EMPHASIS>
945  menu item, and then select the ARM PID hardware.</PARA>
946 </LISTITEM>
947 <LISTITEM>
948 <PARA>Enable the "Build flash programming tool" option in the
949 ARM PID HAL (CYGBLD_BUILD_FLASH_TOOL)
950 and resolve any resulting configuration conflicts.</PARA>
951 </LISTITEM>
952 <LISTITEM>
953 <PARA>Build eCos using 
954 <EMPHASIS>Build</EMPHASIS>
955 -&#62;
956 <EMPHASIS>Library</EMPHASIS></PARA>
957 </LISTITEM>
958 <LISTITEM>
959 <PARA>When the build completes, the FLASH tool image file can
960 be found in the bin/ subdirectory of the install tree,
961 with the prefix "prog_flash"</PARA>
962 </LISTITEM>
963 </ORDEREDLIST>
964 </SECT3>
965 <SECT3>
966 <TITLE>Building the FLASH Tool with ecosconfig</TITLE>
967 <!-- <PARA>(See <XREF LINKEND="USING-ECOSCONFIG-ON-UNIX">)</PARA> -->
968 <ORDEREDLIST>
969 <LISTITEM>
970 <PARA>              Make an empty directory to contain the build tree,
971 and cd into it
972                     </PARA>
973 </LISTITEM>
974 <LISTITEM>
975 <PARA>Enter the command:</PARA>
976 <PROGRAMLISTING>$ ecosconfig new pid</PROGRAMLISTING>
977 </LISTITEM>
978 <LISTITEM>
979 <PARA>Edit the file ecos.ecc and enable the option CYGBLD_BUILD_FLASH_TOOL
980 by uncommenting its user_value property and setting it
981 to 1.</PARA>
982 </LISTITEM>
983 <LISTITEM>
984 <PARA>Enter the commands:</PARA>
985 <PROGRAMLISTING>$ ecosconfig resolve</PROGRAMLISTING>
986 <PARA>[there will be some output]</PARA>
987 <PROGRAMLISTING>$ ecosconfig tree
988 $ make</PROGRAMLISTING>
989 </LISTITEM>
990 <LISTITEM>
991 <PARA>When the build completes, the FLASH tool image file can
992 be found in the bin/ subdirectory of the install tree,
993 with the prefix "prog_flash"</PARA>
994 </LISTITEM>
995 </ORDEREDLIST>
996 </SECT3>
997 <SECT3>
998 <TITLE>Prepare the Board for FLASH Programming</TITLE>
999 <PARA>Each time a new image is to be programmed in the FLASH, the
1000 jumpers on the board must be set to allow Angel to run:</PARA>
1001 <ORDEREDLIST>
1002 <LISTITEM>
1003 <PARA>              Set jumper 7-8 on LK6   [using the Angel code
1004 in the 16 bit EPROM]</PARA>
1005 </LISTITEM>
1006 <LISTITEM>
1007 <PARA>Set jumper 5-6 on LK6   [select 8bit ROM mode]</PARA>
1008 </LISTITEM>
1009 <LISTITEM>
1010 <PARA>Set jumper LK18         [ROM remap - this is
1011 also required for eCos]</PARA>
1012 </LISTITEM>
1013 <LISTITEM>
1014 <PARA>Set S1 to 0-0-1-1       [20MHz operation]</PARA>
1015 </LISTITEM>
1016 <LISTITEM>
1017 <PARA>Open jumper LK4  [enable little-endian operation]
1018
1019 Attach a serial cable from Serial A on the PID board to connector
1020 1 on the development system. This is the cable through which the
1021 binaries will be downloaded. Attach a serial cable from Serial B
1022 on the PID board to connector 2 on the development system (or any
1023 system that will work as a terminal). Through this cable, the FLASH
1024 tool will write its instructions (at 38400 baud).</PARA>
1025 </LISTITEM>
1026 </ORDEREDLIST>
1027 </SECT3>
1028 <SECT3>
1029 <TITLE>Program the FLASH</TITLE>
1030 <ORDEREDLIST>
1031 <LISTITEM>
1032 <PARA>Download the FLASH ROM image onto the PID board. For
1033 example. for the GDB stubs image:
1034
1035 <PROGRAMLISTING>bash$ arm-elf-gdb -nw gdb_module.img
1036 GNU gdb 4.18-DEVTOOLSVERSION
1037 Copyright 1998 Free Software Foundation, Inc.
1038 GDB is free software, covered by the GNU General Public License,
1039 and you are welcome to change it and/or distribute copies
1040 of it under certain conditions. Type "show copying" to see the conditions.
1041 There is absolutely no warranty for GDB. Type "show warranty" for details.
1042 This GDB was configured as "--host=i586-pc-cygwin32 --target=arm-elf".
1043 (no debugging symbols found)...
1044 (gdb) target rdi s=com1
1045 Angel Debug Monitor for PID (Built with Serial(x1), Parallel, DCC) 1.00
1046 (Advanced RISC Machines SDT 2.10)
1047 Angel Debug Monitor rebuilt on Jan 20 1997 at 02:33:43
1048 Connected to ARM RDI target.
1049 (gdb) load
1050 Loading section .rom_vectors, size 0x44 lma 0x60000
1051 Loading section .text, size 0x1f3c lma 0x60044
1052 Loading section .rodata, size 0x2c lma 0x61f80
1053 Loading section .data, size 0x124 lma 0x61fac
1054 Start address 0x60044 , load size 8400
1055 Transfer rate: 5169 bits/sec.
1056 (gdb) q 
1057 The program is running.  Exit anyway? (y or n) y </PROGRAMLISTING>
1058
1059 <NOTE>
1060 <PARA> On a UNIX or Linux system, the serial port must be
1061  /dev/ttyS0 instead of COM1.
1062  You need to make sure that the /dev/ttyS0 files
1063 have the right permissions:
1064 <SCREEN>$ su
1065  Password:
1066  # chmod o+rw /dev/ttyS0*
1067  # exit 
1068                       </SCREEN>
1069 If you are programming the GDB stub image, it will now be located
1070 at 0x60000..0x64000. If you are programming the Cygmon ROM Monitor,
1071 it will be located at 0x60000..0x80000.</PARA>
1072 </NOTE></PARA>
1073 </LISTITEM>
1074 <LISTITEM>
1075 <PARA>Now download the FLASH programmer tool</PARA>
1076 <PROGRAMLISTING>bash$ arm-elf-gdb prog_flash.img 
1077 GNU gdb 4.18-DEVTOOLSVERSION
1078 Copyright 1998 Free Software Foundation, Inc.
1079 GDB is free software, covered by the GNU General Public License,
1080 and you are welcome to change it and/or distribute
1081 copies of it under certain conditions. Type "show copying" to see
1082 the conditions. There is absolutely no warranty for GDB.  Type "show
1083 warranty" for details.
1084 This GDB was configured as "--host=i586-pc-cygwin32 --target=arm-elf".
1085 (gdb) target rdi s=com1
1086 Angel Debug Monitor for PID (Built with Serial(x1), Parallel, DCC) 1.00
1087 (Advanced RISC Machines SDT 2.10)
1088 Angel Debug Monitor rebuilt on Jan 20 1997 at 02:33:43
1089 Connected to ARM RDI target.
1090 (gdb) load
1091 Loading section .rom_vectors, size 0x44 lma 0x40000
1092 Loading section .text, size 0x44a4 lma 0x40044
1093 Loading section .rodata, size 0x318 lma 0x444e8
1094 Loading section .data, size 0x1c8 lma 0x44800
1095 Start address 0x40044 , load size 18888
1096 Transfer rate: 5596 bits/sec.
1097 (gdb) c</PROGRAMLISTING>
1098 </LISTITEM>
1099 <LISTITEM>
1100 <PARA>The FLASH tool will output some text on the board serial
1101 port B at 38400 baud:</PARA>
1102 <PROGRAMLISTING>ARM
1103 eCos
1104
1105 FLASH here!
1106 manuf: 8, device: 40
1107 Error: Wrong Manufaturer: 08
1108 ... Please change FLASH jumper</PROGRAMLISTING>
1109 </LISTITEM>
1110 <LISTITEM>
1111 <PARA>This text is repeated until you remove the jumper 7-8
1112 on LK6. Then the output will be:</PARA>
1113 <PROGRAMLISTING>manuf: 1F, device: A4
1114 AT29C040A recognised
1115 About to program FLASH using data at 60000..64000
1116 *** Press RESET now to abort!</PROGRAMLISTING>
1117 </LISTITEM>
1118 <LISTITEM>
1119 <PARA> You have about 10 seconds to abort the operation by pressing
1120 reset. After this timeout, the FLASH programming happens:</PARA>
1121 <SCREEN>...Programming FLASH 
1122 All done!</SCREEN>
1123 </LISTITEM>
1124 <LISTITEM>
1125 <PARA>Quit/kill the GDB process, which will hang.</PARA>
1126 </LISTITEM>
1127 <LISTITEM>
1128 <PARA>Next time you reset the board, the stub will be in control,
1129 communicating on Serial A at 38400 baud.</PARA>
1130 </LISTITEM>
1131 </ORDEREDLIST>
1132 <NOTE>
1133 <PARA>If you do not have two serial ports available on your host
1134 computer, you may still verify the FLASH programming completed successfully
1135 by quitting/killing the GDB process after running "c" in
1136 step 2 above. Then switch the serial cable on the PID from Serial
1137 A to Serial B and run a terminal emulator on the host computer.
1138 In a few seconds you should see the the repeated text described
1139 in step 2 above and you may continue the remaining steps as normal.</PARA>
1140 </NOTE>
1141 </SECT3>
1142 <SECT3>
1143 <TITLE>Programming the FLASH for big-endian mode</TITLE>
1144 <PARA>The process is almost identical to the previous instructions
1145 which apply to a PID board running in little-endian mode only.</PARA>
1146 <PARA>The only adjustments to make are that if programming a <EMPHASIS>GDB</EMPHASIS> stub
1147 ROM image (or CygMon ROM monitor image), you must enable the option "Use
1148 Big-endian mode" in the <EMPHASIS>eCos Configuration Tool</EMPHASIS> (CYGHWR_HAL_ARM_BIGENDIAN
1149 if using ecosconfig and editing ecos.ecc).</PARA>
1150 <PARA>When programming the FLASH there are two options:</PARA>
1151 <ORDEREDLIST>
1152 <LISTITEM>
1153 <PARA>Program FLASH using the little-endian FLASH tool. After
1154 powering off, replace the ROM controller with the special big-endian
1155 version which can be acquired from ARM. (This has not been tested
1156 by Red Hat).</PARA>
1157 </LISTITEM>
1158 <LISTITEM>
1159 <PARA>Use a special big-endian version of the FLASH tool which
1160 byte-swaps all the words as they are written to the FLASH.</PARA>
1161 </LISTITEM>
1162 </ORDEREDLIST>
1163 <PARA>Build this tool by enabling the "Build flash programming tool
1164 for BE images on LE boards" option (CYGBLD_BUILD_FLASH_TOOL_BE),
1165 resulting in a utility with the prefix "prog_flash_BE_image_LE_system"
1166 which should be used instead of "prog_flash".</PARA>
1167 <PARA>Note that there is a limitation to this method: no sub-word
1168 data can be read from the ROM. To work around this, the .rodata
1169 section is folded into the .data section and thus copied to RAM
1170 before the system starts.</PARA>
1171 <PARA>Given that Thumb instructions are 16 bit, it is not possible
1172 to run ROM-startup Thumb binaries on the PID board using this method.</PARA>
1173 <PARA>When the image has been programmed, power off the board, and
1174 set jumper LK4 to enable big-endian operation.</PARA>
1175 </SECT3>
1176 </SECT2>
1177 <SECT2>
1178 <TITLE>Installing the Stubs into ROM</TITLE>
1179 <ORDEREDLIST>
1180 <LISTITEM>
1181 <PARA>Program the binary image file gdb_module.bin
1182 into ROM referring to the instructions of your ROM programmer.</PARA>
1183 </LISTITEM>
1184 <LISTITEM>
1185 <PARA>Plug the ROM into socket U12 and install jumper LK6 pins
1186 7-8 to enable the ROM.</PARA>
1187 </LISTITEM>
1188 </ORDEREDLIST>
1189 </SECT2>
1190 </SECT1>
1191 <SECT1 id="setup-arm-aeb1">
1192 <TITLE><!-- <index></index> -->ARM AEB-1 Hardware Setup</TITLE>
1193 <SECT2>
1194 <TITLE>Overview</TITLE>
1195 <PARA>The ARM AEB-1 comes with tools in ROM. These include a simple
1196 FLASH management tool and the Angel&reg; monitor. eCos for
1197 the ARM AEB-1 comes with GDB stubs suitable for programming into
1198 the onboard FLASH. GDB is the preferred debug environment for GDB,
1199 and while Angel provides a subset of the features in the eCos GDB
1200 stub, Angel is unsupported.</PARA>
1201 <PARA>Both eCos and the stubs support both Revision B and Revision
1202 C of the AEB-1 board. Stub ROM images for both types of board can
1203 be found in the loaders/arm-aeb directory under the root
1204 of your eCos installation. You can select which board you are using
1205 by selecting either the aeb or aebC platform by selecting the appropriate
1206 platform HAL in the <EMPHASIS>eCos Configuration Tool</EMPHASIS>.</PARA>
1207 <PARA>The GDB stub can be downloaded to the board for programming
1208 in the FLASH using the board's on-board ROM monitor:</PARA>
1209 <ORDEREDLIST>
1210 <LISTITEM>
1211 <PARA>talk to the AEB-1 board with a terminal emulator (or
1212 a real terminal!)</PARA>
1213 </LISTITEM>
1214 <LISTITEM>
1215 <PARA>use the board's rom menu to download a UU-encoded
1216 version of the GDB stubs which will act as a ROM monitor</PARA>
1217 </LISTITEM>
1218 <LISTITEM>
1219 <PARA>tell the board to use this new monitor, and then hook
1220 GDB up to it for real debugging</PARA>
1221 </LISTITEM>
1222 </ORDEREDLIST>
1223 </SECT2>
1224 <SECT2>
1225 <TITLE>Talking to the Board</TITLE>
1226 <PARA>Connect a terminal or computer's serial port to the
1227 ARM AEB-1. On a PC with a 9-pin serial port, you can use the cable
1228 shipped by ARM with no modification. </PARA>
1229 <PARA>Set the terminal or terminal emulator to 9600N1 (9600 baud,
1230 no parity, 1 stop bit). </PARA>
1231 <PARA>Reset the board by pressing the little reset button on the
1232 top. You will see the following text: </PARA>
1233 <PROGRAMLISTING>        ARM Evaluation Board Boot Monitor 0.01 (19 APR 1998)
1234         Press ENTER within 2 seconds to stop autoboot</PROGRAMLISTING>
1235 <PARA>Press ENTER quickly, and you will get the boot prompt: </PARA>
1236 <PROGRAMLISTING>        Boot:</PROGRAMLISTING>
1237 </SECT2>
1238 <SECT2>
1239 <TITLE>Downloading the Stubs via the Rom Menu</TITLE>
1240 <PARA>Using the AEB-1 rom menu to download the GDB stubs from the
1241 provided ".UU" file.</PARA>
1242 <NOTE>
1243 <PARA>This is an annotated 'terminal' session
1244 with the AEB-1 monitor:</PARA>
1245 </NOTE>
1246 <PROGRAMLISTING>+Boot: help
1247 Module is BootStrap       1.00 (14 Aug 1998)</PROGRAMLISTING>
1248 <PROGRAMLISTING>Help is available on:</PROGRAMLISTING>
1249 <PROGRAMLISTING>Help          Modules       ROMModules    UnPlug        PlugIn
1250 Kill          SetEnv        UnSetEnv      PrintEnv      DownLoad
1251 Go            GoS           Boot          PC            FlashWrite
1252 FlashLoad     FlashErase</PROGRAMLISTING>
1253 <PROGRAMLISTING>Boot: download c000
1254 Ready to download. Use 'transmit' option on terminal
1255 emulator to download file.</PROGRAMLISTING>
1256 <PROGRAMLISTING>... at this point, download the ASCII file "loaders/arm-aeb/
1257     gdb_module.img.UU". The details of this operation differ
1258     depending on which terminal emulator is used. It may be
1259     necessary to enter "^D" (control+D) when the download completes
1260    to get the monitor to return to command mode. </PROGRAMLISTING>
1261 <PROGRAMLISTING>Loaded file gdb_module.img.bin at address
1262 0000c000, size = 19392 </PROGRAMLISTING>
1263 </SECT2>
1264 <SECT2>
1265 <TITLE>Activating the GDB Stubs</TITLE>
1266 <PARA>Commit the GDB stubs module to FLASH: </PARA>
1267 <PROGRAMLISTING>        Boot: flashwrite 4018000 C000 8000
1268     </PROGRAMLISTING>
1269 <PARA>Verify that the eCos/"GDB stubs" module is now added
1270 in the list of modules in the board: </PARA>
1271 <PROGRAMLISTING>        Boot: rommodules
1272     </PROGRAMLISTING>
1273 <PARA>You should see output similar to the following: </PARA>
1274 <PROGRAMLISTING>        Header   Base     Limit
1275         04000004 04000000 040034a8 BootStrap       1.00 (14 Aug 1998) 
1276         04003a74 04003800 04003bc0 Production Test 1.00 (13 Aug 1998) 
1277         0400e4f4 04004000 0400e60f Angel           1.02 (12 MAY 1998) 
1278         0401c810 04018000 0401cbc0 eCos              1.3  (27 Jan 2000)
1279 GDB stubs
1280     </PROGRAMLISTING>
1281 <PARA>Now make the eCos/"GDB stubs" module be the default
1282 monitor: </PARA>
1283 <PROGRAMLISTING>        Boot: plugin eCos
1284     </PROGRAMLISTING>
1285 <NOTE>
1286 <PARA>Since the GDB stubs are always linked at the same address
1287 (0x4018000), the operation of writing to the FLASH and selecting
1288 the stubs as default monitor is an idempotent operation. You can
1289 download a new set of stubs following the same procedure - you do
1290 not have to unregister or delete anything.</PARA>
1291 </NOTE>
1292 </SECT2>
1293 <SECT2>
1294 <TITLE>Building the GDB Stub FLASH ROM Images</TITLE>
1295 <PARA>Pre-built GDB stubs images are provided in the directory loaders/arm-aeb
1296 relative to the root of your eCos installation, but here are instructions
1297 on how to rebuild them if you should ever need to.</PARA>
1298 </SECT2>
1299 <SECT2>
1300 <TITLE>Building the GDB Stubs with the eCos Configuration Tool</TITLE>
1301 <ORDEREDLIST>
1302 <LISTITEM>
1303 <PARA>Start with a new document - selecting the 
1304 <EMPHASIS>File</EMPHASIS>
1305 -&#62;
1306 <EMPHASIS>New</EMPHASIS>
1307  menu item if necessary to do this.</PARA>
1308 </LISTITEM>
1309 <LISTITEM>
1310 <PARA>Choose the 
1311 <EMPHASIS>Build</EMPHASIS>
1312 -&#62;
1313 <EMPHASIS>Templates</EMPHASIS>
1314  menu item, and then select the ARM AEB-1 hardware.</PARA>
1315 </LISTITEM>
1316 <LISTITEM>
1317 <PARA>While still displaying the 
1318 <EMPHASIS>Build-&#62;Templates</EMPHASIS>
1319  dialog box, select the "stubs" package template to build a GDB
1320 stub image. Click 
1321 <EMPHASIS>OK</EMPHASIS>.</PARA>
1322 </LISTITEM>
1323 <LISTITEM>
1324 <PARA>If applicable, set the "AEB board revision" option to
1325 "C" from "B" depending on the board revision being used.</PARA>
1326 </LISTITEM>
1327 <LISTITEM>
1328 <PARA>Build eCos using 
1329 <EMPHASIS>Build</EMPHASIS>
1330 -&#62;
1331 <EMPHASIS>Library.</EMPHASIS></PARA>
1332 </LISTITEM>
1333 <LISTITEM>
1334 <PARA>When the build completes, the image files can be found
1335 in the bin/ subdirectory of the install tree. The GDB stub
1336 ROM images have the prefix "gdb_module".</PARA>
1337 </LISTITEM>
1338 </ORDEREDLIST>
1339 </SECT2>
1340 <SECT2>
1341 <TITLE>Building the GDB Stub ROMs with ecosconfig</TITLE>
1342 <!-- <PARA>(See <XREF LINKEND="USING-ECOSCONFIG-ON-UNIX">)</PARA> -->
1343 <ORDEREDLIST>
1344 <LISTITEM>
1345 <PARA>Make an empty directory to contain the build tree,
1346 and cd into it.</PARA>
1347 </LISTITEM>
1348 <LISTITEM>
1349 <PARA>To build a GDB stub ROM image, enter the command:</PARA>
1350 <PROGRAMLISTING>$ ecosconfig new aeb stubs</PROGRAMLISTING>
1351 </LISTITEM>
1352 <LISTITEM>
1353 <PARA>If applicable, edit ecos.ecc and set the AEB board revision. (CYGHWR_HAL_ARM_AEB_REVISION)
1354 from the default "B" to "C" by uncommenting the user_value
1355 property and setting it to "C".</PARA>
1356 </LISTITEM>
1357 <LISTITEM>
1358 <PARA>Enter the commands
1359  
1360 <PROGRAMLISTING>$ ecosconfig tree
1361 $ make</PROGRAMLISTING></PARA>
1362 </LISTITEM>
1363 <LISTITEM>
1364 <PARA>When the build completes, the image files can be found
1365 in the bin/ subdirectory of the install tree. The GDB stub
1366 ROM images have the prefix "gdb_module".</PARA>
1367 </LISTITEM>
1368 </ORDEREDLIST>
1369 </SECT2>
1370 </SECT1>
1371 <SECT1 id="setup-arm-cma230">
1372 <TITLE><!-- <index></index> -->ARM Cogent CMA230 Hardware Setup</TITLE>
1373 <PARA>The eCos Developer's Kit package comes with an EPROM
1374 which provides GDB support for the Cogent evaluation board. An image
1375 of this EPROM is also provided at loaders/arm-cma230/gdbload.bin
1376 under the root of your eCos installation. </PARA>
1377 <PARA>The EPROM is installed to socket U3 on the board. Attention
1378 should be paid to the correct orientation of the EPROM during installation.</PARA>
1379 <PARA>If you are going to burn a new EPROM using the binary image,
1380 be careful to get the byte order correct. It needs to be little-endian,
1381 which is usually the default in PC based programmer software.</PARA>
1382 <PARA>If the GDB stub EPROM you burn does not work, try reversing
1383 the byte-order, even if you think you have it the right way around.
1384 At least one DOS-based EPROM burner program is known to have the
1385 byte-order upside down.</PARA>
1386 <PARA>The GDB stub in the EPROM allows communication with GDB using
1387 the serial port at connector P12 (CMA101) or P3 (CMA102). The communication parameters
1388 are fixed at 38400 baud, 8 data bits, no parity bit and 1 stop bit
1389 (8-N-1).  No flow control is employed. Connection to the host computer
1390 should be made using a dedicated serial cable as specified in the
1391 Cogent CMA manual.</PARA>
1392 <SECT2>
1393 <TITLE>Building the GDB Stub FLASH ROM images</TITLE>
1394 <PARA>Pre-built GDB stubs images are provided in the directory loaders/arm-cma230 relative
1395 to the root of your eCos installation, but here are instructions
1396 on how to rebuild them if you should ever need to.</PARA>
1397 <PARA>CygMon images are prefixed with the name 'cygmon' and
1398 GDB stub ROM images</PARA>
1399 <PARA>are given the prefix 'gdb_module'.
1400 Images may be provided in a number of formats including ELF (.img
1401 extension), binary (.bin extension) and SREC (.srec extension). </PARA>
1402 </SECT2>
1403 <SECT2>
1404 <TITLE>Building the GDB Stubs with the eCos Configuration Tool</TITLE>
1405 <ORDEREDLIST>
1406 <LISTITEM>
1407 <PARA>1. Start with a new document - selecting the File-&#62;New
1408 menu item if necessary to do this.</PARA>
1409 </LISTITEM>
1410 <LISTITEM>
1411 <PARA>Choose the 
1412 <EMPHASIS>Build</EMPHASIS>-&#62;<EMPHASIS>Templates</EMPHASIS>
1413  menu item, and then select the ARM CMA230 hardware.</PARA>
1414 </LISTITEM>
1415 <LISTITEM>
1416 <PARA>While still displaying the 
1417 <EMPHASIS>Build</EMPHASIS>
1418 -&#62;
1419 <EMPHASIS>Templates</EMPHASIS>
1420  dialog box, select the "stubs" package template to build a GDB
1421 stub image. Click 
1422 <EMPHASIS>OK</EMPHASIS>.</PARA>
1423 </LISTITEM>
1424 <LISTITEM>
1425 <PARA>Build eCos using 
1426 <EMPHASIS>Build</EMPHASIS>
1427 -&#62;
1428 <EMPHASIS>Library</EMPHASIS></PARA>
1429 </LISTITEM>
1430 <LISTITEM>
1431 <PARA>When the build completes, the image files can be found
1432 in the bin/ subdirectory of the install tree. The GDB stub
1433 ROM images have the prefix "gdb_module".</PARA>
1434 </LISTITEM>
1435 </ORDEREDLIST>
1436 </SECT2>
1437 <SECT2>
1438 <TITLE>Building the GDB Stub ROMs with ecosconfig</TITLE>
1439 <!-- <PARA>(See <XREF LINKEND="USING-ECOSCONFIG-ON-UNIX">)</PARA> -->
1440 <ORDEREDLIST>
1441 <LISTITEM>
1442 <PARA>1. Make an empty directory to contain the build tree,
1443 and cd into it.</PARA>
1444 </LISTITEM>
1445 <LISTITEM>
1446 <PARA>To build a GDB stub ROM image, enter the command:</PARA>
1447 <PROGRAMLISTING>$ ecosconfig new cma230 stubs</PROGRAMLISTING>
1448 </LISTITEM>
1449 <LISTITEM>
1450 <PARA>Enter the commands:
1451  
1452 <PROGRAMLISTING>$ ecosconfig tree
1453 $ make</PROGRAMLISTING></PARA>
1454 </LISTITEM>
1455 <LISTITEM>
1456 <PARA>When the build completes, the image files can be found
1457 in the bin/ subdirectory of the install tree. The GDB stub
1458 ROM images have the prefix "gdb_module".</PARA>
1459 </LISTITEM>
1460 </ORDEREDLIST>
1461 </SECT2>
1462 </SECT1>
1463 <SECT1 id="setup-arm-ep7211">
1464 <TITLE><!-- <index></index> --><!-- <xref> -->Cirrus Logic ARM EP7211 Development
1465 Board Hardware Setup</TITLE>
1466 <PARA>eCos comes with two Flash ROM images that provide GDB support
1467 for the Cirrus Logic EP7211 Development Board (also known as the
1468 EDB7211).. Note that on some board revisions, the board is silk-screened
1469 as EDB7111-2. The first Flash ROM image provides a port of the CygMon
1470 ROM monitor, which includes a command-line interface and a GDB remote
1471 stub. The second Flash ROM image provides a remote GDB stub only.</PARA>
1472 <PARA>Both ROM images are provided in the directory loaders/arm-edb7211
1473 under the root of your eCos installation. CygMon images are prefixed
1474 with the name 'edb7211_cygmon' and are
1475 provided in a number of formats including binary (.bin extension)
1476 and SREC (.srec) extension. GDB stub ROM images are given the prefix 'edb7211_gdb_module'. </PARA>
1477 <PARA>The ROM images provided for the EP7211 Development Board must
1478 be programmed into the FLASH. Please refer to the section titled
1479 "Loading the ROM image into On-Board flash" on how to program the
1480 ROM onto the board.</PARA>
1481 <PARA>Both Cygmon and GDB Stub ROMS allow communication with GDB
1482 via the serial connector labelled 'UART 1'. The
1483 communication parameters are fixed at 38400 baud, 8 data bits, no
1484 parity bit and 1 stop bit (8-N-1). No flow control is employed.
1485 Connection to the host computer should be made using a null modem cable.
1486 A gender changer may also be required. Note that the GDB Configuration tool
1487 uses the serial port identifiers 0 and 1 to identify the EB7211
1488 serial ports UART1 and UART2 respectively.</PARA>
1489 <PARA>Both eCos and the ROM images assume the core clock is generated
1490 with a 3.6864 MHz PLL input. The CPU will be configured to run at
1491 73.728MHz.</PARA>
1492 <PARA>Note: The EP7211 CPU needs a two step RESET process. After
1493 pressing the &grave;URESET' pushbutton, the &grave;WAKEUP' pushbutton
1494 must be pressed to complete the process.</PARA>
1495 <NOTE>
1496 <PARA>When an eCos program is run on an EDB7211 board fitted with
1497 either CygMon or a GDB stub ROM, then the code in ROM loses control.
1498 This means that if you require the ability to remotely stop execution
1499 on the target, or want thread debugging capabilities, you must include
1500 GDB stub support when configuring eCos.</PARA>
1501 </NOTE>
1502 <SECT2>
1503 <TITLE>Building programs for programming into FLASH</TITLE>
1504 <PARA>If your application is to be run directly from FLASH, you
1505 must configure eCos appropriately for "ROM" startup. This can be
1506 done in the <EMPHASIS>eCos Configuration Tool</EMPHASIS> by setting
1507 the "Startup type" HAL option to "ROM". If using the ecosconfig utility,
1508 set the user_value of the CYG_HAL_STARTUP
1509 option in ecos.ecc to "ROM".</PARA>
1510 <PARA>When you have linked your application with eCos, you will
1511 then have an ELF executable. To convert this into a format appropriate
1512 for the Cirrus Logic FLASH download utility, or the dl_7xxx
1513 utility on Linux, you can use the utility arm-elf-objcopy, as in
1514 the following example:</PARA>
1515 <PROGRAMLISTING>$ arm-elf-objcopy -O binary helloworld.exe helloworld.bin</PROGRAMLISTING>
1516 <PARA>This will produce a binary format image helloworld.bin which
1517 can be downloaded into FLASH.</PARA>
1518 </SECT2>
1519 <SECT2>
1520 <TITLE>Building the GDB Stub FLASH ROM images</TITLE>
1521 <PARA>Pre-built GDB stubs images are provided in the directory loaders/arm-edb7211 relative
1522 to the root of your eCos installation, but here are instructions
1523 on how to rebuild them if you should ever need to.</PARA>
1524 <PARA>CygMon images are prefixed with the name 'cygmon' and
1525 GDB stub ROM images are given the prefix 'gdb_module'.
1526 Images may be provided in a number of formats including ELF (.img
1527 extension), binary (.bin extension) and SREC (.srec extension). </PARA>
1528 </SECT2>
1529 <SECT2>
1530 <TITLE>Building the ROM images with the eCos Configuration Tool</TITLE>
1531 <ORDEREDLIST>
1532 <LISTITEM>
1533 <PARA>Start with a new document - selecting the 
1534 <EMPHASIS>File</EMPHASIS>-&#62;<EMPHASIS>New</EMPHASIS>
1535  menu item if necessary to do this.</PARA>
1536 </LISTITEM>
1537 <LISTITEM>
1538 <PARA>Choose the 
1539 <EMPHASIS>Build</EMPHASIS>-&#62;<EMPHASIS>Templates</EMPHASIS>
1540  menu item, and then select the "Cirrus Logic development board"
1541 hardware.</PARA>
1542 </LISTITEM>
1543 <LISTITEM>
1544 <PARA>While still displaying the 
1545 <EMPHASIS>Build</EMPHASIS>
1546 -&#62;
1547 <EMPHASIS>Templates</EMPHASIS>
1548  dialog box, select either the "stubs" package template to build
1549 a GDB stub image, or the "cygmon" template to build the CygMon ROM
1550 Monitor. Click 
1551 <EMPHASIS>OK</EMPHASIS>.</PARA>
1552 </LISTITEM>
1553 <LISTITEM>
1554 <PARA>Build eCos using 
1555 <EMPHASIS>Build</EMPHASIS>
1556 -&#62;
1557 <EMPHASIS>Library</EMPHASIS></PARA>
1558 </LISTITEM>
1559 <LISTITEM>
1560 <PARA>When the build completes, the image files can be found
1561 in the bin/ subdirectory of the install tree. GDB stub
1562 ROM images have the prefix "gdb_module". CygMon images
1563 have the prefix "cygmon".</PARA>
1564 </LISTITEM>
1565 </ORDEREDLIST>
1566 </SECT2>
1567 <SECT2>
1568 <TITLE>Building the ROM images with ecosconfig</TITLE>
1569 <!-- <PARA>(See <XREF LINKEND="USING-ECOSCONFIG-ON-UNIX">)</PARA> -->
1570 <ORDEREDLIST>
1571 <LISTITEM>
1572 <PARA>Make an empty directory to contain the build tree,
1573 and cd into it.</PARA>
1574 </LISTITEM>
1575 <LISTITEM>
1576 <PARA>To build a GDB stub ROM image, enter the command:</PARA>
1577 <PROGRAMLISTING>$ ecosconfig new edb7xxx stubs</PROGRAMLISTING>
1578 <PARA>or to build a CygMon ROM monitor image, enter the command:</PARA>
1579 <PROGRAMLISTING>$ ecosconfig new edb7xxx cygmon</PROGRAMLISTING>
1580 </LISTITEM>
1581 <LISTITEM>
1582 <PARA>Enter the commands:</PARA>
1583 <PROGRAMLISTING>$ ecosconfig tree
1584 $ make</PROGRAMLISTING>
1585 </LISTITEM>
1586 <LISTITEM>
1587 <PARA>When the build completes, the image files can be found
1588 in the bin/ subdirectory of the install tree. GDB stub
1589 ROM images have the prefix "gdb_module". CygMon images
1590 have the prefix "cygmon".</PARA>
1591 </LISTITEM>
1592 </ORDEREDLIST>
1593 </SECT2>
1594 <SECT2>
1595 <TITLE><!-- <xref> -->Loading the ROM Image into On-board Flash</TITLE>
1596 <PARA>Program images can be written into Flash memory by means of
1597 a bootstrap program which is built into the  EDB7211.  This program
1598 communicates with a support program on your host to download and
1599 program an image into the Flash memory.</PARA>
1600 <PARA>Cirrus Logic provides such a program for use with Windows/DOS.
1601  eCos comes with a similar program which will run under Linux. The
1602 basic operation of both programs is the same.</PARA>
1603 <ORDEREDLIST>
1604 <LISTITEM>
1605 <PARA>Connect a serial line to 'UART 1'.</PARA>
1606 </LISTITEM>
1607 <LISTITEM>
1608 <PARA>Power off the  EDB7211.</PARA>
1609 </LISTITEM>
1610 <LISTITEM>
1611 <PARA>Install jumper 'PROGRAM ENABLE' which
1612 enables this special mode for downloading Flash images. Note that
1613 some board revisions have this jumper labelled &ldquo;BOOT ENABLE&rdquo;.</PARA>
1614 </LISTITEM>
1615 <LISTITEM>
1616 <PARA>Power on the  EDB7211.</PARA>
1617 </LISTITEM>
1618 <LISTITEM>
1619 <PARA>Execute the Flash writing program on your host.  On Linux,
1620 this would be:</PARA>
1621 <PROGRAMLISTING>     # dl_edb7xxx &lt;PATH&#62;/gdb_module.bin</PROGRAMLISTING>
1622 <PARA>where '&lt;PATH&#62;' is the path to
1623 the binary format version of the ROM image you wish to load, either
1624 as built in the previous section or the "loaders/arm-edb7211/" subdirectory
1625 of your eCos installation. The download tool defaults to 38400 baud and
1626 device /dev/ttyS1 for communication. To change
1627 these, specify them as parameters, e.g.
1628               </PARA>
1629 <PROGRAMLISTING># dl_edb7xxx &lt;PATH&#62;/gdb_module.bin 9600 /dev/ttyS0</PROGRAMLISTING>
1630 </LISTITEM>
1631 <LISTITEM>
1632 <PARA>The download program will indicate that it is waiting
1633 for the board to come alive.  At this point, press 'RESET' and
1634 then 'WAKEUP' switches in order.  There should be
1635 some indication of progress, first of the code being downloaded,
1636 then of the programming process.</PARA>
1637 </LISTITEM>
1638 <LISTITEM>
1639 <PARA>Upon completion of the programming, power off the  EDB7211.</PARA>
1640 </LISTITEM>
1641 <LISTITEM>
1642 <PARA>Remove the 'PROGRAM ENABLE/BOOT ENABLE' jumper.</PARA>
1643 </LISTITEM>
1644 <LISTITEM>
1645 <PARA>Power on the  EDB7211, press 'RESET' and 'WAKEUP'.
1646  The new ROM image should now be running on the board.</PARA>
1647 </LISTITEM>
1648 <LISTITEM>
1649 <PARA>The GDB debugger will now be able to communicate with
1650 the board to download and debug RAM based programs.
1651
1652 This procedure also applies for loading ROM-startup eCos programs
1653 into the on-board FLASH memory, given a binary format image of the
1654 program from arm-elf-objcopy.  Loading a ROM-startup eCos program
1655 into Flash will overwrite the GDB Stub ROM/CygMon in Flash,
1656 so you would have to reload the GDB Stub ROM/CygMon to
1657 return to normal RAM-startup program development.</PARA>
1658 </LISTITEM>
1659 </ORDEREDLIST>
1660 </SECT2>
1661 <SECT2>
1662 <TITLE>Building the Flash Downloader on Linux</TITLE>
1663 <PARA>eCos provides a Flash download program suitable for use with
1664 the  EP7211 Development Board which will run on Linux.  Follow these
1665 steps to build this program.  Note: at the time of the writing of
1666 these instructions, the download program is built directly within
1667 the eCos source repository since it is
1668 not configuration specific.</PARA>
1669 <PROGRAMLISTING>  # cd &lt;eCos install dir&#62;/packages/hal/arm/edb7xxx/<replaceable>&Version;</replaceable>/support</PROGRAMLISTING>
1670 <PROGRAMLISTING>  # make</PROGRAMLISTING>
1671 <PARA>(where '# ' is your shell prompt)</PARA>
1672 <PARA>Note: this program was adapted from the Cirrus Logic original
1673 DOS program and still contains some vestiges of that environment.</PARA>
1674 </SECT2>
1675 <SECT2>
1676 <TITLE>Developing eCos Programs with the ARM Multi-ICE</TITLE>
1677 <PARA>The EP7211 Development Board supports use of the ARM
1678             Multi-processor EmbeddedICE(tm), also known as the
1679             Multi-ICE. Full instructions on how to install and use the
1680             Multi-ICE in conjunction with GDB are provided in the
1681             <EMPHASIS>"GNUPro Toolkit Reference for eCos
1682               ARM/Thumb"</EMPHASIS> manual. However, the following
1683             platform-specific details should be noted.</PARA>
1684 <PARA>You will need an ARM Multi-ICE Server configuration
1685             file for the EP7211 Development Board. Here is a suggested
1686             configuration file to use:</PARA>
1687 <PROGRAMLISTING>======== File "720T.cfg" ======== 
1688 ;Total IR length = 4 
1689 [TITLE] 
1690 Multi-ICE configuration for EP7211 
1691  
1692 [TAP 0] 
1693 ARM720T 
1694  
1695 [TAPINFO] 
1696 YES 
1697  
1698 [Timing] 
1699 Low=0 
1700 High=0 
1701 Adaptive=OFF 
1702 ==================================</PROGRAMLISTING>
1703 <PARA>You must ensure that the board has the appropriate soldered
1704 connections. For the EP7211 this involves connecting TEST0 and TEST1
1705 of the EP7211 to ground. To do this you must solder a wire from
1706 ground at JP33 to TP8 and TP9.</PARA>
1707 <PARA>With respect to using multiple devices simultaneously, note
1708 that the EP7211 is not ID sensitive.</PARA>
1709 <PARA>If you wish to view diagnostic output from your program that
1710 was downloaded via the Multi-ICE, you will note that by default
1711 the output on the serial line (as viewed by a terminal such as Hyperterm
1712 in Windows, or cu in Unix) is in the form of GDB packets.</PARA>
1713 <PARA>To get legible output, the solution is to set the "GDB Serial
1714 port" to a different device from the "Diagnostic serial port", and
1715 you should use the Diagnostic serial port to view the diagnostic
1716 output.</PARA>
1717 <PARA>Warning: The multi-ice-gdb-server will fail on startup if
1718 the board has not been both reset and awakened before running the
1719 server. </PARA>
1720 <PARA>To resolve this, it is necessary to free up the connection
1721 from within the ARM Multi-ICE server itself. However when this happens,
1722 the next time you use GDB to load the program into the board, you
1723 will see lots of "Readback did not match original data" messages
1724 in the output of the multi-ice-gdb-server program. This indicates
1725 your program did not load correctly, and you should restart the
1726 multi-ice-gdb-server program, taking care to reset the board correctly
1727 before reconnecting. </PARA>
1728 <PARA>As a reminder, you must specify --config-dialog to the
1729             multi-ice-gdb-server program to connect to the board
1730             correctly. If you do not, the multi-ice-gdb-server program
1731             will not be able to connect.</PARA>
1732 </SECT2>
1733 </SECT1>
1734
1735 <SECT1 ID="setup-arm-ep7212">
1736 <TITLE><!-- <conditionaltext> -->Cirrus Logic ARM EP7212 Development Board
1737 Hardware Setup</TITLE>
1738 <PARA>The Cirrus Logic EP7212 Development Board is almost identical
1739 to the EP7211 Development Board from a hardware setup viewpoint,
1740 and is based on the same port of eCos. Therefore the earlier documentation
1741 for the EP7211 Development Board can be considered equivalent, but
1742 with the following changes:</PARA>
1743 <ITEMIZEDLIST>
1744 <LISTITEM>
1745 <PARA>The first serial port is silk screened as "UART 1" on
1746 the EP7211 Development Board, but is silk screened as "Serial Port
1747 0" on the EP7212 Development Board. Similarly "UART 2" is silk screened
1748 as "Serial Port 1" on the EP7212 Development Board.</PARA>
1749 </LISTITEM>
1750 <LISTITEM>
1751 <PARA>JP2 (used to control reprogramming of the FLASH) is not
1752 silkscreened with "Boot Enable".</PARA>
1753 </LISTITEM>
1754 <LISTITEM>
1755 <PARA>To setup the EP7212 Development Board for use with the
1756 ARM Multi-ICE JTAG debugging interface unit, it is necessary to
1757 connect TEST0 and TEST1 of the EP7212 to ground.  On the Development
1758 Board, this is accomplished by placing shorting blocks on JP47 and
1759 JP48. When the shorting blocks are fitted, the board can only be
1760 operated through the Multi-ICE - debugging over a serial line is
1761 not possible.</PARA>
1762 </LISTITEM>
1763 <LISTITEM>
1764 <PARA><!-- <conditionaltext> -->Pre-built GDB stubs are
1765               provided in the directory
1766               <FILENAME>loaders/arm-edb7212</FILENAME> relative to the
1767               root of your eCos installation</PARA>
1768 </LISTITEM>
1769 <LISTITEM>
1770 <PARA>When rebuilding the GDB stub ROM image, change the "Cirrus
1771 Logic processor variant" option (CYGHWR_HAL_ARM_EDB7XXX_VARIANT)
1772 from the EP7211 to the EP7212. This can be selected in the 
1773 <EMPHASIS>eCos Configuration Tool</EMPHASIS>
1774 , or if using ecosconfig, can be set by uncommenting the user_value
1775 property of this option in ecos.ecc and setting it to "EP7212".</PARA>
1776 </LISTITEM>
1777 </ITEMIZEDLIST>
1778 </SECT1>
1779 <SECT1 ID="setup-arm-ep7312">
1780 <TITLE><!-- <conditionaltext> -->Cirrus Logic ARM EP7312 Development Board
1781 Hardware Setup</TITLE>
1782 <PARA>The Cirrus Logic EP7312 Development Board is similar
1783 to the EP7212 Development Board from a hardware setup viewpoint,
1784 and is based on the same port of eCos.</PARA>
1785 <PARA>When rebuilding the RedBoot ROM image or an eCos application,
1786 change the "Cirrus Logic processor variant" option
1787 (CYGHWR_HAL_ARM_EDB7XXX_VARIANT)
1788 from the EP7211 to the EP7312. This can be selected in the 
1789 <EMPHASIS>eCos Configuration Tool</EMPHASIS>
1790 , or if using ecosconfig, can be set by uncommenting the user_value
1791 property of this option in ecos.ecc and setting it to "EP7312".
1792 </PARA>
1793 <PARA>
1794 See the RedBoot documentation for building and installing RedBoot for this
1795 target.  Only RedBoot is supported as a boot image; ROMRAM startup is
1796 recommended.
1797 </PARA>
1798 <SECT2 ID="ep7312-90MHz-operation">
1799 <TITLE>90MHz Operation</TITLE>
1800 <PARA>
1801 The EP7xxx targets offer a choice of clock speeds, from 18MHz to a maximum,
1802 normally, of 72MHz.  These are described as kHz values 18432 36864 49152
1803 and 73728 within the configuration tool.  If you have a release which
1804 supports it, you will also see 90317 as an available option here, for 90MHz
1805 operation.
1806 </PARA>
1807 <PARA>
1808 This option only applies to certain EP7312 hardware, not all EP7312 boards
1809 support it.  Do not select 90MHz when building RedBoot or your eCos
1810 application unless you are absolutely sure that your board supports it.
1811 </PARA>
1812 <PARA>
1813 If you do have a 90MHz board and wish to execute at 90MHz, it is in fact
1814 not necessary to build RedBoot specially, if you build your eCos
1815 application configured for 90MHz.  RedBoot will run at 72MHz and your
1816 application will run at 90MHz.  If you do install a 90MHz RedBoot, then you
1817 must build eCos for 90MHz or timing and baud rates on serial I/O will be
1818 wrong.
1819 </PARA>
1820 <PARA>
1821 In other words, code (either eCos app or RedBoot) built for 90MHz will
1822 &ldquo;change up a gear&rdquo; when it starts up; but code built for 72MHz,
1823 because it needs to run correctly on boards without the
1824 &ldquo;gearbox&rdquo; does not change back down, so if you mix the two,
1825 unexpected timing can result.  To run a non-eCos application without any
1826 hardware initialization code at 90MHz, you must install a specially-built
1827 RedBoot.
1828 </PARA>
1829 </SECT2>
1830 </SECT1>
1831 <SECT1 id="setup-arm-ep7209">
1832 <TITLE>Cirrus Logic ARM EP7209 Development Board Hardware Setup</TITLE>
1833 <PARA>Note: At time of writing, no EP7209 Development Board is available,
1834 and consequently eCos has not been verified for use with the EP7209
1835 Development Board.</PARA>
1836 <PARA>The Cirrus Logic EP7209 Development Board is almost identical
1837 to the EP7212 Board in all respects, except that it is not fitted
1838 with DRAM, nor has it a DRAM controller.</PARA>
1839 <PARA>The only valid configuration for the EDB7209 is ROM based.
1840 The STUBS and RAM startup modes are not available as no DRAM is
1841 fitted.</PARA>
1842 </SECT1>
1843 <SECT1 id="setup-arm-clps7111">
1844 <TITLE><!-- <index></index> -->Cirrus Logic ARM CL-PS7111 Evaluation Board Hardware Setup</TITLE>
1845 <PARA>The implementation of the port of eCos to the Cirrus Logic
1846 ARM CL-PS7111 Evaluation Board (also known as EB7111) is based on
1847 the EP7211 Development Board port.</PARA>
1848 <PARA>For that reason, the setup required is identical to the  EP7211
1849 Development Board as described above, with the following exceptions:</PARA>
1850 <ITEMIZEDLIST>
1851 <LISTITEM>
1852 <PARA>The Cygmon ROM monitor is not supported</PARA>
1853 </LISTITEM>
1854 <LISTITEM>
1855 <PARA>The ARM Multi-ICE is not supported</PARA>
1856 </LISTITEM>
1857 <LISTITEM>
1858 <PARA><!-- <conditionaltext> -->Pre-built GDB stubs are provided in the
1859 directory loaders/arm-eb7111 relative to the root of your
1860 eCos installation</PARA>
1861 </LISTITEM>
1862 <LISTITEM>
1863 <PARA>If rebuilding the GDB stub ROM image, change the "Cirrus
1864 Logic processor variant" option (CYGHWR_HAL_ARM_EDB7XXX_VARIANT)
1865 from the EP7211 to the CL_PS7111. This can be selected
1866 in the 
1867 <EMPHASIS>eCos Configuration Tool</EMPHASIS>
1868 , or if using ecosconfig, can be set by uncommenting the user_value
1869 property of this option in ecos.ecc and setting it to "CL_PS7111"</PARA>
1870 </LISTITEM>
1871 </ITEMIZEDLIST>
1872 <PARA>All remote serial communication is done with the serial I/O
1873 connector</PARA>
1874 <PROGRAMLISTING>/misc   
1875 % slow_cat.tcl &lt; [path]/gdb_module.srec &#62; /dev/ttyS0</PROGRAMLISTING>
1876 <PARA>Power off the board, and change it to boot the GDB stubs in
1877 big-endian mode by setting the switches like this:</PARA>
1878 <PARA>SW1: 00000000 (all levers down)   
1879 SW2: 10001010</PARA>
1880 <PARA>The GDB stubs allow communication with GDB using the serial
1881 port at connector PJ7A (lower connector). The communication parameters
1882 are  fixed at 38400 baud, 8 data bits, no parity bit and 1 stop
1883 bit  (8-N-1). No flow control is employed. Connection to the host
1884 computer should be made using a straight through serial cable.</PARA>
1885 </SECT1>
1886 <SECT1 id="setup-arm-ebsa285">
1887 <TITLE>StrongARM EBSA-285 Hardware Setup</TITLE>
1888 <PARA>The eCos Developer&rsquo;s Kit package comes with a ROM
1889 image which provides GDB support for
1890 the Intel&reg; StrongARM&reg; Evaluation Board EBSA-285.
1891  Both eCos and the Stub ROM image assume the clocks are: 3.6864
1892 MHz PLL input for generating the core clock, and 50MHz osc input
1893 for external clocks. An image of this ROM is also provided at <filename>loaders/arm-ebsa285/gdbload.bin</filename> under
1894 the root of your eCos installation.</PARA>
1895 <PARA>The ROM monitor image (an eCos GDB
1896 stub) provided for the EBSA-285 board must be programmed into the
1897 flash, replacing the Angel monitor on the board. Please refer to
1898 the section titled "Loading the ROM Image into On-Board flash" on how
1899 to program the ROM onto the board.</PARA>
1900 <PARA>The Stub ROM allows communication with GDB via the serial
1901 connector on the bulkhead mounting bracket COM0.  The communication
1902 parameters are fixed at 38400 baud, 8 data bits, no parity bit and
1903 1 stop bit (8-N-1).  No flow control is employed.</PARA>
1904 <SECT2>
1905 <TITLE>Building the GDB Stub FLASH ROM images</TITLE>
1906 <PARA>Pre-built GDB stubs images are provided in the directory loaders/arm-ebsa285 relative
1907 to the root of your eCos installation, but here are instructions
1908 on how to rebuild them if you should ever need to.</PARA>
1909 </SECT2>
1910 <SECT2>
1911 <TITLE>Building the GDB Stubs with the eCos Configuration Tool</TITLE>
1912 <ORDEREDLIST>
1913 <LISTITEM>
1914 <PARA>Start with a new document - selecting the 
1915 <EMPHASIS>File</EMPHASIS>
1916 -&#62;
1917 <EMPHASIS>New</EMPHASIS>
1918  menu item if necessary to do this.</PARA>
1919 </LISTITEM>
1920 <LISTITEM>
1921 <PARA>Choose the 
1922 <EMPHASIS>Build</EMPHASIS>
1923 -&#62;
1924 <EMPHASIS>Templates</EMPHASIS>
1925  menu item, and then select the StrongARM EBSA285 hardware.</PARA>
1926 </LISTITEM>
1927 <LISTITEM>
1928 <PARA>While still displaying the 
1929 <EMPHASIS>Build</EMPHASIS>
1930 -&#62;
1931 <EMPHASIS>Templates</EMPHASIS>
1932  dialog box, select the "stubs" package template to build a GDB
1933 stub image. Click 
1934 <EMPHASIS>OK</EMPHASIS>.</PARA>
1935 </LISTITEM>
1936 <LISTITEM>
1937 <PARA>Build eCos using 
1938 <EMPHASIS>Build</EMPHASIS>
1939 -&#62;
1940 <EMPHASIS>Library</EMPHASIS></PARA>
1941 </LISTITEM>
1942 <LISTITEM>
1943 <PARA>When the build completes, the image files can be found
1944 in the bin/ subdirectory of the install tree. The GDB stub
1945 ROM images have the prefix "gdb_module".</PARA>
1946 </LISTITEM>
1947 </ORDEREDLIST>
1948 </SECT2>
1949 <SECT2>
1950 <TITLE>Building the GDB Stub ROMs with ecosconfig</TITLE>
1951 <PARA>(See &ldquo;Using ecosconfig on UNIX&rdquo; on&nbsp;page&nbsp;72)</PARA>
1952 <ORDEREDLIST>
1953 <LISTITEM>
1954 <PARA>Make an empty directory to contain the build tree,
1955 and cd into it.</PARA>
1956 </LISTITEM>
1957 <LISTITEM>
1958 <PARA>To build a GDB stub ROM image, enter the command:
1959
1960 <PROGRAMLISTING>$ ecosconfig new ebsa285 stubs</PROGRAMLISTING></PARA>
1961 </LISTITEM>
1962 <LISTITEM>
1963 <PARA>Enter the commands:
1964  
1965 <PROGRAMLISTING>$ ecosconfig tree
1966 $ make</PROGRAMLISTING></PARA>
1967 </LISTITEM>
1968 <LISTITEM>
1969 <PARA>When the build completes, the image files can be found
1970 in the bin/ subdirectory of the install tree. The GDB stub
1971 ROM images have the prefix "gdb_module".</PARA>
1972 </LISTITEM>
1973 </ORDEREDLIST>
1974 </SECT2>
1975 <SECT2>
1976 <TITLE>Loading the ROM Image into On-board Flash</TITLE>
1977 <PARA>There are several ways to install the eCos gdb stub ROM image
1978 in the EBSA board&rsquo;s flash memory. Once installed, the gdb
1979 stub ROM provides standard eCos download and debug via the EBSA
1980 board&quot;s serial port. The options available include the
1981 Linux based EBSA flash upgrade utility provided by Red Hat, direct writing
1982 of the flash via MultiICE (JTAG) hardware debugger, and other flash management
1983 utilities from Intel (these only support DOS, and proprietary ARM tools
1984 and image formats). Only the Red Hat flash upgrade tool is supported
1985 and tested in this release.</PARA>
1986 <PARA>The flash upgrade tool requires the EBSA board to be configured
1987 as a PCI slave (rather than a master, its normal operating mode)
1988 and plugged into a Linux host computer&quot;s PCI bus.</PARA>
1989 <PARA>Configuring the board for flash loading: Follow the instructions
1990 in the EBSA-285 Reference Manual, pages A-2 and A-3 to configure
1991 the board as an add-in card, and enable flash blank programming.
1992  Briefly: assuming the board was in the default setting to execute
1993 as a bus master ("Host Bridge") make jumper 9 (J9), move jumper
1994 10 (J10) to external reset (PCI_RST), and move jumper 15
1995 (J15) link 4-6-5 to connect 5-6 instead of 4-6.</PARA>
1996 <PARA>Configuring the board for execution of eCos programs: Follow
1997 the instructions in the EBSA-285 Reference Manual, pages A-2 and
1998 A-3 to configure the board as a "Host Bridge" with "Central Function".
1999  Briefly: unset J9, move J10 to on-board reset (BRD_RST),
2000 and set J15 to make 4-6 instead of 5-6 (see page A-8 also).  Plug
2001 the card into its own PCI bus, not the Linux PC used for the flash-programming
2002 process.</PARA>
2003 <PARA>Building the Linux software: the Linux software sources are
2004 in directory</PARA>
2005 <PROGRAMLISTING>      &lt;BASE_DIR&#62;/packages/hal/arm/ebsa285/v1_3/support/linux/safl_util</PROGRAMLISTING>
2006 <PARA>in the eCos source repository.  There are two parts to the
2007 system: a loadable kernel module and the flash utility.  The loadable
2008 kernel module is safl.o and the utility is sa_flash.  To
2009 build:</PARA>
2010 <PARA>  cd to this directory, or a copy of it.</PARA>
2011 <PARA>  make</PARA>
2012 <PARA>This builds safl.o and sa_flash. The kernel module
2013 must be installed, and a device file created for it. Both of these
2014 operations require root permissions.  Create the device file by: </PARA>
2015 <PROGRAMLISTING>      % mknod /dev/safl c 10 178</PROGRAMLISTING>
2016 <PARA>Programming the flash: switch off the EBSA-285, and remove
2017 the EBSA-285 board from its PCI bus.  Take appropriate anti-static
2018 precautions. Configure it for flash loading as above, halt your
2019 Linux system and turn it off.  Install the EBSA-285 board in the
2020 PCI bus of the Linux system and boot it up. (Single user is good enough,
2021 assuming your image and safl_util build dir are on a local
2022 disc partition.)  Change directory to the safl_util directory,
2023 then, to load the kernel module and flash an image onto the eval
2024 board (as root): </PARA>
2025 <PROGRAMLISTING>       % insmod safl.o
2026        % sa_flash &lt;image_file&#62;</PROGRAMLISTING>
2027 <PARA>Halt and turn off the Linux machine and remove the EBSA-285
2028 card.  Take appropriate anti-static precautions.  Configure it for
2029 execution of eCos programs as above, and plug it into its own PCI
2030 bus.  Restart the Linux machine however you wish.</PARA>
2031 <PARA>This information is replicated in the README file within the
2032 safl_util directory and its parents, and in the EBSA-285
2033 Reference Manual from Intel, appendix A "Configuration Guide". 
2034 If in doubt, please refer to those documents also.</PARA>
2035 <PARA>This procedure also applies for loading ROM-startup eCos programs
2036 into the on-board flash memory, given a binary format image of the
2037 program from arm-elf-objcopy.  Loading a ROM-startup eCos program
2038 into flash will overwrite the StubROM in flash, so you would have
2039 to reload the StubROM to return to normal RAM-startup program development.</PARA>
2040 </SECT2>
2041 <SECT2>
2042 <TITLE>Running your eCos Program Using GDB and the StubROM</TITLE>
2043 <NOTE>
2044 <PARA>You must first load the StubROM image into the flash memory
2045 on the EBSA-285 board before doing this.  See &ldquo;Loading
2046 the ROM Image into On-board Flash&rdquo;, page 93 for details.</PARA>
2047 </NOTE>
2048 <PARA>Connect to the StubROM in the board and run your eCos program &lt;PROGRAM&#62; as</PARA>
2049 <PARA>follows:</PARA>
2050 <PROGRAMLISTING>      $ arm-elf-gdb -nw &lt;PROGRAM&#62;
2051       (gdb) set remotebaud 38400
2052       (gdb) target remote &lt;DEVICE&#62;</PROGRAMLISTING>
2053 <PARA>Where &lt;DEVICE&#62; is /dev/ttyS0
2054 or COM1: or similar, depending on your environment and how you connected
2055 your serial line to the host computer. Expect some output here,
2056 for example:</PARA>
2057 <PROGRAMLISTING>      Remote debugging using /dev/ttyS0
2058       0x410026a4 in ?? ()</PROGRAMLISTING>
2059 <PARA>then, to load the program</PARA>
2060 <PROGRAMLISTING>        (gdb) load
2061     </PROGRAMLISTING>
2062 <PARA>which will report locations and sizes of sections as they
2063 load, then begin execution using</PARA>
2064 <PROGRAMLISTING>      (gdb) continue</PROGRAMLISTING>
2065 <PARA>If you have no eCos program yet, but you want to connect to
2066 the board just to verify serial communications, tell gdb "set endian
2067 little" before anything else, so that it understands the board (GDB
2068 normally infers this from information within the eCos program).</PARA>
2069 <NOTE>
2070 <PARA>When an eCos program is run on the EBSA-285 board, the GDB
2071 stub in ROM loses control. This means that if you require the ability
2072 to stop execution on the target remotely, or want thread debugging
2073 capabilities, you must include GDB stub support when configuring
2074 <PRODUCTNAME>eCos</PRODUCTNAME>.</PARA>
2075 </NOTE>
2076 </SECT2>
2077 </SECT1>
2078 <SECT1 id="setup-arm-ipaq">
2079 <TITLE><!-- <conditionaltext> --> <!-- NOTE: could not find it --><!-- <index></index> -->Compaq iPAQ PocketPC Hardware Setup</TITLE>
2080 <PARA>For setting up the iPAQ to run with RedBoot, see the the <EMPHASIS>RedBoot
2081 User's Guide</EMPHASIS>. Connections may be made using
2082 the Compact Flash Ethernet interface.  A serial cable may be connected
2083 directly, or via the cradle. Serial communication uses the parameters
2084 38400,8,N,1. The LCD/Touchscreen may also be used as an
2085 interface to RedBoot and eCos applications.</PARA>
2086 </SECT1>
2087 <SECT1 id="setup-arm-aim711">
2088 <TITLE>Arm Industrial Module AIM 711 Hardware Setup</TITLE>
2089 <PARA>The Arm Industrial Module AIM 711 comes with RedBoot installed
2090 as the default boot loader.</PARA>
2091 <PARA>For developing without having a finished custom board, a 
2092 starter-kit with a minimally configured board is available. It offers all the 
2093 connectors needed for development, including serial device, Ethernet, power 
2094 supply and an extra connector for the external bus.</PARA>
2095 <SECT2>
2096 <TITLE>Setup Hardware</TITLE>
2097 <SECT3>
2098 <TITLE>Power supply</TITLE>
2099 <PARA>A 6V - 7.5V power supply must be connected to J2 or TB1. At
2100 J2 the inner pin is V+ and at TB1 it is pin 1.</PARA>
2101 </SECT3>
2102 <SECT3>
2103 <TITLE>Serial devices</TITLE>
2104 <PARA>The AIM 711 has 3 serial devices, which are the debug and 
2105 diagnostic channel COM0 (/dev/ser0), the high performance 16550
2106 UART COM1 (/dev/ser1) and the second internal device COM2
2107 (/dev/ser2).</PARA>
2108 <PARA>To use the debug channel, which is also the default for 
2109 RedBoot, the supplied DB9-male cable must be connected to
2110 CN4. If the also available service board is used, the above
2111 connector must be disabled by setting JP1.</PARA>
2112 <PARA>COM1 is available over the RJ45 connector CN2. This device
2113 can be configured as a RS232, RS422, RS485 or TTL level</PARA>
2114 <PARA>COM2 is only available with TTL level at CN5.</PARA>
2115 </SECT3>
2116 <SECT3>
2117 <TITLE>Ethernet</TITLE>
2118 <PARA>The RJ45 connector CN1 is for Ethernet.</PARA>
2119 </SECT3>
2120 </SECT2>
2121 <SECT2>
2122 <TITLE>Installing RedBoot into FLASH</TITLE>
2123 <SECT3>
2124 <TITLE>Using RedBoot</TITLE>
2125 <PARA>In order that Redboot can overwrite itself, Redboot is built as a ROMRAM image. </PARA>
2126 <PARA>Load the RedBoot binary to the next free space:
2127 <PROGRAMLISTING>RedBoot> load -m tftp -h 192.168.1.36 -r -b 0x40000 redboot.bin
2128 Raw file loaded 0x00040000-0x00063233, assumed entry at 0x00040000</PROGRAMLISTING>
2129 Store it in FLASH:
2130 <PROGRAMLISTING>RedBoot> fis create RedBoot
2131 An image named 'RedBoot' exists - continue (y/n)? y
2132 ... Erase from 0x02000000-0x02025000: .....................................
2133 ... Program from 0x00040000-0x00063234 at 0x02000000: ..........................
2134 ..........
2135 ... Erase from 0x021ff000-0x02200000: .
2136 ... Program from 0x007ff000-0x00800000 at 0x021ff000: .</PROGRAMLISTING>
2137 Restart the AIM 711:
2138 <PROGRAMLISTING>RedBoot> reset
2139 ... Resetting.</PROGRAMLISTING>
2140 </PARA>
2141 </SECT3>
2142 <SECT3>
2143 <TITLE>Using JTAG</TITLE>
2144 <PARA>To rewrite the FLASH using JTAG the service board must be
2145 used, which includes a JTAG connector.</PARA>
2146 </SECT3>
2147 </SECT2>
2148 <SECT2>
2149 <TITLE>More documentation</TITLE>
2150 <PARA>For more information please look at
2151 <ULINK URL="http://www.visionsystems.de/arm7.html">http://www.visionsystems.de/arm7.html</ULINK>.</PARA>
2152 </SECT2>
2153 </SECT1>
2154 <SECT1 id="setup-sh-edk7708">
2155 <TITLE>SH3/EDK7708 Hardware Setup</TITLE>
2156 <PARA>The eCos Developer&rsquo;s Kit package comes with a ROM
2157 which provides GDB support for the Hitachi EDK7708 board (a big-endian
2158 and a little-endian version). Images of these  ROMs are also provided
2159 at <filename>loaders/sh-edk7708/gdbload.bin</filename> and
2160           <filename>loaders/sh-edk7708le/gdbload.bin</filename> under
2161 the root of your eCos installation.</PARA>
2162 <PARA>The ROM is installed to socket U6 on the board. When using
2163 the big-endian ROM, jumper 9 must be set to 2-3. When using the
2164 little-endian ROM, jumper 9 must be set to 1-2. Attention should
2165 be paid to the correct orientation of the ROM during installation.
2166 Only replace the board&quot;s existing ROM using a proper PLCC extraction
2167 tool, as the socket would otherwise risk being damaged. </PARA>
2168 <PARA>If you are going to program a new ROM or FLASH using the binary
2169 image, you may have to experiment to get the right byte-order in
2170 the device. Depending on the programming software you use, it might
2171 be necessary to enable byte-swapping.  If the GDB stub ROM/FLASH
2172 you program does not work, try reversing the byte-order.</PARA>
2173 <PARA>The GDB stub in the EPROM allows communication with GDB using
2174 the serial port at connector J1. The communication parameters are
2175 fixed at 38400 baud, 8 data bits, no parity bit and 1 stop bit (8-N-1).
2176 No flow control is employed. Connection to the host computer should
2177 be made using the dedicated serial cable included in the EDK package. </PARA>
2178 <SECT2>
2179 <TITLE>Installing the Stubs into FLASH</TITLE>
2180 <SECT3>
2181 <TITLE>Preparing the Binaries</TITLE>
2182 <PARA>These two binary preparation steps are not strictly necessary
2183 as the eCos distribution ships with pre-compiled binaries in the
2184 directory loaders/sh-edk7708 and loaders/sh-edk7708le
2185 relative to the installation root.</PARA>
2186 <SECT4>
2187 <TITLE>Building the ROM images with the eCos Configuration Tool</TITLE>
2188 <ORDEREDLIST>
2189 <LISTITEM>
2190 <PARA>Start with a new document - selecting the 
2191 <EMPHASIS>File-&#62;New</EMPHASIS>
2192  menu item if necessary to do this.</PARA>
2193 </LISTITEM>
2194 <LISTITEM>
2195 <PARA>Choose the 
2196 <EMPHASIS>Build-&#62;Templates</EMPHASIS>
2197  menu item, and then select the SH EDK7708 hardware.</PARA>
2198 </LISTITEM>
2199 <LISTITEM>
2200 <PARA>While still displaying the 
2201 <EMPHASIS>Build-&#62;Templates</EMPHASIS>
2202  dialog box, select the &ldquo;stubs&rdquo; package template
2203 to build a GDB stub. Click 
2204 <EMPHASIS>OK</EMPHASIS>.</PARA>
2205 </LISTITEM>
2206 <LISTITEM>
2207 <PARA>If building a little-endian image, disable the &ldquo;Use
2208 big-endian mode&rdquo; option in the SH EDK7708 HAL (CYGHWR_HAL_SH_BIGENDIAN).</PARA>
2209 </LISTITEM>
2210 <LISTITEM>
2211 <PARA>Build eCos using 
2212 <EMPHASIS>Build-&#62;Library</EMPHASIS>. </PARA>
2213 </LISTITEM>
2214 <LISTITEM>
2215 <PARA>When the build completes, the image files can be found
2216 in the bin/ subdirectory of the install tree. GDB stub
2217 ROM images have the prefix &ldquo;gdb_module&rdquo;.</PARA>
2218 </LISTITEM>
2219 </ORDEREDLIST>
2220 </SECT4>
2221 <SECT4>
2222 <TITLE>Building the ROM images with ecosconfig</TITLE>
2223 <ORDEREDLIST>
2224 <LISTITEM>
2225 <PARA>Make an empty directory to contain the build tree,
2226 and cd into it.</PARA>
2227 </LISTITEM>
2228 <LISTITEM>
2229 <PARA>To build a GDB stub ROM image, enter the command: 
2230   
2231 <PROGRAMLISTING>$ ecosconfig new edk7708 stubs</PROGRAMLISTING>
2232  </PARA>
2233 </LISTITEM>
2234 <LISTITEM>
2235 <PARA>If building a little-endian image, uncomment the user
2236 value in ecos.ecc for CYGHWR_HAL_SH_BIGENDIAN
2237 and change it to 0.   </PARA>
2238 </LISTITEM>
2239 <LISTITEM>
2240 <PARA>Enter the commands:
2241     
2242 <PROGRAMLISTING>$ ecosconfig tree      
2243 $ make </PROGRAMLISTING></PARA>
2244 </LISTITEM>
2245 <LISTITEM>
2246 <PARA>When the build completes, the image files can be found
2247 in the bin/ subdirectory of the install tree. GDB stub
2248 ROM images have the  prefix &ldquo;gdb_module&rdquo;.</PARA>
2249 </LISTITEM>
2250 </ORDEREDLIST>
2251 </SECT4>
2252 </SECT3>
2253 <SECT3>
2254 <TITLE> Installing the Stubs into ROM or FLASH</TITLE>
2255 <ORDEREDLIST>
2256 <LISTITEM>
2257 <PARA>Program the binary image file gdb_module.bin
2258 into ROM or FLASH referring to the instructions of your ROM programmer.</PARA>
2259 </LISTITEM>
2260 <LISTITEM>
2261 <PARA>Plug the ROM/FLASH into socket U6. If the image
2262 is little-endian set jumper 9 to 1-2. If the image is big-endian
2263 set jumper 9 to 2-3.</PARA>
2264 </LISTITEM>
2265 </ORDEREDLIST>
2266 </SECT3>
2267 </SECT2>
2268 </SECT1>
2269 <SECT1 id="setup-sh-cq7708">
2270 <TITLE>SH3/CQ7708 Hardware Setup</TITLE>
2271 <SECT2>
2272 <TITLE>Preparing the board</TITLE>
2273 <PARA>Make sure the DIP switches on the board are set as follows:
2274   </PARA>
2275 <PROGRAMLISTING>SW1-1 ON
2276 SW1-2 OFF   
2277 SW1-3 ON   
2278 SW1-4 OFF</PROGRAMLISTING>
2279 <PROGRAMLISTING>SW2-1 ON   
2280 SW2-2 ON   
2281 SW2-3 OFF   
2282 SW2-4 OFF</PROGRAMLISTING>
2283 <PARA>If you are using a straight through serial cable which has
2284 flow control lines, you will also need to cut JP12 (5-6) as the
2285 flow control lines can cause NMIs.</PARA>
2286 </SECT2>
2287 <SECT2>
2288 <TITLE>eCos GDB Stubs</TITLE>
2289 <PARA>The eCos installation CD contains a copy of the eCos GDB stubs
2290 in  binary format which must be programmed into an EPROM or FLASH
2291 and  installed on the board.</PARA>
2292 <SECT3>
2293 <TITLE> Preparing the GDB stubs</TITLE>
2294 <PARA>These stub preparation steps are not strictly necessary as
2295 the eCos distribution ships with pre-compiled stubs in the directory
2296 loaders/sh3-cq7708 relative to the installation root.</PARA>
2297 </SECT3>
2298 <SECT3>
2299 <TITLE>Building the GDB stub image with the eCos Configuration Tool</TITLE>
2300 <ORDEREDLIST>
2301 <LISTITEM>
2302 <PARA>Start with a new document - selecting the 
2303 <EMPHASIS>File-&#62;New</EMPHASIS>
2304  menu item if necessary to do this.</PARA>
2305 </LISTITEM>
2306 <LISTITEM>
2307 <PARA>Choose the 
2308 <EMPHASIS>Build-&#62;Templates</EMPHASIS>
2309  menu item, and then select the SH3 cq7708 hardware.</PARA>
2310 </LISTITEM>
2311 <LISTITEM>
2312 <PARA>While still displaying the 
2313 <EMPHASIS>Build-&#62;Templates</EMPHASIS>
2314  dialog box, select the stubs package template to build a GDB stub.
2315 Click 
2316 <EMPHASIS>OK</EMPHASIS>.</PARA>
2317 </LISTITEM>
2318 <LISTITEM>
2319 <PARA> Build eCos stubs using 
2320 <EMPHASIS>Build-&#62;Library</EMPHASIS>.</PARA>
2321 </LISTITEM>
2322 <LISTITEM>
2323 <PARA> When the build completes, the image files can be found
2324 in the 
2325 <FILENAME>bin/</FILENAME>
2326  subdirectory of the install tree. GDB stub images have the prefix 
2327 <FILENAME>gdb_module</FILENAME>.</PARA>
2328 </LISTITEM>
2329 </ORDEREDLIST>
2330 </SECT3>
2331 <SECT3>
2332 <TITLE> Building the GDB stub image with ecosconfig</TITLE>
2333 <ORDEREDLIST>
2334 <LISTITEM>
2335 <PARA>Make an empty directory to contain the build tree,
2336 and cd into it.</PARA>
2337 </LISTITEM>
2338 <LISTITEM>
2339 <PARA> To build a GDB stub ROM image, enter the command: 
2340      
2341 <PROGRAMLISTING>$ ecosconfig new cq7708 stubs </PROGRAMLISTING></PARA>
2342 </LISTITEM>
2343 <LISTITEM>
2344 <PARA> Enter the commands:
2345     
2346 <PROGRAMLISTING>$ ecosconfig tree      
2347 $ make</PROGRAMLISTING></PARA>
2348 </LISTITEM>
2349 <LISTITEM>
2350 <PARA>When the build completes, the image files can be found
2351 in the 
2352 <FILENAME>bin/</FILENAME>
2353  subdirectory of the install tree. GDB stub images have the prefix 
2354 <FILENAME>gdb_module</FILENAME>.  </PARA>
2355 </LISTITEM>
2356 </ORDEREDLIST>
2357 </SECT3>
2358 </SECT2>
2359 <SECT2>
2360 <TITLE>Programming the stubs in EPROM/FLASH</TITLE>
2361 <PARA>The board can use different sizes of ROMs. Use this table
2362 to adjust the board&rsquo;s jumpers to the ROM sizes you are
2363 using.</PARA>
2364 <PROGRAMLISTING>size(kbit)    JP7   JP9   JP10   JP11     
2365 256           2-3   2-3   open   open     
2366 512           1-2   2-3   open   open     
2367 1000          1-2   open  open   2-3     
2368 2000          1-2   1-2   open   2-3     
2369 4000          1-2   1-2   short  2-3     
2370 8000          1-2   1-2   short  1-2</PROGRAMLISTING>
2371 <PARA>There are two ways to program the stubs. We advise you to
2372 use method 1, since it is simpler. Method 2 is unsupported and requires
2373 a bit of fiddling.</PARA>
2374 <PARA><EMPHASIS>Method 1: </EMPHASIS> </PARA>
2375 <PARA>Program the binary stub image into two EPROMs, E and O. EPROM
2376 E should  contain the even bytes, and O the odd bytes (your EPROM
2377 programmer should  have the ability to split the image).</PARA>
2378 <PARA>EPROM E should be installed in socket IC8, and EPROM O should
2379 be  installed in socket IC4.</PARA>
2380 <PARA>Set JP6 to 16 bit mode (1-2 soldered, 2-3 cut)  Set SW1-4
2381 to ON and SW2-1 to OFF.</PARA>
2382 <PARA></PARA>
2383 <PARA><EMPHASIS>Method2: </EMPHASIS> </PARA>
2384 <PARA>Assuming that the stub binary is smaller than 32 KB, you can
2385 install it in a single EPROM.</PARA>
2386 <PARA>Compile the <FILENAME>mkcqrom.c</FILENAME> program
2387 found in the <FILENAME>misc</FILENAME> directory.</PARA>
2388 <PARA>Use it to convert the binary image to the required format.
2389 See the  <FILENAME>mkcqrom.c</FILENAME> source for a
2390 description of what is done, and why it is  necessary. </PARA>
2391 <PROGRAMLISTING> % mkcqrom gdb_module.bin gdb_mangled.bin</PROGRAMLISTING>
2392 <PARA>Program the <FILENAME>gdb_mangled.bin</FILENAME> file
2393 into an EPROM and install it in  socket IC4</PARA>
2394 <PARA>Set JP6 to 8 bit mode (cut 1-2, solder 2-3)</PARA>
2395 <PARA>The GDB stubs allow communication with GDB using the serial
2396 port at connector CN7. The communication parameters are fixed at
2397 38400 baud, 8 data bits, no parity bit and 1 stop bit (8-N-1). No
2398 flow control is employed. Connection to the host computer should
2399 be made using a  straight through serial cable.</PARA>
2400 </SECT2>
2401 </SECT1>
2402 <SECT1 id="setup-sh-hs7729pci">
2403 <TITLE>SH3/HS7729PCI Hardware Setup</TITLE>
2404 <PARA>Please see the RedBoot manual for instructions on how to prepare
2405 the board for use with eCos.</PARA>
2406 </SECT1>
2407 <SECT1 id="setup-sh-se77x9">
2408 <TITLE>SH3/SE77x9 Hardware Setup</TITLE>
2409 <PARA>Please see the RedBoot manual for instructions on how to prepare
2410 the board for use with eCos.</PARA>
2411 </SECT1>
2412 <SECT1 id="setup-sh-cq7750">
2413 <TITLE>SH4/CQ7750 Hardware Setup</TITLE>
2414 <SECT2>
2415 <TITLE>Preparing the board</TITLE>
2416 <PARA>Make sure the DIP switches on the board are set as follows:
2417   </PARA>
2418 <PROGRAMLISTING>SW1-1 ON
2419 SW1-2 OFF   
2420 SW1-3 ON   
2421 SW1-4 OFF</PROGRAMLISTING>
2422 <PROGRAMLISTING>SW2-1 ON   
2423 SW2-2 ON   
2424 SW2-3 OFF   
2425 SW2-4 OFF</PROGRAMLISTING>
2426 <PARA>If you are using a straight through serial cable which has
2427 flow control lines, you will also need to cut JP12 (5-6) as the
2428 flow control lines can cause NMIs.</PARA>
2429 </SECT2>
2430 <SECT2>
2431 <TITLE>eCos GDB Stubs</TITLE>
2432 <PARA>The eCos installation CD contains a copy of the eCos GDB stubs
2433 in  binary format which must be programmed into an EPROM or FLASH
2434 and  installed on the board.</PARA>
2435 <SECT3>
2436 <TITLE> Preparing the GDB stubs</TITLE>
2437 <PARA>These stub preparation steps are not strictly necessary as
2438 the eCos distribution ships with pre-compiled stubs in the directory
2439 loaders/sh3-cq7708 relative to the installation root.</PARA>
2440 </SECT3>
2441 <SECT3>
2442 <TITLE>Building the GDB stub image with the eCos Configuration Tool</TITLE>
2443 <ORDEREDLIST>
2444 <LISTITEM>
2445 <PARA>Start with a new document - selecting the 
2446 <EMPHASIS>File-&#62;New</EMPHASIS>
2447  menu item if necessary to do this.</PARA>
2448 </LISTITEM>
2449 <LISTITEM>
2450 <PARA>Choose the 
2451 <EMPHASIS>Build-&#62;Templates</EMPHASIS>
2452  menu item, and then select the SH3 cq7708 hardware.</PARA>
2453 </LISTITEM>
2454 <LISTITEM>
2455 <PARA>While still displaying the 
2456 <EMPHASIS>Build-&#62;Templates</EMPHASIS>
2457  dialog box, select the stubs package template to build a GDB stub.
2458 Click 
2459 <EMPHASIS>OK</EMPHASIS>.</PARA>
2460 </LISTITEM>
2461 <LISTITEM>
2462 <PARA> Build eCos stubs using 
2463 <EMPHASIS>Build-&#62;Library</EMPHASIS>.</PARA>
2464 </LISTITEM>
2465 <LISTITEM>
2466 <PARA> When the build completes, the image files can be found
2467 in the 
2468 <FILENAME>bin/</FILENAME>
2469  subdirectory of the install tree. GDB stub images have the prefix 
2470 <FILENAME>gdb_module</FILENAME>.</PARA>
2471 </LISTITEM>
2472 </ORDEREDLIST>
2473 </SECT3>
2474 <SECT3>
2475 <TITLE> Building the GDB stub image with ecosconfig</TITLE>
2476 <ORDEREDLIST>
2477 <LISTITEM>
2478 <PARA>Make an empty directory to contain the build tree,
2479 and cd into it.</PARA>
2480 </LISTITEM>
2481 <LISTITEM>
2482 <PARA> To build a GDB stub ROM image, enter the command: 
2483      
2484 <PROGRAMLISTING>$ ecosconfig new cq7708 stubs </PROGRAMLISTING></PARA>
2485 </LISTITEM>
2486 <LISTITEM>
2487 <PARA> Enter the commands:
2488     
2489 <PROGRAMLISTING>$ ecosconfig tree      
2490 $ make</PROGRAMLISTING></PARA>
2491 </LISTITEM>
2492 <LISTITEM>
2493 <PARA>When the build completes, the image files can be found
2494 in the 
2495 <filename>bin/</filename>
2496  subdirectory of the install tree. GDB stub images have the prefix 
2497 <filename>gdb_module</filename>.  </PARA>
2498 </LISTITEM>
2499 </ORDEREDLIST>
2500 </SECT3>
2501 </SECT2>
2502 <SECT2>
2503 <TITLE>Programming the stubs in EPROM/FLASH</TITLE>
2504 <PARA>The board can use different sizes of ROMs. Use this table
2505 to adjust the board&rsquo;s jumpers to the ROM sizes you are
2506 using.</PARA>
2507 <PROGRAMLISTING>size(kbit)    JP7   JP9   JP10   JP11     
2508 256           2-3   2-3   open   open     
2509 512           1-2   2-3   open   open     
2510 1000          1-2   open  open   2-3     
2511 2000          1-2   1-2   open   2-3     
2512 4000          1-2   1-2   short  2-3     
2513 8000          1-2   1-2   short  1-2</PROGRAMLISTING>
2514 <PARA>There are two ways to program the stubs. We advise you to
2515 use method 1, since it is simpler. Method 2 is unsupported and requires
2516 a bit of fiddling.</PARA>
2517 <PARA><EMPHASIS>Method 1: </EMPHASIS> </PARA>
2518 <PARA>Program the binary stub image into two EPROMs, E and O. EPROM
2519 E should  contain the even bytes, and O the odd bytes (your EPROM
2520 programmer should  have the ability to split the image).</PARA>
2521 <PARA>EPROM E should be installed in socket IC8, and EPROM O should
2522 be  installed in socket IC4.</PARA>
2523 <PARA>Set JP6 to 16 bit mode (1-2 soldered, 2-3 cut)  Set SW1-4
2524 to ON and SW2-1 to OFF.</PARA>
2525 <PARA></PARA>
2526 <PARA><EMPHASIS>Method2: </EMPHASIS> </PARA>
2527 <PARA>Assuming that the stub binary is smaller than 32 KB, you can
2528 install it in a single EPROM.</PARA>
2529 <PARA>Compile the <filename>mkcqrom.c</filename> program
2530 found in the <FILENAME>misc</FILENAME> directory.</PARA>
2531 <PARA>Use it to convert the binary image to the required format.
2532 See the  <FILENAME>mkcqrom.c</FILENAME> source for a
2533 description of what is done, and why it is  necessary. </PARA>
2534 <PROGRAMLISTING> % mkcqrom gdb_module.bin gdb_mangled.bin</PROGRAMLISTING>
2535 <PARA>Program the <FILENAME>gdb_mangled.bin</FILENAME> file
2536 into an EPROM and install it in  socket IC4</PARA>
2537 <PARA>Set JP6 to 8 bit mode (cut 1-2, solder 2-3)</PARA>
2538 <PARA>The GDB stubs allow communication with GDB using the serial
2539 port at connector CN7. The communication parameters are fixed at
2540 38400 baud, 8 data bits, no parity bit and 1 stop bit (8-N-1). No
2541 flow control is employed. Connection to the host computer should
2542 be made using a  straight through serial cable.</PARA>
2543 </SECT2>
2544 </SECT1>
2545 <SECT1 id="setup-sh-se7751">
2546 <TITLE>SH4/SE7751 Hardware Setup</TITLE>
2547 <PARA>Please see the RedBoot manual for instructions on how to prepare
2548 the board for use with eCos.</PARA>
2549 </SECT1>
2550 <SECT1 id="setup-v850-cebsa1">
2551 <TITLE>NEC CEB-V850/SA1 Hardware Setup</TITLE>
2552 <PARA>The CEB-V850 board is fitted with a socketed EPROM. The internal
2553 Flash of the V850 supplied with the CEB-V850 boards defaults to
2554 vectoring into this EPROM. A  GDB stub image should be programmed
2555 into an EPROM fitted to this board, and a pre-built image is provided
2556 at <FILENAME>loaders/v850-ceb_v850/v850sa1/gdb_module.bin </FILENAME>under
2557 the root of your eCos installation.</PARA>
2558 <PARA>The EPROM is installed to the socket labelled U7 on the board.
2559 Attention should be paid to the correct orientation of the EPROM
2560 during installation. </PARA>
2561 <PARA>When programming an EPROM using the binary image, be careful
2562 to get the byte order correct. It needs to be little-endian. If
2563 the EPROM burner software has a hex-editor, check that the first
2564 few bytes of the image look similar to: </PARA>
2565 <PROGRAMLISTING>00000000: 0018 8007 5e02 0000 0000 0000 0000 0000</PROGRAMLISTING>
2566 <PARA>If the byte order is wrong you will see 1800 instead of 0018
2567 etc. Use the EPROM burner software to make a byte-swap before you
2568 burn to image to the EPROM. </PARA>
2569 <PARA>If the GDB stub EPROM you burn does not work, try reversing
2570 the byte-order, even if you think you have it the right way around.
2571 At least one DOS-based EPROM burner program is known to have the
2572 byte-order upside down.</PARA>
2573 <PARA>The GDB stub in the EPROM allows communication with GDB using
2574 the serial port. The communication parameters are fixed at 38400
2575 baud, 8 data bits, no parity bit and 1 stop bit (8-N-1). No flow
2576 control is employed. Connection to the host computer should be made
2577 using a dedicated serial cable as specified in the CEB-V850/SA1
2578 manual.</PARA>
2579 <SECT2>
2580 <TITLE>Installing the Stubs into ROM</TITLE>
2581 <SECT3>
2582 <TITLE>Preparing the Binaries</TITLE>
2583 <PARA>These two binary preparation steps are not strictly necessary
2584 as the eCos distribution ships with pre-compiled binaries in the
2585 directory loaders/v850-ceb_v850 relative to the
2586 installation root.</PARA>
2587 <SECT4>
2588 <TITLE>Building the ROM images with the eCos Configuration Tool</TITLE>
2589 <ORDEREDLIST>
2590 <LISTITEM>
2591 <PARA>Start with a new document - selecting the 
2592 <EMPHASIS>File-&#62;New</EMPHASIS>
2593  menu item if necessary to do this.</PARA>
2594 </LISTITEM>
2595 <LISTITEM>
2596 <PARA>Choose the 
2597 <EMPHASIS>Build-&#62;Templates</EMPHASIS>
2598  menu item, and then select the NEC CEB-V850/SA1 hardware.</PARA>
2599 </LISTITEM>
2600 <LISTITEM>
2601 <PARA>While still displaying the 
2602 <EMPHASIS>Build-&#62;Templates</EMPHASIS>
2603  dialog box, select the &ldquo;stubs&rdquo; package template
2604 to build a GDB stub. Click 
2605 <EMPHASIS>OK</EMPHASIS>.</PARA>
2606 </LISTITEM>
2607 <LISTITEM>
2608 <PARA>Build eCos using 
2609 <EMPHASIS>Build-&#62;Library</EMPHASIS>. </PARA>
2610 </LISTITEM>
2611 <LISTITEM>
2612 <PARA>When the build completes, the image files can be found
2613 in the bin/ subdirectory of the install tree. GDB stub
2614 ROM images have the  prefix &ldquo;gdb_module&rdquo;.</PARA>
2615 </LISTITEM>
2616 </ORDEREDLIST>
2617 </SECT4>
2618 <SECT4>
2619 <TITLE>Building the ROM images with ecosconfig</TITLE>
2620 <ORDEREDLIST>
2621 <LISTITEM>
2622 <PARA>Make an empty directory to contain the build tree,
2623 and cd into it. </PARA>
2624 </LISTITEM>
2625 <LISTITEM>
2626 <PARA>To build a GDB stub ROM image, enter the command:
2627
2628 <PROGRAMLISTING>$ ecosconfig new ceb-v850 stubs </PROGRAMLISTING></PARA>
2629 </LISTITEM>
2630 <LISTITEM>
2631 <PARA>Enter the commands: 
2632
2633 <PROGRAMLISTING>$ ecosconfig tree
2634 $ make</PROGRAMLISTING>
2635  </PARA>
2636 </LISTITEM>
2637 <LISTITEM>
2638 <PARA>When the build completes, the image files can be found
2639 in the bin/ subdirectory of the install tree. GDB stub
2640 ROM images have the prefix &ldquo;gdb_module&rdquo;.</PARA>
2641 </LISTITEM>
2642 </ORDEREDLIST>
2643 </SECT4>
2644 </SECT3>
2645 <SECT3>
2646 <TITLE> Installing the Stubs into ROM or FLASH</TITLE>
2647 <ORDEREDLIST>
2648 <LISTITEM>
2649 <PARA> Program the binary image file gdb_module.bin
2650 into ROM or FLASH referring to the instructions of your ROM
2651                   programmer. </PARA>
2652 </LISTITEM>
2653 <LISTITEM>
2654 <PARA> Plug the ROM/FLASH into the socket as described
2655 at the beginning of this section.</PARA>
2656 </LISTITEM>
2657 </ORDEREDLIST>
2658 </SECT3>
2659 </SECT2>
2660 <SECT2>
2661 <TITLE>Debugging with the NEC V850 I.C.E.</TITLE>
2662 <PARA>eCos applications may be debugged using the NEC V850 In Circuit
2663 Emulator (I.C.E.) A PC running Microsoft Windows is required in
2664 order to run the NEC ICE software and drivers. In addition Red Hat
2665 have developed a &ldquo;libremote&rdquo; server application
2666 named v850ice.exe which is used on the PC connected to the I.C.E.
2667 in order to allow connections from GDB.</PARA>
2668 <PARA>The I.C.E. must be physically connected to a Windows NT system
2669 through NEC&quot;s PCI or PC Card interface.  A driver, DLLs,
2670 and application are provided by NEC to control the I.C.E.</PARA>
2671 <PARA>v850ice is a Cygwin based server that runs on the NT system
2672 and provides an interface between the gdb client and the I.C.E.
2673 software. v850-elf-gdb may be run on the Windows NT system or on
2674 a remote system. v850-elf-gdb communicates with the libremote server
2675 using the gdb remote protocol over a TCP/IP socket.  v850ice
2676 communicates with the I.C.E. by calling functions in the NECMSG.DLL provided
2677 by NEC.</PARA>
2678 <SECT3>
2679 <TITLE>INITIAL SETUP</TITLE>
2680 <ORDEREDLIST>
2681 <LISTITEM>
2682 <PARA>Configure the hardware including the I.C.E., SA1 or
2683 SB1 Option Module, and target board.  Install the interface card
2684 in the Windows NT system. Reference NEC&quot;s documentation
2685 for interface installation, jumper settings, etc.</PARA>
2686 </LISTITEM>
2687 <LISTITEM>
2688 <PARA>Install the Windows NT device driver provided by NEC.</PARA>
2689 </LISTITEM>
2690 <LISTITEM>
2691 <PARA>Copy the NEC DLLs, MDI application, and other support
2692 files to a directory on the Windows NT system. The standard location
2693 is C:\NecTools32. This directory will be referred to as
2694 the "libremote server directory" in this document. v850ice.exe must
2695 also be copied to this directory after being built. The required
2696 files are:  cpu.cfg, Nec.cfg, MDI.EXE, NECMSG.DLL, EX85032.DLL,
2697 V850E.DLL, IE850.MON, IE850E.MON, and D3037A.800.</PARA>
2698 </LISTITEM>
2699 <LISTITEM>
2700 <PARA>Make certain the file cpu.cfg contains the line:</PARA>
2701 <PROGRAMLISTING>CpuOption=SA1</PROGRAMLISTING>
2702 <PARA>if using a V850/SA1 module, or:</PARA>
2703 <PROGRAMLISTING>CpuOption=SB1</PROGRAMLISTING>
2704 <PARA>if using a V850/SB1 module.</PARA>
2705 </LISTITEM>
2706 <LISTITEM>
2707 <PARA>Set the environment variable IEPATH to point to the libremote
2708 server</PARA>
2709 <PARA>directory.</PARA>
2710 </LISTITEM>
2711 </ORDEREDLIST>
2712 </SECT3>
2713 <SECT3>
2714 <TITLE>BUILD PROCEDURES</TITLE>
2715 <PARA>A pre-built v850ice.exe executable is supplied in the loaders/v850-ceb_v850 directory
2716 relative to the root of the eCos installation. However the following process
2717 will allow the rebuilding of this executable if required:</PARA>
2718 <PARA>For this example assume the v850ice libremote tree has been
2719 copied to a directory named "server".  The directory structure will
2720 be similar to the following diagram:</PARA>
2721 <PARA><PROGRAMLISTING>                server
2722                    |
2723                  devo
2724                  /  \
2725            config    libremote
2726                       /     \
2727                    lib       v850ice</PROGRAMLISTING></PARA>
2728 <PARA>Build the v850ice source as follows.  Be sure to use the native
2729 Cygwin compiler tools that were supplied alongside eCos.</PARA>
2730 <PARA>cd server
2731 mkdir build
2732 cd build
2733 ../devo/configure --target=v850-elf --host=i686-pc-cygwin
2734 make</PARA>
2735 <PARA>The resultant libremote server image (v850ice.exe) can be
2736 found in build/libremote/v850ice.  Copy v850ice.exe
2737 to the lib remote server directory.</PARA>
2738 </SECT3>
2739 <SECT3>
2740 <TITLE>V850ICE.EXE EXECUTION</TITLE>
2741 <PARA>The v850ice command line syntax is:</PARA>
2742 <PARA>v850ice [-d] [-t addr] [port number]</PARA>
2743 <PARA>The optional -d option enables debug output.  The -t option
2744 is associated with thread debugging - see the "eCos thread debugging"
2745 section below for details. By default v850ice listens on port 2345
2746 for an attach request from a gdb client.  A different port number
2747 may be specified on the command line.</PARA>
2748 <PARA>To run the libremote server:</PARA>
2749 <ORDEREDLIST>
2750 <LISTITEM>
2751 <PARA>Power on the I.C.E. and target board.</PARA>
2752 </LISTITEM>
2753 <LISTITEM>
2754 <PARA>Open a Cygwin window.</PARA>
2755 </LISTITEM>
2756 <LISTITEM>
2757 <PARA>Run v850ice.</PARA>
2758 </LISTITEM>
2759 <LISTITEM>
2760 <PARA>You will see the MDI interface window appear.  In this
2761 window you should see the "Connected to In-Circuit Emulator" message.
2762  In the Cygwin window, the libremote server will indicate it is
2763 ready to accept a gdb client connection with the message "v850ice:
2764  listening on port 2345."</PARA>
2765 </LISTITEM>
2766 </ORDEREDLIST>
2767 </SECT3>
2768 <SECT3>
2769 <TITLE>V850-ELF-GDB EXECUTION</TITLE>
2770 <PARA>Run the v850-elf-gdb client to debug the V850 target.  It
2771 is necessary to issue certain configuration commands to the I.C.E.
2772 software.  These commands may be issued directly in the MDI window
2773 or they may be issued from the gdb client through the "monitor"
2774 command.</PARA>
2775 <PARA>On the Cosmo CEB-V850 board, on-chip Flash is mapped at address
2776 0x0, the on-board EPROM at 0x100000 and the on-board RAM at 0xfc0000.
2777 Since a stand alone V850 will start executing from address 0x0 on
2778 reset, it is normal to load either an application or a bootstrap
2779 loader for Flash at this address. eCos programs may be built to
2780 boot from Flash or the on-board EPROM. If building for the on-board
2781 EPROM, it would be expected that the Flash will contain the default
2782 CEB-V850 flash contents. An ELF format version of the default contents
2783 may be found in the eCos distribution with the name v850flash.img.</PARA>
2784 <PARA>In stand alone operation, normally the code in this flash image
2785 would have been programmed into the V850 on the Cosmo board, and
2786 this would cause it to vector into the on-board EPROM to run the
2787 application located there. In the case of eCos, this application
2788 may be a GDB stub ROM application, allowing the further download
2789 to RAM over serial of actual applications to debug.</PARA>
2790 <PARA>As an example, we shall demonstrate how to use the I.C.E.
2791 to download the v850flash.img and GDB stub EPROM image using I.C.E.
2792 emulator memory only, and not requiring any actual programming of
2793 devices.</PARA>
2794 <PARA>v850-elf-gdb -nw
2795 (gdb) file v850flash.img
2796 (gdb) target remote localhost:2345
2797 (gdb) monitor reset
2798 (gdb) monitor cpu r=256 a=16
2799 (gdb) monitor map r=0x100000-L 0x80000
2800 (gdb) monitor map u=0xfc0000-L 0x40000
2801 (gdb) monitor pinmask k
2802 (gdb) monitor step
2803 (gdb) monitor step
2804 (gdb) monitor step
2805 (gdb) monitor step
2806 (gdb) load
2807 (gdb) detach
2808 (gdb) file gdb_module.img
2809 (gdb) target remote localhost:2345
2810 (gdb) load
2811 (gdb) continue</PARA>
2812 <PARA>NOTE: The four "monitor step" commands are only required the
2813 first time the board is connected to the I.C.E., otherwise the program
2814 will fail.</PARA>
2815 <PARA>This is because of a limitation of the I.C.E. hardware that
2816 means that the first time it is used, the "map" commands are not
2817 acted on and the addresses "0x100000" and "0xfc0000" are not mapped.
2818 This can be observed using the command "td e-20" in the MDI application&quot;s
2819 console to display the trace buffer, which will show that the contents
2820 of address 0x100000 are not valid. Subsequent runs do not require
2821 the "monitor step" commands.</PARA>
2822 <PARA>It is unusual to load two executable images to a target through
2823 gdb.  From the example above notice that this is accomplished by
2824 attaching to the libremote server, loading the flash image, detaching,
2825 reattaching, and loading the ROM/RAM image. It is more
2826 normal to build an executable image that can be executed directly.
2827 In eCos this is achieved by selecting either the ROM or ROMRAM startup
2828 type, and optionally enable building for the internal FLASH. The
2829 I.C.E. emulator memory can emulate both the internal FLASH and the
2830 EPROM, so real hardware programming is not required.</PARA>
2831 <PARA>Upon running this example you will notice that the libremote
2832 server does not exit upon detecting a detach request, but simply
2833 begins listening for the next attach request.  To cause v850ice
2834 to terminate, issue the "monitor quit" or "monitor exit" command
2835 from the gdb client.  v850ice will then terminate with the next
2836 detach request.  (You can also enter control-c in the Cygwin/DOS
2837 window where v850ice is running.)</PARA>
2838 </SECT3>
2839 <SECT3>
2840 <TITLE>MDI INTERFACE VS. GDB INTERFACE</TITLE>
2841 <PARA>If a filename is referenced in an MDI command, whether the
2842 command is entered in the MDI window or issued from the gdb client
2843 with the monitor command, the file must reside on the Windows NT
2844 libremote server system.  When specifying a filename when entering
2845 a command in the MDI window it is obvious that a server local file
2846 is being referenced.  When issuing an MDI command from the gdb client, the
2847 user must remember that the command line is simply passed to the
2848 I.C.E. software on the server system.  The command is executed by
2849 the I.C.E. software as though it were entered locally.</PARA>
2850 <PARA>Executable images may be loaded into the V850 target by entering
2851 the "load" command in the MDI window or with the gdb "load" command.
2852  If the MDI load command is used, the executable image must be located
2853 on the server system and must be in S Record format.  If the gdb
2854 load command is used, the executable image must be located on the
2855 client system and must be in ELF format.</PARA>
2856 <PARA>Be aware that the gdb client is not aware of debugger commands
2857 issued from the MDI window.  It is possible to cause the gdb client
2858 and the I.C.E. software to get out of sync by issuing commands from
2859 both interfaces during the same debugging session.</PARA>
2860 </SECT3>
2861 <SECT3>
2862 <TITLE>eCos THREAD DEBUGGING</TITLE>
2863 <PARA>eCos and the V850 I.C.E. libremote server have been written
2864 to work together to allow debugging of eCos threads. This is an
2865 optional feature, disabled by default because of the overheads trying
2866 to detect a threaded program involves.</PARA>
2867 <PARA>Obviously thread debugging is not possible for programs with
2868 "RAM" startup type, as they are expected to operate underneath a
2869 separate ROM monitor (such as a GDB stub ROM), that itself would
2870 provide its own thread debugging capabilities over the serial line.
2871 Thread debugging is relevant only for programs built for Flash, ROM,
2872 or ROMRAM startup.</PARA>
2873 <PARA>To configure the libremote server to support thread debugging,
2874 use the command:</PARA>
2875 <PARA><PROGRAMLISTING>(gdb) monitor syscallinfo ADDRESS</PROGRAMLISTING></PARA>
2876 <PARA>at the GDB console prompt, where ADDRESS is the address of
2877 the syscall information structure included in the applications.
2878 In eCos this has been designed to be located at a consistent address
2879 for each CPU model (V850/SA1 or V850/SB1). It
2880 may be determined from an eCos executable using the following command
2881 at a cygwin bash prompt:</PARA>
2882 <PARA><PROGRAMLISTING>v850-elf-nm EXECUTABLE | grep hal_v85x_ice_syscall_info</PROGRAMLISTING></PARA>
2883 <PARA>At the current time, this address is 0xfc0400 for a Cosmo
2884 board fitted with a V850/SA1, or 0xfc0540 for a Cosmo board
2885 fitted with a V850/SB1.</PARA>
2886 <PARA>So for example, the GDB command for the SB1 would be:</PARA>
2887 <PARA><PROGRAMLISTING>(gdb) monitor syscallinfo 0xfc0540</PROGRAMLISTING></PARA>
2888 <PARA>Given that the syscallinfo address is fixed over all eCos
2889 executables for a given target, it is possible to define it on the
2890 libremote command line as well using the "-t" option, for example:</PARA>
2891 <PARA><PROGRAMLISTING>bash$ v850ice -t 0xfc0400
2892 v850ice: listening on port 2345</PROGRAMLISTING></PARA>
2893 </SECT3>
2894 </SECT2>
2895 </SECT1>
2896 <SECT1 id="setup-v850-cebsb1">
2897 <TITLE>NEC CEB-V850/SB1 Hardware Setup</TITLE>
2898 <PARA>The instructions for setting up the CEB-V850/SB1
2899 are virtually identical to those of the CEB-V850/SA1 above.
2900 The only significant differences are that pre-built loaders are available
2901 at loaders/v850-ceb_v850/v850sb1 within
2902 the eCos installation. Binaries supporting boards with both 16MHz
2903 and 8MHz clock speeds are supplied. Also when building applications,
2904 or rebuilding the stubs for a V850/SB1 target, then the
2905 V850 CPU variant must be changed in the CEB-V850 HAL to the SB1.</PARA>
2906 </SECT1>
2907 <SECT1 id="setup-i386-pc">
2908 <TITLE>i386 PC Hardware Setup</TITLE>
2909 <para>
2910 eCos application on the PC can be run in three ways: via RedBoot,
2911 loaded directly from a floppy disk, or loaded by the GRUB bootloader.
2912 </para>
2913 <sect2>
2914 <title>RedBoot Support</title>
2915 <PARA>For information about setting up the PC to run with RedBoot,
2916 consult the RedBoot User&quot;s Guide. If using serial debugging,
2917 the serial line runs at 38400 baud 8-N-1 and should be connected
2918 to the debug host using a null modem cable. If ethernet debugging
2919 is required, an i82559 compatible network interface card, such as
2920 an Intel EtherExpress Pro 10/100,  should be installed
2921 on the target PC and connected to the development PC running GDB.
2922 When RedBoot is configured appropriately to have an IP address set,
2923 then GDB will be able to debug directly over TCP/IP to the
2924 target PC.</PARA>
2925 </sect2>
2926 <sect2>
2927 <title>Floppy Disk Support</title>
2928 <para>
2929 If an application is built with a startup type of FLOPPY, then it is
2930 configured to be a self-booting image that must be written onto a
2931 formatted floppy disk. This will erase any existing file system or
2932 data that is already on the disk, so proceed
2933 with caution.
2934 </para>
2935 <para>
2936 To write an application to floppy disk, it must first be converted to
2937 a pure binary format. This is done with the following command:
2938 </para>
2939 <screen width=72>
2940 $ <userinput>i386-elf-objcopy -O binary app.elf app.bin</userinput>
2941 </screen>
2942 <para>
2943 Here <filename>app.elf</filename> is the final linked application
2944 executable, in ELF format (it may not have a <filename>.elf</filename>
2945 extension). The file <filename>app.bin</filename> is the resulting
2946 pure binary file. This must be written to the floppy disk with the
2947 following command:
2948 <screen width=72>
2949 $ <userinput>dd conv=sync if=app.bin of=/dev/fd0</userinput>
2950 </screen>
2951 </para>
2952 <para>For NT Cygwin users, this can be done by first ensuring that the raw
2953 floppy device is mounted as <filename>/dev/fd0</filename>. To check if this
2954 is the case, type the command <command>mount</command> at the Cygwin bash
2955 prompt. If the floppy drive is already mounted, it will be listed as something
2956 similar to the following line:</para>
2957 <screen>  \\.\a: /dev/fd0 user binmode</screen>
2958 <para>If this line is not listed, then mount the floppy drive using the command:
2959 </para>
2960 <screen>$ <userinput>mount -f -b //./a: /dev/fd0</userinput></screen>
2961 <para>To actually install the boot image on the floppy, use the command:</para>
2962 <screen>
2963 $ <userinput>dd conv=sync if=app.bin of=/dev/fd0</userinput>
2964 </screen>
2965 <para>Insert this floppy in the A: drive of the PC to be used as a target
2966 and ensure that the BIOS is configured to boot from A: by default. On reset,
2967 the PC will boot from the floppy and the eCos application will load
2968 itself and execute immediately.</para>
2969 <note><title>NOTE</title>
2970 <para>Unreliable floppy media may cause the write to silently fail. This
2971 can be determined if the RedBoot image does not correctly
2972 boot. In such cases, the floppy should be (unconditionally) reformatted
2973 using the <command>fdformat</command> command on Linux, or
2974 <command>format a: /u</command> on DOS/Windows. If this fails, try a
2975 different disk.</para>
2976 </note>
2977 </sect2>
2978 <sect2>
2979 <title>GRUB Bootloader Support</title>
2980 <para>
2981 If an application is built with the GRUB startup type, it is
2982 configured to be loaded by the GRUB bootloader.
2983 </para>
2984 <para>
2985 GRUB is an open source boot loader that supports many different
2986 operating systems. It is available from
2987 <ulink
2988 url="http://www.gnu.org/software/grub">http://www.gnu.org/software/grub</ulink>.
2989 The latest version of GRUB should be downloaded from there and installed.
2990 In Red Hat Linux version 7.2 and later it is the default bootloader
2991 for Linux and therefore is already installed.
2992 </para>
2993 <para>
2994 To install GRUB on a floppy disk from Linux you need to execute the
2995 following commands:
2996 </para>
2997 <screen>
2998 $ <userinput>mformat a:</userinput>
2999 $ <userinput>mount /mnt/floppy</userinput>
3000 $ <userinput>grub-install --root-directory=/mnt/floppy '(fd0)'</userinput>
3001 Probing devices to guess BIOS drives. This may take a long time.
3002 Installation finished. No error reported.
3003 This is the contents of the device map /mnt/floppy/boot/grub/device.map.
3004 Check if this is correct or not. If any of the lines is incorrect,
3005 fix it and re-run the script `grub-install'.
3006
3007 (fd0)   /dev/fd0
3008 $ <userinput>cp $ECOS_REPOSITORY/packages/hal/i386/pc/current/misc/menu.lst /mnt/floppy/boot/grub</userinput>
3009 $ <userinput>umount /mnt/floppy</userinput>
3010 </screen>
3011 <para>
3012 The file <filename>menu.lst</filename> is an example GRUB menu
3013 configuration file. It contains menu items to load some of the
3014 standard eCos tests from floppy or from partition zero of the first
3015 hard disk. You should, of course, customize this file to load your own
3016 application. Alternatively you can use the command-line interface of
3017 GRUB to input commands yourself.
3018 </para>
3019 <para>
3020 Applications can be installed, or updated simply by copying them to
3021 the floppy disk at the location expected by the
3022 <filename>menu.lst</filename> file. For booting from floppy disks it
3023 is recommended that the executable be stripped of all debug and symbol
3024 table information before copying. This reduces the size of the file
3025 and can make booting faster.
3026 </para>
3027 <para>
3028 To install GRUB on a hard disk, refer to the GRUB documentation. Be
3029 warned, however, that if you get this wrong it may compromise any
3030 existing bootloader that exists on the hard disk and may make any
3031 other operating systems unbootable. Practice on floppy disks or
3032 sacrificial hard disks first. On machines running Red Hat Linux
3033 version 7.2 and later, you can just add your own menu items to the
3034 <filename>/boot/grub/menu.lst</filename> file that already exists.
3035 </para>
3036 </sect2>
3037 <sect2>
3038 <title>Debugging FLOPPY and GRUB Applications</title>
3039 <para>
3040 When RedBoot loads an application it also provides debugging services
3041 in the form of GDB remote protocol stubs. When an application is
3042 loaded stand-alone from a floppy disk, or by GRUB, these services are
3043 not present. To allow these application to be debugged, it is possible
3044 to include GDB stubs into the application.
3045 </para>
3046 <para>
3047 To do this, set the &quot;Support for GDB stubs&quot;
3048 (<literal>CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS</literal>) configuration
3049 option. Following this any application built will allow GDB to connect
3050 to the debug serial port (by default serial device 0, also known as
3051 COM1) whenever the application takes an exception, or if a Control-C
3052 is typed to the debug port. Ethernet debugging is not supported.
3053 </para>
3054 <para>
3055 The option &quot;Enable initial breakpoint&quot;
3056 (<literal>CYGDBG_HAL_DEBUG_GDB_INITIAL_BREAK</literal>) causes the HAL
3057 to take a breakpoint immediately before calling cyg_start(). This
3058 gives the developer a chance to set any breakpoints or inspect the
3059 system state before it proceeds. The configuration sets this option by
3060 default if GDB stubs are included, and this is not a RedBoot build. To
3061 make the application execute immediately either disable this option,
3062 or disable <literal>CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS</literal>.
3063 </para>
3064 </sect2>
3065 </SECT1>
3066 <SECT1 id="setup-synth-i386linux">
3067 <TITLE><!-- <conditionaltext> --><!-- <index></index> -->i386/Linux Synthetic Target Setup</TITLE>
3068 <PARA>When building for the synthetic Linux target, the resulting
3069 binaries are native Linux applications with the HAL providing suitable
3070 bindings between the eCos kernel and the Linux kernel.</PARA>
3071 <NOTE>
3072 <PARA>Please be aware that the current implementation of the Linux
3073 synthetic target does not allow thread-aware debugging.</PARA>
3074 </NOTE>
3075 <PARA>These Linux applications cannot be run on a Windows system.
3076 However, it is possible to write a similar HAL emulation for the
3077 Windows kernel if such a testing target is desired.</PARA>
3078 <SECT2>
3079 <TITLE>Tools</TITLE>
3080
3081 <PARA>For the synthetic target, eCos relies on features not available
3082 in native compilers earlier than gcc-2.95.1. It also requires version
3083 2.9.5 or later of the GNU linker. If you have gcc-2.95.1 or later
3084 and ld version 2.9.5 or later, then you do not need to build new
3085 tools. eCos does not support earlier versions. You can check the compiler
3086 version using <COMMAND>gcc -v</COMMAND> 
3087 and the linker version using <COMMAND>ld
3088 -v</COMMAND>.</PARA>
3089
3090 <PARA>If you have native tools that are sufficiently recent for
3091 use with eCos, you should be aware that by default eCos assumes
3092 that the tools <COMMAND>i686-pc-linux-gnu-gcc</COMMAND>, <COMMAND>i686-pc-linux-gnu-ar</COMMAND>,
3093  <COMMAND>i686-pc-linux-gnu-ld</COMMAND>, and <COMMAND>i686-pc-linux-gnu-objcopy</COMMAND> are
3094 on your system and are the correct versions for use with eCos. But
3095 instead, you can tell eCos to use your native tools by editing the
3096 configuration value "Global command prefix" (CYGBLD_GLOBAL_COMMAND_PREFIX)
3097 in your eCos configuration. If left empty (i.e. set to the empty
3098 string) eCos will use your native tools when building.</PARA>
3099 <PARA>If you have any difficulties, it is almost certainly easiest
3100 overall to rebuild the tools as described on: <ULINK URL="http://ecos.sourceware.org/getstart.html">http://ecos.sourceware.org/getstart.html</ULINK></PARA>
3101 </SECT2>
3102 </SECT1>
3103
3104
3105 </appendix>