0

I would like to know if it is possible to avoid MISRA warning 10.1, 13.2 and 12.6 after generating a code from Simulink model using embedded code (or is it possible to generate a code with a way around?).

e.g (the generated code)

if (A)
{;}

At if(A) statements there is a MISRA violation.

Is it possible to generated code with embedded coder like

if (A !=0)
{;}
3
  • You should only get a warning for 13.2 from that code. If your tool whines about anything else, it is broken. Commented Feb 18, 2014 at 7:44
  • yes thats true, I am tring to find out if its possible to avoid that warning. thats to configure the embedded coder to generate the code without the warning Commented Feb 18, 2014 at 8:07
  • I'm assuming that "A" is of a boolean type? Can you not tell/config your analyser that that type is boolean? Commented Nov 7, 2014 at 8:47

1 Answer 1

0

I was having difficulty generating this type of construct if (A) without using a Boolean type in which case there is no violation of rule 13.2.

Without a Boolean type, I get something along these lines:

if (A > 1) { ...}

I was using the R2015b release. It will be good if you can share an example model that generates this type of code.

Also, all the listed rules (10.1, 12.6, 13.2) are recommended and not obligatory as per the MISRA AC AGC standard (Guidelines for the application of MISRA-C: 2004 in the context of automatic code generation).

So compliance to those rules is dependent on the criticality of your application.

Even in the latest MISRA 2012 standard where these rules have been reclassified, they are still classified as advisory in the context of generated code.

For general information on MISRA compliance of generated code this is a great reference:

http://www.mathworks.com/solutions/automotive/standards/misra-c.html

or

http://www.mathworks.com/solutions/aerospace-defense/standards/misra-c.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.