Glossary
| Acronym | Definition |
|---|---|
| SPO | Software Production Operation |
| BL | Behavior Layer |
| ML | Middleware Layer |
| BSM | Behavior Specific Middleware |
| TSM | Target Specific Middleware |
Glossary
Referenced Documents
General ConceptsUML & 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 ElementsHere 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.
Validation ConstraintsNo validation constraints Code Generator Specification
This section is divided in 2 parts:
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>_MemMap.hAUTOSAR 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>.cFile 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:
Mandatory Header Inclusion Order. <ComponentName>.c shall include the following headers in the specified order:
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: 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 MappingUse 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 EntityAn 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:
/********************************************************************************** * 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:
Local Data Declaration. For each RTE API that returns, receives, sends or writes data, the generator shall declare:
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: /********************************************************************************/ /* 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 EventAn 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:
Runnable Server Signature. If AROperationEvent
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
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
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
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
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
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 AccessInter-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:
RTE API Name for Implicit Output Inter-Runnable Variable. If ARDataAccess
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
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
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
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:
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
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:
RTE API Argument for Inter-Runnable Variable of Complex Type. If ARDataAccess
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:
Shared/Per Instance Variable AccessParameter AccessAn 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:
RTE API Name for Parameter. If ARDataAccess
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:
Sender Receiver AccessIn the following requirements:
RTE API Name for Queuing Explicit Input Sender-Receiver Data Element. If ARDataAccess
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
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
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
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
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
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
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
except when the ARDataAccess
(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:
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
(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:
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
except when the ARDataAccess
(i.e. except for Rte_DRead API) OR except when the ARDataAccess
(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:
RTE API Argument for Sender-Receiver Data Element with complex type. If ARDataAccess
(i.e. for Rte_Send, Rte_IWrite and Rte_Write APIs with complex type) OR
(i.e. for Rte_Receive) OR
(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:
Operation AccessAn 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:
RTE API Name for Synchronous Client Operation Call. If AROperationAccess
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
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:
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:
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:
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:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||