gcov question

Mariana Solaro msolaro at invap.com.ar
Wed Sep 15 12:52:41 UTC 2010


Hello Aitor, thank you very much for your help. We used what you gave 
us, and it finally worked.
We are measuring the coverage using the TSIM and using the real hardware.

Best regards,
Mariana


El 02/09/2010 11:56 a.m., Aitor.Viana.Sanchez at esa.int escribió:
> Hi Mariana,
>
> 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.
>
> 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.
> On the other side you'll need an application that interprets the data 
> and generages the gcov files.
>
> I already did that exercise some time ago for LEON2 processor (pretty 
> similar to ERC32) and I attach to this email the source code.
>
> This source code has the following directory tree:
>
>     * arch -> all the architecture dependent code
>     * build -> build directory
>     * include -> header files directory
>     * lib -> standard libgcov.c file
>     * os -> OS dependent code. So far only for RTEMS
>     * samples -> some example programs
>     * tools -> gcov-iov version generator tool
>
>
>
> 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
>
>     * if_serial_init - initialise the serial interface
>     * if_serial_read - read from the serial interface
>     * if_serial_write - write to the serial interface
>     * if_serial_destroy - destroy the serial interface
>
>
> 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.
>
> 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.
>
>
> 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.
>
>
>
> 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.
>
>
> Hope this helps
>
>
> Aitor
>
>
>
>
>
> *Mariana Solaro <msolaro at invap.com.ar>*
> Sent by: rtems-users-bounces at rtems.org
>
> 09/02/2010 03:42 PM
>
> 	
> To
> 	rtems-users at rtems.org
> cc
> 	
> Subject
> 	gcov question
>
>
>
> 	
>
>
>
>
>
> Hello, I have a question about gcov an how to use it.
> We are using the sparc ERC32 processor, and the RTEMS 4.10 version.
> We've seen that there is a tool called gcov that allows it to measure
> the tests coverage. We don´t know exactly how to use it with RTEMS. We
> already try to compile the source code with the -ftest-coverage and
> -fprofile-arcs options, but it only generates the .gcno files, and not
> the .gcda files, so when using gcov, the coverage indicated is 0%.
> When the linker starts it says that it can't find the __gcov_init and
> __gcov_merge_add functions.
> So, I would like to know how to use the gcov and gprof tools with RTEMS
> if it is posible.
>
> Thank You!
>
> Bye
>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-users
>

-- 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20100915/b26895ea/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Firma.JPG
Type: image/jpeg
Size: 14091 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/users/attachments/20100915/b26895ea/attachment.jpe>


More information about the users mailing list