Code Generation

Table of Contents

String Patterns

The code generation for this ARXF-CP has been adapted to relief you from specifying AUTOSAR details needed by the ARXF-CP, yet allows you to modify the default behavior of the code generation.

We use string patterns which are replaced during code generation. These string patterns can be used in two locations:

We use the following string patterns which are replaced during code generation:

Examples:

SWCs

Code is generated to initialize the critical region handlers used by the ARXF-CP and add AUTOSAR details to an internal task structure. The RTE APIs used are function pointers which names are composed using the exclusive areas and inter-runnable variables.

To understand which inter-runnable variables belong to which runnables used for UML event dispatchers, the code generation needs two relations:

To understand which exclusive areas belong to which runnables, the code generation needs:




Composition

The AUTOSAR rootcomposition is used for connecting the RTE instances to the Rhapsody instances of SWCs. During code generation, for each SWC a file is generated, with the name <yourSwc>_Prototypes.c with two functions:

Active Classes

Code is generated to add AUTOSAR details to an internal task structure. The RTE APIs used are functions which names are composed using the inter-runnable variables and exclusive areas.

To understand which inter-runnable variables belong to which runnables used for UML event dispatchers, the code generation needs two relations:

To understand which exclusive areas belongs to runnables used for UML event dispatchers, the code generation needs:




On the the ARXF-CP Configuration Code Generation tab you can specify which RTE function must be called if a UML event is added to the event queue of an active class.
Use an empty property ARXF_CP::CodeGeneration::RTEtriggerUMLeventDispatcherActiveClass if the runnable is triggered already (for example cyclic) depending on the RTE configuration for this runnable.

Runnables

An SW-C modelled in Rhapsody using the ARXF-CP has different kinds of runnables:

ARXF-CP Event Dispatchers

Some runnables are used as UML event dispatchers: such runnable processes the UML event queue for that task. An SWC uses its own task and each active class uses its own task. When a UML event is added to the event queue of another task, that task must be triggered by the RTE in case that task is sleeping. For this, you must use a function provided by the RTE if that runnable is not already triggered for example:

You can specify the name of the RTE trigger on the the ARXF-CP Configuration Code Generation tab. The name of the RTE trigger is passed as function pointer to a RXF_Active_Init() generated to initialize an SWC or active class.

AUTOSAR Ports

Code for AUTOSAR ports is not generated automatically; you must use the RTE APIs provided in the RTE contract of your SWC. However, the Helper interface2runnable can be used to add a runnable to your SWC including a portAreaAccess dependency to a receiver port or a server port.

When generating a mini-RTE for your model, the rootcomposition is used to understand which SWC prototypes are connected via what AUTOSAR ports to other SWCs. During the generation of the mini-RTE, runnables which have portAccess dependencies are used to implement Client/Server and/or Sender/Receiver communication.