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

Safety Software Development Workflow

ASIL-D Software Development Gate Sequence
  1. Receive TSRs (with ASIL level) from Systems Engineer
     └── Review: are TSRs unambiguous and testable? Raise issues if not.

  2. Derive Software Safety Requirements (SSRs)
     └── One SSR per testable software behaviour derived from TSR
     └── Tool: DOORS/Polarion; link SSR ↔ TSR (bidirectional)

  3. SSR Review (I1: peer review for ASIL-D)
     └── Completeness, unambiguity, testability, ASIL correctness

  4. Software Architecture Design
     └── Identify safety-critical modules; apply FFI mechanisms
     └── Review: safety architecture review (I2 for ASIL-D)

  5. Unit Implementation
     └── MISRA C:2012 compliance; defensive programming patterns
     └── Static analysis: zero unresolved mandatory MISRA violations

  6. Unit Test Development (before or during implementation — TDD)
     └── MC/DC test cases for all safety-relevant decisions
     └── Target: 100% MC/DC for ASIL-D functions

  7. Unit Testing (on host or target)
     └── Coverage measurement; gap analysis; fill gaps

  8. Unit Test Review (I1)
     └── Review test cases; confirm MC/DC achieved; review pass/fail

  9. Software Integration Testing
     └── Interface testing; back-to-back testing (model vs code)
     └── Regression suite runs on every commit (CI pipeline)

  10. Safety Case update
      └── Update traceability matrix; confirm all SSRs tested; close gaps

Exercise 1: Derive SSRs from TSR

Markdownssr_derivation.md
# Exercise: Derive SSRs from TSR

## Given TSR (Technical Safety Requirement):
TSR-EPS-015 [ASIL-D]:
"The EPS control software shall detect loss of the steering torque sensor
 within 20 ms of fault occurrence and transition to safe state (motor torque = 0 Nm)."

## Derived SSRs:

### SSR-EPS-015-A [ASIL-D]
Function TorqueSensor_Monitor() shall read Channel-A and Channel-B values
every 2ms scheduling interval. If Channel-A value is outside the range
[0.3V, 4.7V], it shall set fault flag FAULT_TORQUE_CH_A and call
SafetyMonitor_SetFault(FAULT_TORQUE_CH_A).
**Verification:** TC-EPS-050 (fault injection: Ch-A stuck-at-0V)

### SSR-EPS-015-B [ASIL-D]
Function TorqueSensor_Monitor() shall detect Channel-A / Channel-B
discrepancy > 0.5 Nm within one 2ms cycle. If discrepancy detected:
set fault flag FAULT_TORQUE_CROSS_CHECK and call
SafetyMonitor_SetFault(FAULT_TORQUE_CROSS_CHECK).
**Verification:** TC-EPS-051 (inject drift on Ch-A)

### SSR-EPS-015-C [ASIL-D]
When any FAULT_TORQUE_* flag is set, function EPS_Control_Compute()
shall set output motor_torque_cmd = 0.0f within the same 2ms cycle
(detection → safe output in ≤ 2ms; total FHTI from fault ≤ 10ms ≤ FTTI/2).
**Verification:** TC-EPS-052 (timing measurement after fault injection)

## Traceability
TSR-EPS-015 → SSR-EPS-015-A + SSR-EPS-015-B + SSR-EPS-015-C (complete coverage)
TC-EPS-050, 051, 052 → must achieve MC/DC for each function

Exercise 3: MISRA C Violation Analysis

Cmisra_violations.c
/* Identify and fix MISRA C:2012 violations in this snippet */
/* (3 violations; answers below) */

#include   /* VIOLATION 1: which rule? */

int g_counter;      /* VIOLATION 2: which rule? */

int process_sensor(int raw)
{
    int result;
    if (raw > 100)
        return -1;  /* VIOLATION 3: which rule? */
    result = raw * 2;
    return result;
}

/* ANSWERS:
   Violation 1: Rule 21.6 — The standard library function printf (via stdio.h)
                shall not be used in production safety code.
                Fix: Remove #include ; use BSW diagnostic logging instead.

   Violation 2: Rule 8.4 / 8.9 — Objects shall be defined at block scope
                if they are only used within a single function.
                g_counter is global but should be local or static.
                Fix: Move to local scope or add 'static' qualifier.

   Violation 3: Rule 15.5 — A function should have a single point of exit
                at the end. The early return violates this.
                Fix:
                int process_sensor(int raw) {
                    int result = -1;
                    if (raw <= 100) { result = raw * 2; }
                    return result;
                }
*/

Summary

The safety software development workflow is a disciplined sequence of gated activities — each gate has defined entry and exit criteria, and the output of each activity is a traceable work product. The most important process discipline for ASIL-D: test cases must be written before or alongside the code (test-driven development), not after. Writing tests after code leads to tests that confirm what the code does rather than what it should do, reducing the fault detection effectiveness. The MC/DC coverage report and the MISRA violation report are generated automatically by CI tools and are included as work products in the safety case.

🔬 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.

← PreviousSoftware Unit Testing & Integration TestingNext →Safety Validation Planning & Methods