Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

Application Base

Technical Reference
Adaptive MICROSAR
Version master-18223

Authors croodro, vsarcbosu, vsarcjogu, vsarcjoba


Status Released
Technical Reference Application Base

Document Information

History
The change history of this file is part of the component change history. It is documented in
ChangeHistory.txt of the component folder.

Reference Documents
[1] AUTOSAR. Specification of Core Types for Adaptive Platform. R19-03.

Caution
We have configured the programs in accordance with your specifications in the ques-
tionnaire. Whereas the programs do support other configurations than the one specified
in your questionnaire, Vector´s release of the programs delivered to your company is
expressly restricted to the configuration you have specified in the questionnaire.

© 2024, Vector Informatik GmbH Version: master-18223 1 / 30

based on template version 1.00.00


Technical Reference Application Base

Contents

1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1 Component Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.1 Initialization and Shutdown 7
2.1.1.1 Generation of initialization.cpp 8

2.2 Known Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9


2.3 Extension Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3.1 BswInitDeinitExtensionModel 10
2.3.1.1 BswInitDeinitExecutableExtension 10
2.3.1.2 BswInitDeinitAttributes 11
2.3.2 CryptoExtensionModel 11
2.3.2.1 CryptoExecutableExtension 11
2.3.3 PhmExtensionModel 12
2.3.3.1 PhmExecutableExtension 12
2.3.4 LogConfigExtensionModel 12
2.3.4.1 LogConfigApiUsage 13
2.3.5 BswExecutableTypeExtensionModel 13
2.3.5.1 BswExecutable 13
2.3.6 BswVersionedApiExtensionModel 14
2.3.6.1 BswVersionedApi 14
2.3.7 BswLowerGradeQualityLevelExtensionModel 15
2.3.7.1 BswLowerGradeQualityLevel 15
2.3.8 SmExtensionModel 16
2.3.8.1 SmExecutableExtension 16
2.3.9 BswSteadyModeExtensionModel 17
2.3.9.1 BswSteadyMode 17

3 Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.1 Build Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.2 Files and Include Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.3 Integration of ApplicationBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.4 CMake . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.4.1 Build 18
3.4.2 Exported CMake packages 18

© 2024, Vector Informatik GmbH Version: master-18223 2 / 30

based on template version 1.00.00


Technical Reference Application Base

3.5 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

4 API Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.1 lib/application_base/include/ara/core/initialization.h File Reference . . . . . . . . . . . . . . . . 20
4.1.1 Detailed Description 20
4.1.2 Function Documentation 21
4.1.2.1 Deinitialize() noexcept 21
4.1.2.2 Initialize() noexcept 22

4.2 lib/application_base/include/amsr/application_base/initialization_error_domain.h File Ref-


erence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.2.1 Detailed Description 24
4.2.2 Enumeration Type Documentation 24
4.2.2.1 InitializationErrc 24
4.2.3 Function Documentation 24
4.2.3.1 GetInitializationErrorDomain() noexcept 24
4.2.3.2 MakeErrorCode(InitializationErrc code, ara::core::ErrorDomain::SupportDataType
data, char const ∗message) noexcept 25

4.3 amsr::application_base::InitializationErrorDomain Class Reference . . . . . . . . . . . . . . . . 26


4.3.1 Detailed Description 27
4.3.2 Constructor & Destructor Documentation 28
4.3.2.1 InitializationErrorDomain() noexcept 28
4.3.3 Member Function Documentation 28
4.3.3.1 Message(ErrorDomain::CodeType error_code) const noexceptfinal 28
4.3.3.2 Name() const noexceptfinal 28
4.3.3.3 ThrowAsException(ara::core::ErrorCode const &error_code) const noex-
cept(false) final 28

5 Glossary and Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29


5.1 Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

6 Contact . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

© 2024, Vector Informatik GmbH Version: master-18223 3 / 30

based on template version 1.00.00


Technical Reference Application Base

Illustrations

Tables

2-1 Supported AUTOSAR Conform Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7


2-2 Known Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2-3 BswInitDeinitAttributes attribute description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2-4 CryptoExecutableExtension attribute description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2-5 PhmExecutableExtension attribute description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2-6 LogConfigApiUsage attribute description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2-7 BswExecutable attribute description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2-8 Valid enum values for the bswExecutableType attribute. . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2-9 BswVersionedApi attribute description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2-10 Valid enum values for the amsrAraCoreApi attribute. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2-11 Valid enum values for the amsrAraComApi attribute. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2-12 BswLowerGradeQualityLevel attribute description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2-13 Valid enum values for the lowerGradeQualityLevel attribute. . . . . . . . . . . . . . . . . . . . . . 16
2-14 SmExecutableExtension attribute description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2-15 BswSteadyMode attribute description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

3-1 CMake options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

Listings

2-1 BswInitDeinitExecutableExtension in ARXML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10


2-2 CryptoExecutableExtension in ARXML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2-3 PhmExecutableExtension in ARXML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2-4 LogConfigApiUsage in ARXML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2-5 BswExecutable in ARXML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2-6 BswVersionedApi in ARXML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2-7 BswLowerGradeQualityLevel in ARXML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2-8 SmExecutableExtension in ARXML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2-9 BswSteadyMode in ARXML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

© 2024, Vector Informatik GmbH Version: master-18223 4 / 30

based on template version 1.00.00


Technical Reference Application Base

3-1 Example usage of ApplicationBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

