Configure AUTOSAR Initialization Runnable (R4.1)
AUTOSAR Release 4.1 introduced the AUTOSAR initialization event
InitEvent). You can use an
designate an AUTOSAR runnable as an initialization runnable, and then map an
initialization function to the runnable. Using an
initialize a software component is a potentially simpler and more efficient than using
AUTOSAR mode management, in which you define a
with a mode for setting up and initializing a software component. (For more information
on the mode management approach, see Configure AUTOSAR Mode-Switch Communication.)
If you import ARXML code that describes a runnable with an
InitEvent, the ARXML importer configures the runnable in
Simulink® as an initialization runnable.
Alternatively, you can configure a runnable to be the initialization runnable in Simulink. For example,
Open a model configured for AUTOSAR.
Open the Configuration Parameters dialog box, go to Code Generation > AUTOSAR Code Generation Options, and verify that the selected AUTOSAR schema version is
Open the AUTOSAR Dictionary. Navigate to a software component, and select the Runnables view.
Select a runnable to configure as an initialization runnable, and click Add Event. From the Event Type drop-down list, select
InitEvent, and specify the Event Name. In this example, initialization event
myInitEventis configured for runnable
You can configure at most one
InitEventfor a runnable.
Open the Code Mappings editor and select the Functions tab.
To map an initialization function to the initialization runnable, select the function. From the Runnable drop-down list, select the runnable for which you configured an
InitEvent. In this example, Simulink entry-point function
Initializeis mapped to AUTOSAR runnable
When you export ARXML code from a model containing an initialization runnable, the
ARXML exporter generates an
InitEvent that is mapped to the
initialization runnable and function. For example:
<EVENTS> <INIT-EVENT UUID="..."> <SHORT-NAME>myInitEvent</SHORT-NAME> <START-ON-EVENT-REF DEST="RUNNABLE-ENTITY">/.../Runnable_Init</START-ON-EVENT-REF> </INIT-EVENT> </EVENTS>