This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ARM-CGT: Code coverage of standard libraries (libc, libc++, C++ STL)

Part Number: ARM-CGT

Tool/software:

Since the compiler qualification kit does not help for standard libraries (see here), we are investigating other ways to qualify the standard libraries that come with tiarmclang for our safety-rated use case. One idea includes calculating code coverage of the standard libraries in our tests. We have been playing around with instrumentation options for tiarmclang and linking instrumented libraries that are part of the compiler package. (for example in folder lib/armv7r-ti-none-eabihf/instrumentation64)

Building a binary like this, we see instrumentation information about pre-compiled standard library functions (f.e. from libc) and instantiations of C++ standard templates (like vector) in the section __llvm_prf_cnts. After executing this binary, we can extract the coverage information successfully. However, we have problems extracting this coverage information for the standard libraries using tiarmcov.

First of all, ti runtime libraries seem to be hidden by default in outputs created by tiarmcov. According to the help output, the parameter --include-ti-runtime should change that, but that only works in a very specific output mode (export in JSON format).

Exporting the coverage results in JSON format with --include-ti-runtime does output libc coverage summaries, including information about the code segments. Together with the source code that is included in the compiler package (folder lib/src), it should be possible to create a nice html/human-readable report with the source code. But tiarmcov does not allow --include-ti-runtime with commands other than export.
Why is this restriction built into tiarmcov? Is there some way to still create a readable report with tiarmcov for these libc modules?

Even doing all that, there does not seem to be any coverage information in the tiarmcov output about C++ standard templates, even though they were instrumented and called.
Are we missing some options to make the C++ standard templates visible in the coverage results?


  • ti runtime libraries seem to be hidden by default in outputs created by tiarmcov

    Correct

    the parameter --include-ti-runtime should change that, but that only works in a very specific output mode (export in JSON format)

    Correct.  This is the only format supported when --include-ti-runtimes is used.

    Why is this restriction built into tiarmcov?

    You stumbled across an early look form of a feature we plan to complete in a future release.  It is not intended as a way to see code coverage of the RTS functions.

    Is there some way to still create a readable report with tiarmcov for these libc modules?

    Unfortunately, no.

    Generally speaking, what works better is to incorporate the source code for the RTS functions you call into your code, then qualify it like any other code in your system.

    Thanks and regards,

    -George

  • Thank you for the information. It is disappointing that TI does not support customers with qualification of the standard libraries included in the ARM-CGT. Including all of the used libc.a function our own source code does not seem feasible to us, especially when the PSDK libraries also need a good number libc.c symbols. We will explore other means for our specific use case.

    Including qualification of the standard libraries in your qualification kit would be huge boon.