© 2024, Vector Informatik GmbH Version: master-18223 5 / 30

based on template version 1.00.00


Technical Reference Application Base

1 Introduction

This document describes the functionality, API and configuration of the Adaptive AUTOSAR BSW
module ApplicationBase.
ApplicationBase provides the global initialization and shutdown functions, that initialize and deinitialize,
respectively, data structures and threads of the AUTOSAR Runtime for Adaptive Applications, as
specified in Adaptive Core Types specification [1].
> Supported AUTOSAR Release R19-03

1.1 Component Design


The ApplicationBase component consists of:
> application_base library
> amsr_applicationbase generator
The application_base library provides the public APIs, ara::core::Initialize() and
ara::core::Deinitialize(). In order for these functions to return suitable errors the error domain
amsr::application_base::InitializationErrorDomain is also provided with the library.
The amsr_applicationbase_init_deinit generator is used to generate the definitions for
ara::core::Initialize() and ara::core::Deinitialize(). This is done by identifying the used
components and then using that information together with a JET-template to create a C++ source file.

ara::core::Initialize() has to be called before any ARA API is called in an Adaptive application.

ara::core::Deinitialize() has to be called when ARA APIs are not used any more in an Adaptive
application.

Only one sequence of ara::core::Initialize(), ara::core::Deinitialize() is supported. If


reinitialization is needed the process shall do a clean exit and recovery shall be done by the execution
manager.

© 2024, Vector Informatik GmbH Version: master-18223 6 / 30

based on template version 1.00.00


Technical Reference Application Base

2 Functional Description

The features listed in these sections cover the complete functionality specified for the ApplicationBase.
Referring to the AUTOSAR standard functionality as specified in [1], the implemented features are
described in 2.1.
Known Limitations of the current implementation of the module are listed in 2.2.

2.1 Features
The following features specified in [1] are supported:

Feature Description
Initialization and Shutdown see 2.1.1

Table 2-1 Supported AUTOSAR Conform Features

2.1.1 Initialization and Shutdown


The function declarations for ara::core::Initialize and ara::core::Deinitialize are provided in a static
header file, initialization.h.
The function definitions are generated to a source file, initialization.cpp, by the generator
amsr_applicationbase. The source file will always contain initialization and deinitialization code for
the components:
> VaCommonLib
> OsAbstraction
> Thread
> LogAndTrace
Initialization and deinitialization code will also be generated to initialization.cpp for all other
components that are used in the Adaptive application (see 2-2 for supported components). To identify
which components are used in an Adaptive application, the generator uses one of several methods
per component. The first method includes the generator looping over the port interfaces defined in the
AUTOSAR model for that application:

> A port interface of type PersistencyInterface indicates Persistency usage.


> A port interface of type ServiceInterface indicates ComIntegrator usage.
> A port interface of type DiagnosticPortInterface indicates AraDiag usage.
> A port interface of type AbstractSynchronizedTimeBaseInterface indicates TimeSync usage.
> A port interface of type CryptoInterface indicates Crypto usage.

Note
The configuration of AraIdsmConfig and the existence of any IdsM port indicate AraIdsm
usage. Please refer to IdsM technical reference for more details.

The second method is to use a component specific model extension to identify usage, this is supported
for:

© 2024, Vector Informatik GmbH Version: master-18223 7 / 30

based on template version 1.00.00


Technical Reference Application Base

> Usage of PlatformHealthManager component identified by setting the usePhmApi attribute from
PhmExecutableExtension to true
> Usage of Crypto component identified by setting the useCryptoApi attribute from CryptoExe-
cutableExtension to true
> Usage of LogConfig component identified by setting the useLogConfigApi attribute from LogCon-
figExtensionModel to true
> Usage of ExternalIpc component identified by setting the bswExecutableType attribute from
BswExecutableTypeExtensionModel to UDPIPCGATEWAY.
> Usage of StateManager component identified by setting the useSmApi attribute from SmExe-
cutableExtension to true

Note
If both a CryptoInterface and the model extension useCryptoApi are configured in the
same model an error will be emitted by the generator if useCryptoApi is set to false.

Components identified using the previously mentioned methods have static data objects in Appli-
cationBase generator source code that represents information needed to wrap component specific
initialize and deinitialize APIs. To modify this information the ApplicationBase generator source code
must be updated.
The third method involves the model extension BswInitDeinitExtensionModel. Defining this model
extension with its underlying attributes provides the information needed to add component specific
initialize and deinitialize functionality dynamically without the need for changing generator source
code.

2.1.1.1 Generation of initialization.cpp


The attribute Executable.category is used by the generator amsr_applicationbase to decide when to
generate the output file initialization.cpp.
If the Executable.category is set to APPLICATION_LEVEL this output file will always be generated. This
is also the default behaviour when Executable.category is missing or set to a non AUTOSAR specified
value.
If the Executable.category is set to PLATFORM_LEVEL the default behavior is not to generate initialization.cpp.
For a set of defined executables this default behaviour can be overridden by using the model extension
BswExecutableTypeExtensionModel. Setting the bswExecutableType attribute to any of the
following values will enable generation of initialization.cpp:

> NETWORK_MANAGER
> DIAGNOSTIC_MANAGER
> HEALTH_MANAGER
> UPDATE_MANAGER
> SOMEIP_DAEMON
> TIMESYNC_DAEMON
> UDPIPCGATEWAY
> CRYPTO_DAEMON

