UML and SysML to AUTOSAR Runnable Code - Class Code Generator Specification

This section describes the UML and SysML to AUTOSAR runnable code generation for structured classes.

This page discusses:

Glossary

Acronym Definition
SPO Software Production Operation
BL Behavior Layer
ML Middleware Layer
BSM Behavior Specific Middleware
TSM Target Specific Middleware

Referenced Documents

Document Internal Reference
UML & SysML to AUTOSAR Runnable Code - Operation Specification [1]

General Concepts

UML & SysML to AUTOSAR Runnable Code generator is an operation generating C code from AUTOSAR architecture designed following UML and SysML standards.

This specification document is focused on the AUTOSAR Runnable code generation from UML class diagram.

Supported Elements

Here is an exhaustiv list of elements used by the operation UML & SysML to AUTOSAR Runnable Code to produce the artefacts with a summary of the purpose and impact.

Element Description AUTOSAR specific
SoftwareArchitecturePackage Container that holds all AUTOSAR software architecture elements.
SoftwareArchitectureComponentPackage Package dedicated to storing AUTOSAR software component definitions.
SoftwareComposition A hierarchical assembly of software components connected by interfaces.
SoftwareAtomicComponent An indivisible AUTOSAR software component implementing runnables and ports.
ARComplexDeviceDriverComponent Component providing complex, hardware-specific driver logic. x
AREcuAbstractionComponent Component abstracting ECU hardware details to offer uniform access. x
ARNvBlockComponent Component managing read/write operations to non-volatile memory blocks. x
ARSensorActuatorComponent Component interfacing with sensors or actuators to process signals. x
ARServiceComponent Component providing standardized AUTOSAR services. x
ARSoftwareAtomicComponent AUTOSAR atomic software component with internal behavior. x
ARInternalBehavior Specification of runnables, events, and component implementation. x
ARComponentVariable Internal variable used inside a component’s behavior. x
ARAbstractEvent Base type for events triggering runnables. x
AROperationEvent Event triggering a runnable when an operation is invoked. x
ARRunnableEntity Executable unit of functionality within a component. x
AROperationAccess Description of runnable access to a client-server operation. x
ARDataAccess Description of runnable access to sender-receiver or parameter data. x
ARClientServerInterface Interface describing callable operations between client and server. x
ARDataInterface Interface defining structured data exchanged in sender-receiver communication. x
ARSenderReceiver Mechanism enabling asynchronous data exchange via data elements. x
ARParameterInterface Interface providing calibration or constant parameters. x
DataElement Typed unit of data transported through an interface.
ClientServerPort Port enabling invocation or provision of client-server operations.
SenderReceiverPort Port enabling sending or receiving data elements asynchronously.

Validation Constraints

No validation constraints

Code Generator Specification

This section is divided in 2 parts:

  • The generated files specification
  • The behavior specification

Files Specifications

A Software Atomic Component is the smallest deployable and executable software unit defined in the AUTOSAR architecture. It encapsulates a coherent piece of application functionality and is designed to be independent, reusable, and composable with other components.

A Software Atomic Component is defined as a UML Component annotated with the SoftwareAtomicComponent stereotype.

Code generator generates 2 files for each Software Atomic Component:

  • <SoftwareAtomicComponentName>.c
  • <SoftwareAtomicComponentName>_MemMap.h

<SoftwareAtomicComponentName>_MemMap.h

AUTOSAR requires that every piece of generated code be mapped to a well-defined memory section. This mechanism enables integration with linker scripts, supports memory protection, and ensures compatibility with AUTOSAR MCAL and OS memory handling. The MemMap.h inclusion pattern is mandatory and follows the AUTOSAR “Memory Mapping” specification.

For each Software Atomic Component <ComponentName>, the code generator shall produce a component-specific memory mapping header file named **<ComponentName>_MemMap.h**

Component MemMap File Content. The file shall have the following structure:

#ifndef <COMPONENTNAME>_MEMMAP_H
#define <COMPONENTNAME>_MEMMAP_H

#endif /* <COMPONENTNAME>_MEMMAP_H */

<SoftwareAtomicComponentName>.c

File Naming and Structure

<ComponentName>.c is the implementation file generated for the AUTOSAR Software Component <ComponentName>. It contains the executable code corresponding to the component’s runnables, internal helper functions, and interactions with the RTE. All functions in this file are placed within AUTOSAR-compliant memory sections using the component-specific MemMap mechanism. The file includes the component’s header and any required AUTOSAR or platform headers. It is fully generated by the code generator and must not be manually modified unless explicitly allowed through protected user-code regions.

The code generator shall generate exactly one implementation file named <ComponentName>.c where <ComponentName> is the exact short name of the Software Atomic Component.

File Uniqueness. The generator shall not produce more than one .c file for the same Software Atomic Component.

Component Description Banner. The generator shall insert a header banner containing at least:

  • information about the generator and its version
  • the identifier (@generated_from) of the SoftwareAtomicComponent element

