AUTOSAR LayeredSoftwareArchitecture
AUTOSAR LayeredSoftwareArchitecture
- AUTOSAR Confidential -
Document ID 053 Layered Software Architecture
V2.4.0
R3.2 Rev 3
Document Information
Document Information
Document Information
Disclaimer
Disclaimer
This specification and the material contained in it, as released by AUTOSAR is for the purpose of information only. AUTOSAR
and the companies that have contributed to it shall not be liable for any use of the specification.
The material contained in this specification is protected by copyright and other types of Intellectual Property Rights. The
commercial exploitation of the material contained in this specification requires a license to such Intellectual Property Rights.
This specification may be utilized or reproduced without any modification, in any form or by any means, for informational
purposes only.
For any other purpose, no part of the specification may be utilized or reproduced, in any form or by any means, without
permission in writing from the publisher.
The AUTOSAR specifications have been developed for automotive applications only. They have neither been developed, nor
tested for non-automotive applications.
The word AUTOSAR and the AUTOSAR logo are registered trademarks.
ID: 00 – Overview
Overview
This document does not contain requirements. It is a document summarizing architectural decisions and discussions of AUTOSAR.
The examples given are not meant to be complete in all respects.
This document focuses on static views of a conceptual layered software architecture. This document does not specify a structural
software architecture with detailed static and dynamic interface descriptions. This is included in the specifications of the basic
software modules.
The functionality and requirements of the Basic Software modules are specified in the module specific requirement and specification
documents.
In Scope:
Automotive ECUs having the following properties:
Strong interaction with hardware (sensors and actuators)
Connection to vehicle network via CAN, LIN or FlexRay
Microcontrollers from 16 to 32 bit with limited resources of Flash and RAM (compared with Enterprise Solutions)
Real Time Operating System
Program execution from internal or external flash memory
Not in scope:
High end embedded applications like HMI Head Unit with High end Operating Systems like WinCE, VxWorks, QNX
containing
Middleware concepts like OSGI, CORBA
Graphics library
Java Virtual Machine
E-Mail client
Communication systems like Bluetooth, USB, Ethernet
Communication protocols like TCP/IP
Flash file system
Dynamic linking and loading of software
Multi processor support in terms of dynamic load balancing
Extensibility:
This SW Architecture is a generic approach. Modules can be added or existing ones can be extended in functionality, but their
configuration has to be considered in the automatic Basic SW configuration process!
Complex drivers can easily be added
Further Layers cannot be added
Interface
AUTOSAR Runtime Environment (RTE)
Standard
Standardized
Software Standardized Standardized AUTOSAR AUTOSAR
AUTOSAR
Interface Interface Interface Interface
Interface
API 2
VFB & RTE ECU
Services Communication
relevant Abstraction
relevant Complex
Operating
Device
System
API 0 Drivers
Standardized
API 3 Private
Interface
Interfaces inside Basic Software Microcontroller
Basic Software
possible Abstraction
ECU-Hardware
Note: This figure is incomplete with respect to the possible interactions between the layers. Please refer to slide ID 04-003 for additional details.
Page 12 - AUTOSAR Confidential -
Document ID 053 Layered Software Architecture
V2.4.0
R3.2 Rev 3
Part 2 – Overview of Software Layers
ID: 02-02 Layered View: Coarse
Application Layer
Services Layer
Complex
ECU Abstraction Layer Drivers
Microcontroller
Application Layer
Microcontroller
The Microcontroller Abstraction Layer is the lowest software layer of the Basic Software.
It contains internal drivers, which are software modules with direct access to the µC internal peripherals and memory mapped µC
external devices.
Task:
Make higher software layers independent of µC
Properties:
Implementation: µC dependent
Upper Interface: standardizable and µC independent
Application Layer
RTE
Co
mpl
ECU Abstraction Layer ex
Driv
ers
Microcontroller Abstraction Layer
Microcontroller
The ECU Abstraction Layer interfaces the drivers of the Microcontroller Abstraction Layer. It also contains drivers for external
devices.
It offers an API for access to peripherals and devices regardless of their location (µC internal/external) and their connection to the µC
(port pins, type of interface)
Task:
Make higher software layers independent of ECU hardware layout
Properties:
Implementation: µC independent, ECU hardware dependent
Upper Interface: µC and ECU hardware independent, dependent on signal type
Application Layer
RTE
Co
mpl
ECU
ECU Abstraction
Abstraction Layer
Layer ex
Driv
ers
Microcontroller Abstraction Layer
Microcontroller
The Services Layer is the highest layer of the Basic Software which also applies for its relevance for the application software: while
access to I/O signals is covered by the ECU Abstraction Layer, the Services Layer offers
Operating system functionality
Vehicle network communication and management services
Memory services (NVRAM management)
Diagnostic Services (including UDS communication, error memory and fault treatment)
ECU state management, mode management
Task:
Provide basic services for application and basic software modules.
Properties:
Implementation: partly µC, ECU hardware and application specific
Upper Interface: µC and ECU hardware independent
Application Layer
RTE
Services Layer
Co
mpl
ECUECU Abstraction
Abstraction Layer
Layer ex
Driv
ers
Microcontroller Abstraction Layer
Microcontroller
The RTE is a layer providing communication services to the application software (AUTOSAR Software Components and/or
AUTOSAR Sensor/Actuator components).
Above the RTE the software architecture style changes from “layered“ to “component style“. The AUTOSAR Software Components
communicate with other components (inter and/or intra ECU) and/or services via the RTE.
Task:
Make AUTOSAR Software Components independent from the mapping to a specific ECU
Properties:
Implementation: ECU and application specific (generated individually for each ECU)
Upper Interface: completely ECU independent
Application Layer
Services Layer
Co
mpl
ECUECU Abstraction
Abstraction Layer
Layer ex
Driv
ers
Microcontroller Abstraction Layer
Microcontroller
The Basic Software can be subdivided into the following types of services:
Input/Output (I/O)
Standardized access to sensors, actuators and ECU onboard peripherals
Memory
Standardized access to internal/external memory (non volatile memory)
Communication
Standardized access to: vehicle network systems, ECU onboard communication systems and ECU internal SW
System
Provision of standardisable (operating system, timers, error memory) and ECU specific (ECU state management,
watchdog manager) services and library functions
Driver
A driver contains the functionality to control and access an internal or an external device.
Internal devices are located inside the microcontroller. Examples for internal devices are
Internal EEPROM
Internal CAN controller
Internal ADC
A driver for an internal device is called internal driver and is located in the Microcontroller Abstraction Layer.
External devices are located on the ECU hardware outside the microcontroller. Examples for external devices are
External EEPROM
External watchdog
External flash
A driver for an external device is called external driver and is located in the ECU Abstraction Layer. It accesses the external device via
drivers of the Microcontroller Abstraction Layer.
Example: a driver for an external EEPROM with SPI interface accesses the external EEPROM via the SPIHandlerDriver.
Exception:
The drivers for memory mapped external devices (e.g. external flash memory) may access the microcontroller directly. Those external
drivers are located in the Microcontroller Abstraction Layer because they are microcontroller dependent.
Interface
An Interface contains the functionality to abstract the hardware realization of a specific device for upper layers. It provides a generic
API to access a specific type of device independent on the number of existing devices of that type and independent on the hardware
realization of the different devices.
Example: an interface for a CAN communication system provides a generic API to access CAN communication networks independent
on the number of CAN Controllers within an ECU and independent of the hardware realization (on chip, off chip).
Handler
A handler is a specific interface which controls the concurrent, multiple and asynchronous access of one or multiple clients to one or
more drivers. I.e. it performs buffering, queuing, arbitration, multiplexing.
Handler functionality is often incorporated in the driver or interface (e.g. SPIHandlerDriver, ADC Driver).
Besides handler functionality, a manager can evaluate and change or adapt the content of the data.
Example: The NVRAM manager manages the concurrent access to internal and/or external memory devices like flash and
EEPROM memory. It also performs management of RAM mirrors, redundant, distributed and reliable data storage, data
checking, provision of default values etc. For details refer to the AUTOSAR requirements documents.
Communication Drivers
Drivers for ECU onboard (e.g. SPI) and vehicle communication (e.g. CAN). OSI-Layer: Part of Data Link Layer
I/O Drivers
Drivers for analog and digital I/O (e.g. ADC, PWM, DIO)
Memory Drivers
Drivers for on-chip memory devices (e.g. internal Flash, internal EEPROM) and memory mapped external memory devices (e.g.
external Flash)
Microcontroller Drivers
Drivers for internal peripherals (e.g. Watchdog, General Purpose Timer)
Group of
Functions with direct µC access (e.g. Core test) Software
modules of
Microcontroller Drivers Memory Drivers Communication Drivers I/O Drivers
internal EEPROM Driver similar type
internal Flash Driver
SPIHandlerDriver
Watchdog Driver
FlexRay Driver
PORT Driver
PWM Driver
MCU Driver
CAN Driver
ADC Driver
GPT Driver
DIO Driver
ICU Driver
LIN Driver
RAM Test
Core Test
Software
module
internal
Clock Unit
EEPROM
peripheral
Power &
FLASH
LIN or
PWM
CCU
WDT
MCU
CAN
ADC
GPT
DIO
SCI
SPI
Microcontroller device
A Complex Driver is a module which implements non-standardized functionality within the basic software stack.
An example is to implement complex sensor evaluation and actuator control with direct access to the µC using specific interrupts
and/or complex µC peripherals (like PCP, TPU), e.g.
Injection control
Electric valve control
Example:
Incremental position detection
Complex Drivers
Task:
Fulfill the special functional and timing requirements for handling complex
sensors and actuators
Properties:
Injection Control
Application Layer
Complex Drivers
e.g. CCU
e.g. PCP
e.g. TPU
Memory Drivers
Drivers cation Drivers Drivers
µC
Microcontroller (µC)
The Communication Hardware Abstraction is a group of modules which abstracts from the location of communication controllers
and the ECU hardware layout. For all communication systems a specific Communication Hardware Abstraction is required (e.g. for
LIN, CAN, FlexRay).
Example: An ECU has a microcontroller with 2 internal CAN channels and an additional on-board ASIC with 4 CAN controllers. The
CAN-ASIC is connected to the microcontroller via SPI.
The communication drivers are accessed via bus specific interfaces (e.g. CAN Interface).
Task:
Provide equal mechanisms to access a bus channel regardless of it‘s location
(on-chip / on-board)
Example:
Properties:
Implementation: µC independent, ECU hardware dependent and external device Communication Hardware Abstraction
dependent
CAN Interface
Upper Interface: bus dependent, µC and ECU hardware independent
CAN
Trans- Driver for ext.
Application Layer ceiver CAN ASIC
Driver
SPIHandler
CAN Driver
DIO Driver
Driver
Complex Drivers
I/O HW
Abstraction
COM HW
Abstraction
CAN
DIO
SPI
µC
Microcontroller (µC)
The SPIHandlerDriver allows concurrent access of several clients to one or more SPI busses.
To abstract all features of a SPI microcontroller pins dedicated to Chip Select, those shall directly be handled by the SPIHandlerDriver.
That means those pins shall not be available in DIO Driver.
Example:
External
External Driver for ext. Driver for ext.
EEPROM
Watchdog Driver ADC ASIC I/O ASIC
Driver
Communication Drivers
SPIHandlerDriver
µC SPI
The I/O Hardware Abstraction is a group of modules which abstracts from the location of peripheral I/O devices (on-chip or on-
board) and the ECU hardware layout (e.g. µC pin connections and signal level inversions). The I/O Hardware Abstraction does not
abstract from the sensors/actuators!
The different I/O devices are accessed via an I/O signal interface.
Task:
Represent I/O signals as they are connected to the ECU hardware (e.g. current, voltage, frequency).
Hide ECU hardware and layout properties from higher software layers.
Properties:
Example:
Implementation: µC independent, ECU hardware dependent
Upper Interface: µC and ECU hardware independent, dependent on signal type I/O Hardware Abstraction
specified and implemented according to AUTOSAR I/O Signal Interface
(AUTOSAR interface)
Driver for ext. Driver for ext.
ADC ASIC I/O ASIC
Application Layer
SPIHandler
ADC Driver
DIO Driver
Driver
Complex Drivers
I/O HW
Abstraction
ADC
DIO
SPI
µC
Microcontroller (µC)
The Memory Hardware Abstraction is a group of modules which abstracts from the location of peripheral memory devices (on-chip
or on-board) and the ECU hardware layout.
Example: on-chip EEPROM and external EEPROM devices should be accessible via an equal mechanism.
The memory drivers are accessed via memory specific abstraction/emulation modules (e.g. EEPROM Abstraction).
By emulating an EEPROM abstraction on top of Flash hardware units a common access via Memory Abstraction Interface to both
types of hardware is enabled.
Example:
Task:
Memory Hardware Abstraction
Provide equal mechanisms to access internal (on-chip) and external (on-board)
memory devices and type of memory hardware (EEPROM, Flash).
Memory Abstraction Interface
Properties: Flash
Implementation: µC independent, external device dependent EEPROM Abstraction EEPROM
Emulation
Upper Interface: µC, ECU hardware and memory device independent
External
Driver
Flash
External
EEPROM Driver
Application Layer
Flash Driver
SPIHandler
EEPROM
Internal
Driver
Driver
Complex Drivers
I/O HW
Abstraction
Memory HW COM HW
Abstraction Abstraction
EEPROM
Memory Drivers
Drivers cation Drivers Drivers
Flash
SPI
µC
Microcontroller (µC)
The Onboard Device Abstraction contains drivers for ECU onboard devices which cannot be seen as sensors or actuators like
internal or external watchdogs. Those drivers access the ECU onboard devices via the µC Abstraction Layer.
Task:
Abstract from ECU specific onboard devices.
Properties:
Implementation: µC independent, external device dependent
Upper Interface: µC independent, partly ECU hardware dependent
Example:
Watchdog Interface
External
Application Layer Watchdog Driver
SPIHandler
watchdog
internal
Driver
driver
Complex Drivers
I/O HW
Abstraction
Onboard Dev. Memory HW COM HW
Abstraction Abstraction Abstraction
Wdg
SPI
µC
Microcontroller (µC)
The Communication Services are a group of modules for vehicle network communication (CAN, LIN and FlexRay). They are
interfacing with the communication drivers via the communication hardware abstraction.
Task:
1. Provide a uniform interface to the vehicle network for communication.
2. Provide uniform services for network management
3. Provide uniform interface to the vehicle network for diagnostic communication
4. Hide protocol and message properties from the application.
Properties:
Implementation: µC and ECU HW independent, partly dependent on bus type
Upper Interface: µC, ECU hardware and bus type independent
The communication services will be detailed for each relevant vehicle network system on the following pages.
Communication Services
Microcontroller (µC) Color code: Bus specific modules are marked gray.
The CAN Communication Services are a group of modules for vehicle network Communication Services
communication with the communication system CAN.
DCM Generic NM
Task: Interface
AUTOSAR Diagnostic
Provide a uniform interface to the CAN network. Hide protocol and message COM Com.
properties from the application. Manager
CAN
Properties: State
Manager
Implementation: µC and ECU HW independent, partly dependent on CAN. PDU Router
AUTOSAR COM, Generic NM Interface and Diagnostic Communication Manager IPDU CAN NM
are the same for all vehicle network systems and exist as one instance per ECU. multi-
Generic NM Interface contains only a dispatcher. No further functionality is plexer CAN Transport
included. In case of gateway ECUs it is replaced by the NM GW which in addition Protocol
provides the functionality to synchronize multiple different networks (of the same
or different types) to synchronously wake them up or shut them down. Communication Hardware Abstraction
CAN Generic NM is specific for CAN networks and will be instantiated per CAN
vehicle network system. CAN Generic NM interface with CAN via underlying CAN Interface
network adapter (CAN NM).
The communication system specific Can State Manager handles the CAN Transceiver Driver for ext.
communication system dependent Start-up and Shutdown features. Furthermore Driver CAN ASIC
it controls the different options of COM to send PDUs and to monitor signal
timeouts.
I/O Drivers Communication Drivers
A signal gateway is part of AUTOSAR COM to route signals.
PDU based Gateway is part of PDU router. SPIHandler
DIO Driver CAN Driver
IPDU multiplexing provides the possibility to add information to enable the Driver
multiplexing of I-PDUs (different contents but same IDs).
Upper Interface: µC, ECU hardware and network type independent (goal)
For refinement of GW architecture please refer to slide 04-050. SPI µC CAN
External
CAN Controller
Task:
DCM
Provide a uniform interface to the LIN network. Hide protocol and message properties from AUTOSAR Diagnostic
the application. COM Com.
Manager
Properties: LIN State
Manager
The LIN Communication Services contain:
A LIN 2.0 compliant communication stack with
Schedule table manager for transmitting LIN frames and to handle requests to switch to PDU Router
other schedule tables.
Transport protocol, used for diagnostics
A WakeUp and Sleep Interface
An underlying LIN Driver: Communication Hardware Abstraction
• implementing the LIN protocol and adaptation the specific hardware
• Supporting both simple UART and complex frame based LIN hardware
LIN Interface
Note: Integration of LIN into AUTOSAR:
(„LIN Master Communication Stack“)
The scheduler manager and its interfaces are used to decide the point of time to send a
LIN frame.
Lin Interface controls the WakeUp/Sleep API and allows the slaves to keep the bus awake
(decentralized approach).
Communication Drivers
The PDU router accesses the LIN Interface on PDU-Level, not on signal level.
The communication system specific LIN State Manager handles the communication
LIN Driver
dependent Start-up and Shutdown features. Furthermore it controls the communication
mode requests from the Communication Manager. The LIN state manager also controls
the I-PDU groups by interfacing COM.
When sending a LIN frame, the LIN Interface requests the data for the frame (I-PDU) from SCI µC
the PDU Router at the point in time when it requires the data (i.e. after sending the LIN
frame header).
The FlexRay Communication Services are a group of modules for vehicle Communication Services
network communication with the communication system FlexRay.
Generic
Task: DCM NM
AUTOSAR Diagnostic Interface
Provide a uniform interface to the FlexRay network. Hide protocol and COM Com.
message properties from the application. Manager
FlexRay
Properties: State
Implementation: µC and ECU HW independent, partly dependent on Manager
PDU Router FlexRay
FlexRay. IPDU NM
AUTOSAR COM, Generic NM Interface and Diagnostic Communication multi-
plexer FlexRay
Manager are the same for all vehicle network systems and exist as one Transport
instance per ECU. Protocol
Generic NM Interface contains only a dispatcher. No further
functionality is included. In case of gateway ECUs, it is replaced by the Communication Hardware Abstraction
NM GW which in addition provides the functionality to synchronize
multiple different networks (of the same or different types) to FlexRay Interface
synchronously wake them up or shut them down.
FlexRay NM is specific for FlexRay networks and will be instantiated Driver for FlexRay Driver for external
per FlexRay vehicle network system. Transceiver FlexRay Controller
The communication system specific FlexRay State Manager handles
the communication system dependent Start-up and Shutdown features. I/O Drivers Communication Drivers
Furthermore it controls the different options of COM to send PDUs and
to monitor signal timeouts.
A signal Gateway is part of AUTOSAR COM to route signals. DIO Driver SPIHandlerDriver Driver for internal FlexRay Controller
PDU based Gateway is part of PDU Router.
IPDU multiplexing provides the possibility to add information to enable
the multiplexing of I-PDUs (different contents but same IDs).
Host µC Internal FlexRay Controller
LIN Slaves usually are „intelligent“ actuators and slaves that are seen as black boxes. As they provide very little hardware capabilities
and resources it is not intended to shift AUTOSAR SW Components on LIN Slaves.
LIN Slave ECUs can be integrated into the AUTOSAR VFB using their Node Capability Descriptions. They are seen as non-
AUTOSAR ECUs. Please reference to the VFB specification.
That means: LIN Slaves can be connected as complete ECUs. But they are not forced to use the AUTOSAR SW Architecture.
Perhaps they can use some standard AUTOSAR modules (like EEPROM, DIO).
Reason: LIN slaves usually have very limited memory resources or are ASICs with „hard-coded“ logic.
Communication Drivers
LIN Communication
Stack
µC SCI
The Memory Services consist of one module, the NVRAM Manager. It is responsible for the management of non volatile data
(read/write from different memory drivers). The application expects a RAM mirror as data interface for fast read access.
Task: Provide non volatile data to the application in a uniform way. Abstract from memory locations and properties. Provide
mechanisms for non volatile data management like saving, loading, checksum protection and verification, reliable storage etc.
Properties:
Implementation: µC and ECU hardware independent, highly configurable
Upper Interface: µC and ECU hardware independent
specified and implemented according to AUTOSAR
(AUTOSAR interface)
Example:
Memory Services
Application Layer
NVRAM Manager
Memory Communi-
Services cation Services
Complex Drivers
I/O HW
Abstraction
Onboard Dev. Memory HW COM HW
Abstraction Abstraction Abstraction
Microcontroller (µC)
The System Services are a group of modules and functions which can be used by modules of all layers. Examples are Real Time
Operating System (which includes timer services), Error Manager.
Some of these services are µC dependent (like OS), partly ECU hardware and application dependent (like ECU State Manager) or
hardware and µC independent.
Task:
Example:
Provide basic services for application and
basic software modules. System Services
Watchdog Manager
Development Error
Function Inhibition
Properties:
Diagnostic Event
Communication
Implementation: partly µC, ECU hardware and
Manager
Manager
Manager
Tracer
DEM
FIM
application specific
Upper Interface: µC and ECU hardware independent
AUTOSAR OS
Application Layer
BSW Scheduler
Memory Communi-
System Services
Services cation Services
Complex Drivers
I/O HW
Abstraction
Onboard Dev. Memory HW COM HW
Abstraction Abstraction Abstraction
Microcontroller (µC)
The Sensor/Actuator AUTOSAR Software Component is a specific type of AUTOSAR Software Component for sensor evaluation
and actuator control. Though not belonging to the AUTOSAR Basic Software, it is described here due to its strong relationship to local
signals. It has been decided to locate the Sensor/Actuator SW Components above the RTE for integration reasons (standardized
interface implementation and interface description). Because of their strong interaction with raw local signals, relocatability is restricted.
Tasks and interfaces are similar to that of a Complex Driver. Examples of tasks of a Sensor/Actuator Component are switch
debouncing, battery voltage monitoring, DC motor control, lamp control etc.
Task:
Abstract from the specific physical properties of sensors
and actuators.
Example:
Properties:
Implementation: µC and ECU HW independent, Application Layer
sensor and actuator dependent
Actuator Sensor
Software Software
Application Layer Component Component
RTE
RTE
Memory Communi-
System Services
Services cation Services
Complex Drivers
I/O HW
Abstraction Basic Software
Onboard Dev. Memory HW COM HW
Abstraction Abstraction Abstraction Interfaces to (e.g.)
• I/O HW Abstraction (access to I/O signals)
Micro-controller Communi- I/O • Memory Services (access to calibration data)
Memory Drivers
Drivers cation Drivers Drivers • System Services (access to Error Manager)
Microcontroller (µC)
Part 4 – Interfaces
4.1 General Rules
• Services Layer: horizontal interfaces are allowed • One Layer may access all interfaces of the SW layer below
Example: Error Manager saves fault data using the
NVRAM manager
• Bypassing of one software layer should be avoided
• ECU Abstraction Layer: horizontal interfaces are allowed
• Bypassing of two or more software layers is not allowed
• A complex driver may use selected other BSW modules
• Bypassing of the µC Abstraction Layer is not allowed
• µC Abstraction Layer: horizontal interfaces are not
allowed. Exception: configurable notifications are allowed
due to performance reasons.
• A module may access a lower layer module of another
layer group (e.g. SPI for external hardware)
AUTOSAR AUTOSAR AUTOSAR AUTOSAR
SW Comp SW Comp SW Comp SW Comp
1 3 4 5
Microcontroller (µC)
This matrix shows the possible interactions between AUTOSAR Basic Software layers
Communication Services
Communication Drivers
Microcontroller Drivers
Example: “I/O Drivers are allowed uses
to use System Services and
Memory Services
System Services
Complex Drivers
Memory Drivers
Hardware, but no other layers”.
I/O Drivers
(gray background indicates “non-Basic Software” layers)
This is only allowed if the Complex Driver offers an interface which can be generically configured by the
accessing AUTOSAR module.
A typical example is the PDU Router: a Complex Driver may implement the interface module of a new bus
system. This is already taken care of within the configuration of the PDU Router.
Again, this is only allowed if the respective modules of the layered software architecture offer the interfaces,
and are prepared to be accessed by a Complex Driver. Usually this means that
The respective interfaces are defined to be re-entrant.
If call back routines are used, the names are configurable
No upper module exists which does a management of states of the module (parallel access would change
states without being noticed by the upper module)
Part 4 – Interfaces
4.2 Interaction of Layers – Example “Memory”
This example shows how the NVRAM Manager and the Watchdog
System Services Memory Services
Manager interact with drivers on an assumed hardware
configuration: Watchdog NVRAM
Manager Manager
The ECU hardware includes an external EEPROM and an external
watchdog connected to the microcontroller via the same SPI. MemIf_Read()
WdgIf_Trigger() MemIf_Write()
The SPIHandlerDriver controls the concurrent access to the SPI Onboard Device Memory Hardware Abstraction
hardware and has to give the watchdog access a higher priority than Abstraction
Memory Abstraction Interface
the EEPROM access.
Watchdog Interface
Fee_Read()
The microcontroller includes also an internal flash which is used in EEPROM Fee_Write()
Wdg_Trigger() Abstraction
parallel to the external EEPROM. The EEPROM Abstraction and the Flash EEPROM
Flash EEPROM Emulation have an API that is semantically Emulation
identical. External External
Watchdog Driver EEPROM Driver
The Memory Abstraction Interface can be realized in the following Spi_ReadIB() Fls_Read()
ways: Spi_WriteIB() Fls_Write()
CS SPI CS SPI
External External
Watchdog EEPROM
Interface Description
The Memory Abstraction Interface could have the following interface MemIf_Write(
(e.g. for the write function): DeviceIndex,
BlockNumber,
DataBufferPtr)
Std_ReturnType MemIf_Write
( Memory Hardware Abstraction
uint8 DeviceIndex,
uint16 BlockNumber, Memory Abstraction Interface
uint8 *DataBufferPtr Ea_Write( Fee_Write(
BlockNumber,
) BlockNumber,
DataBufferPtr)
DataBufferPtr)
Std_ReturnType Ea_Write
(
uint16 BlockNumber,
uint8 *DataBufferPtr
)
File MemIf.h:
#include “Ea.h“ /* for providing access to the EEPROM Abstraction */
...
File MemIf.c:
Does not exist
Result:
No additional code at runtime, the NVRAM Manager virtually accesses the EEPROM Abstraction or the Flash Emulation directly.
File MemIf.h:
File MemIf.c:
#include “Ea.h“ /* for getting the API function addresses */
#include “Fee.h“ /* for getting the API function addresses */
#include “MemIf.h“ /* for getting the WriteFctPtrType */
Result:
The same code and runtime is needed as if the function pointer tables would be inside the NVRAM Manager.
The Memory Abstraction Interface causes no overhead.
Conclusions:
The Memory Abstraction Interface eases the access of the NVRAM Manager to one or more EEPROM and Flash devices
Part 4 – Interfaces
4.3 Interaction of Layers – Example “Communication”
PDU
PDU is the abbreviation of “Protocol Data Unit”. The PDU contains
SDU and PCI.
On the transmission side the PDU is passed from the upper layer TP
PCI data structure SDU
to the lower layer, which interprets this PDU as its SDU.
PCI data structure PDU
CAN IF
For PDU:
<bus prefix> <layer prefix> - PDU
For SDU
<bus prefix> <layer prefix> - SDU
The bus prefix and layer prefix are described in the following table:
ISO Layer Layer AUTOSAR PDU CAN prefix LIN prefix FlexRay prefix
Prefix Modules Name
Layer 6: I COM, DCM I-PDU N/A
Presentation
I PDU router, I-PDU N/A
(Interaction) PDU multiplexer
1 The Interface between PduR and Tp differs significantly compared to the interface between PduR and the Ifs.
In case of TP involvement a handshake mechanism is implemented allowing the transmission of I-Pdus > Frame size.
Note: This image is not complete with respect to all internal communication paths.
Page 55 - AUTOSAR Confidential -
Document ID 053 Layered Software Architecture
V2.4.0
R3.2 Rev 3
Part 4 – Interfaces
4.4 Interaction of Layers –
Example “ECU State Manager”
RTE
Request/release
Post build selectable Configuration tables Service Layer (except communication stack) Communication Services
RUN
1 DEM
2 ComM
3 WdgM
Report Error
DEM
Store Errors
ComM
WdgM Watchdog Manager
…
Communication Manager
restricted areas
and access
This figure does not show all interactions between all modules. It is a discussion base only.
Part 5 – Configuration
2. Link time
Constant data outside the module; the data can be configured after the module has been compiled
In many cases, the configuration parameters of one module will be of different configuration classes.
Example: a module providing post build time configuration parameters will still have some parameters that are pre compile time
configurable.
Use cases
Pre compile time configuration would be chosen for
Enabling/disabling optional functionality
This allows to exclude parts of the source code that are not needed
Optimization of performance and code size
Using #defines results in most cases in more efficient code than access to constants or even access to constants via
pointers.
Generated code avoids code and runtime overhead.
Restrictions
The module must be available as source code
The configuration is static. To change the configuration, the module has to be recompiled
Required implementation
Pre compile time configuration shall be done via the module‘s two configuration files (*_Cfg.h, *_Cfg.c) and/or by code generation:
• *_Cfg.h stores e.g. macros and/or #defines
• *_Cfg.c stores e.g. constants
Nm_Cfg.c Nm_Cfg.h
uses includes
(optional)
Nm.c
File Spi_Cfg.c:
const uint8 myconstant = 1;
#define Dem_FLS_E_ERASE_FAILED 1U
#define Dem_FLS_E_WRITE_FAILED 2U
#define Dem_FLS_E_READ_FAILED 3U
#define Dem_FLS_E_UNEXPECTED_FLASH_ID 4U
#define Dem_NVM_E_REQ_FAILED 5U
#define Dem_CANSM_E_BUSOFF_NETWORK_5 6U
...
File Dem.h:
#include "Dem_Cfg.h" /* for providing access to event symbols */
Dem_ReportErrorStatus(Dem_NVM_E_REQ_FAILED, DEM_EVENT_STATUS_PASSED);
Use cases
Link time configuration would be chosen for
Configuration of modules that are only available as object code
(e.g. IP protection or warranty reasons)
Selection of configuration set after compilation but before linking.
Required implementation
1. One configuration set, no runtime selection
Configuration data shall be captured in external constants. These external constants are located in a separate file. The
module has direct access to these external constants.
Example 1: Event IDs reported to the DEM by a module (CAN Interface) that is available as object code only
XML configuration file of the CAN Interface:
Specifies that it needs the event symbol CANIF_E_INVALID_DLC for production error reporting.
#define Dem_FLS_E_UNEXPECTED_FLASH_ID 1U
#define Dem_NVM_E_REQ_FAILED 2U
#define Dem_CAN_E_TIMEOUT 3U
#define Dem_CANIF_E_INVALID_DLC 4U
...
File CanIf_Lcfg.c:
#include "Dem_Cfg.h" /* for providing access to event symbols */
Dem_ReportErrorStatus(CanIf_InvalidDlc, DEM_EVENT_STATUS_FAILED);
Note: the complete include file structure with all forward declarations is not shown here to keep the example simple.
Example 1: Event IDs reported to the DEM by a module (CAN Interface) that is available as object code only
Problem
Dem_EventIdType is also generated depending of the total number of event IDs on this ECU. In this example it is represented as
uint16. The Can Interface uses this type, but is only available as object code.
Solution
In the contract phase of the ECU development, a bunch of variable types (including Dem_EventIdType) have to be fixed and
distributed for each ECU. The object code suppliers have to use those types for their compilation and deliver the object code using
the correct types.
Use cases
Post build time configuration would be chosen for
Configuration of data where only the structure is defined but the contents not known during ECU build time
Configuration of data that is likely to change or has to be adapted after ECU build time
(e.g. end of line, during test & calibration)
Reusability of ECUs across different product lines (same code, different configuration data)
Restrictions
Implementation requires dereferencing which has impact on performance, code and data size
Required implementation
Required implementation 2: Configuration of CAN Driver that is available as object code only; multiple configuration sets
can be selected during initialization time.
File Can_PBcfg.c:
#include “Can.h” /* for getting Can_ConfigType */
const Can_ConfigType MySimpleCanConfig [2] =
{
{
Can_BitTiming = 0xDF,
Can_AcceptanceMask1 = 0xFFFFFFFF,
Can_AcceptanceMask2 = 0xFFFFFFFF,
Can_AcceptanceMask3 = 0x00034DFF,
Can_AcceptanceMask4 = 0x00FF0000
},
{
…
}
};
To allow the implementation of such different use cases in each BSW module for each module, up to 3 variants can be specified:
A variant is a dedicated assignment of the configuration parameters of a module to configuration classes
Within a variant a configuration parameter can be assigned to only ONE configuration class
Within a variant a configuration class for different configuration parameters can be different (e.g. Pre-Compile for development error
detection and post-build for reprogrammable PDU routing tables
It is possible and intended that specific configuration parameters are assigned to the same configuration class for all variants (e.g.
development error detection is in general pre-compile time configurable).
0x8000 &index[] (=0x8000) As before, the description where to find what is an overall agreement
FL 0x8000 &xx_configuration = 0x4710 1. The index contains more than one description (FL, FR,..) in an array
(here the size of an array element is agreed to be 8)
0x8002 &yy_configuration = 0x4720 2. There is an agreed variable containing the position of one description
0x8004 &zz_configuration = 0x4730 selector = CheckPinCombination()
3. Instead of passing the pointer directly there is one indirection:
…
(struct EcuM_ConfigType *) &index[selector];
FR 0x8008 &xx_configuration = 0x5000 4. Everything else works as in PBL
0x800a &yy_configuration = 0x5400
0x800c &zz_configuration = 0x5200
…
RL 0x8010 &xx_configuration = …
0x8012 &yy_configuration = …
0x8014 &zz_configuration = …
…
Part 6 – Scheduling
Centralize the BSW schedule in the BSW Scheduler implemented by the ECU/BSW integrator
Eases the integration task
Enables applying different scheduling strategies to schedulable objects
Preemptive, non-preemptive, ...
Enables applying different data consistency mechanisms
Enables reducing resources (e.g., minimize the number of tasks)
Zzz_MainFunction_Aaa
BSW Events
RecurringEvent
SporadicEvent
Triggers Yyy_MainFunction_Aaa
Main functions
Can be triggered in all layers by
RecurringEvents
SporadicEvents
Xxx_Isr_Yyy
Microcontroller
Transformation
Task1 {
Zzz_MainFunction_Bbb(); Zzz_MainFunction_Bbb();
Yyy_MainFunction_Aaa(); Yyy_MainFunction_Aaa();
Xxx_MainFunction_Aaa(); Xxx_MainFunction_Aaa();
...
}
Transformation
Task2 {
...
Xxx_MainFunction_Bbb();
Xxx_MainFunction_Bbb(); ...
}
Yyy_MainFunction_Bbb();
Task3 {
...
Yyy_MainFunction_Bbb();
...
}
Transformation
Xxx_Module
Xxx_MainFunction();
Yyy_ AccessResource();
resource
?
Yyy_MainFunction();
Yyy_Module
Transformation
Yyy_AccessResource() {
...
Task1 Xxx_Module SchM_Enter_xxx_(XYZ)
<access_to_shared_resource>
Xxx_MainFunction(); SchM_Exit_xxx(XYZ)
...
}
Yyy_ AccessResource();
Yyy_MainFunction() {
...
resource SchM_Enter_yyy_(XYZ)
<access_to_shared_resource>
SchM_Exit_yyy(XYZ)
Yyy_MainFunction(); ...
}
Task2
Transformation
Yyy_AccessResource() {
...
Task1 Xxx_Module SchM_Enter_xxx_(XYZ)
<access_to_shared_resource>
Xxx_MainFunction(); SchM_Exit_xxx(XYZ)
...
}
Yyy_ AccessResource();
Yyy_MainFunction() {
...
resource SchM_Enter_yyy_(XYZ)
<access_to_shared_resource>
SchM_Exit_yyy(XYZ)
Yyy_MainFunction(); ...
}
Task2
Transformation
Application Layer
COM
DCM
Function Inhibition
Diagnostic Event
Communication
NM If
Development
Error Tracer
BSW Mode
ECU State
Watchdog
Manager
Manager
Manager
Manager
Manager
Manager
NVRAM Manager
SM
I/O Signal Interface
PduR
IPDU NM
TP
Driver for Driver for
Onboard Device Memory Hardware Communication ext. ext.
AUTOSAR OS
SPIHandler
ADC Driver
GPT Driver
CAN Driver
DIO Driver
ICU Driver
Watchdog
LIN Driver
RAM Test
Core Test
EEPROM
FlexRay
internal
internal
PORT
Driver
Driver
Driver
Driver
Driver
Driver
Driver
PWM
Flash
Microcontroller
Application Layer
ComM
NM If
COM
DCM
DEM
FIM
WdgM NvM DET
PDU Router IPDUM
Transceiver
Transceiver
O
FlexRay
CAN
S CAN St Mgr FR St Mgr LIN St Mgr EA Fee
CAN CAN FR FR LIN
TP NM TP NM NM
Watchdog
RAM Test
Core Test
EEPROM
SPIHandl
FR Interface LIN Interface
erDriver
CAN Interface
PORT
Driver
Driver
Driver
Driver
Driver
Driver
Driver
Driver
Driver
Driver
PWM
Flash
MCU
ADC
GPT
DIO
ICU
CAN Driver FlexRay Driver LIN Driver
ECU Hardware
The clustering shown in this document is the one defined by the project so far. MOST is currently not included
AUTOSAR is currently not restricting the clustering on ICC2 level to dedicated
clusters as many different constraint and optimization criteria might lead to different
… ICC3 module ICC2 clusters
ICC2 clusterings. There might be different AUTOSAR ICC2 clusterings against which
compliancy can be stated based on a to be defined approach for ICC2 conformance.
Page 83 - AUTOSAR Confidential -
Document ID 053 Layered Software Architecture
V2.4.0
R3.2 Rev 3
Part 7 – Implementation Conformance Classes
ID: 07-003 ICC1
Application Layer
ECU Hardware
Types of errors
Software errors
Root cause: Wrong software or system design, because software itself can never fail.
Example 1: wrong API parameter (EEPROM target address out of range)
Example 2: Using not initialized data
System errors
Example 1: CAN receive buffer overflow
Example 2: time-out for receive messages
Development
Those errors shall be detected and fixed during development phase. In most cases, those errors are software errors. The
detection of errors that shall only occur during development can be switched off for production code (by static configuration
namely preprocessor switches).
Production / series
Those errors are hardware errors and software exceptions that cannot be avoided and are also expected to occur in production
code.
1. Development Errors
The detection and reporting can be statically switched on/off
There are several alternatives to report an error (detailed on the following slides):
Via API
Inform the caller about success/failure of an operation.
The Diagnostic Event Manager is a standard AUTOSAR module which is always available in production code and whose functionality
is specified within AUTOSAR.
The Development Error Tracer is just a help for SW development and integration and is not necessarily contained in the production
code. The API is specified within AUTOSAR, but the functionality can be chosen/implemented by the developer according to his
specific needs.
The detection and reporting of development errors to the Development Error Tracer can be statically switched on/off per module
(preprocessor switch or two different object code builds of the module).
Problem: the error IDs passed with this API have to be ECU wide defined, have to be statically defined and have to occupy a
compact range of values for efficiency reasons. Reason: The Diagnostic Event Manager uses this ID as index for accessing ROM
arrays.
Process:
1. Each BSW Module declares all production code relevant error variables it needs as “extern”
2. Each BSW Module stores all error variables that it needs in the ECU configuration description (e.g. NVM_E_REQ_FAILED)
3. The configuration tool of the Diagnostic Event Manager parses the ECU configuration description and generates a single file
with global constant variables that are expected by the SW modules (e.g. const Dem_EventIdType
Dem_NVM_E_REQ_FAILED=7; or #define Dem_NVM_E_REQ_FAILED ((Dem_EventIdType)7)
4. The reaction to the errors is also defined in the Error Manager configuration tool. This configuration is project specific.
InstanceId (uint8)
The Instance ID represents the identifier of an indexed based module starting from 0. If the module is a single instance module it
shall pass 0 as an instance ID.
ApiId (uint8)
The API-IDs are specified within the software specifications of the BSW modules. They can be #defines or constants defined in
the module starting with 0.
ErrorId (uint8)
The Error-IDs are specified within the software specifications of the BSW modules. They can be #defines defined in the module‘s
header file.
If there are more errors detected by a particular software module which are not specified within the AUTOSAR module software
specification, they have to be documented in the module documentation.
This is the logical view and allows for a reusable bus/ECU independent design.
VFC-Controller: Special SW-component that decides if the functions of a VFC are required at a given time
and requests or releases communication accordingly.
Partial Network Cluster (PNC): is a group of system signals necessary to support one or more vehicle
functions that are distributed across multiple ECUs in the vehicle network.
This represents the system view of mapping a group of buses to one ore more VFCs.
* All nodes connected to the slave buses are always activated. It is not possible only to activate a subset of the
nodes.
System Services
Communication Services ComM_UserRequest
BswM ComM
PNC states
Network
I-PDU GroupSwitch
PNC request/release Request Request
information ComMode
• Exchange PNC request / release COM NmIf
information between NM and
ComM via NM user data
• Enable / disable I-PDU-groups
Trigger Transmit
PduR CanNm CanSM