First of all, it’s correct that you can’t use build stubs on targets by default.
However, if the actually called function generates an interrupt due to the test data, the result cannot be received even if the test is normally performed.
In this case, you need to handle the build stub in one of three ways below.
1. How to handle when target build
This is how you should contact the actual developer.
This is a method of excluding the source file or library with the function definition from the makefile or the target IDE after checking Use build stub in the environment setting when exporting the target test.
2. How to handle it using the cs_replace_code option
This is a method of forcibly changing the function caller name with the cs_replace_ code option. This is not recommended, as it is a way to change the actual function’s calling part.
Example code
void function();
int main(){
function(); // function that need stub processing
return 0;
}
Added the following option to toolchain.conf
cs_replace_code=functionfunction_stub
3. Stub handling through —preinclude or -include option
This is how to treat system stubs as user stubs and use them.
Example code
int main(){
function(); // function that need stub processing
return 0;
}
After creating an arbitrary header file, add the function definition as shown below.
#ifndef _STUB_HEADER_
#define _STUB_HEADER_
void function(){
}
#endif
In the CT project, right-click the source file with example code > Properties > Compile Flag and replace it with a macro as follows.
-Dfunction=function_stub
Right-click the CT project and click properties, add function_stub function to [Exclude of coverage] > [The list of functions excluded coverage].
Need more help with this?
Don’t hesitate to contact us here.