How can I remove real-time structures from code generated using Embedded Coder?

22 views (last 30 days)
I am generating C code using Embedded Coder from a Simulink model and I need to remove the real-time structures (shown below) from the code.
With my current model settings, I am only seeing the RT_model structure in the code in the "init" and "step" functions, where they are not used for anything. The code generates like this:
/* Model step function */
void step(RT_MODEL_ADM_T *const ADM_M, BOOL_T *ADM_Y_return_value)
{
DW_ADM_T *ADM_DW = ((DW_ADM_T *) ADM_M->dwork);
.
}
/* Model initialize function */
void init(RT_MODEL_ADM_T *const ADM_M)
{
DW_ADM_T *ADM_DW = ((DW_ADM_T *) ADM_M->dwork);
.
}
Instead, I would like the code to generate like the code below:
void step(void)
{
...
}
void init(void)
{
...
}
Why are the real-time structures appearing in my code, and how can I get rid of them?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 23 Nov 2022
This issue can be triggered in a few different ways. First, certain settings in the model's Configuration Parameters can cause the issue. In Configuration Parameters, under the Code Generation/Interfaces tab, make sure the "Code interface packaging" parameter is set to "Nonreusable.".
If that is not the issue, then check the documentation for the various blocks in your model. On the block's documentation page, under "Extended Capabilities" and "C/C++ Code Generation," ensure the blocks in your model aren't marked as "Not recommended for production code." . The "Step" block in particular is known to cause this issue. If blocks in your model are the issue, consider using alternative methods to achieve your desired functionality so that the offending blocks can be eliminated.

More Answers (0)

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!