Is it possible to delete the Initialize function under AUTOSAR Entry Point Functions generated by Embedded Coder?

I have an init() that is generated by default when I build my model configured as AUTOSAR component using Embedded Coder. Is there a way to remove it? In other words, how to delete the Initialize function under AUTOSAR Entry Point Functions?

 Accepted Answer

In general, it is not advised to get rid of the 'Initialize Function', the Entry Point Function that the Embedded Coder always generates by default, even if it appears to be empty. When configuring such model for AUTOSAR, we link the Initialize Function with an Init Runnable in the AUTOSAR Dictionary by default, but there won't be any init event tied to it. If the Initialize Function is empty upon code generation, there's no need to set up the init runnable to be activated by an init event. This will result in an Init runnable in the ARXML, but it won't be associated with any event, meaning it will never be activated.
However, depending on the modeling of functional behavior, there may be necessary data initialization that cannot be simply discarded. It might be feasible to remove the unwanted initialize runnable through a custom post-processing step (from both C and ARXML), but only if it's truly empty. Be cautious when removing the initialization function during custom post-processing, as this could inadvertently introduce bugs into your AUTOSAR component by failing to initialize certain internal states or variables in your code. This could occur if the mapping of the initialization runnable is mistakenly removed.
Furthermore, if you're a top-down user and have ARXMLs created with an AUTOSAR Authoring Tool (like Vector DaVinci Developer) that includes an initialization runnable, you can instruct the importer to designate a specific runnable (triggered with init event) imported from ARXML as the init runnable. This can be accomplished by specifying the 'initializationRunnable' Name-Value pair while running the createComponentAsModel() function, as shown here:
   >> ar = arxml.importer('mySWC.arxml')
   >> createComponentAsModel(ar,'/pkg/swc','ModelPeriodicRunnablesAs','AtomicSubsystem',                     
        'InitializationRunnable','Runnable_Init')

More Answers (0)

Categories

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!