Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Misra standard for embedded software

I have a requirement to make a large amount of code MISRA compliant.
First question: Can somebody to give an estimation for passing well written code for embedded system based on experience. I understand that "well written" is poorly defined and vague so i ask for raw estimation.
Second question: Any recommendation for tool that can be customizable (i.e allowing suppress specific warnings) and used in automatic build environment (i.e command line interface)
Any other useful suggestions that can help with this task.
Thanks Ilya.

like image 742
Ilya Avatar asked Sep 15 '08 13:09

Ilya


People also ask

What is MISRA C in embedded system?

The MISRA C and MISRA C++ standards are a set of coding guidelines for the C and C++ programing languages that promote safety, security, and reliability in embedded system software.

What is the latest MISRA standard?

Today MISRA C is the de facto standard for developing software in C where safety, security and code quality are important. Future developments of MISRA C will continue to extend support for newer versions of the language, and additional language features.

What is the difference between MISRA C 2004 and 2012?

MISRA C:2012 was designed to: Add support for C99 while retaining support for C90. Correct issues found in the 2004 version. Provide backwards compatibility as much as possible to make it unnecessary to modify code when moving from MISRA C:2004 to MISRA C:2012.

What is the latest version of MISRA C?

The current version, MISRA C: 2012 (sometimes written as MISRA C 2012 or MISRA C2012), has evolved over several years, and Amendment 2 to MISRA C: 2012 was published in 2020. Amendment 3 is projected to be released in 2022. For the C++ programming language, the current MISRA standard is MISRA C++ 2008.


1 Answers

I also highly recommend PC-Lint. If you happen to be compiling your code with Visual Studio I recommend a plug-in 'Visual Lint' from Riverblade. If you cannot compile the code in Visual Studio, you can still run PC-Lint from the command line to good effect.

Some embedded system compilers provide MISRA compliance testing as compiler warnings. I use the IAR compiler for Arm7/Arm9 development. It provides an easy to configure MISRA compliance checklist right in the compiler setup.

It is difficult to come up with a rule of thumb for estimating the time it would take you to make some well written code MISRA compliant. A lot depends on the existing coding habits of the programmers and how closely they follow the MISRA rules in the first place.

Rough estimates:
2 - 3 days to become adept at PC-Lint usage.
Initial pass at making existing code MISRA compliant: 10 to 25 percent of the time spent writing the code in the first place.
Keeping code MISRA compliant: 5 to 10 percent added to code development. Half of this cost is changing the habits of your coders to follow the 'MISRA way' of doing things. The other half is the extra cost of code testing and inspection to ensure MISRA compliance.

like image 194
Darryl Buchanan Avatar answered Oct 11 '22 23:10

Darryl Buchanan