MISRA C
Encyclopedia
MISRA C is a software development standard for the C
programming language
developed by MISRA (Motor Industry Software Reliability Association). Its aims are to facilitate code safety
, portability
and reliability in the context of embedded systems, specifically those systems programmed in ISO C. There is also a set of guidelines for MISRA C++.
However, there are now more MISRA users outside of the automotive industry than in it: "MISRA has evolved as a widely accepted model for best practices by leading developers in sectors including aerospace, telecom, medical devices, defense, railway, and others."
The first edition of the MISRA C standard, "Guidelines for the use of the C language in vehicle based software", was produced in 1998, and is officially known as MISRA-C:1998.
In 2004, a second edition "Guidelines for the use of the C language in critical systems", or MISRA-C:2004 was produced, with many substantial changes to the guidelines, including a complete renumbering of the rules.
Work has just started on the next revision of the guidelines, which are intended to address use of C99
.
As with many standards (eg ISO, BSI Group
, RTCA, Incorporated et al) the MISRA C guideline documents are not free to users or implementors.
MISRA-C:1998 had 127 rules, of which 93 were required and 34 were advisory; the rules were numbered in sequence from 1 to 127.
The MISRA-C:2004 document contains 141 rules, of which 121 are "required" and 20 are "advisory"; they are divided into 21 topical categories, from "Environment" to "Run-time failures".
An Exemplar Suite for MISRA-C:2004 is available from the MISRA Forum, which allows tool users to evaluate and compare the checking support provided by the various MISRA tools. Additionally, it gives tool implementors some guidance as to the intent of the Rules within MISRA-C:2004.
Most of the guidelines can be checked using tools that perform static code analysis
. The remaining guidelines require the use of dynamic code analysis.
Tools that check code for MISRA conformance are:
C compilers that support MISRA conformance are:
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....
developed by MISRA (Motor Industry Software Reliability Association). Its aims are to facilitate code safety
Safety
Safety is the state of being "safe" , the condition of being protected against physical, social, spiritual, financial, political, emotional, occupational, psychological, educational or other types or consequences of failure, damage, error, accidents, harm or any other event which could be...
, portability
Portability
Portability may refer to:*Portability , the portability of social security benefits*Software portability, the portability of a piece of software to multiple platforms...
and reliability in the context of embedded systems, specifically those systems programmed in ISO C. There is also a set of guidelines for MISRA C++.
However, there are now more MISRA users outside of the automotive industry than in it: "MISRA has evolved as a widely accepted model for best practices by leading developers in sectors including aerospace, telecom, medical devices, defense, railway, and others."
The first edition of the MISRA C standard, "Guidelines for the use of the C language in vehicle based software", was produced in 1998, and is officially known as MISRA-C:1998.
In 2004, a second edition "Guidelines for the use of the C language in critical systems", or MISRA-C:2004 was produced, with many substantial changes to the guidelines, including a complete renumbering of the rules.
Work has just started on the next revision of the guidelines, which are intended to address use of C99
C99
C99 is a modern dialect of the C programming language. It extends the previous version with new linguistic and library features, and helps implementations make better use of available computer hardware and compiler technology.-History:...
.
As with many standards (eg ISO, BSI Group
BSI Group
BSI Group, also known in its home market as the British Standards Institution , is a multinational business services provider whose principal activity is the production of standards and the supply of standards-related services.- History :...
, RTCA, Incorporated et al) the MISRA C guideline documents are not free to users or implementors.
Rules
MISRAC stands for "Motor Industry Software Reliability Association" C standardsMISRA-C:1998 had 127 rules, of which 93 were required and 34 were advisory; the rules were numbered in sequence from 1 to 127.
The MISRA-C:2004 document contains 141 rules, of which 121 are "required" and 20 are "advisory"; they are divided into 21 topical categories, from "Environment" to "Run-time failures".
Tools
While there exist many software tools that claim to check code for "MISRA conformance", there is no MISRA certification process.An Exemplar Suite for MISRA-C:2004 is available from the MISRA Forum, which allows tool users to evaluate and compare the checking support provided by the various MISRA tools. Additionally, it gives tool implementors some guidance as to the intent of the Rules within MISRA-C:2004.
Most of the guidelines can be checked using tools that perform static code analysis
Static code analysis
Static program analysis is the analysis of computer software that is performed without actually executing programs built from that software In most cases the analysis is performed on some version of the source code and in the other cases some form of the object code...
. The remaining guidelines require the use of dynamic code analysis.
Tools that check code for MISRA conformance are:
- LDRALiverpool Data Research AssociatesLiverpool Data Research Associates is a provider of software analysis, test and requirements traceability tools for the Public and Private sectors and a pioneer in static and dynamic software analysis.-History:...
- ParasoftParasoftParasoft is an independent software vendor with headquarters in Monrovia, California. It was founded in 1987 by five graduates of the California Institute of Technology who had been working on Caltech Cosmic Cube....
- PC-LintPC-LintPC-lint is a commercial static code analysis software tool produced by Gimpel Software for the C/C++ languages.PC-lint is a command-line tool for developers, indicating suspicious or plain wrong issues in source code...
- PolyspacePolyspacePolyspace is a static code analysis tool inspired by the failure of the maiden flight of Ariane 5 where a run time error resulted in destruction of the launch vehicle. It is the first example of large-scale static code analysis by abstract interpretation to detect and prove the absence of certain...
- QA-CQA-CQA-C is a commercial static code analysis software tool produced by Programming Research for the C language created in 1986.This is the tool that was used to make the C source code measurements given in the book Safer C by Les Hatton:...
- Understand (software)
- KlocworkKlocworkKlocwork is a software company with headquarters in Burlington, MA and R&D based in Ottawa, ON, Canada. Klocwork was founded in 2001 as a spin-out of Nortel Networks and has over 850 customers who use its software development tools.-Products:...
C compilers that support MISRA conformance are:
- Green Hills SoftwareGreen Hills SoftwareGreen Hills Software is a privately owned company that builds operating systems and development tools for embedded systems. The company was founded in 1982 by Dan O'Dowd and Carl Rosenberg...
- IAR SystemsIAR SystemsIAR Systems is a Swedish computer technology company working in the area of embedded system development tools. IAR Systems was founded in 1983, and is listed on NASDAQ OMX, Stockholm....