CtrlK
BlogDocsLog inGet started
Tessl Logo

testland/embedded-coverage-strategy-reference

Pure-reference catalog of code-coverage strategy for embedded C/C++: the criteria hierarchy (statement / branch / decision / condition / MC/DC), the gcov toolchain (.gcno/.gcda, --coverage), the LLVM source-based toolchain (llvm-profdata / llvm-cov), host-build vs QEMU-build instrumentation, MISRA-C:2012 and DO-178C structural-coverage expectations by safety level (DAL A maps to MC/DC), and report-format choices. Use when choosing what structural-coverage level to require and wiring gcov / llvm-cov into the build; physical .gcda retrieval from hardware is in hardware-in-loop-reference, QEMU machine flags in qemu-system-test-runner, and to author the embedded tests themselves use googletest-embedded-arm or unity-test-framework-c.

74

Quality

93%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide

SecuritybySnyk

Passed

No findings from the security scan

Overview
Quality
Evals
Security
Files

safety-standards-and-formats.mdreferences/

Safety-standard coverage expectations and report formats

Deep reference for the embedded-coverage-strategy-reference SKILL.md. Consult when negotiating a coverage target against a safety standard, or when choosing which report format to produce and gate on.

Safety-standard coverage expectations

These are cited by stable ID - the standards themselves are gated and not WebFetchable.

Standard / levelMinimum structural coverage
MISRA-C:2012 Coverage GuidanceNo prescribed numeric target; the rule set requires defined control flow and explicit default: in switch, which makes branch coverage achievable. See "MISRA-C:2012 §8 Coverage"
DO-178C / DAL A (catastrophic failure)MC/DC required for every condition (see "DO-178C §6.4.4 Structural Coverage")
DO-178C / DAL BDecision coverage
DO-178C / DAL CStatement coverage
DO-178C / DAL DNone mandated
ISO 26262 ASIL DMC/DC strongly recommended for unit verification (see "ISO 26262-6:2018 Table 12")
ISO 26262 ASIL A / B / CBranch (B/C) or statement (A) coverage
IEC 62304 Class C (medical, life-supporting)No numeric target, but bidirectional traceability + structural coverage justification expected

The number "100% MC/DC" in aviation is famously expensive; the standard accepts "MC/DC of the integrated executable object code" which is interpreted differently by certifiers. Treat these as the floor, not a turnkey recipe.

Coverage report formats

FormatProducerConsumer
.gcov (text)gcovHuman reading; line-level annotation
.gcov.json.gzgcov --json-formatCI parser; no source-code dependency per GCC docs
.info (LCOV)lcov --capture or llvm-cov export -format=lcovCodecov / Coveralls / SonarQube
.profdatallvm-profdata mergeInput only to llvm-cov
HTMLgenhtml (LCOV) or llvm-cov show -format=htmlHumans; not for diff'ing
JSONllvm-cov export -format=textCustom CI dashboards
Cobertura XMLgcovr --xml (gcovr is a third-party gcov wrapper)Jenkins coverage plugin

For embedded CI, the rule of thumb is: produce lcov.info as the durable artefact; render HTML for the developer; gate the PR on the .info totals.

SKILL.md

tile.json