<!-- Copyright (C) 2003 Red Hat, Inc. -->
|
<!-- Copyright (C) 2003 Red Hat, Inc. -->
|
<!-- This material may be distributed only subject to the terms -->
|
<!-- This material may be distributed only subject to the terms -->
|
<!-- and conditions set forth in the Open Publication License, v1.0 -->
|
<!-- and conditions set forth in the Open Publication License, v1.0 -->
|
<!-- or later (the latest version is presently available at -->
|
<!-- or later (the latest version is presently available at -->
|
<!-- http://www.opencontent.org/openpub/). -->
|
<!-- http://www.opencontent.org/openpub/). -->
|
<!-- Distribution of the work or derivative of the work in any -->
|
<!-- Distribution of the work or derivative of the work in any -->
|
<!-- standard (paper) book form is prohibited unless prior -->
|
<!-- standard (paper) book form is prohibited unless prior -->
|
<!-- permission is obtained from the copyright holder. -->
|
<!-- permission is obtained from the copyright holder. -->
|
<HTML
|
<HTML
|
><HEAD
|
><HEAD
|
><TITLE
|
><TITLE
|
>Using the command line</TITLE
|
>Using the command line</TITLE
|
><meta name="MSSmartTagsPreventParsing" content="TRUE">
|
><meta name="MSSmartTagsPreventParsing" content="TRUE">
|
<META
|
<META
|
NAME="GENERATOR"
|
NAME="GENERATOR"
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
|
"><LINK
|
"><LINK
|
REL="HOME"
|
REL="HOME"
|
TITLE="eCos User Guide"
|
TITLE="eCos User Guide"
|
HREF="ecos-user-guide.html"><LINK
|
HREF="ecos-user-guide.html"><LINK
|
REL="UP"
|
REL="UP"
|
TITLE="Running an eCos Test Case"
|
TITLE="Running an eCos Test Case"
|
HREF="running-an-ecos-test-case.html"><LINK
|
HREF="running-an-ecos-test-case.html"><LINK
|
REL="PREVIOUS"
|
REL="PREVIOUS"
|
TITLE="Running an eCos Test Case"
|
TITLE="Running an eCos Test Case"
|
HREF="running-an-ecos-test-case.html"><LINK
|
HREF="running-an-ecos-test-case.html"><LINK
|
REL="NEXT"
|
REL="NEXT"
|
TITLE="Testing Filters"
|
TITLE="Testing Filters"
|
HREF="testing-filters.html"></HEAD
|
HREF="testing-filters.html"></HEAD
|
><BODY
|
><BODY
|
CLASS="SECT1"
|
CLASS="SECT1"
|
BGCOLOR="#FFFFFF"
|
BGCOLOR="#FFFFFF"
|
TEXT="#000000"
|
TEXT="#000000"
|
LINK="#0000FF"
|
LINK="#0000FF"
|
VLINK="#840084"
|
VLINK="#840084"
|
ALINK="#0000FF"
|
ALINK="#0000FF"
|
><DIV
|
><DIV
|
CLASS="NAVHEADER"
|
CLASS="NAVHEADER"
|
><TABLE
|
><TABLE
|
SUMMARY="Header navigation table"
|
SUMMARY="Header navigation table"
|
WIDTH="100%"
|
WIDTH="100%"
|
BORDER="0"
|
BORDER="0"
|
CELLPADDING="0"
|
CELLPADDING="0"
|
CELLSPACING="0"
|
CELLSPACING="0"
|
><TR
|
><TR
|
><TH
|
><TH
|
COLSPAN="3"
|
COLSPAN="3"
|
ALIGN="center"
|
ALIGN="center"
|
>eCos User Guide</TH
|
>eCos User Guide</TH
|
></TR
|
></TR
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="10%"
|
WIDTH="10%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
><A
|
><A
|
HREF="running-an-ecos-test-case.html"
|
HREF="running-an-ecos-test-case.html"
|
ACCESSKEY="P"
|
ACCESSKEY="P"
|
>Prev</A
|
>Prev</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="80%"
|
WIDTH="80%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
>Chapter 12. Running an <SPAN
|
>Chapter 12. Running an <SPAN
|
CLASS="PRODUCTNAME"
|
CLASS="PRODUCTNAME"
|
>eCos</SPAN
|
>eCos</SPAN
|
> Test Case</TD
|
> Test Case</TD
|
><TD
|
><TD
|
WIDTH="10%"
|
WIDTH="10%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
><A
|
><A
|
HREF="testing-filters.html"
|
HREF="testing-filters.html"
|
ACCESSKEY="N"
|
ACCESSKEY="N"
|
>Next</A
|
>Next</A
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><HR
|
><HR
|
ALIGN="LEFT"
|
ALIGN="LEFT"
|
WIDTH="100%"></DIV
|
WIDTH="100%"></DIV
|
><DIV
|
><DIV
|
CLASS="SECT1"
|
CLASS="SECT1"
|
><H1
|
><H1
|
CLASS="SECT1"
|
CLASS="SECT1"
|
><A
|
><A
|
NAME="USING-COMMANDLINE-TESTCASE">Using the command line</H1
|
NAME="USING-COMMANDLINE-TESTCASE">Using the command line</H1
|
><P
|
><P
|
>Start a command shell (such as a Cygwin shell window in Windows)
|
>Start a command shell (such as a Cygwin shell window in Windows)
|
with the environment variables set as described in the toolchain
|
with the environment variables set as described in the toolchain
|
documentation. Change to the directory in which you set up your build
|
documentation. Change to the directory in which you set up your build
|
tree, and invoke GDB on the test
|
tree, and invoke GDB on the test
|
program.</P
|
program.</P
|
><P
|
><P
|
>To run the bin_sem0 test (which will
|
>To run the bin_sem0 test (which will
|
test the kernel for the correct creation and destruction of binary
|
test the kernel for the correct creation and destruction of binary
|
semaphores) type: </P
|
semaphores) type: </P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>$ <TT
|
>$ <TT
|
CLASS="REPLACEABLE"
|
CLASS="REPLACEABLE"
|
><I
|
><I
|
>TARGET-</I
|
>TARGET-</I
|
></TT
|
></TT
|
>gdb -nw install/tests/kernel/<TT
|
>gdb -nw install/tests/kernel/<TT
|
CLASS="REPLACEABLE"
|
CLASS="REPLACEABLE"
|
><I
|
><I
|
><version></I
|
><version></I
|
></TT
|
></TT
|
>/tests/bin_sem0</PRE
|
>/tests/bin_sem0</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>You should see output similar to the following in the command
|
>You should see output similar to the following in the command
|
window:</P
|
window:</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>GNU gdb THIS-GDB-VERSION
|
>GNU gdb THIS-GDB-VERSION
|
Copyright 2001 Free Software Foundation, Inc.
|
Copyright 2001 Free Software Foundation, Inc.
|
GDB is free software, covered by the GNU General Public License, and you are
|
GDB is free software, covered by the GNU General Public License, and you are
|
welcome to change it and/or distribute copies of it under certain conditions.
|
welcome to change it and/or distribute copies of it under certain conditions.
|
Type "show copying" to see the conditions.
|
Type "show copying" to see the conditions.
|
There is absolutely no warranty for GDB. Type "show warranty" for details.
|
There is absolutely no warranty for GDB. Type "show warranty" for details.
|
This GDB was configured as "--host=THIS-HOST --target=THIS-TARGET".
|
This GDB was configured as "--host=THIS-HOST --target=THIS-TARGET".
|
(gdb)</PRE
|
(gdb)</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>If you are trying to run a synthetic target test on Linux, skip the following connection and download
|
>If you are trying to run a synthetic target test on Linux, skip the following connection and download
|
steps. Otherwise, connect to the target by typing: </P
|
steps. Otherwise, connect to the target by typing: </P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>(gdb) set remotebaud 38400
|
>(gdb) set remotebaud 38400
|
(gdb) target remote /dev/ttyS0</PRE
|
(gdb) target remote /dev/ttyS0</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>on Linux or</P
|
>on Linux or</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>(gdb) set remotebaud 38400
|
>(gdb) set remotebaud 38400
|
(gdb) target remote com1</PRE
|
(gdb) target remote com1</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>on Windows or</P
|
>on Windows or</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>(gdb) target sim</PRE
|
>(gdb) target sim</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>to use a simulator in either host O/S.</P
|
>to use a simulator in either host O/S.</P
|
><P
|
><P
|
>Check the documentation for the target board for the actual baud rate
|
>Check the documentation for the target board for the actual baud rate
|
to use when connecting to real targets.</P
|
to use when connecting to real targets.</P
|
><P
|
><P
|
>You will see output similar to the following: </P
|
>You will see output similar to the following: </P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>Remote debugging using /dev/ttyS1
|
>Remote debugging using /dev/ttyS1
|
0x0000d50c in ?? ()
|
0x0000d50c in ?? ()
|
at <TT
|
at <TT
|
CLASS="REPLACEABLE"
|
CLASS="REPLACEABLE"
|
><I
|
><I
|
>BASE_DIR</I
|
>BASE_DIR</I
|
></TT
|
></TT
|
>/kernel/<TT
|
>/kernel/<TT
|
CLASS="REPLACEABLE"
|
CLASS="REPLACEABLE"
|
><I
|
><I
|
><version></I
|
><version></I
|
></TT
|
></TT
|
>/src/common/kapi.cxx:345
|
>/src/common/kapi.cxx:345
|
|
|
Current language: auto; currently c++
|
Current language: auto; currently c++
|
(gdb) </PRE
|
(gdb) </PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>Or if you are using the simulator:</P
|
>Or if you are using the simulator:</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>Connected to the simulator.
|
>Connected to the simulator.
|
(gdb)</PRE
|
(gdb)</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>Now download the program to the target with</P
|
>Now download the program to the target with</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>(gdb) load</PRE
|
>(gdb) load</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>You should see output similar to the following on your screen: </P
|
>You should see output similar to the following on your screen: </P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>Loading section .text, size 0x4b04 lma 0x108000
|
>Loading section .text, size 0x4b04 lma 0x108000
|
Loading section .rodata, size 0x738 lma 0x10cb08
|
Loading section .rodata, size 0x738 lma 0x10cb08
|
Loading section .data, size 0x1c0 lma 0x10d240
|
Loading section .data, size 0x1c0 lma 0x10d240
|
Start address 0x108000, load size 21500
|
Start address 0x108000, load size 21500
|
Transfer rate: 24571 bits/sec, 311 bytes/write.
|
Transfer rate: 24571 bits/sec, 311 bytes/write.
|
(gdb)</PRE
|
(gdb)</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>You are now ready to run your program. If you type: </P
|
>You are now ready to run your program. If you type: </P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>(gdb) continue</PRE
|
>(gdb) continue</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>you will see output similar to the following: </P
|
>you will see output similar to the following: </P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>Continuing.
|
>Continuing.
|
PASS:<Binary Semaphore 0 OK>
|
PASS:<Binary Semaphore 0 OK>
|
EXIT:<done></PRE
|
EXIT:<done></PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><DIV
|
><DIV
|
CLASS="NOTE"
|
CLASS="NOTE"
|
><BLOCKQUOTE
|
><BLOCKQUOTE
|
CLASS="NOTE"
|
CLASS="NOTE"
|
><P
|
><P
|
><B
|
><B
|
>Note: </B
|
>Note: </B
|
> If you are using a simulator or the synthetic target rather
|
> If you are using a simulator or the synthetic target rather
|
than real hardware, you must use the GDB command
|
than real hardware, you must use the GDB command
|
“run” rather than “continue” to
|
“run” rather than “continue” to
|
start your program.</P
|
start your program.</P
|
></BLOCKQUOTE
|
></BLOCKQUOTE
|
></DIV
|
></DIV
|
><P
|
><P
|
>You can terminate your GDB session with
|
>You can terminate your GDB session with
|
<SPAN
|
<SPAN
|
CLASS="emphasis"
|
CLASS="emphasis"
|
><I
|
><I
|
CLASS="EMPHASIS"
|
CLASS="EMPHASIS"
|
>Control+C</I
|
>Control+C</I
|
></SPAN
|
></SPAN
|
>, otherwise it will sit in the
|
>, otherwise it will sit in the
|
“idle” thread and use up CPU time. This is not a problem
|
“idle” thread and use up CPU time. This is not a problem
|
with real targets, but may have undesirable effects in simulated or
|
with real targets, but may have undesirable effects in simulated or
|
synthetic targets. Type <B
|
synthetic targets. Type <B
|
CLASS="COMMAND"
|
CLASS="COMMAND"
|
>quit</B
|
>quit</B
|
> and you are
|
> and you are
|
done. </P
|
done. </P
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="NAVFOOTER"
|
CLASS="NAVFOOTER"
|
><HR
|
><HR
|
ALIGN="LEFT"
|
ALIGN="LEFT"
|
WIDTH="100%"><TABLE
|
WIDTH="100%"><TABLE
|
SUMMARY="Footer navigation table"
|
SUMMARY="Footer navigation table"
|
WIDTH="100%"
|
WIDTH="100%"
|
BORDER="0"
|
BORDER="0"
|
CELLPADDING="0"
|
CELLPADDING="0"
|
CELLSPACING="0"
|
CELLSPACING="0"
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="running-an-ecos-test-case.html"
|
HREF="running-an-ecos-test-case.html"
|
ACCESSKEY="P"
|
ACCESSKEY="P"
|
>Prev</A
|
>Prev</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="34%"
|
WIDTH="34%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="ecos-user-guide.html"
|
HREF="ecos-user-guide.html"
|
ACCESSKEY="H"
|
ACCESSKEY="H"
|
>Home</A
|
>Home</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="testing-filters.html"
|
HREF="testing-filters.html"
|
ACCESSKEY="N"
|
ACCESSKEY="N"
|
>Next</A
|
>Next</A
|
></TD
|
></TD
|
></TR
|
></TR
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="top"
|
VALIGN="top"
|
>Running an <SPAN
|
>Running an <SPAN
|
CLASS="PRODUCTNAME"
|
CLASS="PRODUCTNAME"
|
>eCos</SPAN
|
>eCos</SPAN
|
> Test Case</TD
|
> Test Case</TD
|
><TD
|
><TD
|
WIDTH="34%"
|
WIDTH="34%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="running-an-ecos-test-case.html"
|
HREF="running-an-ecos-test-case.html"
|
ACCESSKEY="U"
|
ACCESSKEY="U"
|
>Up</A
|
>Up</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="top"
|
VALIGN="top"
|
>Testing Filters</TD
|
>Testing Filters</TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></DIV
|
></DIV
|
></BODY
|
></BODY
|
></HTML
|
></HTML
|
|
|