What does MISRA C/C++ compliance really involve?

Mon, 02/17/2020 - 12:49

Some organizations believe they can claim MISRA compliance for their software simply by buying any one of the many MISRA-checking tools on the market. That’s not the case. In fact, this approach is extremely risky.

Compliance to MISRA C/C++ is not simply something you can define according to your own taste. The MISRA consortium defines the conditions for formulating a defensible compliance claim. If you’d like to do your own research, here are three normative sources:

• MISRA C:2012 Revision 1, Section 5.5 (Claiming compliance), which refers to Sections 3 (Tool selection) and 4 (Prerequisite knowledge), and Appendix F (Process and tools checklist).

• MISRA C++:2008, Section 4.4 (Claiming compliance), which refers to Section 4.2 (The programming language and coding context).

• MISRA Compliance: 2016. This document is explicitly devoted to the topic of MISRA compliance. Although its adoption is currently optional, it will become mandatory with the next editions of MISRA C and MISRA C++.

What do you need to do to claim MISRA compliance?

We cannot cover every aspect of MISRA compliance in a short blog like this. However, here is a simplified summary of the key elements your processes will need to meet.

In essence, you can claim MISRA compliance if you can provide satisfactory evidence that you have:

  1. Put several processes in place. For example, you will need processes to authorize MISRA deviations, to ensure availability of sufficient run-time resources (such as processing time and stack space), to show absence of run-time errors and so on.

  2. Selected a language standard. For example, C90, C99, ....

  3. Configured the compiler toolchain appropriately. You will need to evaluate which of the many available options you will use.

  4. Checked deficiencies in the compiler toolchain with your selected options.

  5. Prepared a Guideline Enforcement Plan (GEP). This should cover how you will check compliance with the MISRA guidelines. With our ECLAIR tool, the manual contains a ready-to-use GEP, which you can integrate with other material, to satisfy this point.

  6. Ensured your team has the suitable skills and sufficient range of experience. Our CTO, Roberto Bagnara, regularly runs courses to help teams smoothly and successfully adopt MISRA C. We can also tailor our courses to your organization’s specific needs.

  7. Configured the MISRA analysis tool(s) appropriately. This is critical: millions of dialects of C and C++ exist. If your tools do not match the dialect implemented by your compiler toolchain with the compiler options you selected, your analysis results will be worthless.

If you’d like to read more about the many C language dialects that a single toolchain may implement, we’ve written about it here.

With our ECLAIR tool this step is both automatic and free. The tool will automatically adapt to your toolchain and options. And, it gives you evidence that it did so.

  1. Investigated and resolved or recorded deviations for any analysis tool diagnostic. This is where the superior quality of ECLAIR reports is key. Our detailed reports provide everything you need to investigate and resolve non-compliances.

You can capture deviations in the ECLAIR configuration and/or directly in the source code. The ECLAIR summary reports, which you can produce in PDF and Office formats, contain all the documentary evidence required. This includes the guideline compliance summary, declaring the level of compliance for each guideline, and the deviation records covering all violations of the guidelines.

We’re always happy to help – come and meet us at one of our events

If MISRA compliance feels time consuming or overwhelming, the BUGSENG team can help. We have lots of experience of introducing MISRA tools and processes into organizations. We can also help teams of engineers bring existing software projects into MISRA compliance. You can find out more about our consulting services here.

We’re also out and about at various industry events throughout the year. The next one is Automotive Spin Italia in Milan on 20 February. Our CTO, Roberto Bagnara, will be giving a presentation on "The Qualification of Software Tools in Compliance with ISO 26262".

We’ll then be at Embedded World in Nuremberg from 25-27 February. Roberto will be presenting at the conference on the Tuesday afternoon, but you’ll also find us in Hall 4, booth 360 throughout the event. If you’d like to see how we can help your organization achieve MISRA compliance, come along – or email lavinia.battaglia@bugseng.com to schedule a specific time to chat to Roberto.

Here is a little treat for our visitors: you can book here using our voucher code 424704 and get your Embedded World tickets for free.

Roberto Bagnara, Ph.D is CTO of BUGSENG, a leading provider of solutions and services for static code analysis. He is also a member of the ISO/IEC JTC1/SC22/WG14 - C Standardization Working Group and the MISRA C Working Group.



We are a passionate team of experts. Do not hesitate to let us have your feedback:
You may be surprised to discover just how much your suggestions matter to us.