This is described further in the TechRef of the affected components.

© 2024, Vector Informatik GmbH Version: master-18223 8 / 30

based on template version 1.00.00


Technical Reference Application Base

2.2 Known Limitations

Limitation Description
Supported Modules Built-in support of initialization and deinitialization code is only
supported for VaCommonLib, OsAbstraction, Thread, LogAnd-
Trace, Persistency, ComIntegrator, AraDiag, TimeSync, Crypto
and PlatformHealthManager. Information about the mentioned
components is static and provided through ApplicationBase gen-
erator source code. It is also possible to specify usage of a new
component dynamically by using the model extension BswInit-
DeinitExtensionModel.
Reinitialization Only one sequence of ara::core::Initialize(),
ara::core::Deinitialize() is supported in one process.

Table 2-2 Known Limitations

© 2024, Vector Informatik GmbH Version: master-18223 9 / 30

based on template version 1.00.00


Technical Reference Application Base

2.3 Extension Models


The following extension models are supported in the ApplicationBase component.
> BswInitDeinitExtensionModel
> CryptoExtensionModel
> PhmExtensionModel
> LogConfigExtensionModel
> BswExecutableTypeExtensionModel
> BswVersionedApiExtensionModel
> SmExtensionModel
> BswSteadyModeExtensionModel

2.3.1 BswInitDeinitExtensionModel
The extension model BswInitDeinitExtensionModel contains one top level SdgClass named BswInit-
DeinitExecutableExtension which extends the AUTOSAR class Executable. Defining this model
extension with its underlying attributes provides the information needed to add component specific
initialize and deinitialize functionality dynamically without the need for changing generator source code.
Also defining the model extension is a trigger to identify usage of components within an Adaptive
MICROSAR application for components described by using the extension model.

BswInitDeinitExecutableExtension

0..* bswInitDeinitAttributesWrapper

BswInitDeinitAttributes

bswInitDeinitComponentName : String [1..1]


bswInitDeinitIncludePath : String [1..1]
bswInitDeinitNamespace : String [1..1]
bswInitDeinitPriority : Integer [1..1]

2.3.1.1 BswInitDeinitExecutableExtension
A top level SdgClass referenced when using the extension model during modelling. Contains an
aggregated class called bswInitDeinitAttributesWrapper which provides the relation to instances of
the BswInitDeinitAttributes class.
Listing 2-1 demonstrates how the BswInitDeinitExecutableExtension should be modeled in the
ARXML model.

<ADMIN-DATA>
<SDGS>
<SDG GID="DvMex:BswInitDeinitExecutableExtension">
<SDG GID="bswInitDeinitAttributesWrapper">
<SDG GID="BswInitDeinitAttributes">
<SD GID="bswInitDeinitComponentName">TEST_COMPONENT</SD>

© 2024, Vector Informatik GmbH Version: master-18223 10 / 30

based on template version 1.00.00


Technical Reference Application Base

<SD GID="bswInitDeinitIncludePath">amsr/test_component/internal/lifecycle.h</SD>
<SD GID="bswInitDeinitNamespace">amsr::test_component::internal</SD>
<SD GID="bswInitDeinitPriority">101</SD>
</SDG>
</SDG>
</SDG>
</SDGS>
</ADMIN-DATA>

Listing 2-1 BswInitDeinitExecutableExtension in ARXML.

2.3.1.2 BswInitDeinitAttributes
This class contains the attributes needed to define usage of a component using this extension model.
The attributes are described in described in table 2-3.

Attribute Type Mult. Note


bswInitDeinitComponentName String 1..1 The name of the component, which is used for identification and
error reporting. Should be a non empty string value.
bswInitDeinitIncludePath String 1..1 An include path that points to a headerfile that holds InitializeCom-
ponent and DeinitializeComponent functions. Should be a non
empty string value.
bswInitDeinitNamespace String 1..1 A namespace where to call InitializeComponent and Deinitialize-
Component from. Should be a non empty string value delimited
by ::. Only alphanumerical characters and underscores allowed.
bswInitDeinitPriority Integer 1..1 A priority index to control the order which the component should
be initialized and deinitialized in. Needs to be a value not already
occupied by other components.

Table 2-3 BswInitDeinitAttributes attribute description

The bswInitDeinitPriority attribute can only be set to a value that isn’t already occupied by either
core or custom components. The 0-100 range is reserved for core components like Persistency or
AraDiag. New custom components are recommended to use a priority index greater than 100 to avoid
collisions with core components.

2.3.2 CryptoExtensionModel
The extension model CryptoExtensionModel contains a top level SdgClass named CryptoExe-
cutableExtension which extends the AUTOSAR class Executable. Usage of the extension model
shall denote usage of the Crypto component in an Adaptive MICROSAR application.

CryptoExecutableExtension

useCryptoApi : Boolean [0..1]

2.3.2.1 CryptoExecutableExtension
The top level SdgClass referenced during modelling and also the only SdgClass contained in this
extension model.

Listing 2-2 demonstrates how the CryptoExecutableExtension is used in the ARXML model to denote
usage of the Crypto component.

© 2024, Vector Informatik GmbH Version: master-18223 11 / 30

based on template version 1.00.00


Technical Reference Application Base

<ADMIN-DATA>
<SDGS>
<SDG GID="DvMex:CryptoExecutableExtension">
<SD GID="useCryptoApi">true</SD>
</SDG>
</SDGS>
</ADMIN-DATA>

