AUTOSAR Documentation
AUTOSAR Documentation
Layered Architecture
The major layers of AUTOSAR are:
Microcontroller
Service layer
Complex
ECU Abstraction layer device
drivers
(CDD)
Microcontroller Abstraction layer
(MCAL)
Microcontroller Abstraction Layer (MCAL): This layer consists of the drivers that
have direct access to the microcontroller, internal peripherals and memory mapped
microcontroller external devices. This layer is hardware specific and roots access to
registers of the controller. It is further classified into I/O drivers, Communication
(Comm) drivers, Memory drivers, MCU drivers, Crypto drivers and Wireless
communication drivers.
ECU Abstraction layer: This layer is a software interface to electrical values of specific
ECU to decouple higher level software from underlying hardware dependencies. It
provides interfaces to access all the features of an ECU like communication, memory, I/O
and so on. It is subdivided into I/O hardware abstraction, Comm hardware abstraction,
Wireless communication hardware abstraction, Crypto hardware abstraction, Memory
hardware abstraction and On-board Device Abstraction layer.
o Comm hardware abstraction layer: This layer provides equal mechanisms to
access a communication channel regardless of the location (on-chip or on-board).
o I/O hardware abstraction layer: This layer provides access to I/O drivers by
mapping I/O hardware abstraction ports to ECU signals.
o Memory hardware abstraction layer: abstracts from the location of peripheral
memory devices. Memory drivers are accessed via memory specific interfaces. It
provides equal mechanisms to access internal, on-chip and external on-board
memory devices.
o On-board Device Abstraction layer: It contains drivers for ECU on-board devices
which are not present on the chip. This layer is ECU specific.
o Crypto hardware abstraction layer: This module abstracts the crypto functionality
by hiding the information of the Crypto used (internal, external device or
software based).
Service layer: This layer provides independent interface of a MCU and ECU hardware to
application software. It is subdivided into:
o System services: This provides services related to Operation System (OS),
Interrupts, counters, safety control units, built-in self-test and so on. These
services are used by all layers but some services are microcontroller dependent.
o Memory services: These services are responsible for the management of non-
volatile read or write from different memory drivers. These provide non-volatile
data to the application software and also mechanisms for non-volatile data
management (saving, loading, checksum protection, etc.)
o Crypto services: These services play an important role in the security aspect and
prevent unauthorized access to the ECU data. It checks if data is from trusted
source or not and takes care of threats.
o Communication services: These services help establish communication
(application to application or system to system) and are responsible for vehicle
network management. Here, applications can be a part of other ECUs. It is
interfaced with communication drivers via the communication hardware
abstraction layer.
o Off board Communication Services: These services are responsible for vehicle to
outer client communication via a wireless network. It has three blocks used for
implementing different functionalities. This module provides a uniform interface
for Wireless Ethernet network by hiding protocol and message properties.
Complex device drivers: This is a special layer that fulfils functions and timing
requirements for handling complex sensors and actuators. It is used to create drivers for
hardware that is not supported by AUTOSAR. It is a part of BSW because these drivers
must interact with other general features.
AUTOSAR INTERFACES
1. AUTOSAR interface: It is a generic interface derived from configurations provided by the RTE
and serve as an interface between the various application software or application software and
base software. For example, application software can read or write data via these interfaces.
2. Standardized AUTOSAR interface: It is pre-defined by AUTOSAR standards used by application
software for access to AUTOSAR services provided by the BSW modules, like ECU state
manager etc.
3. Standardized interface: It is pre-defined by AUTOSAR standard as an API in C language. It is
utilized between BSW modules or between RTE and BSW modules.
Software Component (SC)
SC is organized in self-contained units called Atomic Software Component Types (ASCT).
ASCT represents functional implementation of applications. These small components together
form the functional implementation of software. Software components are classified as:
Solution:
ASW
Sensor Application NV Block Parameter
Actuator SWC SWC SWC
SWC
RTE
Microcontroller
a. ECU Abstraction SWC: reads corresponding I/O pin and calculates the count information
of pulses that speed sensor provides.
b. Sensor/Actuator SWC: interacts with the ECU Abstraction layer and gets sensor pulses.
Calculates the speed based on sensor input. This component can be programmed to
calculate speed in different units (km, m), that can be further used by application SWC.
c. Application SWC: performs core logic of requirement that is to cut off engine when it
crosses a particular speed. It gets the calculated speed from sensor/actuator SWC and
does further processing.
d. Parameter SWC: for core calculations, we need calibration parameter which is required
by the application side to decide high speed cut off value. This block provides the
calibration parameter to the application SWC.
e. CDD: since requirement mentions that the injection must be cut-off immediately, there
should be no delay in this operation. CDD takes the cut-off command from the
application SWC and sets the corresponding I/O pins of controller to cut-off injection
immediately.
f. Diagnostic manager: comes as part of BSW development. Application component will be
connected to this service component and in case an error occurs, application component
can pass on the information to the service component. This error entry is taken care by
the BSW diagnostic manager.
g. NV Block SWC: This application software calculates the maximum speed and stores in
NVM. A NV Block is created for this application and this gets data from application
SWC and passes on to the NVM Manager of BSW. To save data, ECU has external flash
IC which will be handled in the BSW layer like the memory abstraction layer. During
startup, NVM handles storing saved data from the external memory and passes it on to
ASW layer using NV block component.
P-port R -port
b. Client server interface (CSI): used to communicate or access services from other
components. If a particular component has a function and this has to be called from other SW
component, then CSI can be used. The component that owns the function will be called the
server and this will have the provider port. The caller or user to the function on another
component will be the client and will have a receiver port.
U
P-port R-port
SWC-1 SWC-2
SWC-4 SWC-3
a. From the configuration site, first create SRI and specify the data to be communicated in the
variable data prototype.
b. Additional properties like units, computational methods can be provided from the application
primitive or application record data type with SRI.
c. Multiple data can be sent on the same port. We can specify multiple variable prototype in the
same SRI.
d. Then create port on the component and link this created SRI to it. This completes the SR
configuration and port linking.
SWC-1 U SWC-2
- Configuring a CSI: a) Create a CSI and a CS operation inside the interface which creates a
server operation. The server operation must contain the arguments definition with the
direction of the argument like IN, OUT or INOUT.
- We can mention multiple CS operation with a CSI. This is similar to an SRI where data and
operation can be clubbed together to the same interface definition.
- Create a provider port for the server and a receiver port for the client and map the CSI to it.
This completes the CS configuration.
EXAMPLE 1.a: Continuation of EXAMPLE 1 with respect to the AUTOSAR
interfaces.
a. ECU Abstraction SWC: Passes the data coming from the sensor to the application
SWC. For this we can use a SRI. The ECU Abstraction will have the provider port
and the Sensor/Actuator SWC will have the receiver port.
b. Sensor/Actuator SWC: this calculates the speed and sends it to other application
component through the same SRI, since it’s only data communication.
c. Application SWC: this receives the cut-off calibration from the parameter SWC to do
further calculations. We can sue a parameter interface to get the calibration
information. The maximum speed interface that the ASW component needs to write
to the NV Block component can take the NV interface type for this communication.
d. NV Block SWC: the communication between NV block and the BSW NVM manager
happens through CS communication because the BSW is usually a service.
e. Diagnostic manager: to log a diagnostic entry, we will use a CS communication since
this is also a BSW service that’s offered from diagnostic module.
f. CDD: to cut-off injector, we pass data command to the CDD. This command can be a
single data to communicate, so we can use SRI.
Composition 2
U
SWC-3
U
SWC-1 SWC-2
Composition 1
- Runnable properties:
a. If runnable is accessing any SR/NV interface, the below configurations are
applicable:
b. Parameter accessed from runnable: parameter can only be read and not written,
hence:
d. Local interface: read local variable and write local variable have no port since they
are not going to be sent/receiver from external components. They will have interface
defined within the scope of the component.
- Note: runnable can be invoked concurrently, that takes true or false input that mentions if
runnable is to be called recursively or parallel on different tasks. This is important when OS
is scheduling runnable.
Events
- Events are additional configurations to a runnable that specifies the OS on how to call or
schedule a runnable. Runnables are mapped to the RTE events and further the OS and RTE
layer together ensure that the runnable function is called in an expected manner.
- In case OS needs to start a runnable when the corresponding event occurs, the RTE event can
directly reference the runnable that needs to be started.
- When the SWC description uses this feature, it is responsible of the OS to start the runnable
when the event occurs.
- Consider the following categories of events:
a. Init event: specifies that the runnable is meant to be called only once and the runnable is
only for initializing the software during start up.
b. Timing event: used when the OS needs to call the runnable in a timing period. For
example, if we need to call a runnable every 100ms periodically then a timing event is
created and this runnable is mapped to it. OS calls this runnable based on the timing
period.
c. External trigger occurred event and internal trigger occurred event : here, the runnable is
called when a trigger event occurs. This is associated with the trigger interface type when
we expect triggers to occur.
d. Background event: used for runnable that need to be run in the background. The OS will
call the mapped runnable to a background event while the core is idle.
e. Operation invoked event: used on the server side of the Client-server communication. It
mentions the runnable to be called when a client requests a server execution through a
synchronous or asynchronous call.
f. The asynchronous server call result event: it is raised when an asynchronous server call is
finished. The associated runnable to this event is called when this event occurs.
g. Data write complete/data send complete event: this is associated with the provider port. It
mentions to call a runnable when data has been sent on a P-port.
h. Data receive event/ receiver error event: it is associated with R-port and triggered when
data is received on a port or when there is an error during reception. It is mainly used for
runtime optimization that a function is run only when needed and not always.
i. Mode switch event: it is used when there was a state change in a particular mode and to
trigger the associated runnable when it occurs.
j. Mode manager error event and Mode switch Ack event: it is used in case of error or when
mode switches are acknowledged.
c. RTE Communication
- Consider the following block diagram:
ASWC 1 ASWC 2
BSW
- Consider two SWC that need to communicate with each other via RTE.
- ASWC 1 has P-port to write data out and a function that writes data to RTE through
AUTOSAR Interface or RTE API. RTE defines the APIs mentioned in the component and
has the functional implementation for this. It defines an interface from its side and takes a
copy of this interface that ASWC 1 provides.
- ASWC 2 has a runnable function to read the data from ASWC 1. It uses RTE to get the data
via interface. RTE implements the receiver API to copy its interface data to the pointer that
was passed to the application.
d. RTE Scheduling
- We know that every runnable has to be mapped to an event.
- Consider function 1 is mapped to a timing event and function 2 is mapped to a data receive
event where we run the function only when new data arrives.
- A separate RTE configuration is required for the scheduling activity which will be done at the
final stages of the development process in the system development. This is called event to
task mapping in RTE configuration.
- We map timing event from C1 to the function CalcTask and data receive event to ReadTask.
Based on this configuration, RTE will create task bodies for every individual task that is
configured.
- RTE will add a prefix Rte_Task to every task it creates and follows with the name of the task,
such as Rte_Tak_CalcTask(), which will then be added to the OS scheduler. This is how RTE
generates the task names by the definition from the configuration.
- The task definition will contain the mapped runnable.
Example: function 1
Rte_Tak_CalcTask()
{
function1();
}
- For receiver function, RTE will add a flagging mechanism to make sure that this function is
called only when data is received on this port.
Rte_Task_ReadTask()
{
if(DataReceiveFlag==1)
{
function2();
DataReceiveFlag=0;
}
}
DataReceiveFlag is mentioned in the RTE API write function. The flag is set whenever there
is new data.
e. RTE Generator
- RTE layer is mostly generated out of configurations and needs special generation tools that
follow AUTOSAR standards.
- The inputs for this generator are ARXML configurations which include:
o SWC description: configurations from SWC development.
o ECU extraction configuration: configurations relevant to a particular ECU
o RTE and ECU OS configuration: comprises of OS task containers and map event
to task for a particular SWC.
o ECU instance configuration: contains description of the corresponding controller
unit.
o BSW configuration for BSW modules.
- These inputs are passed to RTE Generator that analyses the AUTOSAR configuration and
produces the RTE APIs and RTE layer.
- The outputs of the generator are:
o RTE layer .c files
o Application specific headers for each SWC.
o Additional configuration files:
OS related arxml configuration: has scheduling information of the tasks
created by RTE. This is further processed by the OS tools to do scheduling.
IOC related arxml configuration: IOC or Inter OS Communication is a
extraction that has communication passing over course or partitions. The OS
will use this information to transfer interfaces.
McSupportData.arxml: has information of the measurements and calibration.
It is used for debugging purposes to view or modify interfaces during testing.
BswMD.arxml: has the information of memory mapping for RTE generated
interfaces.
AUTOSAR methodology
1. System level development: includes SWC, HW selection, ECU resources, overall system.
These SWC are interfaced via VFB or Virtual Function Bus. VFB is the sum of all
communication mechanisms and interfaces to the BSW provided by AUTOSAR on an
abstraction level. VFB allows a virtual integration in an early development phase. All the
development on the system level and HW ECU related configurations are to be developed for
the particular system. Then we map SWC that are already developed on the system level to
particular ECUs.
2. ECU Extraction: extracts only ECU specific information from the system and can be done for
only one ECU at a time. The output of this stage are 3 files:
a. Flatview.arxml: contains the flattened list of components from system and the
communication connectors between them.
b. Flatmap.arxml: contains the instances for all interfaces and components for that
particular ECU. It is used for calibration and measurement purposes.
c. ECUExtraction.arxml: contains the ECU signals, signal mapping, SWC
implementation and ECU mappings.
3. ECU Configuration: contains the ECU specific configurations. The event to task mapping
where we map events from developed SWC to the OS tasks are performed here. Assigns the
developed components to the particular course or partition on the same ECU.
4. Generate RTE layer for ECUs: firstly, pass all the developed configuration arxmls to the RTE
generation tool and this will create the complete RTE layer for each ECU. The
communication between the ECUs are managed by RTE through the configured
communication channels.
- I/O Configuration: here, we define the port and port interface required to pass the
information to the upper application layer through RTE.
a. From temperature abstraction function, the function triggers the ADC conversion and the
ADC result from the temperature sensor is placed in a variable called Result. To pass this
result to upper application layer, we require a SRI with a P-port to write this data to RTE.
b. On H-bridge abstraction side, we have two functions start and stop. Since these functions
must be called from the application, we use a CSI with a P-port. This abstraction layer
owns the function and this will be the server side.
RTE
Microcontroller
ARXML
- ARXML stands for AutosaR eXtensible Markup Language. It is a configuration file used by
AUTOSAR.
- In the ARXML file, all the configurations related to AUTOSAR should start with the tag
“AUTOSAR”.
- We can mention the attributes of the version of AUTOSAR that we use and also the
corresponding schema. These are constant for the entire project.
- All the configurations must be inside <AR-PACKAGES>. Packages can contain any number
of packages inside and we are free to club or categorize configurations based on our uses or
applications and we can place them on different AR packages.
- In order to name an AR-PACKAGE, we follow the format: <SHORT-NAME>NAME OF
THE PACKAGE</SHORT-NAME>
- All the configurations relevant to AR-PACKAGES are placed within <ELEMENTS>.
Elements usually include the reference to the location of the child (configurations).
NOTE: PATH = path to the “AUTOSAR_00046.xsd” file in your Local project folder.
- This completes the AUTOSAR architecture of all the layers for our use-case but the RTE
layer can only be generated using specialized software applications that are not easily
available and are expensive.