How do I get rid of MISRA 6.3 violations during static code analysis of code generated by Embedded Coder in MATLAB R2016b?

6 views (last 30 days)
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 following documentation page suggests that 'typedefs' indicating size and signedness should be used in place of the basic types.
Run the following command to get the documentation page in MATLAB R2018b.
web(fullfile(docroot, 'codeprover/ug/misra-c-coding-rules.html'))
However, generated code contains "real_T", "uint_T", instead of "real64_T".
How do I get rid of MISRA 6.3 violations during static code analysis of code generated by Embedded Coder?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Jan 2024
Edited: MathWorks Support Team on 29 Feb 2024
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:
This is a known limitation with Embedded Coder. To work around the issue, you can use Data Type Replacement to replace the non-compliant built-in data types with compatible ones. For more information on replacing built-in data types, run the following command in the command window of MATLAB R2016b.
web(fullfile(docroot, 'ecoder/ug/data-type-replacement.html'))
For latest release documentation refer to the following link.
Note that you may need to use a "Simulink.NumericType" object to re-define replacement names for some of these data types. To know more, run the following command in the command window of MATLAB R2018b and refer the documentation page.
web(fullfile(docroot, 'simulink/slref/simulink.numerictype.html'))
Please follow the below link to search for the required information regarding the current release:

More Answers (0)

Products


Release

R2016b

Community Treasure Hunt

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

Start Hunting!