Listing 2-2 CryptoExecutableExtension in ARXML.

Attributes contained in the CryptoExecutableExtension are described in table 2-4.

Attribute Type Mult. Note


useCryptoApi Boolean 0..1 Used to denote usage of the Crypto component in an Adaptive
MICROSAR application.

Table 2-4 CryptoExecutableExtension attribute description

Setting useCryptoApi to false when a port interface of type CryptoInterface exist in the model will
produce and error due to contradicting usage information.

2.3.3 PhmExtensionModel
The extension model PhmExtensionModel contains a top level SdgClass named PhmExecutableEx-
tension which extends the AUTOSAR class Executable. Usage of the extension model shall denote
usage of PlatformHealthManager in an Adaptive MICROSAR application.

PhmExecutableExtension

usePhmApi : Boolean [0..1]

2.3.3.1 PhmExecutableExtension
The top level SdgClass referenced during modelling and also the only SdgClass contained in this
extension model.

Listing 2-3 demonstrates how the PhmExecutableExtension is used in the ARXML model to denote
usage of the PlatformHealthManager component.

<ADMIN-DATA>
<SDGS>
<SDG GID="DvMex:PhmExecutableExtension">
<SD GID="usePhmApi">true</SD>
</SDG>
</SDGS>
</ADMIN-DATA>

Listing 2-3 PhmExecutableExtension in ARXML.

Attributes contained in the PhmExecutableExtension are described in table 2-5.

2.3.4 LogConfigExtensionModel
The extension model LogConfigExtensionModel contains a top level SdgClass named LogCon-
figApiUsage which extends the AUTOSAR class Executable. Usage of the extension model shall
denote usage of LogConfig in an Adaptive MICROSAR application.

© 2024, Vector Informatik GmbH Version: master-18223 12 / 30

based on template version 1.00.00


Technical Reference Application Base

Attribute Type Mult. Note


usePhmApi Boolean 0..1 Used to denote usage of the PlatformHealthManager component
in an Adaptive MICROSAR application.

Table 2-5 PhmExecutableExtension attribute description

LogConfigApiUsage

useLogConfigApi : Boolean [0..1]

2.3.4.1 LogConfigApiUsage
The top level SdgClass referenced during modelling and also the only SdgClass contained in this
extension model.

Listing 2-4 demonstrates how the LogConfigExtensionModel is used in the ARXML model to denote
usage of the LogConfig component.

<ADMIN-DATA>
<SDGS>
<SDG GID="DvMex:LogConfigApiUsage">
<SD GID="useLogConfigApi">true</SD>
</SDG>
</SDGS>
</ADMIN-DATA>

Listing 2-4 LogConfigApiUsage in ARXML.

Attributes contained in the LogConfigApiUsage are described in table 2-6.

Attribute Type Mult. Note


useLogConfigApi Boolean 0..1 Used to denote usage of the LogConfig component in an Adaptive
MICROSAR application.

Table 2-6 LogConfigApiUsage attribute description

2.3.5 BswExecutableTypeExtensionModel
The extension model BswExecutableTypeExtensionModel contains a top level SdgClass named
BswExecutable which extends the AUTOSAR class Executable. This extension model can be used
to identify a relation between an executable and a certain type when other methods of identification
aren’t sufficient.

BswExecutable

bswExecutableType : Enum [0..1]

2.3.5.1 BswExecutable
The top level SdgClass referenced during modelling and also the only SdgClass contained in this
extension model.

Listing 2-5 demonstrates how BswExecutable is used to identify an Executable of type DIAGNOS-
TIC_MANAGER. modeled in the ARXML model.

© 2024, Vector Informatik GmbH Version: master-18223 13 / 30

based on template version 1.00.00


Technical Reference Application Base

<ADMIN-DATA>
<SDGS>
<SDG GID="DvMex:BswExecutable">
<SD GID="bswExecutableType">DIAGNOSTIC_MANAGER</SD>
</SDG>
</SDGS>
</ADMIN-DATA>

Listing 2-5 BswExecutable in ARXML.

Attributes contained in the BswExecutable class are described in table 2-7.


Attribute Type Mult. Note
bswExecutableType Enum 0..1 Identifies the type of an executable. Refer to 2-8 for valid enum
values.

Table 2-7 BswExecutable attribute description

Enum value Note


DIAGNOSTIC_MANAGER Used to identify amsr-vector-fs-diagnosticmanager
EXECUTION_MANAGER Used to identify amsr-vector-fs-em-executionmanager
PASSTHROUGH_MANAGER Used to identify amsr-vector-fs-passthroughmanager
NETWORK_MANAGER Used to identify amsr-vector-fs-nm-networkmanager
HEALTH_MANAGER Used to identify amsr-vector-fs-phm-healthmanager
UPDATE_MANAGER Used to identify amsr-vector-fs-updatemanager
TIMESYNC_DAEMON Used to identify amsr-vector-fs-timesync
STATE_MANAGER Used to identify State Management.
UDPIPCGATEWAY Used to identify amsr-vector-fs-udpipcgateway
CRYPTO_DAEMON Used to identify amsr_crypto_daemon
SOMEIP_DAEMON Used to identify amsr-vector-fs-someipdaemon

Table 2-8 Valid enum values for the bswExecutableType attribute.

