Autosar TR Bswumlmodelmodelingguide
Autosar TR Bswumlmodelmodelingguide
Model
AUTOSAR CP Release 4.4.0
Disclaimer
This work (specification and/or software implementation) 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 work.
The material contained in this work is protected by copyright and other types of intel-
lectual property rights. The commercial exploitation of the material contained in this
work requires a license to such intellectual property rights.
This work 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 work
may be utilized or reproduced, in any form or by any means, without permission in
writing from the publisher.
The work has been developed for automotive applications only. It has neither been
developed, nor tested for non-automotive applications.
The word AUTOSAR and the AUTOSAR logo are registered trademarks.
Table of Contents
1 Introduction 8
1.1 Artifacts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.1.1 Header Files . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.1.2 Imported Type Definitions . . . . . . . . . . . . . . . . . . . . 8
1.1.3 Type Definitions . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.1.4 Function Definitions . . . . . . . . . . . . . . . . . . . . . . . 8
1.1.5 Callback Notifications . . . . . . . . . . . . . . . . . . . . . . 9
1.1.6 Scheduled Functions . . . . . . . . . . . . . . . . . . . . . . 9
1.1.7 Mandatory Interfaces . . . . . . . . . . . . . . . . . . . . . . 9
1.1.8 Optional Interfaces . . . . . . . . . . . . . . . . . . . . . . . . 9
1.1.9 Configurable Interfaces . . . . . . . . . . . . . . . . . . . . . 9
1.1.10 Sequence Diagrams . . . . . . . . . . . . . . . . . . . . . . . 10
1.1.11 Various Diagrams . . . . . . . . . . . . . . . . . . . . . . . . 10
1.1.12 Modeling of services . . . . . . . . . . . . . . . . . . . . . . . 10
2 Modeling Guide 11
2.1 Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2 Model Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.3 Modeling of BSW Modules . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.1 Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.1.1 Packages . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.1.2 Components . . . . . . . . . . . . . . . . . . . . . . 12
2.3.1.3 Component Diagrams . . . . . . . . . . . . . . . . . 13
2.3.1.4 Type Diagrams . . . . . . . . . . . . . . . . . . . . . 14
2.3.2 Function interfaces . . . . . . . . . . . . . . . . . . . . . . . 14
2.3.3 API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.3.3.1 Scheduled Functions . . . . . . . . . . . . . . . . . . 16
2.3.4 API Function Parameters . . . . . . . . . . . . . . . . . . . . 17
2.3.5 Module Dependencies . . . . . . . . . . . . . . . . . . . . . . 19
2.3.5.1 Virtual Interfaces . . . . . . . . . . . . . . . . . . . . 19
2.3.5.2 Mandatory Interfaces . . . . . . . . . . . . . . . . . . 21
2.3.5.3 Optional Interfaces . . . . . . . . . . . . . . . . . . . 21
2.3.6 Generic Interface . . . . . . . . . . . . . . . . . . . . . . . . 21
2.3.7 Callback Notifications . . . . . . . . . . . . . . . . . . . . . . 22
2.3.7.1 Callback definition and usage (non Configurable
Callback) . . . . . . . . . . . . . . . . . . . . . . . . 23
2.3.7.2 Configurable Callback definition and usage . . . . . 24
2.3.7.3 Callback Generic Interfaces . . . . . . . . . . . . . . 25
2.3.8 Data Type Definitions . . . . . . . . . . . . . . . . . . . . . . 26
2.3.8.1 Simple Types . . . . . . . . . . . . . . . . . . . . . . 26
2.3.8.2 Enumerations . . . . . . . . . . . . . . . . . . . . . . 27
2.3.8.3 Std_ReturnType Extensions . . . . . . . . . . . . . . 28
2.3.8.4 Structures . . . . . . . . . . . . . . . . . . . . . . . . 29
2.3.8.5 Bitfields . . . . . . . . . . . . . . . . . . . . . . . . . 30
References
[1] Layered Software Architecture
AUTOSAR_EXP_LayeredSoftwareArchitecture
[2] List of Basic Software Modules
AUTOSAR_TR_BSWModuleList
[3] Glossary
AUTOSAR_TR_Glossary
[4] Specification of Standard Types
AUTOSAR_SWS_StandardTypes
[5] Generic Structure Template
AUTOSAR_TPS_GenericStructureTemplate
[6] Standardized M1 Models used for the Definition of AUTOSAR
AUTOSAR_MOD_GeneralDefinitions
1 Introduction
This modeling guide describes the applied modeling techniques and rules, used to
specify the AUTOSAR Basic Software within a UML model.
The information contained in the BSW model is processed by the AUTOSAR Meta
Model Tool (MMT) and provides a major input of the several Software Specifications
(SWS) defined by AUTOSAR. In order to make the BSW model accessible by the MMT,
it is essential that the model observes the rules described in this document.
1.1 Artifacts
The main purpose of the AUTOSAR BSW UML model is keeping the 99+ documents
synchronous with respect to file structure, provided and required interfaces, sequence
diagrams, state machines etc. Therefore, all the relevant information is kept in the
BSW model according to the modeling rules specified in chapter 2, Modeling Guide.
The following artifacts are contributed to the SWS documents by the BSW UML model:
Chapter 5.1 of each SWS document contains the BSW module’s file structure, in par-
ticular its file inclusion structure. Most modules’ include file relationships have a similar
structure, in fact some parts are actually identically modeled. Therefore, the Header
File structure is being modeled using a class diagram, with stereotyped classes repre-
senting the source code- and header files; see section 2.4.1.
SWS chapter 8.1 contains a tabular list of imported types. This table is automatically
generated from the module dependency as explained in section 2.3.5.
SWS chapter 8.2 contains detailed descriptions of all types defined within a given BSW
module. For details on the modeling of type definitions refer to section 2.3.8.
SWS chapter 8.3 contains a detailed description for each function provided by the
BSW module. The description is presented in form of a table with a specific layout.
The individual fields of the table are filled from the API function definitions according to
section 2.3.3.
Very similar to the Function Definitions, SWS chapter 8.4 contains the callback defi-
nitions the BSW module provides. These are callbacks which will be called by other
BSW modules, where the lower layer module is typically the caller. A table for each
callback notification will be generated for a module’s specified callbacks according to
section 2.3.7.
Scheduled Functions are described in SWS chapter 8.5. The definition of scheduled
functions in the BSW UML model is described in section 2.3.3.1.
SWS chapter 8.6.1 contains a list of “mandatory interfaces” expected by the module.
The list is generated from the BSW UML model according to the mandatory dependen-
cies as described in section 2.3.5.2.
Similarly, the list of “optional interfaces” contained in SWS chapter 8.6.2 is generated
from the BSW UML model according to the optional dependencies as described in
section 2.3.5.3.
SWS Chapter 8.6.3 contains a BSW module’s “Configurable Interfaces”. These are
interfaces whose called function name can be configured using ECU configuration pa-
rameters. In AUTOSAR, these are typically used for issuing callback notifications, i.e.
the module owning the configurable interface uses it to notify a (configurable) upper
layer module’s callback. In other words the module defining a “Configurable Inter-
face” calls an other module that implements these interface definition. A table for each
callback notification will be generated for a module’s specified callbacks according to
section 2.3.7.2.
In order to visualize the interaction of a BSW module with other modules, SWS Chap-
ter 9 contains UML Sequence Diagrams for the module’s typical use cases. In or-
der to keep such Sequence Diagrams consistent between different modules within the
AUTOSAR BSW stack, they are also modeled within the BSW UML model. The dia-
grams are being exported to image files by the mmt tool; they are then being included
by the SWS document files. For the detailed modeling guidelines see section 2.4.2
The SWS documents of various BSW modules use additional UML diagrams e.g. for
either specifying core functionality, or for additionally illustrating dependencies between
modules. Some concrete examples are the various state machines used throughout
the AUTOSAR BSW stack, for example in the CAN State Manager or in COM manager.
Whenever possible, such diagrams should also be modeled in the BSW UML model.
This ensures that the sources of the document diagrams will not get lost, and also
facilitates their maintenance and keeping a uniform modeling style.
BSW Modules belonging to the Service Layer of the AUTOSAR Basic Software Archi-
tecture may offer their services in the form of AUTOSAR Service Interfaces. AUTOSAR
Service Interfaces are described in terms of the Software Component Template rather
than C-language interfaces, and they come in different flavors, e.g. ClientServer-
Interface, SenderReceiverInterface, ModeSwitchInterface. Consequently, their prop-
erties require a different style of modeling than the standard BSW API functions. Mod-
eling of AUTOSAR services is described in section 2.3.9
2 Modeling Guide
This Chapter contains the modeling rules that shall be followed when modeling
AUTOSAR BSW artifacts within the BSW UML model. It is important that these rules
are used consistently throught the model for the following reasons: The model stays
readable, additions and modifications are done in a reproducible way preventing the
duplication of elements, and most importantly, the automated artifact generation using
the MMT tool depends on nonambiguous modeling conventions.
2.1 Terminology
The agreed tool for UML modeling in AUTOSAR is Enterprise Architect by Sparx Sys-
tems. Accordingly the BSW model is being maintained using Enterprise Architect ver-
sion 7.5 and above. This guide focusses on modeling techniques rather than tools,
therefore this document strives to describe the concepts in terms of UML. Neverthe-
less, in order to be precise, sometimes terms specific to Enterprise Architect are used.
2.3.1 Modules
2.3.1.1 Packages
2.3.1.2 Components
[TR_BSWMG_00009] Type Diagram d If a BSW module defines data types, its module
package shall contain a “types diagram” (Enterprise Architect: UML Class Diagram). c
()
[TR_BSWMG_00010] Naming of Types Diagram d The name of the types diagram
shall be the name of the module component followed by a space character followed by
Types, e.g. FrTp Types. c()
[TR_BSWMG_00011] Content of Types Diagram d The types diagram shall contain
all types defined by the BSW module. c()
An AUTOSAR BSW modules provides services to other BSW modules in the form of C-
syntax functions. These functions are also the underlying implementation of AUTOSAR
Services accessed by Software Components over the RTE.
This section explains how each such function is modeled in the form of an UML opera-
tion. Each operation is placed in an UML interface owned by the BSW module realizing
the service. This UML interface is hereinafter called Function interface.
[TR_BSWMG_00012] Function interfaces d For each function to be provided by a
BSW module, an UML interface (the “function interface”) shall be created in its module
package. The stereotype of the interface shall be “interface”. c()
[TR_BSWMG_00013] Naming of function interfaces d The function interface shall
have the same name as the actual function. (depends on TR_BSWMG_00017, TR_BSWMG_00030) c()
In general AUTOSAR BSW modules require functions from the APIs of other BSW
modules in order to fulfill their own functionality. The general modeling pattern of de-
pendencies between one BSW module and another uses so called function interfaces
and virtual interfaces.
First, due to the fact that dependencies between APIs sometimes have to be expressed
on a single API level of detail, each API function requires a representation on module
level. For this purpose, the function interfaces have been introduced. (see 2.3.2)
Second, in order to further enhance the expressiveness of the BSW module, the con-
cept of function interfaces is extended by virtual interfaces. Virtual interfaces are
derived from function interfaces to merge a certain set of API functions. Recursive
structures of virtual interfaces are also allowed, so a virtual interface is allowed to be
derived from other virtual interfaces. This concept basically allows to reduce the num-
ber of module dependencies on the ’client’ side, by providing a single virtual interface
per providing module, collecting all functions required by this module.
[TR_BSWMG_00028] Virtual Interfaces d A virtual interface shall be modeled as an
interface with the stereotype «interface» (just like a normal interface). c()
[TR_BSWMG_00029] Naming of Virtual Interface d The name of a virtual interface
shall consist of the name of the depending BSW module, the name of the providing
module and the kind of dependency, each part separated by an underscore.
<NameOfDependingModule>_<NameOfProvidingModule>_<KindOfRelation>
c()
[TR_BSWMG_00039] Virtual Interface Multiplicity d One virtual interface refers to
exactly one pair of modules of realizing and depending modules. c()
[TR_BSWMG_00040] Virtual Interface Location d A virtual interface shall be placed
in the module package of the depending BSW module. c()
[TR_BSWMG_00041] Virtual Interface Contents d A virtual interface shall inherit its
functions from the realizer’s function interfaces. c()
[TR_BSWMG_00042] No Mixed Usage of Function Interfaces and Virtual Inter-
faces d Depending modules shall either directly depend on another module’s function
interfaces approach or depend on a virtual interface towards the other module. The
two approaches shall not be mixed. c()
In some occasions the AUTOSAR BSW stack defines a number of interfaces which
have basically the same function signature but slightly differ with regards to a module-
specific naming. In these cases, redundant definitions of interfaces shall be prevented
by usage of only one interface definition. To define a specific naming, a “Custom
Interface” shall be used. A “Custom Interface” inherits from the interface definition and
can override the naming rules.
The following modeling pattern shall be used for defining “Generic Interfaces”:
[TR_BSWMG_00061] Generic Interface Definition d The function definition shall be
placed into an UML interface having the stereotype «generic_interface». c()
[TR_BSWMG_00132] Generic Interface Definition d This “generic interface” defini-
tion shall be considered abstract and not directly be referenced by any module. c()
[TR_BSWMG_00133] Generic Interface Definition d A Generic Interface Definition
shall contain ONE operation with stereotype «function_blueprint». c()
Lower-layer modules are caller of callbacks. Often, these modules can configure which
actual instance of a callback definition will be called, i.e. which upper layer will be called
in the callback situation. In the SWS the configurability of a callback is described in
two parts: An API table for the configurable callback function including details like
the callback signature and arguments, and the actual ECU configuration parameters
described in chapter 10.
Figure 2.11: Configurable Callback: The lower module have to be configured which im-
plementation of an upper module will be called.
Hint: “Name” is the name of the editing field in the EA edit mask.
[TR_BSWMG_00152] SWS Item ID of a type d The tagged value “bsw.swsItemId” is
used to specify the SWS Item ID of a API function. c()
[TR_BSWMG_00153] Up-traces of a type d The tagged value “bsw.traceRefs” is used
to specify up-traces to requirements. Multiple requirement IDs have to be separated by
a comma. c()
[TR_BSWMG_00141] Header File Reference of a type d The tagged value
“bsw.headerFile” is used to specify the header file where the type is provided. c()
2.3.8.2 Enumerations
AUTOSAR defines a standard API return type that is being used throughout the BSW
stack. It is also the only return type that can be used in ClientServer type Service
Interface Operations.
“Std_ReturnType” is being defined in the SWS Standard Types [4]
([SRS_BSW_00377]). Additionally, two standard values E_OK and E_NOT_OK
are defined which should normally be used with Std_ReturnType.
If these two return values are not sufficient, a BSW module is allowed to define addi-
tional return values to be used with Std_ReturnType. Such user defined values shall
be prefixed with the module prefix and can be in the range 0x02–0x3f.
[TR_BSWMG_00089] Std_ReturnType Extension Definition d The definition of a
BSW module specific Std_ReturnType extension shall be modeled as an UML Class
with stereotype «extra_literals». c()
[TR_BSWMG_00090] Std_ReturnType Extension Name d The UML Class contain-
ing the Std_ReturnType extensions shall be named <Ma>_ReturnType (Ma = Module
Abbreviation). c()
[TR_BSWMG_00091] Std_ReturnType Extension Literal Definition d All BSW mod-
ule specific possible return type extension literals shall be modeled as attributes of this
class. The order of the attributes from top to bottom shall represent the order of the
enumeration specified. c()
[TR_BSWMG_00092] Std_ReturnType Extension Literal Details d The following
fields shall be used for specifying the return type extension literals:
• The “Name” field shall contain the Std_ReturnType extension literal name.
• The field “Type” shall be empty.
• The field “Stereotype” shall be empty.
• The field “Scope” shall be “Public”.
• The flag “Is Literal” shall be set.
• The field “Notes” shall contain the description of the custom return value.
c()
[TR_BSWMG_00093] Std_ReturnType Extension Literal Value d Custom
Std_ReturnType values shall always be defined with a specified unsigned inte-
ger value larger than 1 (i.e. E_NOT_OK). The integral value shall be placed in the field
“Initial Value”. c()
2.3.8.4 Structures
2.3.8.5 Bitfields
[TR_BSWMG_00086] Bitfield: Bit Mask and Bit Range Order d The order of the
attributes from top to bottom shall be increasing with bit flag or bit mask values (i.e. the
value specified in field “Initial Value”. c()
[TR_BSWMG_00087] Bitfield: Bit Range Value Definition d A bit range can assume
a number of different values. The meaning of these values shall be specified using
tagged values on the bitfield type’s attributes. c()
[TR_BSWMG_00088] Bitfield: Bit Range Value Details d Each bit range value spec-
ification consists of a group up to three tagged values.
Each group starts with the keyword “value.”, followed by a number starting from ‘0’,
followed by one of three keywords.
• “name” (e.g.: value.0.name): Name of the value. Example: “PHYS_REQ”
• “value” (e.g.: value.0.value): Hexadecimal or binary value; this shall lie within the
range of one of the bit masks. Example: 0b00010000
• “description” (e.g.: value.0.description): Optional description of the value. Exam-
ple: “physical request”
c()
Many data types are configurable since they depend on the configuration of the basis
software. Therefore so called “blueprint conditions” have been introduced into BSW
model to express e.g. configurable inheritance.
[TR_BSWMG_00070] Derived Types Blueprint Conditions d If a type is derived from
more than one other data type, the generalization dependency shall have a tagged
value “Vh.BlueprintCondition” which specifies the exact conditions for selecting the as-
sociated data type. (e.g., Vh.BlueprintCondition = platform dependend) c()
[TR_BSWMG_00503] Blueprint Policies for CompuMethods d To de-
fine blueprint policies for a type’s compu method the tagged value
“Vh.compuMethod.BlueprintPolicy” with the legal values “not-modifiable”, “list”, or
“single” shall be used.
The blueprint derivation guide shall be described by the tagged value
“Vh.compuMethod.BlueprintPolicy.DerivationGuide” or for multi-line guides by
• “Vh.compuMethod.BlueprintPolicy.DerivationGuide.1”
• “Vh.compuMethod.BlueprintPolicy.DerivationGuide.2”
• ...
It is not applicable for blueprint policy not-modifiable.
To explicitly set the maximal and minimal number of elements for a blueprint
policy list the tagged values “Vh.compuMethod.BlueprintPolicy.maxElements” and
“Vh.compuMethod.BlueprintPolicy.minElements” shall be used. c()
1 Vh.compuMethod.BlueprintPolicy:
2 list
3 Vh.compuMethod.BlueprintPolicy.maxElements:
4 3
5 Vh.compuMethod.BlueprintPolicy.minElements:
6 1
7 Vh.compuMethod.BlueprintPolicy.DerivationGuide.1:
8 0x00 is locked
9 Vh.compuMethod.BlueprintPolicy.DerivationGuide.2:
10 0x01...0x3F is configuration dependent
11 Vh.compuMethod.BlueprintPolicy.DerivationGuide.3:
12 0x40...0xFF is Reserved by Document
4 Vh.BlueprintCondition:
5 SleepMode = {ecuc(EcuM/EcuMConfiguration/
EcuMCommonConfiguration/EcuMSleepMode.SHORT-NAME)}
6 Vh.BlueprintValue:
7 SleepModeId = {ecuc(EcuM/EcuMConfiguration/
EcuMCommonConfiguration/EcuMSleepMode.EcuMSleepModeId)}
The following listing shows the old syntax of modeling / defining ClientServerInterface
in AUTOSAR R4.0.3 SWS documents.
1 ClientServerInterface Csm_Hash {
2
3 // errors assisioated with the ProtInterface
4 PossibleErrors {
5 CSM_E_NOT_OK = 1
6 CSM_E_BUSY = 2
7 CSM_E_SMALL_BUFFER = 3
8 };
9
10
11 //containing operations
12
13 //parameter kinds can be IN, OUT and INOUT
14 //
15 //ERR is not a parameter
16 // -> should be a associated error to an operation
17 HashStart (
18 ERR(CSM_E_NOT_OK, CSM_E_BUSY)
19 );
20
21 HashUpdate (
22 IN HashDataBuffer dataBuffer,
23 IN uint32 dataLength,
24 ERR(CSM_E_NOT_OK, CSM_E_BUSY)
25 );
26
27 HashFinish (
28 OUT HashResultBuffer resultBuffer,
29 INOUT HashLengthBuffer resultLength,
30 IN boolean TruncationIsAllowed,
31 ERR(CSM_E_NOT_OK, CSM_E_BUSY, CSM_E_SMALL_BUFFER)
32 );
33 };
Figure 2.23: Example ClientServerInterface BSW mapping diagamm (CSI bsw mapping
diagram)
The following listing shows the old syntax of modeling / defining ModeSwitchInterfaces
in AUTOSAR R4.0.3 SWS documents.
1 ModeSwitchInterface WdgM_IndividualMode {
2 isService = true;
3 WdgMMode currentMode;
4 };
Corresponding ModeDeclarationGroup:
1 ModeDeclarationGroup WdgMMode {
2 { SUPERVISION_OK,
3 SUPERVISION_FAILED,
4 SUPERVISION_EXPIRED,
5 SUPERVISION_STOPPED,
6 SUPERVISION_DEACTIVATED
7 }
8 initialMode = SUPERVISION_OK
9 };
Corresponding Type:
1 ImplementationDataType AppModeRequestType {
2 lowerLimit = 0;
3 upperLimit = 2;
4 };
The following listing shows examples of type definitions in the old syntax of modeling /
defining types in AUTOSAR R4.0.3 SWS documents.
Definition of arrays on arguments of ClientServerOperations:
1 ClientServerInterface Dcm_RequestControlServices
2 {
3 PossibleErrors {
4 E_NOT_OK = 1,
5 };
6 RequestControl(
7 OUT uint8 OutBuffer[<DcmDspRequestControlOutBufferSize>],
8 IN uint8 InBuffer[<DcmDspRequestControlInBufferSize>],
9 ERR{E_NOT_OK });
10 }
Many service interfaces are configurable since they depend on the configuration of the
basis software. Therefore so called “blueprint conditions” have been introduced into
BSW model to express e.g. that the existence of ports depends on the existence of
specific EcuC parameters.
The following listing shows examples of the old syntax of modeling / defining of vari-
ability in AUTOSAR R4.0.3 SWS documents. The variability was defined informal as
comments.
Variability in Ports:
1 Service ComM
2 {
3 ...
4 // port present for each channel
5 // if ComMModeLimitationEnabled (see ECUC_ComM_00560);
6 // there are NC channels;
7 ProvidePort ComM_ChannelLimitation CL000;
8 ...
9 ProvidePort ComM_ChannelLimitation CL<NC-1>;
10 ...
11 }
1 ClientServerInterface DataServices:
2
3 Using the concepts of the SW-C template, the interface is defined as
follows if ClientServer interface is used (DcmDspDataUsePort set to
USE_DATA_SYNCH_CLIENT_SERVER or USE_DATA_ASYNCH_CLIENT_SERVER):
1 SenderReceiver DataServices:
2
3 Using the concepts of the SW-C template, the interface is defined as
follows if SenderReceiver interface is used (DcmDspDataUsePort set
to USE_DATA_SENDER_RECEIVER):
2.4 Diagrams