Type mismatch error during the compilation for the generation of C code.
18 views (last 30 days)
Show older comments
Victor Crespo
on 27 Mar 2020
Commented: Ajay Pattassery
on 11 May 2020
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.
0 Comments
Accepted Answer
Ajay Pattassery
on 10 May 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.
2 Comments
More Answers (0)
See Also
Categories
Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!