Simulink Coder: TYPECAST must map to a C type in the target hardware (uint64 does not map to a 64-bit C type)

11 views (last 30 days)
Hi,
I am trying to generate code for a Simulink model (with included Matlab functions) with the Simulink coder. I get the following error message:
For code generation, integer input or result classes for TYPECAST must map directly to a C type in the target hardware.
The class uint64 does not map to a 64-bit C type.
The error occurs in the following line:
var_msg_count_uint8 = typecast(object.msg_count, 'uint8');
where object is a bus object, and msg_count is defined as uint64. Background: To be able to send the object using dsp.sendUdp, we create a uint8 packet from it.
Code Generation Settings in Simulink Coder:
  • System target file: Visual C/C++ Solution file for Simulink Coder
  • Objective: Debugging
  • Hardware board: None
  • Device vendor: Intel
  • Device type: x-86-64 (Windows64)
  • Support long long enabled (works neither with enabled nor disabled)
I would expect that Visual C/C++ and x-86-64 should have a uint64 data type.
What do I need to set or do so that the type conversion works and C (or C++) code is created successfully?
Best
Jan-Patrick
P.S. I've already seen the other question with a similar topic, but the given answers did not help my problem...

Accepted Answer

Jan-Patrick Osterloh
Jan-Patrick Osterloh on 19 Sep 2023
I found the answer to my own problem. I have referenced Models in my Project, and it seems that the Code Gereration has to be configured for each referenced model individually. Setting "Hardware Implementation - Advanced Settings - Support long long" to true in all Referenced Models did the trick. I had done this only on the "main" model, not the referenced models.

More Answers (0)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!