2.3.6 BswVersionedApiExtensionModel
The extension model BswVersionedApiExtensionModel contains a top level SdgClass named
BswVersionedApi which extends the AUTOSAR class Executable. Usage of this extension model
shall denote which respective version of ara::core and ara::com is used by an Adaptive MICROSAR
application.

BswVersionedApi

amsrAraCoreApi : Enum [0..1]


amsrAraComApi : Enum [0..1]

2.3.6.1 BswVersionedApi
The top level SdgClass referenced during modelling and also the only SdgClass contained in this
extension model.

Listing 2-6 demonstrates how BswVersionedApi is used in the ARXML model to denote ara::core
and ara::com API version 20.11.

© 2024, Vector Informatik GmbH Version: master-18223 14 / 30

based on template version 1.00.00


Technical Reference Application Base

<ADMIN-DATA>
<SDGS>
<SDG GID="DvMex:BswVersionedApi">
<SD GID="amsrAraCoreApi">r20_11</SD>
<SD GID="amsrAraComApi">r20_11</SD>
</SDG>
</SDGS>
</ADMIN-DATA>

Listing 2-6 BswVersionedApi in ARXML.

Attributes contained in the BswVersionedApi class are described in table 2-9.

Attribute Type Mult. Note


amsrAraCoreApi Enum 0..1 ara::core API version. Refer to 2-10 for valid enum values.
amsrAraComApi Enum 0..1 amsr::com API version. Refer to 2-11 for valid enum values.

Table 2-9 BswVersionedApi attribute description

Enum value Note


r19_03 Denotes ara::core API version 19_03.
r20_11 Denotes ara::core API version 20_11.

Table 2-10 Valid enum values for the amsrAraCoreApi attribute.

Enum value Note


r18_03 Denotes ara::com API version 18_03.
r20_11 Denotes ara::com API version 20_11.

Table 2-11 Valid enum values for the amsrAraComApi attribute.

2.3.7 BswLowerGradeQualityLevelExtensionModel
The extension model BswLowerGradeQualityLevelExtensionModel contains a top level SdgClass
named BswLowerGradeQualityLevel which extends the AUTOSAR class Executable. Usage of this
extension model shall denote activation of lower quality level source code for an Executable.

BswLowerGradeQualityLevel

lowerGradeQualityLevel : Enum [0..1]

2.3.7.1 BswLowerGradeQualityLevel
The top level SdgClass referenced during modelling and also the only SdgClass contained in this
extension model.

Listing 2-7 demonstrates how BswLowerGradeQualityLevel is used in the ARXML model to denote
beta source code activation.

<ADMIN-DATA>
<SDGS>
<SDG GID="DvMex:BswLowerGradeQualityLevel">
<SD GID="lowerGradeQualityLevel">BETA</SD>

© 2024, Vector Informatik GmbH Version: master-18223 15 / 30

based on template version 1.00.00


Technical Reference Application Base

</SDG>
</SDGS>
</ADMIN-DATA>

Listing 2-7 BswLowerGradeQualityLevel in ARXML.

Attributes contained in the BswLowerGradeQualityLevel class are described in table 2-12.

Attribute Type Mult. Note


lowerGradeQualityLevel Enum 0..1 Quality level. Refer to 2-13 for valid enum values.

Table 2-12 BswLowerGradeQualityLevel attribute description

Enum value Note


QM Denotes quality level QM.
BETA Denotes quality level BETA.
BETA_QM Denotes quality level BETA and QM.

Table 2-13 Valid enum values for the lowerGradeQualityLevel attribute.

2.3.8 SmExtensionModel
The extension model SmExtensionModel contains a top level SdgClass named SmExecutableEx-
tension which extends the AUTOSAR class Executable. Usage of the extension model shall denote
usage of StateManager in an Adaptive MICROSAR application.

SmExecutableExtension

useSmApi : Boolean [0..1]

2.3.8.1 SmExecutableExtension
The top level SdgClass referenced during modelling and also the only SdgClass contained in this
extension model.

Listing 2-3 demonstrates how the SmExecutableExtension is used in the ARXML model to denote
usage of the StateManager component.

<ADMIN-DATA>
<SDGS>
<SDG GID="DvMex:SmExecutableExtension">
<SD GID="useSmApi">true</SD>
</SDG>
</SDGS>
</ADMIN-DATA>

Listing 2-8 SmExecutableExtension in ARXML.

Attributes contained in the SmExecutableExtension are described in table 2-14.

© 2024, Vector Informatik GmbH Version: master-18223 16 / 30

based on template version 1.00.00


Technical Reference Application Base

Attribute Type Mult. Note


useSmApi Boolean 0..1 Used to denote usage of the StateManager component in an
Adaptive MICROSAR application.

Table 2-14 SmExecutableExtension attribute description

2.3.9 BswSteadyModeExtensionModel
The extension model BswSteadyModeExtensionModel contains a top level SdgClass named
BswSteadyMode which extends the AUTOSAR class Executable. Usage of this extension model
shall denote activation of Steady Mode for an Executable.

BswSteadyMode

steadyMode : Boolean [0..1]

2.3.9.1 BswSteadyMode
The top level SdgClass referenced during modelling and also the only SdgClass contained in this
extension model.

Listing 2-9 demonstrates how BswSteadyMode is used in the ARXML model to denote Steady Mode
activation.

<ADMIN-DATA>
<SDGS>
<SDG GID="DvMex:BswSteadyMode">
<SD GID="steadyMode">true</SD>
</SDG>
</SDGS>
</ADMIN-DATA>

Listing 2-9 BswSteadyMode in ARXML.

Attributes contained in the BswSteadyMode class are described in table 2-15.

Attribute Type Mult. Note


steadyMode Boolean 0..1 Used to denote usage of Steady Mode in an Adaptive MICROSAR
application.

Table 2-15 BswSteadyMode attribute description

© 2024, Vector Informatik GmbH Version: master-18223 17 / 30

based on template version 1.00.00


Technical Reference Application Base

3 Integration

3.1 Build Dependencies


To build ApplicationBase the following components are required:
> amsr-vector-fs-libvac

3.2 Files and Include Structure


The header files can be included like this:
#include ”ara/core/initialization.h”
The initialization.h is specified in Adaptive Core Types specification [1].

The generator amsr_applicationbase generator is delivered as a single jar-file:


amsr_applicationbase.jar.

3.3 Integration of ApplicationBase


Following steps are necessary if ApplicationBase shall be used:

For every application (i.e. an executable that uses ApplicationBase):


> Create an ARXML manifest as defined by AUTOSAR_TPS_ManifestSpecification.
> Add the generated header for this application.
> Build the application.

Every application needs an individual ApplicationBase library that is built with the application specific
generated code.

3.4 CMake
For detailed usage of CMake see documentation available at https://cmake.org/documentation.

3.4.1 Build
The CMake project provided with this component has options as specified in 3-1.

CMake option Description Defaultvalue


-DENABLE_DOXYGEN Vector internal use. Set to OFF OFF
-DBUILD_TESTS Vector internal use. Set to OFF OFF

Table 3-1 CMake options

3.4.2 Exported CMake packages


The amsr-vector-fs-applicationbase CMake project exports packages which can be used to compile
against the exported library.

3.5 Usage
The example shown in 3-1 demonstrates the usage of ApplicationBase.

© 2024, Vector Informatik GmbH Version: master-18223 18 / 30

based on template version 1.00.00


Technical Reference Application Base

// ...
#include "ara/core/initialization.h"

int main(int argc, char* argv[]) {


// static variables/objects initialized
// setup signal handling, ...
ara::core::Result<void> init_result {ara::core::Initialize()};
// init_result.HasValue() != true -> ARA can not be used
// init_result.HasValue() == true -> ARA can be used
if(init_result.HasValue()) {
// ... business logic ...

// all threads accessing ARA \gls{API}s joined


ara::core::Result<void> deinit_result {ara::core::Deinitialize()};
deinit_result.InspectError([](ara::core::ErrorCode const& error) {
std::cerr << "ara::core::Deinitialize() failed!";
std::cerr << "Result contains: " << error.Message() << ", " << error.UserMessage();
});
}
} // static variables/objects will be deinitialized

Listing 3-1 Example usage of ApplicationBase

© 2024, Vector Informatik GmbH Version: master-18223 19 / 30

based on template version 1.00.00


Technical Reference Application Base

4 API Description

Caution
The API of the MICROSAR Adaptive product is built by public classes, their methods, free
functions and types. Classes, their accessible methods, free functions and other types that
are intended to be used by customers are annotated with the documentation tag \vpublic.
These items build the product public API. Customer software shall just use the public API
of MICROSAR Adaptive. The private part shall not be used.

4.1 lib/application_base/include/ara/core/initialization.h File Reference


Provides ara::core::Initialize() and ara::core::Deinitialize().
#include "amsr/application_base/initialization_error_domain.h"
#include "ara/core/result.h"
Include dependency graph for initialization.h:

lib/application_base
/include/ara/core/initialization.h

amsr/application_base
/initialization_error ara/core/result.h
_domain.h

vac/language/throw
limits utility ara/core/error_code.h ara/core/error_domain.h ara/core/exception.h
_or_terminate.h

Enumerations
> enum ara::core::details::InitializationState : std::uint8_t { kUninitialized, kInitialized, kDeinitial-
ized }
Defines the reachable initialization states.

Functions
> Result< void > ara::core::Initialize () noexcept
(Pre-)Initialization of the ARA Framework.
> Result< void > ara::core::Deinitialize () noexcept
Shutdown of the ARA Framework.

Variables
> InitializationState ara::core::details::g_initialization_state
The internal initialization state of ara::core.

4.1.1 Detailed Description


Provides ara::core::Initialize() and ara::core::Deinitialize().
Provides the global initialization and shutdown functions that initialize resp. deinitialize data structures
and threads of the AUTOSAR Runtime for Adaptive Applications (ARA).
Unit:
ApplicationBase::InitializationDeinitialization

© 2024, Vector Informatik GmbH Version: master-18223 20 / 30

based on template version 1.00.00


Technical Reference Application Base

4.1.2 Function Documentation


4.1.2.1 Result<void> ara::core::Deinitialize ( ) [noexcept]
Shutdown of the ARA Framework.
When Initialize() has returned successfully, Deinitialize() has to be called. After this call, no interaction
with the ARA (Adaptive Runtime for Application) is allowed (with the exception of constant initializations
and types which are trivial destructible). As a prerequisite to calling this API it is expected that the use
of ARA interfaces is completed (with the given exceptions). It is required to make this call in a place
where it is guaranteed that the static initialization has completed and destruction of statically initialized
data has not yet started (e.g. inside of main function).

Precondition
ara::core::Initialize() has returned successfully.
All threads accessing ARA APIs joined.

Note
Calling any ARA functions after calling this function may have unforeseen consequences. When
Deinitialize() returns with an error, it is generally unsafe to call either Deinitialize() or Initialize()
again.

Remarks
The function body is generated.
// ...
#include "ara/core/initialization.h"

int main(int argc, char* argv[]) {


// static variables/objects initialized
// setup signal handling, ...
ara::core::Result<void> init_result {ara::core::Initialize()};
// init_result.HasValue() != true -> ARA can not be used
// init_result.HasValue() == true -> ARA can be used
if(init_result.HasValue()) {
// ... business logic ...

// all threads accessing ARA APIs joined


ara::core::Result<void> deinit_result {ara::core::Deinitialize()};
deinit_result.InspectError([](ara::core::ErrorCode const& error) {
std::cerr << "ara::core::Deinitialize() failed!";
std::cerr << "Result contains: " << error.Message() << ", " << error.UserMessage();
});
}
} // static variables/objects will be deinitialized

Product public API

Thread-safe: FALSE

Reentrant: FALSE

© 2024, Vector Informatik GmbH Version: master-18223 21 / 30

based on template version 1.00.00


Technical Reference Application Base

Return values

InitializationErrc::kWrongSequence Deinitialize() is called in a wrong sequence (e.g


called prior to Initialize()).

4.1.2.2 Result<void> ara::core::Initialize ( ) [noexcept]


(Pre-)Initialization of the ARA Framework.
Prior to this call, no interaction with the ARA (Adaptive Runtime for Applications) is allowed with the
exception of constant initializations and types which are trivially destructible. It is required to make
this call in a place where it is guaranteed that static memory initialization has completed (e.g. inside
of main function). When Initialize() has returned successfully, calling it again will return an error.
When Initialize() returns with an error, the application may report the error cause and exit by using an
appropriate return code. Calling Deinitialize() in this case is not necessary.

Note
Calling any ARA functions before calling this function may have unforeseen consequences.

Remarks
The function body is generated.

// ...
#include "ara/core/initialization.h"

int main(int argc, char* argv[]) {


// static variables/objects initialized
// setup signal handling, ...
ara::core::Result<void> init_result {ara::core::Initialize()};
// init_result.HasValue() != true -> ARA can not be used
// init_result.HasValue() == true -> ARA can be used
if(init_result.HasValue()) {
// ... business logic ...

// all threads accessing ARA APIs joined


ara::core::Result<void> deinit_result {ara::core::Deinitialize()};
deinit_result.InspectError([](ara::core::ErrorCode const& error) {
std::cerr << "ara::core::Deinitialize() failed!";
std::cerr << "Result contains: " << error.Message() << ", " << error.UserMessage();
});
}
return init_result.HasValue() ? 0 : -1;
} // static variables/objects will be deinitialized

Product public API

Thread-safe: FALSE

Reentrant: FALSE

© 2024, Vector Informatik GmbH Version: master-18223 22 / 30

based on template version 1.00.00


Technical Reference Application Base

Return values

InitializationErrc::kWrongSequence Initialize() is called in a wrong sequence (e.g. twice


consecutively)

4.2 lib/application_base/include/amsr/application_base/initialization_error_domain.h File Ref-


erence
Error domain for errors originating from initialization and deinitialization of components.
#include <limits>
#include <utility>
#include "ara/core/error_code.h"
#include "ara/core/error_domain.h"
#include "ara/core/exception.h"
#include "vac/language/throw_or_terminate.h"
Include dependency graph for initialization_error_domain.h:

lib/application_base
/include/amsr/application
_base/initialization_error
_domain.h

vac/language/throw
limits utility ara/core/error_code.h ara/core/error_domain.h ara/core/exception.h
_or_terminate.h

This graph shows which files directly or indirectly include this file:

lib/application_base
/include/amsr/application
_base/initialization_error
_domain.h

lib/application_base
/include/ara/core/initialization.h

Classes
> class amsr::application_base::InitializationException
Exception type thrown by ara::core::Initialize() and ara::core::Deinitialize().
> class amsr::application_base::InitializationErrorDomain
Error domain for errors originating from ara::core::Initialize() and ara::core::Deinitialize().

© 2024, Vector Informatik GmbH Version: master-18223 23 / 30

based on template version 1.00.00


Technical Reference Application Base

Enumerations
> enum amsr::application_base::InitializationErrc : ara::core::ErrorDomain::CodeType { amsr::application_base:
= 101 }
Specifies the internal errors that can occur upon calling ara::core::Initialize() and ara::core::Deinitialize().

Functions
> constexpr ara::core::ErrorDomain const & amsr::application_base::GetInitializationErrorDomain ()
noexcept
Obtain the reference to the single global InitializationErrorDomain instance.
> constexpr ara::core::ErrorCode amsr::application_base::MakeErrorCode (InitializationErrc code,
ara::core::ErrorDomain::SupportDataType data, char const ∗message) noexcept
Create a new ErrorCode for InitializationErrorDomain with the given support data type and message.

4.2.1 Detailed Description


Error domain for errors originating from initialization and deinitialization of components.

Unit:
ApplicationBase::InitializationDeinitializationErrorHandling

4.2.2 Enumeration Type Documentation


4.2.2.1 enum amsr::application_base::InitializationErrc : ara::core::ErrorDomain::CodeType
[strong]
Specifies the internal errors that can occur upon calling ara::core::Initialize() and ara::core::Deinitialize().

