MATLAB: Can I programmatically add data access to AUTOSAR runnables

accessautosarAUTOSAR Blocksetdataheaderrterunnable

I have a subsystem with grounded inports and outports. However, I would still like for the interface generated for this subsystem to reflect data read access for the inports and write access for the outports. However, I observe the following ARXML:
<RUNNABLE-ENTITY UUID="cedfa0d7-2958-5e82-9d63-c7b2b8ccd7f4">
<SHORT-NAME>demoReport_step</SHORT-NAME>
<MINIMUM-START-INTERVAL>0</MINIMUM-START-INTERVAL>
<CAN-BE-INVOKED-CONCURRENTLY>false</CAN-BE-INVOKED-CONCURRENTLY>
<SYMBOL>demoReport_step</SYMBOL>
</RUNNABLE-ENTITY>
And the following interface in the corresponding Rte header:
#define Rte_IWrite_demoReport_init_ProvidePortF_ProvidePortF Rte_IWrite_demoReport_demoReport_init_ProvidePortF_ProvidePortF
void Rte_IWrite_demoReport_init_ProvidePortF_ProvidePortF(const myBus* u);
#define Rte_IWriteRef_demoReport_init_ProvidePortF_ProvidePortF Rte_IWriteRef_demoReport_demoReport_init_ProvidePortF_ProvidePortF
myBus* Rte_IWriteRef_demoReport_init_ProvidePortF_ProvidePortF(void);
Is it possible to prevent Simulink from optimizing away the grounded inports and outports? Is it possible to programmatically add the data access specification for these ports?

Best Answer

There is currently no way to prevent the optimization of grounded inports and outports in generated ARXML. There is also no way to programmatically add the data access during code generation. However, one workaround is as follows:
Add "dummy" logic signals between the inports and outports. For example, a simple passthrough of the input signals. This will prevent the optimization removing these ports, since they are now in use. This would require editing the generated code after the fact to switch the logic from the simple passthrough to the desired behavior.