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

Spatial FFI: MPU OsApplication Boundaries

Freedom from Interference (FFI) for spatial corruption requires that a fault in a QM SWC cannot corrupt the memory of an ASIL SWC. The MPU hardware enforces this — OsApplication boundaries prevent any write outside the SWC's designated region.

CSpatial_FFI_Test.c
/* FFI validation test: inject wild pointer in QM task */
/* Expected: OsProtectionHook fires, safety task unaffected */

TASK(Task_QM_FaultInjection)
{
    /* Intentionally write to ASIL SWC .data section */
    /* (QM OsApp has no MPU access to ASIL region) */
    volatile uint32* asil_data_ptr = (volatile uint32*)0x200010A0; /* EPS .data */
    *asil_data_ptr = 0xDEADBEEF;  /* MPU fault triggered here */
    TerminateTask();
}

/* Expected OsProtectionHook call: */
/* FatalError = E_OS_PROTECTION_MEMORY */
/* OS action: PRO_TERMINATEAPPL_RESTART (QM OsApp restarted) */
/* ASIL task continues unaffected — FFI demonstrated */

Temporal FFI: OsTaskTimeFrame Injection Test

CTemporal_FFI_Test.c
/* FFI validation test: inject while(1) in QM task */
/* Expected: ASIL safety task continues firing at 10ms period */

TASK(Task_QM_TimingFault)
{
    /* Simulated temporal interference: infinite loop */
    while (1) { /* busy-wait */ }
    TerminateTask();
}

/* What happens: */
/* 1. Task_QM_TimingFault exceeds OsTaskExecutionBudget (e.g., 5ms) */
/* 2. OS timing protection fires: OsProtectionHook(E_OS_PROTECTION_TIME) */
/* 3. QM task terminated by OS */
/* 4. Task_SafetyCtrl_10ms continues firing at 10ms unimpeded */
/* 5. TRACE32 timeline confirms: SafetyCtrl jitter < 50us despite QM fault */

Communication FFI: E2E Coverage

ISO 26262 defines three communication fault models that E2E must cover for safety-relevant signals transmitted between SWCs (especially across ECU boundaries):

Fault ModelISO 26262 TermE2E Mechanism
Data corrupted in transitCorruptionCRC (P01: CRC8, P04: CRC32)
Old data replayed / frozen senderRepetition / lossCounter (P01: 4-bit, P04: 8-bit) + MaxDeltaCounter
Data from wrong sender/signalWrong addressingDataID (P01: 16-bit, P04: 32-bit) included in CRC

💡 FFI Argument Completeness

ISO 26262-6:2018 Table 9 requires that the FFI argument explicitly identifies which mechanism (spatial, temporal, or communication) addresses each interface. The safety plan must contain a table mapping every ASIL-rated interface to the FFI mechanism — MPU for memory, OsTaskTimeFrame for CPU time, E2E profile for communication. An FFI argument that only covers spatial separation is incomplete and will be flagged in a functional safety assessment.

Safety Plan Documentation: FFI Argument Table

MarkdownFFI_Argument_Table.md
# FFI Argument Table — ECU_EPS v2.3

| Interface | From (ASIL) | To (ASIL) | Fault Type | Mechanism | Profile | Evidence |
|-----------|-------------|-----------|------------|-----------|---------|----------|
| EPS_TorqueCmd (CAN) | BrakeCtrl (D) | EPS_SWC (D) | Corruption | E2E P04 | CRC32 | E2E_TP_001 |
| EPS_TorqueCmd (CAN) | BrakeCtrl (D) | EPS_SWC (D) | Repetition | E2E P04 | Counter | E2E_TP_001 |
| EPS_TorqueCmd (CAN) | BrakeCtrl (D) | EPS_SWC (D) | Wrong addr | E2E P04 | DataID | E2E_TP_001 |
| SharedNvmFlag | ADAS (QM) | NvM_BSW (ASIL-B) | Corruption | OsSpinlock + CRC32 | NVM_CRC32 | NVM_TP_003 |
| EPS .data | EPS_SWC (D) | — (spatial) | Spatial FFI | MPU OsApplication | Non-trusted | MPU_TP_007 |
| SafetyCtrl timing | Task_SafetyCtrl | Task_QM | Temporal FFI | OsTaskTimeFrame | 480us budget | TIMING_TP_002 |

Notes:
- E2E_TP_001: E2E test protocol, verified by fault injection test campaign
- NVM_TP_003: NvM block CRC test — corrupt block, verify NVM_REQ_INTEGRITY_FAILED
- MPU_TP_007: Wild-pointer injection test — verify OsProtectionHook fires, ASIL task unaffected
- TIMING_TP_002: while(1) injection test — verify OsTimingProtection terminates QM task

Summary

FFI is not a checkbox — it requires positive evidence for each interference pathway (spatial, temporal, communication). The standard evidence set is: a wild-pointer injection test for spatial FFI, a while(1) injection test for temporal FFI, and E2E fault injection for communication FFI. All three tests must be executed on target hardware and documented in the safety plan before functional safety assessment.

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

← PreviousSafe BSW Module ConfigurationNext →Hands-On: ASIL-D ECU Configuration