Home Learning Paths ECU Lab Assessments Interview Preparation Arena Pricing Log In Sign Up

LDRA TBvision Overview

FeatureDescription
MISRA checkingFull MISRA C:2012 rule set including directives; Amendment 1/2 support
Complexity metricsMcCabe cyclomatic complexity; nesting depth; function length; SLOC
Coverage trackingStatement, branch, MC/DC coverage from unit test execution
ASPICE templatesPre-built ASPICE SWE.4 report templates; traceability matrix
Requirements traceLinks rules/metrics to requirements and test cases
CI integrationEclipse IDE plugin; Jenkins plugin; CLI for CI/CD

LDRA TBvision CLI Configuration

Bashldra_analysis.sh
#!/bin/bash
# LDRA TBvision batch analysis
set -e

LDRA_HOME="/opt/ldra"
PROJECT="SpeedController"
CONFIG="config/ldra_misra_asil_b.tbs"

# Run LDRA analysis
"${LDRA_HOME}/bin/ldra" \
    -config "${CONFIG}" \
    -project "${PROJECT}" \
    -files src/SpeedController.c src/FaultManager.c \
    -include include/ \
    -define AURIX_TC387 TARGET_ASIL_B \
    -report MISRA HTML \
    -report METRICS HTML \
    -report ASPICE PDF \
    -output reports/ldra/

# Parse results for CI quality gate
MISRA_ERRORS=$(grep -c "Error" reports/ldra/misra_summary.txt || echo 0)
MANDATORY_VIOLATIONS=$(grep "Mandatory" reports/ldra/misra_summary.txt | \
    awk '{print $NF}' | head -1)

if [ "${MANDATORY_VIOLATIONS}" -gt 0 ]; then
    echo "FAIL: ${MANDATORY_VIOLATIONS} mandatory MISRA violations"
    exit 1
fi
echo "LDRA analysis PASSED: 0 mandatory violations"

Code Complexity Metrics and Thresholds

MetricDefinitionASIL-B ThresholdASIL-D Threshold
McCabe cyclomatic complexityLinearly independent paths through function<= 15<= 10
Nesting depthMaximum depth of nested if/for/while/switch<= 5<= 4
Function length (SLOC)Source lines of code per function<= 75<= 50
Number of parametersFunction parameters count<= 7<= 5
Fan-outNumber of distinct functions called<= 10<= 7

Summary

LDRA TBvision is particularly valued in automotive projects for its ASPICE-ready report templates and its ability to generate evidence packages that map directly to ASPICE SWE.4 base practices. The complexity metrics are not just code quality indicators -- they are safety requirements: a function with cyclomatic complexity > 15 cannot be adequately unit-tested with MC/DC coverage because the number of test cases required grows exponentially with complexity. The metric thresholds in the table are recommendations derived from industry experience; projects must define their own thresholds in the software quality plan and enforce them consistently through the LDRA configuration.

🔬 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

  1. 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'.
  2. 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.
  3. 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.
  4. 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.

← PreviousPolyspace Bug Finder and Code ProverNext →Perforce QA-C / Helix QAC