wtorek, 14 sierpnia 2012

How-to: prepare environment to run coverage analysis on RTEMS for pc386 BSP

I was trying to prepare environment to analyze coverage on RTEMS. Firstly I tried to do this for sparc/erc32 as it is most used by ESA (I’m ESA SOCIS participant). I tried to run do_coverage script or run_coverage script from rtems-4.11-work/rtems-testing/rtems-coverage/ directory. Unfortunately, scripts failed. I get message that script was unable to find tsim-erc32 on PATH. I started looking for it and I discovered that TSIM is commercial simulator for ERC32. Due to that I couldn’t get my environment ready to perform coverage analysis for ERC32. I knew that erc32 could be simulated in tsim or gdb-sis also, so I decided to try run do_coverage script with all steps (-A option when invoking do_coverage). And once again it failed. Sis is unsupported for coverage analysis.

As my efforts to have working environment for erc32 failed due to lack of TSIM I decided to prepare environment for another BSP. I chose i386/pc386. Although it is quite popular and I supposed to get much help I encourage quite a few problems while trying to get it working. One - missing dos2unix was very simple to solve.

yum install dos2unix

Another one was that couverture-qemu is developing and when trying to build it I get some warnings which end build process. Finally I solve this by disable breaking of compilation on compiler warning. I was also confused when after qemu installation I discovered that it also didn’t work because qemu executable changed name from qemu to qemu-system-i386. This problem is solved now and shouldn’t appear anymore if you have the newest rtems-testing git repository cloned and built. (I hadn't :-) )

To help anyone who would like to get this working I try to write some kind of tutorial.

TUTORIAL

To have rtems coverage analysis tools for i386/pc386 working you have to install qemu first. For coverage purposes it is recommended to install couverture-qemu as it is extended with trace generation possibilities.

You have to clone couverture-qemu git repository.

cd ~
git clone htpp://forge.open-do.org/anonscm/git/couverture-qemu/couverture-qemu.git
cd couverture-qemu/
git checkout origin/release-1.2.2
./configure --target-list=”i386-softmmu” --prefix=/home/rtems/qemu/install --disable-werror
make
make install

Now couverture-qemu should have been installed in /home/rtems/qemu/install directory.

To complete preparing qemu for using you should follow instructions from http://www.rtems.org/wiki/index.php/QEMU#Using_the_rtems-testing_Module
This include creating hd directory in /home/rtems/qemu/, cloning rtems-testing git repository, configuring and building rtems for i386/pc386.

It is also worth of remind that when working with rtems you should have some rtems path added to your PATH. On RTEMS CentOS Virtual Machine it is very simple:
. ~/rtems-4.11-work/setenv

After that you can try if it all works properly by running pc386 script with hello.exe.
There can also appear problems with path. If you get message “Unable to find qemu on PATH” you should export PATH to qemu installation.
export PATH = /home/rtems/qemu/install/bin/:$PATH

After all that steps, with pc386 BSP built and qemu installed you should be able to run coverage analysis succesfully.
When running coverage sripts you should be on the top of your RTEMS tree, in my case it is rtems-4.11-work directory.

The simplest form of running coverage analysis is running do_coverage script with all steps (cleaning rtems tree, configuring and building rtems, updating, copying and running tests, generating reports). It takes the greatest amount of time. If you had have configured and built RTEMS earlier you can skip some of this steps by putting some options when invoking do_coverage.

cd /home/rtems/rtems-4.11-work/
The simplest form of running coverage (all steps) for pc386 BSP
rtems-testing/rtems-coverage/do_coverage -A -B pc386

You can also specify other options in do_coverage scripts. To lists all this option type:
rtems-testing/rtems-coverage/do_coverage -?

Is it easy to understand? What should I add here else? I am waiting for your comments :-)

Brak komentarzy:

Prześlij komentarz