Hi. I want to set up code coverage for my ARM gcc project.
I am using the gcc toolchain that is being installed from this location:
https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2017q4/gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2
in a Docker container. I am using this to compile for an arm based microcontroller. The project uses arm-none-eabi-gcc as the compiler and arm-none-eabi-gcc-ar as the linker.
I tried adding -fprofile-arcs and -ftest-coverage to the CC Flags and -fprofile-arcs to the AR_FLAGS in my Makefile. When I try to run make, the linker produces this error: "arm-none-eabi-ar: two different operation options specified".
It is worth noting that the compilation of the individual files succeeds.
I next tried just invoking the following linker command by itself inside the Docker container:
arm-none-eabi-ar -fprofile-arcs
and I get that same error: "arm-none-eabi-ar: two different operation options specified".
How can I compile for code coverage testing with this toolchain? Is there a different set of flags that I should use to invoke arm-none-eabi-ar?
Thank you.
https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html doesn't give special explanation.
But https://gcc.gnu.org/onlinedocs/gcc/Gcov-Intro.html#Gcov-Intro mentions that
gcov works only on code compiled with GCC. It is not compatible with any other profiling or test coverage mechanism.
gcov
Please double check whether your ar executable utilizes gcov.
The package I am using is gcc-arm-none-eabi-7-2017-q4-major. As far as I can tell the code is compiled with gcc. It uses the compiler and linker from this package. Is there a way you can tell me that I can double check whether the ar executable utilizes gcov?