<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hello Aitor, thank you very much for your help. We used what you gave
us, and it finally worked.<br>
We are measuring the coverage using the TSIM and using the real
hardware.<br>
<br>
Best regards, <br>
Mariana<br>
<br>
<br>
El 02/09/2010 11:56 a.m., <a class="moz-txt-link-abbreviated" href="mailto:Aitor.Viana.Sanchez@esa.int">Aitor.Viana.Sanchez@esa.int</a> escribió:
<blockquote
cite="mid:OF51053070.8472DEA9-ONC1257792.005001B1-C1257792.0052139D@esa.int"
type="cite"><font face="sans-serif" size="2">Hi Mariana,</font>
<br>
<br>
<font face="sans-serif" size="2">When you compile your code with
-ftest-coverage
and -fprofile-arcs the compiler analyses and divides the compiled code
into basic blocks. Those blocks are one or more lines of code and each
of them has a counter, added also by the compiler. The compiled code is
also instrumented with some assembly code in order to increase the
basic
block counters.</font>
<br>
<br>
<font face="sans-serif" size="2">The __gcov_init and __gcov_merge_add
functions (among others) are missing from the RTEMS toolchain so need
to
be implemented (or borrow from the libgcov.c as they are pretty
standard).
The only problem you may face is that the libgcov standard library is
implemented
for non-embedded systems which means that the counters and coverage
information
is dumped from time to time to the proper files. In ERC32 (embedded
system)
you won't have that capability so you'll have to modify (re-implement)
some of the functions. In particular gcov_init() and gcov_exit() to
store
the info in local memory and flush it off a e.g. serial line.</font>
<br>
<font face="sans-serif" size="2">On the other side you'll need an
application
that interprets the data and generages the gcov files.</font>
<br>
<br>
<font face="sans-serif" size="2">I already did that exercise some
time
ago for LEON2 processor (pretty similar to ERC32) and I attach to this
email the source code.</font>
<br>
<br>
<font face="sans-serif" size="2">This source code has the following
directory
tree:</font>
<br>
<ul>
<li><font face="sans-serif" size="2">arch -> all the
architecture dependent
code</font>
</li>
<li><font face="sans-serif" size="2">build -> build directory</font>
</li>
<li><font face="sans-serif" size="2">include -> header files
directory</font>
</li>
<li><font face="sans-serif" size="2">lib -> standard libgcov.c
file</font>
</li>
<li><font face="sans-serif" size="2">os -> OS dependent code. So
far only
for RTEMS</font>
</li>
<li><font face="sans-serif" size="2">samples -> some example
programs</font>
</li>
<li><font face="sans-serif" size="2">tools -> gcov-iov version
generator
tool</font></li>
</ul>
<br>
<br>
<font face="sans-serif" size="2">If you look into the arch directory
you'll see the sparc sub-directory and under this both the erc32 and
leon2
directories. The erc32 directory and particulary the if_serial.c file
is
the one you'll have to modify to make it work under ERC32. Only four
functions
need to be implemented</font>
<br>
<ul>
<li><font face="sans-serif" size="2">if_serial_init - initialise
the serial
interface</font>
</li>
<li><font face="sans-serif" size="2">if_serial_read - read from the
serial
interface</font>
</li>
<li><font face="sans-serif" size="2">if_serial_write - write to the
serial
interface</font>
</li>
<li><font face="sans-serif" size="2">if_serial_destroy - destroy
the serial
interface</font></li>
</ul>
<br>
<font face="sans-serif" size="2">Implementing those functions and
adding
to the Makefile the necessary lines to also compile the erc32
architecture
(easy) you'll build a libgcov_rtems_erc32.a library which you'll link
together
with your application under coverage testing.</font>
<br>
<br>
<font face="sans-serif" size="2">In the directory e.g samples/bubble
you'll find the the lcov.sh script. Which contains all the necessary
commands
to compile the bubble.c application, link it with the
libcov_rtems_xxx.a
library, execute it under TSIM and then analyse the results.</font>
<br>
<br>
<br>
<font face="sans-serif" size="2">I did not get into too much detail
regarding
the GCOV functionality. The source code attached is working and I have
used it with RTEMS 4.8 and LEON2 under both TSIM and real hardware
using
the RS232 port.</font>
<br>
<br>
<br>
<br>
<font face="sans-serif" size="2">With regard to GPROF, also some code
needs to be implemented. I already started a gprof implementation for
leon2
and RTEMS 4.8 but its still not working 100% properly. If you want I
can
also send it to you. </font>
<br>
<br>
<br>
<font face="sans-serif" size="2">Hope this helps</font>
<br>
<br>
<br>
<font face="sans-serif" size="2">Aitor</font>
<br>
<br>
<br>
<br>
<br>
<br>
<table width="100%">
<tbody>
<tr valign="top">
<td width="40%"><font face="sans-serif" size="1"><b>Mariana
Solaro <a class="moz-txt-link-rfc2396E" href="mailto:msolaro@invap.com.ar"><msolaro@invap.com.ar></a></b>
</font><br>
<font face="sans-serif" size="1">Sent by:
<a class="moz-txt-link-abbreviated" href="mailto:rtems-users-bounces@rtems.org">rtems-users-bounces@rtems.org</a></font>
<p><font face="sans-serif" size="1">09/02/2010 03:42 PM</font>
</p>
</td>
<td width="59%">
<table width="100%">
<tbody>
<tr valign="top">
<td>
<div align="right"><font face="sans-serif" size="1">To</font></div>
</td>
<td><font face="sans-serif" size="1"><a class="moz-txt-link-abbreviated" href="mailto:rtems-users@rtems.org">rtems-users@rtems.org</a></font>
</td>
</tr>
<tr valign="top">
<td>
<div align="right"><font face="sans-serif" size="1">cc</font></div>
</td>
<td><br>
</td>
</tr>
<tr valign="top">
<td>
<div align="right"><font face="sans-serif" size="1">Subject</font></div>
</td>
<td><font face="sans-serif" size="1">gcov question</font></td>
</tr>
</tbody>
</table>
<br>
<table>
<tbody>
<tr valign="top">
<td>
<br>
</td>
<td><br>
</td>
</tr>
</tbody>
</table>
<br>
</td>
</tr>
</tbody>
</table>
<br>
<br>
<br>
<tt><font size="2">Hello, I have a question about gcov an how to use
it.<br>
We are using the sparc ERC32 processor, and the RTEMS 4.10 version.<br>
We've seen that there is a tool called gcov that allows it to measure <br>
the tests coverage. We don´t know exactly how to use it with RTEMS. We
<br>
already try to compile the source code with the -ftest-coverage and <br>
-fprofile-arcs options, but it only generates the .gcno files, and not
<br>
the .gcda files, so when using gcov, the coverage indicated is 0%.<br>
When the linker starts it says that it can't find the __gcov_init and <br>
__gcov_merge_add functions.<br>
So, I would like to know how to use the gcov and gprof tools with RTEMS
<br>
if it is posible.<br>
<br>
Thank You!<br>
<br>
Bye<br>
<br>
_______________________________________________<br>
rtems-users mailing list<br>
<a class="moz-txt-link-abbreviated" href="mailto:rtems-users@rtems.org">rtems-users@rtems.org</a><br>
</font></tt><a moz-do-not-send="true"
href="http://www.rtems.org/mailman/listinfo/rtems-users"><tt><font
size="2">http://www.rtems.org/mailman/listinfo/rtems-users</font></tt></a><tt><font
size="2"><br>
</font></tt>
<br>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<img src="cid:part1.04000108.04080208@invap.com.ar" border="0"></div>
</body>
</html>