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

18 次查看(过去 30 天)
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.

采纳的回答

Ajay Pattassery
Ajay Pattassery 2020-5-10
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Deployment, Integration, and Supported Hardware 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by