- To do so, you can go the Model Settings (or use CTRL+E).
- In the code generation option (in the left pane), you can navigate to the custom code option.
- You can disable the generation of the “init” function from here by disabling the “Initialize Code” in the Additional source code option.
- Please make sure to apply the changes and then regenerate for the changes to take place into effect.
init function for each SWC mandatory in autosar?
2 次查看(过去 30 天)
显示 更早的评论
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,
0 个评论
回答(1 个)
Amish
2023-12-15
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.
For further help with configuring AUTOSAR code generation, you can also refer to the link:
Hope this helps
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 AUTOSAR Blockset 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!