In some cases where runtime library during initialization needs to have some software/hardware components to be up and running and initialized prior to initialization. e.g.: RTOS.
By default: When collecting application level coverage, runtime library is being initialized as early as fist instrumented line of code is being executed. In order to NOT automatically initialize runtime you need to do the following:
1) Need to build runtime differently.
Add the CPPTEST_AUTO_INITIALIZATION=0 to the list of your macros during building runtime library:
$ make EXTRA_CFLAGS="-DCPPTEST_AUTO_INITIALIZATION=0"
2) need to add this trigger in code (e.g. right after OS_Init) to initialize parasoft runtime:
#include "cpptest.h" CppTest_InitializeRuntime()
I am using the CMake extension for creating C/C++ Test projects and what I noticed is, that the extension is also capturing commands which compile/link temporary files during a CMake build. This is especially, or maybe only, the case when the build has dependencies on other static libraries.
These commands will also make it into the bdf file, which in the end cause linking issues during test generation.
If I remove following entries from the bdf file, everything works as expected: