top of page

Food & Mood Group

Public·23 members
Johnny Prasad
Johnny Prasad

Misra C 2012: A Comprehensive Guide to Downloading and Using the Coding Standard for Embedded Software


Misra C 2012 Download Pdf: A Guide for Embedded Software Developers




If you are an embedded software developer who uses C as your programming language, you might have heard of Misra C. But what is it exactly and why should you care? In this article, we will explain what Misra C is, what are its main features and benefits, and how you can download and use it for your projects.




Misra C 2012 Download Pdf



What is Misra C and why is it important?




Misra C is a set of coding guidelines for C programming language




Misra C stands for Motor Industry Software Reliability Association C. It is a set of coding guidelines that aim to improve the quality, safety, and reliability of software written in C programming language. It was originally developed by a consortium of automotive companies in the UK in the early 1990s, but has since been adopted by other industries and sectors that use embedded systems.


Misra C aims to improve the quality, safety, and reliability of embedded software




Embedded software is software that runs on devices that are not general-purpose computers, such as microcontrollers, sensors, actuators, etc. Embedded software often controls critical functions and interacts with physical systems, such as cars, planes, medical devices, etc. Therefore, embedded software must be reliable, robust, secure, and efficient.


However, writing embedded software in C can be challenging and error-prone. C is a low-level language that gives programmers a lot of freedom and flexibility, but also exposes them to many pitfalls and risks. For example, C does not have built-in mechanisms for memory management, type checking, exception handling, etc. This means that programmers have to deal with these issues manually and carefully.


Misra C provides a set of rules and directives that help programmers avoid common mistakes and bad practices in C code. By following these guidelines, programmers can write code that is more consistent, readable, maintainable, portable, testable, and secure. This can reduce the number of defects, bugs, crashes, vulnerabilities, and failures in embedded software.


Misra C is widely used in industries such as automotive, aerospace, medical, and defense




Because of its benefits for embedded software development, Misra C has become a de facto standard in many industries that rely on embedded systems. For example:



  • Automotive: Misra C is used to develop software for electronic control units (ECUs) that control various functions and features of modern cars, such as engine, brakes, steering, airbags, etc. Misra C helps ensure that the software meets the safety and performance requirements of the automotive industry.



  • Aerospace: Misra C is used to develop software for avionics systems that control the flight and navigation of aircraft, such as flight management systems, autopilot systems, communication systems, etc. Misra C helps ensure that the software meets the safety and reliability requirements of the aerospace industry.



  • Medical: Misra C is used to develop software for medical devices that monitor and treat patients, such as pacemakers, infusion pumps, ventilators, etc. Misra C helps ensure that the software meets the safety and quality requirements of the medical industry.



  • Defense: Misra C is used to develop software for defense systems that protect and support military operations, such as radar systems, missile systems, communication systems, etc. Misra C helps ensure that the software meets the security and robustness requirements of the defense industry.



In addition to these industries, Misra C is also used in other domains that use embedded systems, such as industrial automation, consumer electronics, telecommunications, etc.


What are the main features and benefits of Misra C 2012?




Misra C 2012 is the latest version of the standard, released in 2013




Misra C 2012 is the third and latest version of the standard, released in 2013. It replaces the previous versions of Misra C:1998 and Misra C:2004. It is based on the ISO/IEC 9899:1990 (C90) standard for C programming language, but also supports some features from ISO/IEC 9899:1999 (C99) and ISO/IEC 9899:2011 (C11).


Misra C 2012 introduces new rules and directives, as well as clarifications and corrections




Misra C 2012 contains 143 rules and 16 directives that cover various aspects of C programming, such as syntax, data types, operators, expressions, control flow, functions, pointers, arrays, structures, unions, enumerations, bit-fields, preprocessor directives, etc. Some of these rules and directives are new or modified from the previous versions of Misra C. Some of them are also clarified or corrected to address ambiguities or inconsistencies.


The rules and directives are classified into three categories:



  • Mandatory: These are rules and directives that must be followed in all circumstances. Violating a mandatory rule or directive will result in non-compliant code.



  • Required: These are rules and directives that should be followed in all circumstances. Violating a required rule or directive should be avoided unless there is a strong justification.



  • Advisory: These are rules and directives that should be followed where possible. Violating an advisory rule or directive may be acceptable in some situations.



The rules and directives are also classified into two types:



  • Rules: These are rules that can be checked by static analysis tools or compilers. They are expressed in a formal notation that can be interpreted by machines.



  • Directives: These are directives that cannot be checked by static analysis tools or compilers. They are expressed in natural language that can be interpreted by humans.



Misra C 2012 supports modern C features such as C99 and C11




Misra C 2012 is based on the C90 standard for C programming language, but it also supports some features from the newer standards of C99 and C11. For example:



  • C99 features: Misra C 2012 supports features such as variable-length arrays (VLAs), designated initializers, compound literals, flexible array members (FAMs), inline functions, restrict keyword, etc.



  • C11 features: Misra C 2012 supports features such as static assertions (_Static_assert), atomic types (_Atomic), generic selections (_Generic), etc.



However, not all features from C99 and C11 are supported by Misra C 2012. Some features are explicitly excluded or discouraged by the standard. For example:



  • C99 features: Misra C 2012 excludes features such as complex numbers (_Complex), variable arguments (stdarg.h), long long int type (long long), etc.



Misra C 2012 offers more flexibility and adaptability for different projects and contexts




One of the main improvements of Misra C 2012 over the previous versions of Misra C is that it offers more flexibility and adaptability for different projects and contexts. For example:



  • Deviation procedures: Misra C 2012 allows developers to deviate from some rules and directives if they have a valid reason and document it properly. This can help developers deal with situations where following a rule or directive is impractical, impossible, or undesirable.



  • Decidability levels: Misra C 2012 assigns a decidability level to each rule and directive, indicating how easy or hard it is to check them automatically or manually. This can help developers choose the appropriate tools and methods to apply the standard.



  • Compliance levels: Misra C 2012 defines three levels of compliance, depending on how many rules and directives are followed and how many deviations are allowed. This can help developers set realistic and achievable goals for their projects.



Misra C 2012 helps developers avoid common errors and vulnerabilities in C code




By following the rules and directives of Misra C 2012, developers can avoid many common errors and vulnerabilities that can affect the quality, safety, and reliability of embedded software. For example:



  • Undefined behavior: Misra C 2012 helps developers avoid situations where the behavior of the code is not specified by the C standard, such as integer overflow, division by zero, null pointer dereference, etc. Undefined behavior can lead to unpredictable and undesirable results, such as crashes, data corruption, security breaches, etc.



  • Implementation-defined behavior: Misra C 2012 helps developers avoid situations where the behavior of the code depends on the compiler or platform used, such as bit-field ordering, alignment requirements, endianness, etc. Implementation-defined behavior can lead to portability and compatibility issues, such as incorrect calculations, data loss, communication failures, etc.



  • Unspecified behavior: Misra C 2012 helps developers avoid situations where the behavior of the code is not uniquely determined by the C standard, such as the order of evaluation of subexpressions, the order of execution of function arguments, etc. Unspecified behavior can lead to inconsistency and non-determinism issues, such as different outcomes for the same input, race conditions, timing errors, etc.



How can you download and use Misra C 2012?




Misra C 2012 is available as a PDF document from the official website of Misra




If you want to download and use Misra C 2012 for your projects, you can get it from the official website of Misra: https://misra.org.uk/. You will need to register an account and pay a license fee to access the document. The license fee depends on the type and number of users you have. For example:



  • Single user license: This license allows one individual to use Misra C 2012 for personal or commercial purposes. The license fee is 15 (excluding VAT).



  • Academic license: This license allows one academic institution to use Misra C 2012 for teaching or research purposes. The license fee is 50 (excluding VAT).



  • Corporate license: This license allows one organization to use Misra C 2012 for commercial purposes. The license fee depends on the number of employees in the organization. For example, for an organization with up to 10 employees, the license fee is 150 (excluding VAT).



You can also get a free preview of Misra C 2012 from the website. The preview contains a summary of the rules and directives, as well as some examples and explanations.


Misra C 2012 requires a license fee for commercial use, but not for academic or personal use




As mentioned above, Misra C 2012 requires a license fee for commercial use. This means that if you use Misra C 2012 for developing software that is intended for sale or distribution to third parties, you need to pay a license fee to Misra. However, if you use Misra C 2012 for academic or personal use only, you do not need to pay a license fee. For example:



  • Academic use: If you are a student or a teacher who uses Misra C 2012 for learning or teaching purposes, you do not need to pay a license fee. You can use the academic license that is provided by your institution.



  • Personal use: If you are a hobbyist or an enthusiast who uses Misra C 2012 for your own projects, you do not need to pay a license fee. You can use the single user license that is provided by Misra.



However, even if you do not need to pay a license fee, you still need to follow the terms and conditions of Misra C 2012. For example, you cannot copy, modify, distribute, or sell the document without the permission of Misra.


Misra C 2012 can be used with various tools and compilers that support it




To use Misra C 2012 effectively, you need to have tools and compilers that support it. These tools and compilers can help you check, verify, and enforce the rules and directives of Misra C 2012. They can also help you generate reports and documentation for your code. There are many tools and compilers that support Misra C 2012, such as:



  • Static analysis tools: These are tools that analyze your code without executing it. They can detect violations of Misra C 2012 rules and directives, as well as other issues such as syntax errors, style issues, code smells, etc. Some examples of static analysis tools that support Misra C 2012 are PC-lint, LDRA Testbed, PRQA QA-C, etc.



  • Dynamic analysis tools: These are tools that analyze your code while executing it. They can detect violations of Misra C 2012 rules and directives, as well as other issues such as memory leaks, buffer overflows, concurrency errors, etc. Some examples of dynamic analysis tools that support Misra C 2012 are Valgrind, Parasoft C/C++test, Coverity, etc.



  • Compilers: These are tools that translate your code into executable files. They can check and enforce some of the Misra C 2012 rules and directives at compile time, as well as optimize your code for performance and efficiency. Some examples of compilers that support Misra C 2012 are GCC, Clang, IAR Embedded Workbench, etc.



