AUTOSAR Runtime Environment and Virtual Function Bus: Nico Naumann
AUTOSAR Runtime Environment and Virtual Function Bus: Nico Naumann
AUTOSAR Runtime Environment and Virtual Function Bus: Nico Naumann
Function Bus
Nico Naumann
1 Introduction
The AUTOSAR 1 software architecture is an open standard automotive software
architecture that has been developed by a joint group of automotive vendors
and stakeholders in oder to create an integrated standard infrastructure for
vehicle software development. It aims to improve the efficiency and quality of
automotive software by means of a widely accepted standard while preserving
the competitiveness of the participants products, i.e. Cooperate on standards,
compete on implementation.
In order to achieve a high degree of transparency against the underlying hard-
ware infrastructure, the AUTOSAR standard introduces two architectural con-
cepts that facilitate infrastructure independent software development. Namely,
these are the Virtual Function Bus (VFB) and the Runtime Infrastructure (RTE)
that are closely related to each others and that shall be introduced in detail in
the following.
The rest of this paper is structured as follows: First, a short introduction
into the general ideas behind the concepts of RTE and VFB with respect to
the AUTOSAR mission will be given. Afterwards, a more detailed view on the
runtime environment will point out which kind of components can interact with
the RTE and what has to be provided to realize this interaction. In section 4, the
concepts of runnables will be introduced in more detail and different concepts
of mappings of tasks to artifacts of the underlying operating system will be
shown. Afterwards, in section 5, an example for the implementation of the RTE
according to the Sender-Receiver communication pattern will be given. Finally,
different mechanisms of how the RTE can interact with hardware components
will be shown in section 6.
2 Fundamentals
One of the basic principles of the AUTOSAR software design is the relocatabil-
ity of components among different architectures. In contrast to other embedded
software architectures where each component is highly specialized on the un-
derlying hardware infrastructure, OEMs and vehicle manufacturer can use the
AUTOSAR approach to redeploy existing components to any kind of hardware
infrastructure that supports the AUTOSAR standard.
In order to realize this degree of flexibility against the underlying infrastruc-
ture, the AUTOSAR software architecture follows several abstraction principles.
In general, any piece of software within an AUTOSAR infrastructure can be seen
as an independent component while each AUTOSAR application is a set of inter-
connected AUTOSAR components. Further, the different layers of abstraction
allow the application designer to disregard several aspects of the physical system
on which the application will later be deployed on, like:
Fig. 2. Example VFB to RTE mapping where the virtual communication topol-
ogy is mapped to three different ECU’s [3]
Each ECU has its own customized RTE implementation which is generated
during the ECU Configuration process of the AUTOSAR methodology 2 . The
ECU mapping, i.e. the information about which component will deployed on
which ECU, is part of the input of this configuration process.
Depending on the location of each component, the formerly virtual inter-
action can then be mapped to real interaction implementation. More precisely,
components that are mapped onto one ECU will communicate through Intra-
ECU-Mechanisms, like function calls while Inter-ECU communication will be
realized using, e.g. a communication bus infrastructure. Since the RTE source
code is usually generated, it can be tailored by the generator to implement
exactly the communication paths required by its connected AUTOSAR com-
ponents. Thus the RTE can be seen as a static implementation of specialized
communication topologies.
Figure 2 illustrates an example transformation where the components that were
virtually connected via one single virtual function bus are mapped onto three
ECU’s. Due to the mapping on different ECU’s the different RTE’s that are
2
see [5] for more details on the ECU configuration process and the AUTOSAR
methodology in general
AUTOSAR Runtime Environment and Virtual Function Bus 5
Fig. 3. Comparison of VFB and RTE with focus on selected common concepts
Although the concepts of virtual function bus and the runtime infrastructure are
fundamentally different, they both share a common application programming in-
terface. Since at the time the application modeler defines the interaction between
its application and the virtual function bus, the application programming inter-
face which is used at that time has to be used by the runtime environment as
well in order to provide a working environment for the modeled application.
However, in other terms like system view or concepts of communication sup-
ported, the VFB and the RTE have a fundamentally different conceptual base.
The table in figure 3 provides an overview on various aspects that are relevant
for both, Virtual Function Bus as well as Runtime Environment.
3.1 Overview
In figure 4, an architectural overview about the RTE and their respective inter-
faces to AUTOSAR components is illustrated. The interfaces that are used to
connect any type of software component, are split into three categories:
Fig. 4. Overview on the RTE integration into the AUTOSAR layered architec-
ture [2]
Examples for such services are Memory Services (NVRAM Manager), Network
Communication Management Services as well as Diagnostic Services and State
8 Nico Naumann
Management. Services are part of the AUTOSAR basic software and can be con-
sumed by AUTOSAR Software components. They are attached to the RTE using
standardized AUTOSAR Interfaces which allows other software components to
connect to outgoing ports or provide input for incoming ports of AUTOSAR
services. Further, the semantics of ports as defined by the Virtual Function Bus
specification also apply for AUTOSAR services. In cases when an AUTOSAR
software components from the application layer request service objects, it is the
task of the runtime to map those calls to actual service object symbols on the
local ECU.
Anyhow, since AUTOSAR services provide functionality closely related to the
ECU on which they are deployed on, the RTE does not provide any mechanisms
to access a service from a remote ECU. Further a service-to-service communi-
cation is not allowed by the AUTOSAR specification since this would violate
the layered architecture. The fulfillment of these constraints has to be enforces
during the RTE generation process.
4 Runnables
Since AUTOSAR software components have no direct access to the underlying
hardware or the operating system, the implementation of the atomic software
components cannot reflect artifacts like Threads or Processes. Instead, each piece
of functionality that has to be executed during runtime of the software compo-
nent is wrapped into a so-called Runnable. The VFB-Specification defines a
runnable as a
AUTOSAR Runtime Environment and Virtual Function Bus 9
void S e a t H e a t i n g_ R u n n a b l e _ r u n 1 (){
...
RTE _Rea d_InP ort_ Value (...);
// do something
R TE _ Wr it e _O u tP or t _V al u e (...);
...
}
4.1 Integration
The concept of runnables affects several aspects of AUTOSAR, like the operat-
ing system, the runtime environment as well as the virtual function bus. Each
of them deals with runnables differently, depending on their view on the overall
system. The goal of this section is to show the dependencies and points of in-
tersection where the three participants OS, RTE and VFB are related in terms
of their integration of runnables. Figure 5 illustrates this relation and will be
explained in the following
10 Nico Naumann
RTE View The runtime environment maps runnables that can be executed to-
gether into one OS task. This task is then structured and controlled using RTE
glue code that will control the correct execution of the runnables within the OS
task. In figure 5, the boxes colored in red denote single runnables. The corre-
sponding control flow that triggers the execution of such a runnable as well as
the glue code (yellow box) is under control of the runtime environment.
VFB View On the level of the virtual function bus (i.e. during design time of the
application), the integration context of the runnable as well as the environment
in which it will be executed are not of concern. Instead, anything except the
sequence of single instructions within the function body and the constraints on
invocation for the runnable are disregarded.
AUTOSAR Runtime Environment and Virtual Function Bus 11
(a) A basic task (b) A basic task (c) An extended task con- (d) An extended
containing a sin- containing mul- taining multiple category 1 task containing a
gle category 1 tiple category 1 runnables single category 2
runnable runnables runnable
runnables and cannot be fully exploited within this document. More precisely,
since the mapping depends on information like type of the runnable (either
category 1 or 2) as well as their activation and execution behavior (e.g. cyclic
execution every N ms, etc.) a wide set of possible runnable configurations exists.
However, in the following, several scenarios will be presented that shall give an
overview on possible integration of one and more runnables within an operating
system task. Figure 6 provides a graphical overview on the control flow of the
scenarios described below.
5 RTE Implementation
The virtual function bus specification as introduced in [6] defines two communi-
cation patterns that can be used by an AUTOSAR software component: Sender-
Receiver and Client-Server. Both patterns have in common that, although their
usage is specified on the level of the virtual function bus, their implementation
is provided by methods of the implementation of the runtime environment.
In order to provide a better understanding of the relations between the run-
time environment and the interaction among AUTOSAR software components,
the following section will give an in-depth introduction to the implementation
background of the runtime environment. For the sake of simplicity, this will be
done using the example of the Sender-Receiver pattern. However, the concepts
in general do apply to Client-Server as well.
5.1 Fundamentals
In the following part, a generic example will be used that is illustrated in figure
7 using the modeling notation of the AUTOSAR Virtual Function Bus specifica-
tion. It shows a simple communication architecture between one sender compo-
nent that is providing an outgoing send port which is connected to two receiving
software components. Since on the VFB level there is no statement about the
actual location of the software components, it will be shown in the following how
the generated RTE implementation might look like, depending on which kind of
deployment and configuration has been chosen.
API Description
Explicit Read/Write
RTE_Read_...() Read / Write Data Value (Last-Is-Best Semantic)
RTE_Write_...()
RTE_Invalidate_...() Invalidation of previously sent value / reset to initial
RTE_Receive_...() Send or Receive Data Value
RTE_Send_...() Receive: Blocking using WaitPoint until data value is
received (DataReceiveEvent / DataReceiveErrorEvent)
Send: Non-Blocking, delegation to AUTOSAR COM
RTE_Feedback_...() Wait for completion of data send (RTE Send)
(DataSendCompleteEvent)
Implicit Read/Write
RTE_IRead_...() Implicit Reading / Writing
RTE_IWrite_...()
Table 2. Listing of AUTOSAR RTE API method prefixes for the various send
and receive communication modes
5.3 Implementation
In the following subsection the different API calls and the generated RTE source
code that realizes these API calls will be introduced. Since the RTE generator is
not a standardized component of the AUTOSAR architecture but its implemen-
tation may vary depending on the vendor, the following source listing cannot be
understood as actual running sources but only as an illustration of the underlying
concepts. Thus, any of the following source listings are considered pseudo-code
and do not attempt to represent runnable source code of an actual programming
language.
implementation for the interfaces listed in table 2. In listing 4, two examples are
given that represent two possible combination of port semantics.
The first is the case of explicit reading in an intra-ECU communication ex-
ample where the caller directly reads the local variable that contains the most
recent value on the incoming port (if any). The second receive port implemen-
tation represents a Intra-ECU communication scenario that is implemented us-
ing a blocking API RTE_Receive...() that additionally implements a queue for
incoming values.
6 Hardware Interaction
As mentioned previously, an AUTOSAR software component is not allowed to
access elements of the underlying ECU hardware layer directly. Instead, the lay-
ered software architecture includes components to decouple the application logic
from the internals of hardware functionality in oder to enable relocatability. At
the level of the RTE, these components can then provide AUTOSAR Interfaces
for software components that provide normalized, hardware independent infor-
mation that abstracts from actual physical values. The ECU Abstraction layer
as well as Complex Device Drivers are such components that are accessible via
the RTE and provide access to/from the underlying hardware.
Since the AUTOSAR layered software architecture restricts direct access to hard-
ware from upper layers, an additional concept is provided in order to bypass that
restriction for resource critical and/or Non-AUTOSAR compliant software com-
ponents. The Complex Device Driver provides an AUTOSAR Interface to the
application layer and has direct access to values on the physical layer. This is
usually used for the implementation of complex sensor or actuator drivers that
need direct control over the underlying hardware.
The separation of application logic from details of the underlying hardware has
several advantages compared to an integrated approach. First, the relocatability
of AUTOSAR software components can be achieved transparently since the ap-
plication source code does not concern any specifics of ECU hardware. Further,
this separation of concerns allows OEMs to develop components of each layer
independently. That way, ECU manufacturers can manage the development of
controllers that are specific for their hardware while the application layer soft-
ware components can be designed independently by a vehicle manufacturer for
instance. Additionally, this layered design allows to interchange components of
the architecture without affecting components from the layers above. Changing
the micro controller for example would only affect the MCAL while everything
from ECU abstraction upwards could remain unchanged.
18 Nico Naumann
7 Conclusion
Goal of this paper was to introduce into the concepts of the AUTOSAR Vir-
tual Function Bus and the Runtime Environment. It was shown how the virtual
function bus enables the description of a virtual application infrastructure that
allows the AUTOSAR software components to be design without regarding the
actual physical infrastructure that they will reside on. Afterwards, the relation
between the virtual infrastructure and its actual implementation by the runtime
environment was outlined. Thereby, special attention was payed to the details on
how the generated RTE source code realizes the different communication topolo-
gies and their semantics.
Furthermore, this paper introduced into the relation of the runtime environ-
ment to other artifacts of the AUTOSAR layered software architecture such as
communication services and the operating system. Details were shown how the
description of runnables are mapped to operating system tasks and how their ex-
ecution is managed by the runtime environment. Finally, an overview was given
on how hardware interaction is realized and how this affects the way in which
AUTOSAR software components are developed.
References
1. AUTOSAR GbR. Autosar glossary, 2008.
2. AUTOSAR GbR. Specification of rte, 2008.
3. AUTOSAR GbR. Specification of the virtual functional bus, 2008.
4. AUTOSAR GbR. Technical overview, 2008.
5. Regina Hebig. Autosar methodology. Technical report, Hasso-Plattner-Institute for
IT Systems Engineering, 2009.
6. Robert Warschofsky. Autosar software architecture. Technical report, Hasso-
Plattner-Institute for IT-Systems Engineering, 2009.
AUTOSAR Runtime Environment and Virtual Function Bus 19
8 Appendix
// Sender implementation
void R T E _ R u n n a b l e S e n d e r 1 0 0 m s _ r u n 1 (){
...
R T E _ S e n d _ P a s s e n g e r D e t e c t e d _ v a l (...);
...
}
// Receiver implementation
void R T E _ R u n n a b l e R e c e i v e r 1 0 0 m s _ r u n 1 (){
...
v = R T E _ R e c e i v e _ P a s s e n g e r D e t e c t e d _ v a l (...);
int i = new int ();
...
}
Listing 2. Usage of the RTE API within a sender and receiver-communication
channel