Mandatory Header Inclusion Order. <ComponentName>.c shall include the following headers in the specified order:

  1. Required RTE header: Rte_<ComponentName>.h
  2. Standard AUTOSAR headers (e.g., Std_Types.h) as required by generated types.
  3. Component-specific configuration headers if necessary.

The code generator shall include the header file Rte_<ComponentName>.h in the generated implementation file <ComponentName>.c.

User-Code Sections Creation. The generator shall create user-code sections delimited with begin/end markers following the pattern:

/********************************************************************************/
/* BEG_USER_CODE(<section_name>) do not remove */
/* Add your <contents> here */
/* END_USER_CODE(<section_name>) do not remove */
/********************************************************************************/

Preservation of User Code. Any content inserted by the user inside these user-code sections shall be preserved during regeneration of the file.

Provided User-Code Sections. The generator shall provide the following user-code sections in <ComponentName>.c:

  • User Header Inclusions (user_includes)
  • User-Defined Types (user_types)
  • User-Defined Data / Variables (user_data)
  • User Function Prototypes (user_prototypes)
  • User Methods (user_methods)

User Header Inclusions: This section allows the user to add additional #include directives that are required by custom logic, helper functions, or external libraries used inside the component implementation.

/********************************************************************************/
/* BEG_USER_CODE(user_includes) do not remove */
#include "MyMathLib.h"
#include "MyCustomConfig.h"
/* END_USER_CODE(user_includes) do not remove */
/********************************************************************************/

User-Defined Types: This section allows users to define additional data types that are needed by their custom code, such as: custom struct, enum, typedef, local type aliasing…

/********************************************************************************/
/* BEG_USER_CODE(user_types) do not remove */
typedef struct
{
    uint16 counter;
    float32 average;
} MyLocalStatsType;
/* END_USER_CODE(user_types) do not remove */
/********************************************************************************/

User-Defined Data / Variables: This section is used to declare user-specific global or module-level variables that the generator should not manage. It may also include: calibration arrays, lookup tables, local buffers, state variables.

/********************************************************************************/
/* BEG_USER_CODE(user_data) do not remove */
static uint32 DebugCounter = 0;
float32 SensorCache = 0.0F;
/* END_USER_CODE(user_data) do not remove */
/********************************************************************************/

User Function Prototypes: This section is used to declare prototypes of custom user functions that will be implemented later in the same file, usually inside another user-code region or after the generated runnables.

/********************************************************************************/
/* BEG_USER_CODE(user_prototypes) do not remove */
static void ComputeAverage(void);
void LogErrorStatus(uint8 code);
/* END_USER_CODE(user_prototypes) do not remove */
/********************************************************************************/

User Methods: This section allows users to implement their custom functions that are not generated by the tool, typically complementing or supporting the generated runnables and internal logic.

/********************************************************************************/
/* BEG_USER_CODE(user_methods) */
static void ComputeAverage(void)
{
    // Custom average computation
}

void LogErrorStatus(uint8 code)
{
    // Custom logging function
}
/* END_USER_CODE(user_methods) */
/********************************************************************************/

Runnable Placement After User Prototypes. The code generator shall place all generated runnables after the User Function Prototypes section, ensuring that any prototypes declared for user functions or internal helper functions appear before the runnable implementations.

Runnable Placement Before User Methods. The generated runnables shall appear before the User Methods section, so that user-implemented functions can call the runnables if required.

Memory Mapping

Use of START/STOP Section Macros. The generator shall enclose all function definitions within the following memory section macros:

#define <ComponentName>_START_SEC_CODE
#include "<ComponentName>_MemMap.h"

/* Function definitions */

#define <ComponentName>_STOP_SEC_CODE
#include "<ComponentName>_MemMap.h"

No Functions Outside Mapped Sections. No function definition shall appear in <ComponentName>.c outside the memory-mapped code section.

Balanced Section Markers. Every START_SEC_CODE macro emitted by the generator shall have a corresponding and correctly-ordered STOP_SEC_CODE.

User Function Prototypes Memory Section Placement. The code generator shall ensure that all user function prototypes inserted in the User Function Prototypes user-code section are enclosed within the component-specific memory mapping macros. User function prototypes shall not be placed outside the active START_SEC_CODE / STOP_SEC_CODE memory section.

#define <ComponentName>_START_SEC_CODE
#include "<ComponentName>_MemMap.h"

... User Function Prototypes section ...

#define <ComponentName>_STOP_SEC_CODE
#include "<ComponentName>_MemMap.h"

Runnable Memory Section Placement. All generated runnables shall be enclosed within the component-specific memory mapping macros. No runnable shall appear outside the START/STOP SEC_CODE block.

#define <ComponentName>_START_SEC_CODE
#include "<ComponentName>_MemMap.h"

/* Runnable implementations here */

#define <ComponentName>_STOP_SEC_CODE
#include "<ComponentName>_MemMap.h"

