- Function Prototype Control: The function prototype can be influenced by the configuration settings and the modeling pattern being followed to implement the model. Additionally, the scope (i.e., global or local) affects the way in which code is generated for the model. You can refer to the following documentation link on the generation of code for a Simulink Function block: https://www.mathworks.com/help/rtw/ug/generate-code-for-a-model-with-simulink-functions.html.
- Code Interface Packaging: In the Model Configuration pane, the value of Code interface packaging specifies how the code generator packages the generated C or C++ code. It contains three values: Nonreusable, Reusable, and C++ class. You can look into the documentation link regarding the effect of each value on the generated code: https://www.mathworks.com/help/rtw/ref/codeinterfacepackaging.html.
- Optimization settings: The optimization settings defined in the Optimization section of the Model Configuration Parameters affect the structure of the generated code. For example, if you specify the setting of Signal storage reuse as on, then code will be generated with the buffers being reused for the input and output signals. You can refer to the following documentation for all parameters in the Optimization section: https://www.mathworks.com/help/rtw/ref/optimization-pane-general.html.
reusable library function code generation format issue
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I am trying to generate c code using embedded coder for my custom timer library logic created using simulink block. There is generate code format issue for the same library logic used in different control model.
In one model it creating code in below format with return value.
boolean_T IncrementTimer(boolean_T p_Alarm_IN, uint16_T p_ThresholdTime,rtDW_IncrementTimer_t *localDW)
In second model code is generated with below format for the same library model
void IncrementTimer(boolean_T p_Alarm_IN, uint16_T p_ThresholdTime, boolean_T *p_Alarm_OUT, rtDW_IncrementTimer_t *localDW)
Please suggest why there is discrepancy for the same timer logic in used in different model instances.
0 Commenti
Risposte (1)
Ashutosh Thakur
il 24 Lug 2024
Hello Amit,
The discrepancy in the generated code can be due to various reasons, mainly depending on the configuration settings present in each model. Here are some of the potential reasons:
I suggest you look into the differences in the Code generation settings in Model Configuration Parameters and search the documentation to understand the impact of optimizations applied to it. This will provide more clarity on why this behavior is present in different control models.
I hope this information helps you!
0 Commenti
Vedere anche
Categorie
Scopri di più su Deployment, Integration, and Supported Hardware in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!