AUTOSAR BSW, RTE and MCAL Explained: Layers, Responsibilities and Data Flow
AUTOSAR Classic separates application behavior from reusable ECU infrastructure and microcontroller-specific access. Three terms are central to this architecture: Basic Software (BSW), Runtime Environment (RTE) and Microcontroller Abstraction Layer (MCAL).
- BSW provides standardized ECU infrastructure, including system, communication, memory, diagnostic and hardware-abstraction functionality.
- RTE connects AUTOSAR Software Components (SWCs) to one another and to configured BSW services.
- MCAL provides standardized interfaces to microcontroller internal peripherals.
MCAL is part of BSW, not a separate peer layer. The RTE is positioned between application software and BSW in the Classic Platform architecture.
Scope: This article focuses on AUTOSAR Classic. Module availability, exact interfaces, configuration parameters and generated artifacts depend on the AUTOSAR release, ECU design and supplier implementation. The flows below are conceptual engineering examples; use the project's approved specifications and tool documentation for production configuration.
1. AUTOSAR Classic software architecture
A simplified view of the Classic Platform contains the application layer, RTE and BSW, running on the ECU hardware.
The diagram groups modules to explain their responsibilities. It is not a complete representation of every AUTOSAR module or every possible dependency. Complex Drivers may interact with hardware and other software layers according to the ECU architecture.
1.1 Application layer
The application layer contains SWCs that implement vehicle functions, such as:
- Vehicle-speed calculation and display.
- Door, window and seat control.
- Thermal management.
- Powertrain control functions.
- Sensor plausibility and monitoring logic.
SWCs describe their interactions through ports and interfaces. They should generally use the generated RTE interfaces rather than directly accessing microcontroller registers or depending on another component's private implementation.
1.2 Runtime Environment
The RTE realizes configured communication between SWCs and provides access to configured BSW functionality. It is generated for the ECU integration context; it is not a general-purpose operating system.
1.3 Basic Software
BSW provides common services and hardware-facing infrastructure. Its modules are configured and integrated for the target ECU. MCAL is the lowest standard BSW layer closest to the microcontroller peripherals.
2. What is BSW?
Basic Software is the standardized software infrastructure below the RTE. It provides common services so application software does not need to implement every low-level ECU function itself.
The BSW stack is commonly described using functional layers and module groups.
2.1 Services Layer
The Services Layer provides common services used by application software and other BSW modules. Depending on the ECU, examples include:
| Module / group | Typical responsibility |
|---|---|
| AUTOSAR OS | Tasks, scheduling, alarms, events and resource management |
| EcuM | ECU startup, shutdown and related state handling |
| BswM | Coordination of configured mode-related actions and rules |
| WdgM | Supervision of configured software execution and watchdog-related behavior |
| NvM | Management of non-volatile data blocks |
| COM | Signal-level communication services and I-PDU processing |
| PduR | Routing protocol data units between configured modules |
| DCM | Diagnostic communication management |
| Dem | Diagnostic event and event-memory management |
This is an illustrative selection, not a mandatory module list for every ECU. Module responsibilities and interfaces are defined by the applicable AUTOSAR specifications and supplier implementation.
2.2 ECU Abstraction Layer
The ECU Abstraction Layer hides selected ECU-specific device details from upper software layers. It can provide standardized access to devices that are not simply an internal microcontroller peripheral.
For example, an ECU may contain an external watchdog, an external EEPROM or a board-level I/O device. The software path depends on the device interface, driver architecture and project design.
2.3 Microcontroller Abstraction Layer
MCAL contains drivers for supported microcontroller internal peripherals. It abstracts hardware registers and peripheral-specific operations behind defined software interfaces.
Examples include ADC, CAN, DIO, SPI, PWM, ICU, GPT and Port drivers, where supported by the selected MCU and implementation.
2.4 Complex Drivers
A Complex Driver is used when a required hardware function or timing behavior is not adequately covered by the standard abstraction available in the project's architecture. It may access hardware directly or interact with other software layers through project-defined interfaces.
Complex Drivers should be designed with clear ownership, initialization, concurrency, safety and integration rules. They are not a reason to bypass the standard architecture without justification.
3. What is RTE?
The Runtime Environment is the generated layer that connects SWCs to one another and to configured BSW functionality.
The RTE is generated using information such as SWC descriptions, ports, interfaces, component connections, ECU allocation and relevant ECU configuration. Its generated APIs and behavior are specific to the ECU integration.
3.1 Common communication patterns
- Sender-Receiver: A sender provides data elements that a receiver consumes. Typical examples include vehicle speed, temperature and status.
- Client-Server: A client requests an operation provided by a server and receives a result or status.
- Mode communication: Components exchange or respond to configured mode information.
- Inter-runnable communication: Runnables within a component share data using configured mechanisms such as inter-runnable variables.
The exact API names and semantics depend on the generated RTE and interface configuration.
3.2 Example: sharing vehicle speed
Assume VehicleSpeedProvider calculates a vehicle-speed value and InstrumentCluster uses it to update a display.
At a conceptual level:
- The producer runnable obtains input data and calculates vehicle speed.
- The producer writes the configured data element through its RTE interface.
- The generated RTE implements the configured communication mechanism.
- The consumer runnable reads the data through its RTE interface.
- The consumer applies display-specific logic.
The components communicate through defined interfaces rather than depending on each other's internal code. Buffering, data consistency, update timing and runnable activation must be considered in the ECU design.
3.3 RTE APIs and runnable execution
The RTE commonly generates APIs for operations such as reading or writing Sender-Receiver data and invoking Client-Server operations. Exact function names and signatures are generated from the model; they should not be guessed or copied from a different ECU.
A runnable is an executable unit of an SWC. It is activated by configured events, for example:
- Timing events.
- Data-received events.
- Operation-invoked events.
- Mode-related events.
In a typical Classic ECU integration, runnable activation is mapped into OS tasks and related scheduling configuration. Review the event-to-runnable mapping, task mapping, priority, activation period, execution time, deadline and re-entrancy assumptions.
Important distinction: RTE communication and OS scheduling are related integration concerns, but the RTE is not the OS and does not independently decide the complete ECU scheduling policy.
4. What is MCAL?
The Microcontroller Abstraction Layer is the lowest standard BSW layer and is closest to the microcontroller. MCAL drivers provide software interfaces to supported internal peripherals.
Common MCAL driver areas include:
| Driver | Typical purpose |
|---|---|
| ADC | Analog-to-digital conversion |
| CAN | Access to the microcontroller's CAN controller |
| DIO | Digital input and output channels |
| SPI | Synchronous serial peripheral communication |
| PWM | Pulse-width modulation generation |
| ICU | Input capture and edge measurement |
| GPT | General-purpose timer functions |
| Port | Pin direction, mode and related port configuration |
The available drivers and supported features depend on the MCU family, AUTOSAR release and MCAL supplier.
4.1 MCAL does not implement every upper-layer function
A CAN MCAL driver controls the microcontroller's CAN peripheral through its supported driver interface. It does not, by itself, implement the complete AUTOSAR communication stack, define application signals or decide how vehicle data is packed into a CAN frame.
Likewise, an ADC driver provides peripheral access and conversion-related services; application-specific filtering, plausibility checks and control decisions generally belong elsewhere in the ECU software architecture.
4.2 Configuration and initialization
MCAL integration typically requires engineering checks around:
- MCU and peripheral clock configuration.
- Pin multiplexing and electrical configuration.
- Peripheral channel and controller allocation.
- Interrupt configuration and priorities, where applicable.
- Driver initialization order.
- Linker, memory and compiler integration constraints.
- Consistency between generated configuration and the target hardware.
Exact initialization APIs and sequencing are implementation-specific. Follow the supplier's integration manual and the ECU startup design.
5. MCAL vs ECU Abstraction vs Complex Drivers
These concepts are related but serve different purposes.
| Element | Main responsibility | Example |
|---|---|---|
| MCAL | Abstracts microcontroller internal peripherals | Internal ADC, CAN controller, SPI, PWM and DIO |
| ECU Abstraction | Hides selected ECU-specific device details | External watchdog or board-level device |
| Complex Driver | Handles hardware functionality or timing needs not suitably covered by the standard abstraction | Specialized hardware access with project-defined integration |
For example, an internal ADC peripheral is normally accessed through the ADC MCAL driver. An external device connected over SPI may involve an SPI MCAL driver plus a device-specific driver or abstraction. The exact layering depends on the project's design.
Do not assume that every external device follows one identical software path.
6. Practical example: analog sensor acquisition
Consider an analog temperature sensor connected to an MCU ADC input. The application needs a temperature value for monitoring or control.
This is a conceptual data path. Depending on the ECU design, an I/O abstraction or device-specific module may be present, and data may be transferred through configured buffers, callbacks or other mechanisms.
6.1 Engineering sequence
- Confirm the sensor electrical range and output characteristics.
- Check the MCU pin assignment and ADC channel against the board schematic and MCU documentation.
- Configure ADC resolution, reference, channel and acquisition parameters as supported.
- Configure the acquisition trigger and conversion handling.
- Obtain the conversion result through the configured driver interface.
- Apply application-level conversion, scaling and plausibility checks.
- Provide the value to consumers through the SWC interface and RTE.
- Verify the measured value and timing on the target ECU.
6.2 Illustrative conversion calculation
Suppose a hypothetical ADC uses a 12-bit result and a 5.0 V reference. For an ideal unipolar conversion, the approximate input voltage can be estimated as:
For an illustrative ADC code of 2048:
This calculation is an educational example, not a universal conversion rule. Actual scaling depends on ADC transfer characteristics, reference accuracy, input conditioning, calibration, coding convention and sensor behavior. Use the MCU datasheet and project calibration data.
6.3 Polling, interrupts and DMA
Depending on the driver and MCU implementation, acquisition may use polling, interrupt notification or DMA-supported mechanisms.
| Method | General behavior | Engineering consideration |
|---|---|---|
| Polling | Software checks conversion or peripheral status | CPU load and response latency |
| Interrupt | Peripheral event notifies software | ISR duration, priority and synchronization |
| DMA | Hardware transfers data to memory where supported | Buffer ownership, coherency and transfer completion |
The MCAL driver does not automatically determine the activation period of the application runnable. Peripheral acquisition timing and application scheduling must be configured and verified as separate but coordinated concerns.
7. Practical example: CAN transmit and receive paths
A common AUTOSAR Classic integration task is transmitting an application signal over CAN and receiving a signal from another ECU.
7.1 Transmit path
A simplified transmit path is:
Application SWC → RTE → COM → PduR → CanIf → CAN Driver (MCAL) → CAN Controller
| Element | Responsibility in the conceptual path |
|---|---|
| Application SWC | Produces the application value |
| RTE | Connects the SWC to configured communication functionality |
| COM | Maps signal data into an I-PDU according to configuration |
| PduR | Routes the I-PDU to the configured lower-layer destination |
| CanIf | Provides the CAN interface abstraction and maps configured transmit PDUs |
| CAN Driver (MCAL) | Controls the MCU CAN controller through the driver interface |
| CAN Controller | Transmits the frame on the physical bus |
The exact call sequence and configuration objects depend on the communication-stack implementation and ECU configuration.
7.2 Receive path
A simplified receive path is:
CAN Controller → CAN Driver (MCAL) → CanIf → PduR → COM → RTE → Receiving SWC
When a receiving SWC obtains an incorrect value, inspect the data path in order:
- Confirm the CAN identifier and raw payload in the bus trace.
- Verify the configured controller, hardware object and CanIf mapping.
- Check receive PDU routing through PduR.
- Check COM I-PDU length and signal mapping.
- Verify start bit, bit length, byte order, signedness, scaling and offset.
- Confirm the RTE connection and consumer runnable behavior.
- Check timeout, invalid-value and data-update handling.
7.3 Diagnostic communication is not ordinary COM signal communication
For CAN-based UDS diagnostics, a common conceptual path is:
CAN Driver / CanIf → CanTp → PduR → DCM
CanTp handles transport-protocol functions such as segmentation and reassembly. PduR routes configured diagnostic PDUs, and DCM handles diagnostic communication services. Dem is commonly involved in diagnostic event management.
Do not treat a diagnostic request as an ordinary COM signal. The diagnostic communication path and configuration are different.
8. Initialization and startup considerations
A Classic ECU startup sequence coordinates hardware initialization, BSW initialization, OS startup and application execution. The exact sequence depends on the ECU architecture, selected modules and supplier implementation.
A simplified conceptual sequence is:
When debugging startup issues, review:
- Reset and startup code behavior.
- Clock and memory initialization.
- MCAL initialization and driver state.
- BSW module initialization dependencies.
- OS startup and task activation.
- RTE initialization and application runnable activation.
- ECU mode and communication state transitions.
This diagram is a teaching abstraction, not a mandatory universal AUTOSAR initialization order. Use the ECU's generated startup code, integration documentation and module-specific requirements to determine the real sequence.
9. Timing, data ownership and integration
A correct architecture diagram does not guarantee correct runtime behavior. Data acquisition, communication and runnable scheduling must satisfy the ECU's timing and consistency requirements.
For a periodic sensor-processing runnable, document:
- Sampling trigger and conversion timing.
- Whether acquisition uses polling, interrupts or DMA.
- Data freshness and update ownership.
- Runnable activation period and execution deadline.
- Scaling, range checking and plausibility handling.
- Behavior when acquisition or communication fails.
- Synchronization and protection for shared data.
Measure end-to-end latency on the target ECU. Desktop simulation or successful code generation alone does not prove that target timing requirements are met.
10. Common integration and debugging scenarios
Case A: ADC value is always zero or remains unchanged
Possible checks:
- Confirm pin multiplexing and ADC channel configuration.
- Verify peripheral clock and driver initialization status.
- Check the conversion trigger and channel group configuration.
- Confirm the result buffer and notification mechanism.
- Inspect the physical input voltage with suitable measurement equipment.
- Check whether the application reads the correct result and data type.
Approach: Separate the investigation into hardware input, MCAL conversion, result transfer and application consumption. This helps identify the first boundary where the expected value disappears.
Case B: CAN frame is not transmitted
Possible checks:
- Confirm the application updates the intended data element.
- Check RTE connection and COM signal-to-I-PDU mapping.
- Verify COM transmission mode and triggering conditions.
- Check PduR routing and CanIf transmit-PDU mapping.
- Confirm CAN controller, hardware object and driver state.
- Check bus state, transceiver enable and physical connectivity.
Approach: Trace the transmit request through module boundaries. A correct application value does not prove that a configured I-PDU was triggered or routed.
Case C: CAN frame is visible but the receiving SWC reads an incorrect value
Possible checks:
- Raw payload bytes and CAN identifier.
- COM start bit, length, byte order and signedness.
- Scaling, offset and invalid value.
- PDU length and routing configuration.
- RTE connection and consumer runnable activation.
- Network database and generated configuration baseline.
Approach: Compare the raw bus payload with the configured signal decoding before changing application logic.
Case D: RTE generation or integration fails
Possible checks:
- Unconnected or incompatible ports.
- Missing interface or data-type references.
- Incorrect ECU allocation.
- Runnable-to-event mapping.
- Incompatible or incomplete configuration inputs.
Approach: Resolve the first model-level error, validate the relevant model and ECU configuration, then regenerate. Avoid patching generated RTE output to hide a source-model issue.
Case E: ECU startup stops before application execution
Possible checks:
- Reset cause and startup code.
- MCU clock and memory setup.
- MCAL driver initialization result.
- BSW initialization dependency and error handling.
- OS startup, task configuration and protection errors.
- RTE initialization and ECU state transitions.
Approach: Use startup logs, debugger breakpoints and module status information to locate the last successful initialization boundary.
11. Practical integration and validation checklist
| Area | Verification question | Evidence |
|---|---|---|
| Hardware | Do pin, clock and peripheral settings match the target MCU and board? | Schematic, datasheet and configuration review |
| MCAL | Are drivers configured and initialized correctly? | Driver status, generated configuration and target test |
| ECU Abstraction | Are ECU-level devices accessed through the intended abstraction? | Architecture and integration review |
| BSW | Are module connections and parameters consistent? | Configuration validation and generation reports |
| RTE | Do generated APIs and connections match the SWC model? | RTE generation report and compile results |
| OS | Are runnables mapped to the intended tasks and events? | OS configuration and timing measurements |
| Communication | Do transmit and receive paths behave as specified? | Bus trace and module-level diagnostics |
| Application | Are scaling, plausibility and failure reactions correct? | Unit and integration test results |
| Target | Does end-to-end behavior meet timing and functional requirements? | ECU test report |
12. Common misconceptions
“BSW and MCAL are separate peer layers.”
MCAL is part of BSW.
“RTE is the operating system.”
RTE connects SWCs and configured BSW functionality. The OS is a BSW service.
“MCAL contains the complete CAN communication stack.”
MCAL provides access to the microcontroller CAN peripheral. Higher communication modules provide additional PDU routing and signal-processing functionality.
“Application software directly accesses every peripheral.”
The architecture provides abstraction interfaces. Project-specific complex drivers or approved extensions may be exceptions, but should be explicitly designed and controlled.
“Successful code generation proves the ECU is correct.”
Generation does not prove hardware behavior, timing, signal correctness or target integration. These require appropriate verification.
13. Interview questions and answers
1. What is BSW in AUTOSAR?
BSW is the standardized ECU software infrastructure that provides services, communication, memory, diagnostics and hardware-abstraction functionality.
2. What is the relationship between BSW and MCAL?
MCAL is the lowest standard BSW layer and provides interfaces to microcontroller internal peripherals.
3. What is the role of RTE?
RTE connects AUTOSAR SWCs to one another and to configured BSW functionality through generated interfaces.
4. Is RTE an operating system?
No. RTE provides communication and access mechanisms. The OS is a BSW service responsible for scheduling and related operating-system functions.
5. What is the difference between MCAL and ECU Abstraction?
MCAL abstracts microcontroller internal peripherals. ECU Abstraction hides selected ECU-specific device details from upper layers.
6. What is a Complex Driver?
It is used for hardware functionality or timing requirements that are not suitably covered by the standard abstraction in the project's architecture.
7. Name some common MCAL drivers.
ADC, CAN, DIO, SPI, PWM, ICU, GPT and Port, depending on the MCU and implementation.
8. Does the CAN MCAL driver pack application signals into CAN frames?
No. Signal and I-PDU processing is handled by higher communication modules such as COM, while CanIf and the CAN driver provide lower-layer CAN access.
9. What is the role of PduR?
PduR routes configured protocol data units between communication modules.
10. What is the difference between COM and CanIf?
COM handles signal and I-PDU-level communication services. CanIf provides an abstraction interface for CAN communication controllers and configured CAN PDUs.
11. Does MCAL determine the activation period of an application runnable?
No. Peripheral acquisition and application runnable scheduling are coordinated but separate configuration concerns. Runnable activation is associated with configured events and OS integration.
12. What would you check if an ADC value is always zero?
Check the physical input, pin configuration, ADC channel, clock, driver initialization, conversion trigger, result buffer and application read path.
13. What would you check if a CAN frame is visible but the SWC reads the wrong value?
Check raw payload, COM mapping, start bit, length, byte order, signedness, scaling, I-PDU routing and RTE connection.
14. Why is target timing measurement important?
Because successful generation or desktop testing does not prove that peripheral acquisition, communication and runnable execution meet ECU timing requirements.
14. Key takeaways
- BSW provides the ECU's standardized software infrastructure.
- RTE connects SWCs to one another and to configured BSW functionality.
- MCAL is part of BSW and abstracts microcontroller internal peripherals.
- ECU Abstraction and Complex Drivers address different hardware-integration needs.
- COM, PduR, CanIf and the CAN MCAL driver have distinct responsibilities in a typical CAN communication stack.
- Peripheral acquisition and application runnable scheduling must be coordinated but are not the same function.
- Configuration and generated code must be verified through integration and target testing.
Related AUTOSAR topics
- Classic vs Adaptive AUTOSAR: Architecture, Execution Models and Engineering Differences
- AUTOSAR Configuration Explained
- AUTOSAR COM, PduR and DCM Explained
References and release guidance
AUTOSAR specifications are release-specific. The official AUTOSAR website lists platform releases and related specifications. A production project may use an earlier release or a supplier-supported baseline. Always use the release, module specifications and toolchain agreed for the ECU project.
Engineering note: This article explains architecture and typical integration paths. Exact module behavior, configuration parameters, generated interfaces and supported combinations must be checked against the project's selected AUTOSAR release and the supplier's implementation documentation.