User Methods Memory Section Placement. The code generator shall ensure that all user methods inserted in the User Methods user-code section are enclosed within the component-specific memory mapping macros. User methods shall not be placed outside the active START_SEC_CODE / STOP_SEC_CODE memory section.

#define <ComponentName>_START_SEC_CODE
#include "<ComponentName>_MemMap.h"

... User Methods section ...

#define <ComponentName>_STOP_SEC_CODE
#include "<ComponentName>_MemMap.h"

Semantic Code Specifications

This section describes the behavior of the code generator depending on the UML/SysML element.

Runnable Entity

An AUTOSAR Runnable Entity is defined as a UML Operation annotated with the ARRunnableEntity stereotype.

Runnable Name. The generator shall produce a runnable function whose name matches exactly the name of the ARRunnableEntity.

Runnable Description Banner. For each generated runnable, the generator shall insert a header banner containing at least:

  • the runnable name, <RunnableName>
  • the runnable symbol, <RunnableSymbol>
  • the identifier (@generated_from) of the ARRunnableEntity element, <RunnableId>
  • the list of available RTE APIs for the Runnable Entity. This list shall reflect exactly the APIs exposed by the RTE contract.
/**********************************************************************************
* RUNNABLE: <RunnableName>
* SYMBOL: <RunnableSymbol>
* @generated_from <RunnableId>
**********************************************************************************
* Calibration APIs:
* Rte_Prm_...
**********************************************************************************
* Rte_Receive_...
**********************************************************************************
* Sender APIs:
* Rte_Send_...
**********************************************************************************
* Synchronous Client APIs:
* Rte_Call_...
**********************************************************************************
* RTE Events:
* OperationInvokedEvent: OIE_...
**********************************************************************************/

Runnable Signature. The generator shall declare each runnable using the AUTOSAR FUNC macro and the component’s memory class, according to the following format:

FUNC(void, <ComponentName>_CODE) <RunnableName>(void)

Runnable Arguments (Server Runnables Only). If the runnable is a server runnable, the generator shall declare function input arguments exactly as defined in the RTE contract, following AUTOSAR type qualifiers (IN, OUT, INOUT, pointers, etc.). If the runnable is not a server runnable, the generated signature shall not contain any parameters.

Runnable Content Structure. Each generated runnable shall contain, in the following strict order:

  1. Local Data Declaration
  2. User Data Declaration Section
  3. RTE API Calls (returned-data assignments)
  4. User Code Section

Local Data Declaration. For each RTE API that returns, receives, sends or writes data, the generator shall declare:

  • a variable to hold the return value (Std_ReturnType) AND/OR
  • a variable to hold the data to be sent/written/read/received

Initialization of Return Variables. Each return variable (Std_ReturnType) shall be initialized to RTE_OK at the beginning of the runnable.

Provided User-Code Sections. The generator shall provide the following user-code sections:

  • User Data Declaration (user_data_declaration_<RunnableId>)
  • User Code (user_code_<RunnableId>)

User Data Declaration:

/********************************************************************************/
/* BEG_USER_CODE(user_data_declaration_<RunnableId>) do not remove */
/* Add your data declarations here */
/* END_USER_CODE(user_data_declaration_<RunnableId>) do not remove */
/********************************************************************************/

User Code:

/********************************************************************************/
/* BEG_USER_CODE(user_code_<RunnableId>) do not remove */
/* Add your code here */
/* END_USER_CODE(user_code_<RunnableId>) do not remove */
/********************************************************************************/

List of available AUTOSAR APIs. The generator shall include a complete list of all AUTOSAR RTE APIs available to the runnable. This list shall reflect exactly the APIs exposed by the RTE contract.

...
retdata_Send_SRP_SRI_out_custom_queuing_Data_custom = Rte_Send_SRP_SRI_out_custom_queuing_Data_custom(data_Send_SRP_SRI_out_custom_queuing_Data_custom);
retdata_Write_SRP_SRI_out_custom_sampling_Data_custom = Rte_Write_SRP_SRI_out_custom_sampling_Data_custom(data_Write_SRP_SRI_out_custom_sampling_Data_custom);
retdata_IWrite_SRP_SRI_out_custom_sampling_Data_custom = Rte_IWrite_SRP_SRI_out_custom_sampling_Data_custom(data_IWrite_SRP_SRI_out_custom_sampling_Data_custom);
retdata_Send_SRP_SRI_out_alias_queuing_Data_alias = Rte_Send_SRP_SRI_out_alias_queuing_Data_alias(data_Send_SRP_SRI_out_alias_queuing_Data_alias);
retdata_Write_SRP_SRI_out_alias_sampling_Data_alias = Rte_Write_SRP_SRI_out_alias_sampling_Data_alias(data_Write_SRP_SRI_out_alias_sampling_Data_alias);
...

Example of RTE APIs call

Returned-Data Assignments. Every RTE API call shall assign its return value to the corresponding variable previously declared, e.g.:

retdata_Write_* = Rte_Write_*(data_Write_*);

