Professional Documents
Culture Documents
TechnicalReference ApplicationBase
TechnicalReference ApplicationBase
Technical Reference
Adaptive MICROSAR
Version master-18223
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.
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
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
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
6 Contact . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Illustrations
Tables
Listings
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
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.
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
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:
> 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.
> NETWORK_MANAGER
> DIAGNOSTIC_MANAGER
> HEALTH_MANAGER
> UPDATE_MANAGER
> SOMEIP_DAEMON
> TIMESYNC_DAEMON
> UDPIPCGATEWAY
> CRYPTO_DAEMON
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.
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
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>
<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>
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.
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
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.
<ADMIN-DATA>
<SDGS>
<SDG GID="DvMex:CryptoExecutableExtension">
<SD GID="useCryptoApi">true</SD>
</SDG>
</SDGS>
</ADMIN-DATA>
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
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>
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.
LogConfigApiUsage
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>
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
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.
<ADMIN-DATA>
<SDGS>
<SDG GID="DvMex:BswExecutable">
<SD GID="bswExecutableType">DIAGNOSTIC_MANAGER</SD>
</SDG>
</SDGS>
</ADMIN-DATA>
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
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.
<ADMIN-DATA>
<SDGS>
<SDG GID="DvMex:BswVersionedApi">
<SD GID="amsrAraCoreApi">r20_11</SD>
<SD GID="amsrAraComApi">r20_11</SD>
</SDG>
</SDGS>
</ADMIN-DATA>
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
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>
</SDG>
</SDGS>
</ADMIN-DATA>
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
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>
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
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>
3 Integration
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.
3.5 Usage
The example shown in 3-1 demonstrates the usage of ApplicationBase.
// ...
#include "ara/core/initialization.h"
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.
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.
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"
Thread-safe: FALSE
Reentrant: FALSE
Return values
Note
Calling any ARA functions before calling this function may have unforeseen consequences.
Remarks
The function body is generated.
// ...
#include "ara/core/initialization.h"
Thread-safe: FALSE
Reentrant: FALSE
Return values
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().
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.
Unit:
ApplicationBase::InitializationDeinitializationErrorHandling
Returns
Reference to the InitializationErrorDomain instance.
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
amsr::application_base amsr::application_base
::GetInitializationErrorDomain ::MakeErrorCode
Parameters
Returns
The new ErrorCode instance.
amsr::application_base amsr::application_base
::MakeErrorCode ::GetInitializationErrorDomain
amsr::application_base
::MakeErrorCode
ara::core::ErrorDomain
amsr::application_base
::InitializationErrorDomain
ara::core::ErrorDomain
amsr::application_base
::InitializationErrorDomain
Public Types
> using Exception = InitializationException
Alias for the exception base class.
Parameters
Returns
The text message, never nullptr.
Product public API
Parameters
The documentation for this class was generated from the following file:
> lib/application_base/include/amsr/application_base/initialization_error_domain.h
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).
6 Contact
> News
> Products
> Demo software
> Support
> Training data
> Addresses
www.vector.com