How do I keep unused root-Level Inports in the generated code
5 views (last 30 days)
Show older comments
Dear Community,
I have been looking for a simple solution to my problem, but cannot quite find the right approach.
I am generating C-Code using the Embedded Coder for a simple Algorithm. Now, the problem is that I want to fix the the number of inputs in the generated code, even if a particular input-signal remains unused. The background is that the algorithm is going to change over time but the interface should remain unchanged, because the C-function I am generating is embedded in a larger project.
When I generate the code, the number of arguments in the "step" function change, because the unused input signals are dropped (they get optimized).
My solution was to create a test point for the unused input signal. The problem is that a test point generates the "B-structure" in the code, which I don't want either.
So, my question is: is there a way to fix the root-level inports as inputs in the generated code regardless whether they are used or not?
I cannot find that checkbox in the configuration parameters.
Additional Info: I generate Code programatically, so using the App or the Simulink Interface is unfortunately not an option.
Thanks in advance!
0 Comments
Answers (1)
Fangjun Jiang
on 7 Jan 2021
In your model configuration, search for "block reduction", un-check it.
I assume you must have the root-level Inport blocks terminated somewhere. I was hoping this note in the help document of "block reduction" is relevant.
Dead Code Elimination. Any blocks or signals in anunused code path are eliminated from generated code.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!