Operation Event

An Operation Event is an AUTOSAR behavioral trigger that activates a Runnable Entity when a client invokes a service operation provided by an AUTOSAR Service Interface. It represents a server-side activation condition for runnables that implement operations exposed by a Server Port.

An AUTOSAR Operation Event is defined as a UML Property annotated with the AROperationEvent stereotype.

In the following requirements:

  • <ComponentName> denotes the name of the Software Atomic Component.
  • <TypeName> denotes the type name or the element type name in the case of an AR Array Implementation Data Type.

Runnable Server Signature.

If AROperationEvent

  • has attribute Runnable referring to ARRunnableEntity, AND
  • has attribute Operation referring to a Operation of an ARClientServerInterface, AND
  • has attribute Software Port referring to a ClientServerPort with
    • attribute Is Conjugated set to false

then the associated ARRunnableEntity is a Runnable Server AND the generated signature shall contain parameters defined in Operation of ARClientServerInterface:

FUNC(void, <ComponentName>_CODE) <RunnableName>(VAR(<TypeOfParameter1>, AUTOMATIC) parameter1, VAR(<TypeOfParameter1>, AUTOMATIC) parameter2,...)

Runnable Server In Arguments with simple type

If Operation of ARClientServerInterface has Parameter

  • whose attribute Direction set to in, AND
  • whose type is a simple type

then the parameter shall be generated in the Runnable Entity signature using the AUTOSAR macro:

VAR(<TypeName>, AUTOMATIC)

Runnable Server In Arguments with complex type

If Operation of ARClientServerInterface has Parameter

  • whose attribute Direction set to in, AND
  • whose type is a complex type (i.e., an AR Structure Implementation Data Type or an AR Array Implementation Data Type)

then the parameter shall be generated in the Runnable Entity signature using the AUTOSAR macro:

P2VAR(<TypeName>, AUTOMATIC, <ComponentName>_APPL_DATA)

Runnable Server Out/Inout Arguments.

If Operation of ARClientServerInterface has Parameter

  • whose attribute Direction set to out OR inout, AND

then the parameter shall be generated in the Runnable Entity signature using the AUTOSAR macro:

P2VAR(<TypeName>, AUTOMATIC, <ComponentName>_APPL_DATA)

Runnable Server Returned Argument with simple type

If Operation of ARClientServerInterface has Parameter

  • whose attribute Direction set to return, AND
  • whose type is a simple type

then the Runnable Entity signature shall be generated using the AUTOSAR macro:

FUNC(<TypeName>, RTE_APPL_DATA, RTE_CODE)

Runnable Server Returned Argument with complex type

If Operation of ARClientServerInterface has Parameter

  • whose attribute Direction set to return, AND
  • whose type is a complex type (i.e., an AR Structure Implementation Data Type or an AR Array Implementation Data Type)

then the Runnable Entity signature shall be generated using the AUTOSAR macro:

FUNC_P2CONST(<TypeName>, RTE_APPL_DATA, RTE_CODE)

Data Access

A Data Access for a Runnable Entity is a configuration that allows a runnable entity to read from or write to specific data elements, either through ports (interfaces) or internal variables defined within the component. This access can include reading or writing data on sender-receiver ports, using inter-runnable variables, or interacting with local variables, depending on the type of communication and data consistency required. The Data Access definition ensures that the runnable can obtain the input it needs or update outputs as part of its operations within the component.

An AUTOSAR Data Access is defined as a UML Property annotated with the ARDataAccess stereotype.

Inter-Runnable Variable Access

Inter-Runnable Variables (IRV) are used to exchange data internally between different runnable entities of the same AUTOSAR Software Component. They are not exposed outside the component but allow runnables to share information efficiently within the component context. For simplicity, the acronym IRV may be used.

In the following requirements:

  • <RunnableName> denotes the name of the Runnable Entity.
  • <IRVName> denotes the name of the Inter-Runnable Variable.

RTE API Name for Implicit Output Inter-Runnable Variable.

If ARDataAccess

  • refers to an ARComponentVariable with attribute kind set to InterRunnableVariable, AND
  • has attribute Direction set to out, AND
  • has attribute Is Implicit set to true

then the operation shall generate the following RTE API in the body of the Runnable Entity:

Rte_IrvIWrite_<RunnableName>_<IRVName> 

RTE API Name for Explicit Output Inter-Runnable Variable.

If ARDataAccess

  • refers to an ARComponentVariable with attribute kind set to InterRunnableVariable, AND
  • has attribute Direction set to out, AND
  • has attribute Is Implicit set to false

then the operation shall generate the following RTE API in the body of the Runnable Entity:

Rte_IrvWrite_<RunnableName>_<IRVName> 

RTE API Name for Implicit Input Inter-Runnable Variable.

If ARDataAccess

  • refers to an ARComponentVariable with attribute kind set to InterRunnableVariable, AND
  • has attribute Direction set to in, AND
  • has attribute Is Implicit set to true

