Filter löschen
Filter löschen

init function for each SWC mandatory in autosar?

1 Ansicht (letzte 30 Tage)
Vivian
Vivian am 8 Sep. 2023
Beantwortet: Amish am 15 Dez. 2023
I am mapping my SWC to autosar code generator.
Each time it comes back with init() function, though I don't want the init() at all.
Is the init function required for autosar? if not, how can I get rid of it from my generated code by modifing the options?
thanks,

Antworten (1)

Amish
Amish am 15 Dez. 2023
Hi Vivian,
I understand that you are trying to map the SWC to AUTOSAR code generator and are getting the “init[NM1] ” function in the generated code.
Before understanding how to get rid of it, you can try to understand the reason for this function’s presence. In AUTOSAR, the “init” function is typically generated for initializing the component and is considered good practice for ensuring that the component starts in a known state. However, it is not strictly mandatory if your component does not require any initialization.
As you suspect, it is possible to get rid of the “init” function by modifying respective options.
  1. To do so, you can go the Model Settings (or use CTRL+E).
  2. In the code generation option (in the left pane), you can navigate to the custom code option.
  3. You can disable the generation of the “init” function from here by disabling the “Initialize Code” in the Additional source code option.
  4. Please make sure to apply the changes and then regenerate for the changes to take place into effect.
For further help with configuring AUTOSAR code generation, you can also refer to the link:
Hope this helps

Kategorien

Mehr zu AUTOSAR Blockset finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by