Main Content

Custom Toolchain Directives Required for Code Coverage and Execution Profiling

If you use a custom toolchain for building a processor-in-the-loop (PIL) target application that supports Simulink® Coverage™ analysis or Embedded Coder® code execution profiling, in the toolchain definition file, you must provide these compiler directives:

  • CompileFlag — Specify the flag that C or C++ compiler uses to compile source files without linking. For example, if the compiler in the toolchain is GNU® C or C++, set the directive to -c.

  • PreprocessFile — Specify the flag that C or C++ compiler uses to preprocess the source files without running other compiler stages. For example, if the compiler in the toolchain is GNU C or C++, set the directive to -E.

This section from a toolchain definition file example shows how you can use the setDirective method to provide the directives.

tc = coder.make.ToolchainInfo('BuildArtifact','nmake makefile');
tc.Name ='My Toolchain Name';
tc.Platform ='win64';
tc.SupportedVersion ='14';
...
% ------------------------------
% C Compiler
% ------------------------------
tool = tc.getBuildTool('C Compiler');
tool.setName('My C Compiler');
...
tool.setDirective('CompileFlag','-c');
tool.setDirective('PreprocessFile','-E');
...

Related Topics