You can also use other tools that support Misra C 2012, such as code editors, code generators, code reviewers, code formatters, etc.


Misra C 2012 can be applied manually or automatically, depending on the level of compliance required




To apply Misra C 2012 to your code, you can either do it manually or automatically, depending on the level of compliance required by your project. For example:



  • Manual application: This means that you write your code according to the rules and directives of Misra C 2012 by yourself. You can use the document as a reference and check your code manually or with the help of tools. This method gives you more control and flexibility over your code, but it also requires more time and effort.



  • Automatic application: This means that you use tools that automatically generate or modify your code according to the rules and directives of Misra C 2012. You can use code generators that produce compliant code from high-level specifications or models. You can also use code formatters that adjust your code style and formatting to comply with the standard. This method saves you time and effort, but it also limits your control and flexibility over your code.



You can also use a combination of manual and automatic application methods to achieve the best results.


Misra C 2012 can be customized and tailored to suit specific needs and preferences




One of the advantages of Misra C 2012 is that it can be customized and tailored to suit specific needs and preferences of different projects and contexts. For example:



  • You can choose which rules and directives to follow or deviate from according to your project requirements and constraints.



  • You can define your own rules and directives to supplement or replace the ones provided by Misra C 2012.



  • You can configure your tools and compilers to check and enforce the rules and directives of Misra C 2012 according to your preferences.



However, when customizing or tailoring Misra C 2012, you should be careful not to compromise the quality, safety, and reliability of your code. You should also document your decisions and justifications clearly and transparently.


Conclusion




Misra C 2012 is a set of coding guidelines for C programming language that aims to improve the quality, safety, and reliability of embedded software. It is based on the C90 standard, but also supports some features from C99 and C11. It introduces new rules and directives, as well as clarifications and corrections. It offers more flexibility and adaptability for different projects and contexts. It helps developers avoid common errors and vulnerabilities in C code.


Misra C 2012 is available as a PDF document from the official website of Misra. It requires a license fee for commercial use, but not for academic or personal use. It can be used with various tools and compilers that support it. It can be applied manually or automatically, depending on the level of compliance required. It can be customized and tailored to suit specific needs and preferences.


If you are an embedded software developer who uses C as your programming language, you should consider using Misra C 2012 for your projects. It can help you write code that is more consistent, readable, maintainable, portable, testable, and secure. It can also help you meet the safety and performance requirements of your industry and domain.


FAQs




What is the difference between Misra C and Misra C++?




Misra C++ is another set of coding guidelines for C++ programming language that is based on Misra C. It covers some aspects of C++ that are not covered by Misra C, such as classes, templates, exceptions, inheritance, polymorphism, etc. It also has some rules and directives that are different from or contradict Misra C.


How can I get certified for Misra C 2012?




There is no official certification process for Misra C 2012. However, you can get a certificate of compliance from some third-party organizations that offer Misra C 2012 training and assessment services. These organizations can help you learn and apply Misra C 2012 to your code and verify your compliance level.


Is Misra C 2012 compatible with other coding standards?




Misra C 2012 is compatible with some other coding standards that are based on or derived from it. For example, AUTOSAR C++14 is a coding standard for automotive software development that is based on Misra C 2012 and Misra C++. However, Misra C 2012 may not be compatible with some other coding standards that have different or conflicting rules and directives.


What are some examples of software projects that use Misra C 2012?




Some examples of software projects that use Misra C 2012 are:



  • The Linux kernel: The Linux kernel is the core component of the Linux operating system that manages the hardware and software resources of the system. The Linux kernel uses a subset of Misra C 2012 rules to improve its code quality and security.



  • The Mars Curiosity rover: The Mars Curiosity rover is a robotic vehicle that explores the surface of Mars as part of the NASA's Mars Science Laboratory mission. The Mars Curiosity rover uses Misra C 2012 to develop its flight software that controls its navigation, communication, instrumentation, etc.



  • The SpaceX Falcon 9 rocket: The SpaceX Falcon 9 rocket is a reusable launch vehicle that delivers satellites and cargo to orbit and beyond. The SpaceX Falcon 9 rocket uses Misra C 2012 to develop its flight software that controls its guidance, propulsion, telemetry, etc.



Where can I find more information about Misra C 2012?




You can find more information about Misra C 2012 from the following sources:



  • The official website of Misra: https://misra.org.uk/



  • The official document of Misra C 2012: https://misra.org.uk/Publications/tabid/57/Default.aspx



  • The official forum of Misra: https://misra.org.uk/forum/default.aspx



  • The official blog of Misra: https://misra.org.uk/Blog/tabid/60/Default.aspx



  • The official Twitter account of Misra: @MISRA_C



71b2f0854b


About

Welcome to the group! You can connect with other members, ge...

Members

  • Leslie West
    Leslie West
  • Svyatoslav Silin
    Svyatoslav Silin
  • Michael Williams
    Michael Williams
  • Hunter Wood
    Hunter Wood
  • Waylon Johnson
    Waylon Johnson
bottom of page