then the operation shall generate the following RTE API in the body of the Runnable Entity:

Rte_IrvIRead_<RunnableName>_<IRVName> 

RTE API Name for Explicit Input Inter-Runnable Variable.

If ARDataAccess

  • refers to an ARComponentVariable with attribute kind set to InterRunnableVariable, AND
  • has attribute Direction set to in, AND
  • has attribute Is Implicit set to false

then the operation shall generate the following RTE API in the body of the Runnable Entity:

Rte_IrvRead_<RunnableName>_<IRVName> 

RTE API Variable for Inter-Runnable Variable.

For each ARDataAccess that refers to an ARComponentVariable with attribute kind set to InterRunnableVariable, a variable shall be declared as a local variable in the Local Data Declaration section of the Runnable Entity body:

VAR(<TypeName>, AUTOMATIC) data_<RteApiRootName>_<IRVName>;

where:

  • <TypeName> is the type name or the element type name in the case of an AR Array Implementation Data Type.
  • <RteApiRootName> is one of: IrvIWrite, IrvWrite, IrvIRead, or IrvRead.

This local variable shall hold the value to be written to or read from the Inter-Runnable Variable.

RTE API Returned Argument for Inter-Runnable Variable.

If ARDataAccess

  • refers to an ARComponentVariable with attribute kind set to InterRunnableVariable, AND
    • has attribute Direction set to out, OR
    • has attribute Direction set to in AND has attribute Is Implicit set to false AND whose type is a complex type (i.e., an AR Structure Implementation Data Type or an AR Array Implementation Data Type)

then a variable for holding the returned argument value shall be declared as a local variable in the Local Data Declaration section of the Runnable Entity body:

Std_ReturnType retdata_<RteApiRootName>_<RunnableName>_<IRVName> = RTE_OK;

where:

  • <RteApiRootName> is one of: IrvIWrite, IrvWrite or IrvRead.

RTE API Argument for Inter-Runnable Variable of Complex Type.

If ARDataAccess

  • refers to an ARComponentVariable with attribute kind set to InterRunnableVariable, AND
  • whose type is a complex type (i.e., an AR Structure Implementation Data Type or an AR Array Implementation Data Type), AND
    • has attribute Direction set to out, OR
    • has attribute Direction set to in AND has attribute Is Implicit set to false

then the argument passed to the generated RTE API shall be a pointer.

The generated code within the Runnable Entity body shall follow this pattern:

retdata_<RteApiRootName>_<RunnableName>_<IRVName> = Rte_<RteApiRootName>_<RunnableName>_<IRVName>(&data_<RteApiRootName>_<IRVName>);

where:

  • <RteApiRootName> is one of: IrvIWrite, IrvWrite or IrvRead.
Shared/Per Instance Variable Access

Shared Variables hold data or parameters that are shared across all instances of a component, meaning all component copies use and see the same value. Shared variables are useful for parameters or information that should remain consistent application-wide.

Per Instance Variables are parameters that are unique to each instance of a software component, so each copy of the component has its dedicated value. These variables enable instance-specific storage or configuration within multi-instance software architectures.

RTE API Name for Shared/Per Instance Variable.

If ARDataAccess

  • refers to an ARComponentVariable with attribute kind set to Shared OR to Per Instance, AND
  • has attribute Direction set to in

then the operation shall generate the following RTE API in the body of the Runnable Entity:

Rte_CData_<VariableName> 

RTE API Returned Argument for Shared/Per-Instance Variable of Custom Type.

If type of Shared/Per Instance Variable is an AR Custom Implementation Data Type OR an AR Alias Implementation Data Type referring an AR Custom Implementation Data Type then the returned argument shall be declared as a local variable in the Local Data Declaration section of the Runnable Entity body:

VAR(<CustomTypeName>, AUTOMATIC) param_CData_<VariableName>;

RTE API Returned Argument for Shared/Per-Instance Variable of Structure Type.

If type of Shared/Per Instance Variable is an AR Structure Implementation Data Type OR an AR Alias Implementation Data Type referring an AR Structure Implementation Data Type then the returned argument shall be declared as a local variable in the Local Data Declaration section of the Runnable Entity body:

P2CONST(<StructureTypeName>, AUTOMATIC, RTE_APPL_DATA) param_CData_<VariableName>;

RTE API Returned Argument for Shared/Per-Instance Variable of Array Type.

If type of Shared/Per Instance Variable is an AR Array Implementation Data Type OR an AR Alias Implementation Data Type referring an AR Array Implementation Data Type then the returned argument shall be declared as a local variable in the Local Data Declaration section of the Runnable Entity body:

P2CONST(<ArrayBaseTypeName>, AUTOMATIC, RTE_APPL_DATA) param_CData_<VariableName>;

where:

  • <ArrayBaseTypeName> is the element type.
Parameter Access

An AUTOSAR Parameter represents configuration or calibration data associated with an AUTOSAR Software Component.

