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

OsCore Objects & Assignment

Each physical core is represented by one OsCore container. The master core (Core 0) is always started by the BSP startup code; secondary cores are either auto-started or explicitly launched with Os_StartCore().

OsCore ParameterValue / TypePurpose
OsCoreId0, 1, 2 …Unique numeric ID referenced by tasks and ISRs
OsCoreIsStartedByStartupCodeTRUE / FALSETRUE = hardware/BSP starts core automatically; FALSE = master must call Os_StartCore(coreId, &status)
OsCoreUseMasterStartupCodeTRUE on Core 0 onlyDesignates the bootstrap core that calls Os_Init() and starts the OS
OsCoreAutostartTRUE / FALSEAuto-activates tasks and alarms on that core when Os_StartCore() returns
CEcuM_Callouts.c
/* Secondary core launch from EcuM_AL_DriverInitOne on Core 0 */
StatusType coreStatus;
Os_StartCore(OS_CORE_ID_1, &coreStatus);
if (coreStatus != E_OK) {
    /* Core 1 failed to start — log DEM event and continue on Core 0 only */
    Dem_ReportErrorStatus(DEM_EVENT_CORE1_START_FAIL, DEM_EVENT_STATUS_FAILED);
}
/* BootBarrier: Core 0 waits until Core 1 signals MCAL init complete */
Os_WaitBarrier(BOOT_BARRIER_MCAL_DONE);

Task-to-Core Binding via OsTaskCoreRef

Every Task and ISR must have exactly one OsTaskCoreRef pointing to an OsCore. A task without this reference defaults to Core 0, which is a silent misconfiguration that causes spurious priority inversion on multi-core ECUs.

XMLOs_TaskBinding.arxml


  Task_SafetyCtrl_10ms
  12
  /Os/Cores/OsCore0
  /Os/Apps/OsApp_Safety




  Task_ComStack_1ms
  8
  /Os/Cores/OsCore1
  /Os/Apps/OsApp_QM

⚠️ Priority Space is Per-Core

AUTOSAR OS task priorities are local to each core — Task_SafetyCtrl_10ms with priority 12 on Core 0 and Task_ComStack_1ms with priority 8 on Core 1 are completely independent. You can have two tasks with the same priority number on different cores without conflict. However, spinlocks and IOC channels that bridge cores must account for the effective combined worst-case latency.

Per-Core OS Objects

OS objects — OsApplications, schedule tables, alarms, OsCounters, and spinlocks — are always core-local. Objects on Core 0 are never directly visible to Core 1's scheduler. Cross-core interaction is exclusively via IOC or spinlock-protected shared memory.

OS ObjectScopeCross-Core Rule
OsTask / OsISRCore-local (OsTaskCoreRef)Never activated from another core's task directly — use IOC event or SetEvent with IOC
OsAlarmCore-local (linked to OsCounter on same core)Cannot trigger a task on a different core
OsCounterCore-local hardware timerEach core uses its own hardware timer source (e.g., STM0 on Core 0, STM1 on Core 1)
OsSpinlockSystem-global (all cores)Only cross-core synchronisation mechanism inside AUTOSAR OS
OsApplicationCore-local MPU domainMPU regions configured per core; non-trusted OsApp restricted to own memory

Multi-Core Startup Sequence

Multi-Core Boot Sequence
  Core 0 (Master)                        Core 1 (Slave)
  ────────────────────────────────────────────────────────────
  Mcu_Init(), Port_Init()
  Os_InitMemory()
  Os_Init()                              (powered but idle)
  Os_StartCore(CORE_ID_1, &status) ──────► Core 1 wakes
                                           Os_InitMemory()
                                           Os_Init() on Core 1
                                           Spi_Init(), Fls_Init()  ← parallel MCAL
                                           Os_WaitBarrier(BOOT_BARRIER_MCAL_DONE)
  Os_WaitBarrier(BOOT_BARRIER_MCAL_DONE) ◄─ barrier released
  CanIf_Init(), PduR_Init(), Com_Init()
  Fee_Init(), NvM_Init(), NvM_ReadAll()
  Dcm_Init(), Dem_Init()
  BswM switches to FULL_RUN ──────────── Both cores running
  ────────────────────────────────────────────────────────────

💡 BootBarrier Pattern

Os_WaitBarrier() is an AUTOSAR OS API that blocks a core until all other cores participating in the barrier have also called it. Use one barrier after all MCAL inits (before BSW init) and optionally a second before FULL_RUN activation. Without it, Core 0 may attempt to call CanIf_Init() before Core 1's Can_Init() on the shared CAN controller has completed.

Summary

Multi-core OS configuration is the foundation for all subsequent multi-core work. OsCore assignment, per-task OsTaskCoreRef binding, and the BootBarrier startup sequence must be correct before any IOC channel, spinlock, or cross-core BSW module can function. A missing OsTaskCoreRef silently places tasks on Core 0, corrupting the intended load balance and ASIL partitioning.

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

Next →Inter-Core Communication (IOC)