]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - doc/html/user-guide/using-commandline-testcase.html
Initial revision
[karo-tx-redboot.git] / doc / html / user-guide / using-commandline-testcase.html
1 <!-- Copyright (C) 2003 Red Hat, Inc.                                -->
2 <!-- This material may be distributed only subject to the terms      -->
3 <!-- and conditions set forth in the Open Publication License, v1.0  -->
4 <!-- or later (the latest version is presently available at          -->
5 <!-- http://www.opencontent.org/openpub/).                           -->
6 <!-- Distribution of the work or derivative of the work in any       -->
7 <!-- standard (paper) book form is prohibited unless prior           -->
8 <!-- permission is obtained from the copyright holder.               -->
9 <HTML
10 ><HEAD
11 ><TITLE
12 >Using the command line</TITLE
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
14 <META
15 NAME="GENERATOR"
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
17 "><LINK
18 REL="HOME"
19 TITLE="eCos User Guide"
20 HREF="ecos-user-guide.html"><LINK
21 REL="UP"
22 TITLE="Running an eCos Test Case"
23 HREF="running-an-ecos-test-case.html"><LINK
24 REL="PREVIOUS"
25 TITLE="Running an eCos Test Case"
26 HREF="running-an-ecos-test-case.html"><LINK
27 REL="NEXT"
28 TITLE="Testing Filters"
29 HREF="testing-filters.html"></HEAD
30 ><BODY
31 CLASS="SECT1"
32 BGCOLOR="#FFFFFF"
33 TEXT="#000000"
34 LINK="#0000FF"
35 VLINK="#840084"
36 ALINK="#0000FF"
37 ><DIV
38 CLASS="NAVHEADER"
39 ><TABLE
40 SUMMARY="Header navigation table"
41 WIDTH="100%"
42 BORDER="0"
43 CELLPADDING="0"
44 CELLSPACING="0"
45 ><TR
46 ><TH
47 COLSPAN="3"
48 ALIGN="center"
49 >eCos User Guide</TH
50 ></TR
51 ><TR
52 ><TD
53 WIDTH="10%"
54 ALIGN="left"
55 VALIGN="bottom"
56 ><A
57 HREF="running-an-ecos-test-case.html"
58 ACCESSKEY="P"
59 >Prev</A
60 ></TD
61 ><TD
62 WIDTH="80%"
63 ALIGN="center"
64 VALIGN="bottom"
65 >Chapter 12. Running an <SPAN
66 CLASS="PRODUCTNAME"
67 >eCos</SPAN
68 > Test Case</TD
69 ><TD
70 WIDTH="10%"
71 ALIGN="right"
72 VALIGN="bottom"
73 ><A
74 HREF="testing-filters.html"
75 ACCESSKEY="N"
76 >Next</A
77 ></TD
78 ></TR
79 ></TABLE
80 ><HR
81 ALIGN="LEFT"
82 WIDTH="100%"></DIV
83 ><DIV
84 CLASS="SECT1"
85 ><H1
86 CLASS="SECT1"
87 ><A
88 NAME="USING-COMMANDLINE-TESTCASE">Using the command line</H1
89 ><P
90 >Start a command shell (such as a Cygwin shell window in Windows)
91 with the environment variables set as described in the toolchain
92 documentation.  Change to the directory in which you set up your build
93 tree, and invoke  GDB on the test
94 program.</P
95 ><P
96 >To run the bin_sem0 test (which will
97 test the kernel for the correct creation and destruction of binary
98 semaphores) type: </P
99 ><TABLE
100 BORDER="5"
101 BGCOLOR="#E0E0F0"
102 WIDTH="70%"
103 ><TR
104 ><TD
105 ><PRE
106 CLASS="PROGRAMLISTING"
107 >$ <TT
108 CLASS="REPLACEABLE"
109 ><I
110 >TARGET-</I
111 ></TT
112 >gdb -nw install/tests/kernel/<TT
113 CLASS="REPLACEABLE"
114 ><I
115 >&#60;version&#62;</I
116 ></TT
117 >/tests/bin_sem0</PRE
118 ></TD
119 ></TR
120 ></TABLE
121 ><P
122 >You should see output similar to the following in the command
123 window:</P
124 ><TABLE
125 BORDER="5"
126 BGCOLOR="#E0E0F0"
127 WIDTH="70%"
128 ><TR
129 ><TD
130 ><PRE
131 CLASS="PROGRAMLISTING"
132 >GNU gdb THIS-GDB-VERSION
133 Copyright 2001 Free Software Foundation, Inc.
134 GDB is free software, covered by the GNU General Public License, and you are
135 welcome to change it and/or distribute copies of it under certain conditions.
136 Type "show copying" to see the conditions.
137 There is absolutely no warranty for GDB.  Type "show warranty" for details.
138 This GDB was configured as "--host=THIS-HOST --target=THIS-TARGET".
139 (gdb)</PRE
140 ></TD
141 ></TR
142 ></TABLE
143 ><P
144 >If you are trying to run a synthetic target test on Linux, skip the following connection and download
145 steps. Otherwise, connect to the target by typing: </P
146 ><TABLE
147 BORDER="5"
148 BGCOLOR="#E0E0F0"
149 WIDTH="70%"
150 ><TR
151 ><TD
152 ><PRE
153 CLASS="PROGRAMLISTING"
154 >(gdb) set remotebaud 38400
155 (gdb) target remote /dev/ttyS0</PRE
156 ></TD
157 ></TR
158 ></TABLE
159 ><P
160 >on Linux or</P
161 ><TABLE
162 BORDER="5"
163 BGCOLOR="#E0E0F0"
164 WIDTH="70%"
165 ><TR
166 ><TD
167 ><PRE
168 CLASS="PROGRAMLISTING"
169 >(gdb) set remotebaud 38400
170 (gdb) target remote com1</PRE
171 ></TD
172 ></TR
173 ></TABLE
174 ><P
175 >on Windows or</P
176 ><TABLE
177 BORDER="5"
178 BGCOLOR="#E0E0F0"
179 WIDTH="70%"
180 ><TR
181 ><TD
182 ><PRE
183 CLASS="PROGRAMLISTING"
184 >(gdb) target sim</PRE
185 ></TD
186 ></TR
187 ></TABLE
188 ><P
189 >to use a simulator in either host O/S.</P
190 ><P
191 >Check the documentation for the target board for the actual baud rate
192 to use when connecting to real targets.</P
193 ><P
194 >You will see output similar to the following: </P
195 ><TABLE
196 BORDER="5"
197 BGCOLOR="#E0E0F0"
198 WIDTH="70%"
199 ><TR
200 ><TD
201 ><PRE
202 CLASS="PROGRAMLISTING"
203 >Remote debugging using /dev/ttyS1
204 0x0000d50c in ?? ()
205     at <TT
206 CLASS="REPLACEABLE"
207 ><I
208 >BASE_DIR</I
209 ></TT
210 >/kernel/<TT
211 CLASS="REPLACEABLE"
212 ><I
213 >&#60;version&#62;</I
214 ></TT
215 >/src/common/kapi.cxx:345
216
217 Current language:  auto; currently c++
218 (gdb) </PRE
219 ></TD
220 ></TR
221 ></TABLE
222 ><P
223 >Or if you are using the simulator:</P
224 ><TABLE
225 BORDER="5"
226 BGCOLOR="#E0E0F0"
227 WIDTH="70%"
228 ><TR
229 ><TD
230 ><PRE
231 CLASS="PROGRAMLISTING"
232 >Connected to the simulator.
233 (gdb)</PRE
234 ></TD
235 ></TR
236 ></TABLE
237 ><P
238 >Now download the program to the target with</P
239 ><TABLE
240 BORDER="5"
241 BGCOLOR="#E0E0F0"
242 WIDTH="70%"
243 ><TR
244 ><TD
245 ><PRE
246 CLASS="PROGRAMLISTING"
247 >(gdb) load</PRE
248 ></TD
249 ></TR
250 ></TABLE
251 ><P
252 >You should see output similar to the following on your screen: </P
253 ><TABLE
254 BORDER="5"
255 BGCOLOR="#E0E0F0"
256 WIDTH="70%"
257 ><TR
258 ><TD
259 ><PRE
260 CLASS="PROGRAMLISTING"
261 >Loading section .text, size 0x4b04 lma 0x108000
262 Loading section .rodata, size 0x738 lma 0x10cb08
263 Loading section .data, size 0x1c0 lma 0x10d240
264 Start address 0x108000, load size 21500
265 Transfer rate: 24571 bits/sec, 311 bytes/write.
266 (gdb)</PRE
267 ></TD
268 ></TR
269 ></TABLE
270 ><P
271 >You are now ready to run your program. If you type: </P
272 ><TABLE
273 BORDER="5"
274 BGCOLOR="#E0E0F0"
275 WIDTH="70%"
276 ><TR
277 ><TD
278 ><PRE
279 CLASS="PROGRAMLISTING"
280 >(gdb) continue</PRE
281 ></TD
282 ></TR
283 ></TABLE
284 ><P
285 >you will see output similar to the following: </P
286 ><TABLE
287 BORDER="5"
288 BGCOLOR="#E0E0F0"
289 WIDTH="70%"
290 ><TR
291 ><TD
292 ><PRE
293 CLASS="PROGRAMLISTING"
294 >Continuing.
295 PASS:&lt;Binary Semaphore 0 OK&gt;
296 EXIT:&lt;done&gt;</PRE
297 ></TD
298 ></TR
299 ></TABLE
300 ><DIV
301 CLASS="NOTE"
302 ><BLOCKQUOTE
303 CLASS="NOTE"
304 ><P
305 ><B
306 >Note: </B
307 > If you are using a simulator or the synthetic target rather
308             than real hardware, you must use the GDB command
309             &#8220;run&#8221; rather than &#8220;continue&#8221; to
310             start your program.</P
311 ></BLOCKQUOTE
312 ></DIV
313 ><P
314 >You can terminate your GDB session with
315 <SPAN
316 CLASS="emphasis"
317 ><I
318 CLASS="EMPHASIS"
319 >Control+C</I
320 ></SPAN
321 >, otherwise it will sit in the
322 &#8220;idle&#8221; thread and use up CPU time. This is not a problem
323 with real targets, but may have undesirable effects in simulated or
324 synthetic targets. Type <B
325 CLASS="COMMAND"
326 >quit</B
327 > and you are
328 done. </P
329 ></DIV
330 ><DIV
331 CLASS="NAVFOOTER"
332 ><HR
333 ALIGN="LEFT"
334 WIDTH="100%"><TABLE
335 SUMMARY="Footer navigation table"
336 WIDTH="100%"
337 BORDER="0"
338 CELLPADDING="0"
339 CELLSPACING="0"
340 ><TR
341 ><TD
342 WIDTH="33%"
343 ALIGN="left"
344 VALIGN="top"
345 ><A
346 HREF="running-an-ecos-test-case.html"
347 ACCESSKEY="P"
348 >Prev</A
349 ></TD
350 ><TD
351 WIDTH="34%"
352 ALIGN="center"
353 VALIGN="top"
354 ><A
355 HREF="ecos-user-guide.html"
356 ACCESSKEY="H"
357 >Home</A
358 ></TD
359 ><TD
360 WIDTH="33%"
361 ALIGN="right"
362 VALIGN="top"
363 ><A
364 HREF="testing-filters.html"
365 ACCESSKEY="N"
366 >Next</A
367 ></TD
368 ></TR
369 ><TR
370 ><TD
371 WIDTH="33%"
372 ALIGN="left"
373 VALIGN="top"
374 >Running an <SPAN
375 CLASS="PRODUCTNAME"
376 >eCos</SPAN
377 > Test Case</TD
378 ><TD
379 WIDTH="34%"
380 ALIGN="center"
381 VALIGN="top"
382 ><A
383 HREF="running-an-ecos-test-case.html"
384 ACCESSKEY="U"
385 >Up</A
386 ></TD
387 ><TD
388 WIDTH="33%"
389 ALIGN="right"
390 VALIGN="top"
391 >Testing Filters</TD
392 ></TR
393 ></TABLE
394 ></DIV
395 ></BODY
396 ></HTML
397 >