Unlike Shared Variables or Per-Instance Variables, a Parameter is not modified at runtime. Its value is typically provided by the ECU Configuration (ECUC) or calibration files and is intended to be read-only during execution.

Parameters allow a component to access configuration values in a standardized way without embedding constants directly in the generated code. They support reuse, configurability, and calibration of software functions.

In the following requirements:

  • <PortName> denotes the name of the port.
  • <ParameterName> denotes the name of the parameter.

RTE API Name for Parameter.

If ARDataAccess

  • has attribute Direction set to in, AND
  • has attribute Data referring to a DataElement of an ARParameterInterface, AND
  • has attribute Software Port referring to a SenderReceiverPort of the parent Software Atomic Component

then the operation shall generate the following RTE API in the body of the Runnable Entity:

Rte_Prm_<PortName>_<ParameterName> 

RTE API Returned Argument for Parameter of Custom Type.

If type of Parameter is an AR Custom Implementation Data Type OR an AR Alias Implementation Data Type referring an AR Custom Implementation Data Type then the returned argument shall be declared as a local variable in the Local Data Declaration section of the Runnable Entity body:

VAR(<CustomTypeName>, AUTOMATIC) param_Prm_<PortName>_<ParameterName>;

RTE API Returned Argument for Parameter of Structure Type.

If type of Parameter is an AR Structure Implementation Data Type OR an AR Alias Implementation Data Type referring an AR Structure Implementation Data Type then the returned argument shall be declared as a local variable in the Local Data Declaration section of the Runnable Entity body:

P2CONST(<StructureTypeName>, AUTOMATIC, RTE_APPL_DATA) param_Prm_<PortName>_<ParameterName>;

RTE API Returned Argument for Parameter of Array Type.

If type of Parameter is an AR Array Implementation Data Type OR an AR Alias Implementation Data Type referring an AR Array Implementation Data Type then the returned argument shall be declared as a local variable in the Local Data Declaration section of the Runnable Entity body:

P2CONST(<ArrayBaseTypeName>, AUTOMATIC, RTE_APPL_DATA) param_Prm_<PortName>_<ParameterName>;

where:

  • <ArrayBaseTypeName> is the element type.
Sender Receiver Access

In the following requirements:

  • <PortName> denotes the name of the port.
  • <DataName> denotes the name of the Data Element.

RTE API Name for Queuing Explicit Input Sender-Receiver Data Element.

If ARDataAccess

  • has attribute Direction set to in, AND
  • has attribute Is Implicit set to false, AND
  • has attribute Data referring to a DataElement of an ARSenderReceiver interface, AND
  • has attribute Software Port referring to a SenderReceiverPort with
    • attribute Mode set to Queuing, AND
    • attribute Is Conjugated set to true

then the operation shall generate the following RTE API in the body of the Runnable Entity:

Rte_Receive_<PortName>_<DataName> 

RTE API Name for Sampling Implicit Input Sender-Receiver Data Element.

If ARDataAccess

  • has attribute Direction set to in, AND
  • has attribute Is Implicit set to true, AND
  • has attribute Data referring to a DataElement of an ARSenderReceiver interface, AND
  • has attribute Software Port referring to a SenderReceiverPort with
    • attribute Mode set to Sampling, AND
    • attribute Is Conjugated set to true

then the operation shall generate the following RTE API in the body of the Runnable Entity:

Rte_IRead_<PortName>_<DataName> 

RTE API Name for Sampling Explicit Input Sender-Receiver Data Element of complex type

If ARDataAccess

  • has attribute Direction set to in, AND
  • has attribute Is Implicit set to false, AND
  • has attribute Data referring to a DataElement of an ARSenderReceiver interface whose type is a complex type (i.e., an AR Structure Implementation Data Type or an AR Array Implementation Data Type), AND
  • has attribute Software Port referring to a SenderReceiverPort with
    • attribute Mode set to Sampling, AND
    • attribute Is Conjugated set to true

then the operation shall generate the following RTE API in the body of the Runnable Entity:

Rte_Read_<PortName>_<DataName> 

RTE API Name for Sampling Explicit Input Sender-Receiver Data Element of simple type

If ARDataAccess

  • has attribute Direction set to in, AND
  • has attribute Is Implicit set to false, AND
  • has attribute Data referring to a DataElement of an ARSenderReceiver interface whose type is a simple type (i.e., an AR Custom Implementation Data Type), AND
  • has attribute Software Port referring to a SenderReceiverPort with
    • attribute Mode set to Sampling
    • attribute Is Conjugated set to true

then the operation shall generate the following RTE API in the body of the Runnable Entity:

Rte_DRead_<PortName>_<DataName> 

RTE API Name for Queuing Explicit Output Sender-Receiver Data Element.

If ARDataAccess

  • has attribute Direction set to out, AND
  • has attribute Is Implicit set to false, AND
  • has attribute Data referring to a DataElement of an ARSenderReceiver interface, AND
  • has attribute Software Port referring to a SenderReceiverPort with
    • attribute Mode set to Queuing
    • attribute Is Conjugated set to false

