| Tool | Type | MISRA Support | ASIL Qualification | Typical Use |
|---|---|---|---|---|
| PC-lint Plus (Gimpel) | Lint/static | MISRA-C:2012 full | TÜV certified plugin | Fast CI gate; developer workflow |
| Polyspace Bug Finder | Abstract interp. | MISRA-C:2012 | ISO 26262 qualified | ASIL B/C: find runtime errors |
| Polyspace Code Prover | Formal proof | MISRA-C:2012 | ISO 26262 qualified (ASIL D) | Prove absence of RTE per function |
| LDRA TBvision | Static+coverage | MISRA-C:2012 | ISO 26262 qualified | Combined static + structural coverage |
| Cppcheck | Open-source | MISRA-C:2012 (limited) | Not qualified | Development: fast, free; not for ASIL use |
| Coverity | SAST | Partial MISRA | Not automotive-qualified | Security-focused; CI pipeline |
Static Analysis Tools for Automotive C
Polyspace Bug Finder: Key Checks
/* Polyspace Bug Finder detects runtime errors statically */
/* Colours: Red = definite bug, Orange = possible bug, Green = proved safe */
#include
uint32_t g_table[10];
/* Polyspace RED: Out-of-bounds array access */
void bad_access(uint8_t idx) {
g_table[idx] = 0u; /* idx can be 0-255 but table is [10] → definite OOB */
}
/* Polyspace ORANGE: Possible division by zero */
uint32_t divide(uint32_t a, uint32_t b) {
return a / b; /* orange: b might be 0; add guard */
}
/* Fixed: Polyspace GREEN — proves no runtime error */
uint32_t divide_safe(uint32_t a, uint32_t b) {
if (b == 0u) { return 0u; }
return a / b;
}
/* Polyspace also detects:
- Integer overflow (signed)
- NULL pointer dereference
- Use of uninitialised variable
- Infinite loop (Code Prover)
- Unreachable code
- Non-terminating function call
Configuration: polyspace-bug-finder -sources src/ -checkers all-misra
-misra-c:2012 -results-dir results/polyspace */ CI/CD Pipeline Integration
# GitLab CI: static analysis gates for MISRA-C:2012 compliance
# Runs on every merge request
stages: [build, static_analysis, report]
misra_check:
stage: static_analysis
image: pclint-plus:latest
script:
# Run PC-lint on all source files; output MISRA violations to file
- pclint-plus -DMISRA_C_2012 -w3 src/*.c > lint_results.txt 2>&1
# Count mandatory violations (must be 0)
- mandatory=$(grep -c "MISRA.*mandatory" lint_results.txt || true)
- echo "Mandatory violations: $mandatory"
- if [ "$mandatory" -gt "0" ]; then exit 1; fi
# Count required violations (must stay below threshold)
- required=$(grep -c "MISRA.*required" lint_results.txt || true)
- echo "Required violations: $required (threshold: 50)"
- if [ "$required" -gt "50" ]; then exit 1; fi
artifacts:
paths: [lint_results.txt]
reports:
codequality: lint_results.txt
allow_failure: false # mandatory: blocks merge
polyspace_bugfinder:
stage: static_analysis
script:
- polyspace-bug-finder -sources src/ -checkers all-misra -misra-c:2012
- polyspace-results-export -format csv -output results.csv
- python3 ci/check_polyspace_results.py results.csv # assert no reds
artifacts:
paths: [results.csv, polyspace_results/]Summary
Static analysis is mandatory, not optional, for ASIL-B and above: ISO 26262 Part 6 Table 1 requires use of a qualified static analysis tool at ASIL-C and above. The tiered approach works well in practice: a fast linter (PC-lint, Cppcheck) in the developer's IDE provides immediate feedback; a CI-integrated MISRA checker (PC-lint Plus) gates every merge request; and Polyspace Code Prover runs on release candidates to produce formal proofs. Suppression annotations must be paired with deviation records — a bare //lint -e9079 with no justification is a compliance audit failure.
🔬 Deep Dive — Core Concepts Expanded
This section builds on the foundational concepts covered above with additional technical depth, edge cases, and configuration nuances that separate competent engineers from experts. When working on production ECU projects, the details covered here are the ones most commonly responsible for integration delays and late-phase defects.
Key principles to reinforce:
- Configuration over coding: In AUTOSAR and automotive middleware environments, correctness is largely determined by ARXML configuration, not application code. A correctly implemented algorithm can produce wrong results due to a single misconfigured parameter.
- Traceability as a first-class concern: Every configuration decision should be traceable to a requirement, safety goal, or architecture decision. Undocumented configuration choices are a common source of regression defects when ECUs are updated.
- Cross-module dependencies: In tightly integrated automotive software stacks, changing one module's configuration often requires corresponding updates in dependent modules. Always perform a dependency impact analysis before submitting configuration changes.
🏭 How This Topic Appears in Production Projects
- Project integration phase: The concepts covered in this lesson are most commonly encountered during ECU integration testing — when multiple software components from different teams are combined for the first time. Issues that were invisible in unit tests frequently surface at this stage.
- Supplier/OEM interface: This is a topic that frequently appears in technical discussions between Tier-1 ECU suppliers and OEM system integrators. Engineers who can speak fluently about these details earn credibility and are often brought into critical design review meetings.
- Automotive tool ecosystem: Vector CANoe/CANalyzer, dSPACE tools, and ETAS INCA are the standard tools used to validate and measure the correct behaviour of the systems described in this lesson. Familiarity with these tools alongside the conceptual knowledge dramatically accelerates debugging in real projects.
⚠️ Common Mistakes and How to Avoid Them
- Assuming default configuration is correct: Automotive software tools ship with default configurations that are designed to compile and link, not to meet project-specific requirements. Every configuration parameter needs to be consciously set. 'It compiled' is not the same as 'it is correctly configured'.
- Skipping documentation of configuration rationale: In a 3-year ECU project with team turnover, undocumented configuration choices become tribal knowledge that disappears when engineers leave. Document why a parameter is set to a specific value, not just what it is set to.
- Testing only the happy path: Automotive ECUs must behave correctly under fault conditions, voltage variations, and communication errors. Always test the error handling paths as rigorously as the nominal operation. Many production escapes originate in untested error branches.
- Version mismatches between teams: In a multi-team project, the BSW team, SWC team, and system integration team may use different versions of the same ARXML file. Version management of all ARXML files in a shared repository is mandatory, not optional.
📊 Industry Note
Engineers who master both the theoretical concepts and the practical toolchain skills covered in this course are among the most sought-after professionals in the automotive software industry. The combination of AUTOSAR standards knowledge, safety engineering understanding, and hands-on configuration experience commands premium salaries at OEMs and Tier-1 suppliers globally.