Filter löschen
Filter löschen

How do I keep unused root-Level Inports in the generated code

5 Ansichten (letzte 30 Tage)
Sergio Delgado
Sergio Delgado am 7 Jan. 2021
Kommentiert: Sergio Delgado am 15 Jan. 2021
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!

Antworten (1)

Fangjun Jiang
Fangjun Jiang am 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.
  1 Kommentar
Sergio Delgado
Sergio Delgado am 15 Jan. 2021
Hello, Thanks for your answer.
This is the configuration file I am using (see attachment)
The "Block Reduction" is unchecked... still, the input arguments of the step-Function are gone.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Deployment, Integration, and Supported Hardware finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by