- 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 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Ashutosh Thakur
2024년 7월 24일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Deployment, Integration, and Supported Hardware에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!