Type mismatch error during the compilation for the generation of C code.

15 visualizaciones (últimos 30 días)
I have a Simulink model built with blocks previously developed, that I have stored into two different libraries.
When I select the menu option "Update Diagram", Simulink compiles the model and doesn't show any warning or error messages, but when I try to compile it to generate the C code, the process fails and produces errors regarding data types, p.e:
### Build procedure for model: 'ModelName' aborted due to an error.
Error using tlc_c (line 179)
Parameter Value of 'ParameterName' is being cast from data type 'int32' to the data type 'int8'. Downcasts and signed/unsigned mismatches of tunable parameter expressions are not allowed in order to ensure consistent behavior between simulation and generate code.
I suppose that if Simulink is capable to compile the model without errors there must be possible that Simulink Coder does the same.
Somebody can tell me what is happening?.
It is an issue of the configuration of the code generation process?.
Thanks in advance.

Respuesta aceptada

Ajay Pattassery
Ajay Pattassery el 10 de Mayo de 2020
The Downcast error can be avoided in code generation if the Detect Downcast feature is set to none. (By default this feature will be set to error) .
Configuration Parameters > Diagnostics > Data Validity > Parameters>Detect Downcast>none.
Refer here for more information.

Más respuestas (0)

Categorías

Más información sobre Deployment, Integration, and Supported Hardware en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by