The checkers run as separate processes on the build host (or on this computer for an SDK installed here); nothing is bundled.
State: modelled with Cppcheck 2.13.0 and its MISRA addon on a daemon in C and C++ with planted defects, configured by CMake 3.28.3 with an aarch64 GCC 13.3.0 stand-in SDK, here and over OpenSSH 9.6p1; a defect found only with the target's macros; line and inline suppressions honoured on the next run; sparse 0.6.4 through make M= C=2 on Linux 6.6.52 (an in-tree CAN driver with the tree left unchanged, another in-tree driver, an out-of-tree driver); checkpatch.pl 0.32 on a driver and a git format-patch patch; the running app. Not run with a real Yocto, Wind River or vendor SDK, with your MISRA rule texts, with Cppcheck other than 2.13.0, on a BitBake-built kernel, on Windows, against a real build server, or at realistic code-base size. MISRA C++ is not checked.
Cppcheck on an application
- Configure the application once (see SDK applications) so it has
compile_commands.json. - Run Analyse Application with Cppcheck..., or Analyse Current File with Cppcheck for one file. The working copy is sent first.
- Cppcheck runs over the compile commands with the target compiler's predefined macros and a platform file of the target's type sizes taken from the same compiler (Cppcheck's own arm64 platform file has a 32-bit
long), and the std, posix and gnu library configurations. - Findings land in Problems with severity, rule id and related locations.
Settings, all under neuralInverse.embeddedLinux.analysis.:
| Setting | Meaning |
|---|---|
cppcheckPath | Cppcheck on the machine where the SDK is (2.13 or later); empty for cppcheck on PATH |
checks | Check groups besides errors: warning, style, performance, portability |
misra | Runs the MISRA C:2012 addon on C files (python3 is needed where Cppcheck runs) |
misraRuleTexts | The company's MISRA C:2012 rule texts file, from your licensed copy; none is shipped. Without it, findings name only the rule number |
suppressionsFile | The project's suppressions file, relative to the source tree |
exclude | Glob patterns of source files not analysed |
sparsePath | sparse on the build host for the kernel check |
Suppress a finding with a reason
- On a finding, press Ctrl+. and choose Suppress ... with a Reason....
- Pick where it is recorded: This Line, This File or Every File of the Application (in the project's suppressions file), or Inline Comment Above the Line in the source itself.
- Enter the reason. The confirmation shows the file and the exact lines.
Cppcheck and MISRA C:2012 findings in Problems with the quick fix to suppress a rule with a reason.
The choice of where a suppression is recorded: this line, this file, every file of the application, or an inline comment.
Export the report
Export Static Analysis Report... writes Markdown (tool, version, command line, configuration, the SHA-256 of the rule texts and suppressions files, findings, suppression reasons, the MISRA compliance summary and its limits) or CSV.
Kernel drivers: sparse and checkpatch.pl
- Check Kernel Driver with sparse... builds a temporary copy of a driver folder with
make M= C=2 CHECK=sparseagainst the kernel recipe's prepared build folder andKERNEL_CCfrombitbake -e virtual/kernel. Neither the source nor the build folder is written. Findings land on the driver's lines. Build the kernel once first, withoutrm_work. - Check Current File or Patch with checkpatch.pl runs the kernel's own script on a source file or a patch (for example one written by devtool finish); findings stand on the patch's own lines.
Agent tools
Five read-only tools read findings and run the checks; writing a suppression always asks first.
Next: Targets.