MATLAB: How to get rid of MISRA 6.3 violations during static code analysis of code generated by Embedded Coder

6/3coderdataembeddedEmbedded Codermisrareplacementtype

The code generated with Embedded Coder is not MISRA Compliant, and that the code analysis tool you use warns you about the typedefs that are not compliant with MISRA 6.3.
The MISRA 6.3 rule on the documentation suggests that typedefs that indicate size and signedness should be used in place of the basic types. However, generated code contains "real_T", "uint_T", instead of "real64_T".
Is there a workaround?

Best Answer

This is a known limitation with Embedded Coder. To work around the issue, you can use Data Type Replacement to replace the violating built-in data types with compatible ones. Please see more on replacing built-in data types on the following documentation page:
Please note that you may need to use a Simulink.NumericType object to re-define replacement names for some of these data types.