The “RootIOFormat” parameter controls how root-level inputs and outputs are handled in the generated C code. It can have the following three settings:
- Individual arguments: Passes each root-level model input and output value to the entry-point function as a separate argument.
- Structure reference: Packs root-level model input into a struct, packs root-level model output into another struct and passes the structures to the entry-point function as arguments.
- Part of model data structure: Packages root-level model input and output into the real-time model data structure “rtModel”.
In the “Individual arguments” setting, inputs/outputs are passed separately as “real_T”, no “ExtU_<model>_T” structure is created. Here’s the Simulink model configuration that I created:
1. Open Simulink and create a new model.
2. Add an “Inport” block (from Sources) and an “Outport” block (from Sinks). Connect the “Inport” directly to the “Outport”.
3. Set the system target file to “ert.tlc” and solver as “fixed step”.
4. Set the following settings for the model-
Below is the code generated in the “ExtraneousFunc.c” (Model name is ExtraneousFuc).
set_param(modelName, 'GenCodeOnly', 'on');
set_param(modelName, 'HardwareBoard', 'None');
set_param(modelName, 'TargetLang', 'C');
set_param(modelName, 'CodeInterfacePackaging', 'Reusable function');
set_param(modelName, 'GenerateAllocFcn', 'off');
set_param(modelName, 'RootIOFormat', 'Individual arguments');
Below is the code generated in the “ExtraneousFunc.c” (Model name is ExtraneousFuc).
If you still observe an extraneous initialization function referencing “ExtU_<model>_T” with the “Individual arguments” setting which leads to build errors, please provide your model or the steps to recreate the issue.