then the operation shall generate the following RTE API in the body of the Runnable Entity:

Rte_Send_<PortName>_<DataName> 

RTE API Name for Sampling Implicit Output Sender-Receiver Data Element.

If ARDataAccess

  • has attribute Direction set to out, AND
  • has attribute Is Implicit set to true, AND
  • has attribute Data referring to a DataElement of an ARSenderReceiver interface, AND
  • has attribute Software Port referring to a SenderReceiverPort with
    • attribute Mode set to Sampling
    • attribute Is Conjugated set to false

then the operation shall generate the following RTE API in the body of the Runnable Entity:

Rte_IWrite_<PortName>_<DataName> 

RTE API Name for Sampling Explicit Output Sender-Receiver Data Element.

If ARDataAccess

  • has attribute Direction set to out, AND
  • has attribute Is Implicit set to false, AND
  • has attribute Data referring to a DataElement of an ARSenderReceiver interface, AND
  • has attribute Software Port referring to a SenderReceiverPort with
    • attribute Mode set to Sampling, AND
    • attribute Is Conjugated set to false

then the operation shall generate the following RTE API in the body of the Runnable Entity:

Rte_Write_<PortName>_<DataName> 

RTE API Variable for Sender-Receiver Data Element.

For each ARDataAccess that

  • has attribute Data referring to a DataElement of an ARSenderReceiver interface, AND
  • has attribute Software Port referring to a SenderReceiverPort

except when the ARDataAccess

  • has attribute Direction set to in, AND
  • has attribute Is Implicit set to true, AND
  • has attribute Data referring to a DataElement of an ARSenderReceiver interface whose type is a complex type (i.e., an AR Structure Implementation Data Type or an AR Array Implementation Data Type), AND
  • has attribute Software Port referring to a SenderReceiverPort with
    • attribute Mode set to Sampling, AND
    • attribute Is Conjugated set to true

(i.e. except for Rte_IRead API with complex type)

a variable shall be declared as a local variable in the Local Data Declaration section of the Runnable Entity body:

VAR(<TypeName>, AUTOMATIC) data_<RteApiRootName>_<PortName>_<DataName>;

where:

  • <TypeName> is the type name, or the element type name in the case of an AR Array Implementation Data Type.
  • <RteApiRootName> is one of: Receive, IRead, Read, DRead, Send, IWrite or Write

This local variable shall hold the value to be written to or read from the Sender-Receiver Data Element.

RTE API Variable for Sampling Implicit Input Sender-Receiver Data Element with complex type

For each ARDataAccess that

  • has attribute Direction set to in, AND
  • has attribute Is Implicit set to true, AND
  • has attribute Data referring to a DataElement of an ARSenderReceiver interface whose type is a complex type (i.e., an AR Structure Implementation Data Type or an AR Array Implementation Data Type), AND
  • has attribute Software Port referring to a SenderReceiverPort with:
    • attribute Mode set to Sampling, AND
    • attribute Is Conjugated set to true

(i.e. for Rte_IRead API with complex type)

a variable shall be declared as a local variable in the Local Data Declaration section of the Runnable Entity body:

P2CONST(<TypeName>, AUTOMATIC, RTE_APPL_DATA) data_Rte_IRead_<PortName>_<DataName>;

where:

  • <TypeName> is the type name, or the element type name in the case of an AR Array Implementation Data Type.

This local variable shall hold the value to be written to or read from the Sender-Receiver Data Element.

RTE API Returned Argument for Sender-Receiver Data Element.

For each ARDataAccess that

  • has attribute Data referring to a DataElement of an ARSenderReceiver interface, AND
  • has attribute Software Port referring to a SenderReceiverPort

except when the ARDataAccess

  • has attribute Direction set to in, AND
  • has attribute Is Implicit set to false, AND
  • has attribute Data referring to a DataElement of an ARSenderReceiver interface, AND
  • has attribute Software Port referring to a SenderReceiverPort with
    • attribute Mode set to Sampling, AND
    • attribute Is Conjugated set to true

(i.e. except for Rte_DRead API)

OR except when the ARDataAccess

  • has attribute Direction set to in, AND
  • has attribute Is Implicit set to true, AND
  • has attribute Data referring to a DataElement of an ARSenderReceiver interface whose type is a simple type (i.e., an AR Custom Implementation Data Type), AND
  • has attribute Software Port referring to a SenderReceiverPort with
    • attribute Mode set to Sampling
    • attribute Is Conjugated set to true

(i.e. except for Rte_IRead API with simple type )

a variable for holding the returned argument value shall be declared as a local variable in the Local Data Declaration section of the Runnable Entity body:

Std_ReturnType retdata_<RteApiRootName>_<PortName>_<DataName> = RTE_OK;

where:

  • <RteApiRootName> is one of: Receive, IRead, Read, Send, IWrite or Write