Product public API

4.2.3 Function Documentation


4.2.3.1 constexpr ara::core::ErrorDomain const& amsr::application_base::GetInitializationErrorDomain
( ) [inline], [noexcept]
Obtain the reference to the single global InitializationErrorDomain instance.

© 2024, Vector Informatik GmbH Version: master-18223 24 / 30

based on template version 1.00.00


Technical Reference Application Base

Returns
Reference to the InitializationErrorDomain instance.

Product public API

References amsr::application_base::GetInitializationErrorDomain().
Referenced by amsr::application_base::GetInitializationErrorDomain(), and amsr::application_base::MakeErrorCod
Here is the call graph for this function:

amsr::application_base
::GetInitializationErrorDomain

Here is the caller graph for this function:

amsr::application_base amsr::application_base
::GetInitializationErrorDomain ::MakeErrorCode

4.2.3.2 constexpr ara::core::ErrorCode amsr::application_base::MakeErrorCode (


InitializationErrc code, ara::core::ErrorDomain::SupportDataType data, char const ∗
message ) [inline], [noexcept]
Create a new ErrorCode for InitializationErrorDomain with the given support data type and message.

Parameters

code Enumeration value from


InitializationErrc.
data Vendor-defined
supplementary value.
message User-defined context
message (can be nullptr).

© 2024, Vector Informatik GmbH Version: master-18223 25 / 30

based on template version 1.00.00


Technical Reference Application Base

Returns
The new ErrorCode instance.

Product public API

References amsr::application_base::GetInitializationErrorDomain(), and amsr::application_base::MakeErrorCode()


Referenced by amsr::application_base::MakeErrorCode().
Here is the call graph for this function:

amsr::application_base amsr::application_base
::MakeErrorCode ::GetInitializationErrorDomain

Here is the caller graph for this function:

amsr::application_base
::MakeErrorCode

4.3 amsr::application_base::InitializationErrorDomain Class Reference


Error domain for errors originating from ara::core::Initialize() and ara::core::Deinitialize().
#include <initialization_error_domain.h>

© 2024, Vector Informatik GmbH Version: master-18223 26 / 30

based on template version 1.00.00


Technical Reference Application Base

Inheritance diagram for amsr::application_base::InitializationErrorDomain:

ara::core::ErrorDomain

amsr::application_base
::InitializationErrorDomain

Collaboration diagram for amsr::application_base::InitializationErrorDomain:

ara::core::ErrorDomain

amsr::application_base
::InitializationErrorDomain

Public Types
> using Exception = InitializationException
Alias for the exception base class.

Public Member Functions


> constexpr InitializationErrorDomain () noexcept
Default constructor.
> char const ∗ Name () const noexceptfinal
Return the "shortname" ApApplicationErrorDomain.SN of this error domain.
> char const ∗ Message (ErrorDomain::CodeType error_code) const noexceptfinal
Translates an error code value into a text message.
> void ThrowAsException (ara::core::ErrorCode const &error_code) const noexcept(false) final
Throw the exception type corresponding to the given ErrorCode.

4.3.1 Detailed Description


Error domain for errors originating from ara::core::Initialize() and ara::core::Deinitialize().

Product public API

© 2024, Vector Informatik GmbH Version: master-18223 27 / 30

based on template version 1.00.00


Technical Reference Application Base

4.3.2 Constructor & Destructor Documentation


4.3.2.1 constexpr amsr::application_base::InitializationErrorDomain::InitializationErrorDomain
( ) [inline], [noexcept]
Default constructor.
Product public API

4.3.3 Member Function Documentation


4.3.3.1 char const∗ amsr::application_base::InitializationErrorDomain::Message (
ErrorDomain::CodeType error_code ) const [inline], [final], [noexcept]
Translates an error code value into a text message.

Parameters

error_code The error code value


to translate.

Returns
The text message, never nullptr.
Product public API

4.3.3.2 char const∗ amsr::application_base::InitializationErrorDomain::Name ( ) const


[inline], [final], [noexcept]
Return the "shortname" ApApplicationErrorDomain.SN of this error domain.
Returns
"InitializationError".
Product public API

4.3.3.3 void amsr::application_base::InitializationErrorDomain::ThrowAsException (


ara::core::ErrorCode const & error_code ) const [inline], [final], [noexcept]
Throw the exception type corresponding to the given ErrorCode.

Parameters

error_code The ErrorCode


instance.

Product public API

The documentation for this class was generated from the following file:
> lib/application_base/include/amsr/application_base/initialization_error_domain.h

© 2024, Vector Informatik GmbH Version: master-18223 28 / 30

based on template version 1.00.00


Technical Reference Application Base

5 Glossary and Abbreviations

5.1 Abbreviations

Abbreviation Description
API Application Programming Interface
ARXML AUTOSAR XML
AUTOSAR Automotive Open System Architecture
BSW Basic Software
MICROSAR Microcontroller Open System Architecture (the Vector AUTOSAR solu-
tion).

© 2024, Vector Informatik GmbH Version: master-18223 29 / 30

based on template version 1.00.00


Technical Reference Application Base

6 Contact

Visit our website for more information on

> News
> Products
> Demo software
> Support
> Training data
> Addresses

www.vector.com

© 2024, Vector Informatik GmbH Version: master-18223 30 / 30

based on template version 1.00.00

You might also like