RTE API Argument for Sender-Receiver Data Element with complex type.

If ARDataAccess

  • has attribute Data referring to a DataElement of an ARSenderReceiver interface whose type is a complex type (i.e., an AR Structure Implementation Data Type or an AR Array Implementation Data Type), AND
  • has attribute Software Port referring to a SenderReceiverPort
  • has attribute Direction set to in

(i.e. for Rte_Send, Rte_IWrite and Rte_Write APIs with complex type)

OR

  • has attribute Direction set to in, AND
  • has attribute Is Implicit set to false, AND
  • has attribute Data referring to a DataElement of an ARSenderReceiver interface, AND
  • has attribute Software Port referring to a SenderReceiverPort with
    • attribute Mode set to Queuing, AND
    • attribute Is Conjugated set to true

(i.e. for Rte_Receive)

OR

  • has attribute Direction set to in, AND
  • has attribute Is Implicit set to false, AND
  • has attribute Data referring to a DataElement of an ARSenderReceiver interface whose type is a complex type (i.e., an AR Structure Implementation Data Type or an AR Array Implementation Data Type), AND
  • has attribute Software Port referring to a SenderReceiverPort with
    • attribute Mode set to Sampling, AND
    • attribute Is Conjugated set to true

(i.e. for Rte_Read)

then the argument passed to the generated RTE API shall be a pointer.

The generated code within the Runnable Entity body shall follow this pattern:

retdata_<RteApiRootName>_<PortName>_<DataName> = Rte_<RteApiRootName>_<PortName>_<DataName>(&data_<RteApiRootName>_<IRVName>);

where:

  • <RteApiRootName> is one of: Receive, Read, Send, IWrite or Write.

Operation Access

An Operation Access represents the invocation of an AUTOSAR Client-Server operation from within a Runnable Entity. It describes how a Runnable interacts with a Client-Server Interface by calling one of its defined Operations, using the RTE-generated Client API.

An AUTOSAR Data Access is defined as a UML Property annotated with the AROperationAccess stereotype.

In the following requirements:

  • <PortName> denotes the name of the port.
  • <OperationName> denotes the name of the Server Operation.

RTE API Name for Synchronous Client Operation Call.

If AROperationAccess

  • has attribute Direction set to in, AND
  • has attribute Asynchronous set to false, AND
  • has attribute Operation referring to a Operation of an ARClientServerInterface, AND
  • has attribute Software Port referring to a ClientServerPort with
    • attribute Is Conjugated set to true

then the operation shall generate the following RTE API in the body of the Runnable Entity:

Rte_Call_<PortName>_<OperationName> 

RTE API Returned Argument for Client Operation Call.

If AROperationAccess

  • has attribute Direction set to in, AND
  • has attribute Operation referring to a Operation of an ARClientServerInterface, AND
  • has attribute Software Port referring to a ClientServerPort with
    • attribute Is Conjugated set to true

a variable for holding the returned argument value shall be declared as a local variable in the Local Data Declaration section of the Runnable Entity body:

Std_ReturnType retdata_Call_<PortName>_<OperationName> = RTE_OK;

where:

  • <RteApiRootName> is Call.

RTE API Argument Declation for Client Operation Call.

For each Parameter of Operation referred by AROperationAccess, a variable shall be declared as a local variable in the Local Data Declaration section of the Runnable Entity body:

VAR(<TypeName>, AUTOMATIC) <PortName>_<ParameterName>;

where:

  • <TypeName> is the type name, or the element type name in the case of an AR Array Implementation Data Type.
  • <ParameterName> is the name of the parameter.

This local variable shall hold the value to be written to or read from the Operation.

RTE API Argument Declation for Client Operation Call with same name as Operation

If the local variable that holds the value to be written to or read from the Operation has same name as the Operation, then the name of the local variable is prefixed by RteArg_.

RTE API Argument Declation for Client Operation Call with complex type.

If the Parameter of Operation referred by AROperationAccess has a complex type (i.e., an AR Structure Implementation Data Type or an AR Array Implementation Data Type), then the argument passed to the generated RTE API shall be a pointer.

The generated code within the Runnable Entity body shall follow this pattern:

retdata_<RteApiRootName>_<PortName>_<OperationName> = Rte_<RteApiRootName>_<PortName>_<OperationName>(&<PortName>_<ParameterName>);

where:

  • <RteApiRootName> is Call.
  • <ParameterName> is the name of the parameter.

RTE API Argument Declation for Client Operation Call with inout/out direction.

If the Parameter of Operation referred by AROperationAccess has Direction set to out OR inout then the argument passed to the generated RTE API shall be a pointer.

The generated code within the Runnable Entity body shall follow this pattern:

retdata_<RteApiRootName>_<PortName>_<OperationName> = Rte_<RteApiRootName>_<PortName>_<OperationName>(&<PortName>_<ParameterName>);

where:

  • <RteApiRootName> is Call.
  • <ParameterName> is the name of the parameter.