3 Examples of Better Embedded Coding With MISRA
Embedded code is in countless systems today. And that code needs to be right — or it could compromise safety and security.
Why Embedded Systems Developers Need Reliable Code
Embedded code powers the world’s most important systems.
It’s used in:
- Automobiles people drive every day.
- Heart monitors (and other medical devices) that keep people alive.
- Airplanes that fly around the world.
Coding errors are not an option.
That’s why embedded coding needs to comply with guidelines. This ensures code is safe, secure, and reliable. But these guidelines can vary based on the programming language used.
2 Key Programming Languages For Embedded Systems
Most embedded systems are programmed in C and C++.
That’s because C and C++ permit low-level control of hardware. C and C++ can support the complexity of embedded coding. At the same time, using these languages leads to efficient code.
Plus, there’s a large percentage of C/C++ programmers. And they can maintain optimal performance — which is key for embedded systems.
Using MISRA For Embedded Coding in C and C++
Many embedded industries have strict compliance standards for safety and security. And these standards often require the use of a coding standard.
There are several different coding standards available for C and C++. But is one of the most trusted coding standards. MISRA rules ensure that code complies with industry standards. It helps you reduce cyclomatic complexity. And it improves the quality of the code.
Here are three examples of how embedded developers in different industries use MISRA for better coding.
1. MISRA for Better Embedded Coding in Automotive
Automotive developers trust MISRA to ensure better code. That’s because MISRA is the benchmark of quality and compliance in the automotive industry.
“MISRA is recognized as the de facto benchmark and has been adopted throughout the Japanese automotive industry, spanning the complete supply chain from the OEMS right down to the silicon level."
ISO 26262 Compliance
The automotive industry needs to comply with , a functional safety standard.
ISO 26262 has strict requirements for four Automotive Safety Integrity Levels (ASIL) — A through D. It recommends using a coding standard to ensure compliance with ASIL — and highlights the MISRA coding standard.
uses Helix QAC to apply MISRA C rules. This helps them comply with ISO 26262. Plus, Helix QAC finds issues that other tools miss. So, Protean doesn’t have to worry about .
Consistent Code Quality
uses Helix QAC to apply MISRA C rules, too. This helps developers adopt best coding practices. And it ensures consistent code quality from all developers — regardless of individual experience.
2. MISRA For Better Embedded Coding in Rail
Railway system developers also trust MISRA for better code.
“MISRA is the obvious choice. Originally created by the automotive industry, it is one of the longest established and most respected standards, and has been widely adopted across multiple safety-related markets.”
EN 50128 Compliance
The rail industry needs to comply with , a functional safety standard.
EN 50128 five Software Safety Integrity Levels (SSIL), ranging from SSIL0 to SSIL4. A coding standard is recommended for compliance for all SSILs — but it’s mandatory for SSIL3 and SSIL4.
This coding standard must:
- Prevent the use of undefined or unspecified behavior.
- Prevent the programmer making common mistakes.
- Limit the use of certain constructs.
- Remove potential ambiguity.
- Restrict library usage.
MISRA fulfills these requirements and ensures better code.
uses Helix QAC to apply MISRA rules and fulfill compliance requirements of EN 50128. This ensures that their driverless trains — Lyon Metro — are safe, secure, and reliable.
For Viveris, accurate code diagnostics are just as important as compliance.
By using Helix QAC, they get better MISRA C rule coverage than they would with other tools. Real problems are identified — and fixed. And there are fewer .
So, their code is better, and their time is better spent.
3. MISRA For Better Embedded Coding in Aerospace
Aerospace developers trust MISRA for better code, too.
The MISRA rule-set comes from some of the world’s leading coding experts. It’s suitable for (and widely adopted across) mission-critical and safety-critical industries — including aerospace.
The aerospace industry needs to comply with , a functional safety standard.
DO-178C includes five safety levels — A through E. And complying with these safety levels requires a coding standard, such as MISRA.
uses MISRA C++ as their coding standard — and ensures MISRA compliance with Helix QAC.
Quality — Even in Auto-Generated Code
Selex ES also uses Helix QAC and MISRA C and C++ rules to ensure quality in embedded coding. They even use it on auto-generated code. This means they can ensure code quality — and accelerate development times.
How to Achieve MISRA Compliance
To comply with the MISRA coding standard, you need to apply MISRA rules. This could be done manually during code reviews. Or it could be automated using a .
However, not all static code analyzers are the same. And when it comes to MISRA, some tools are more accurate than others. Helix QAC, for example, is the most accurate static analyzer for MISRA C and C++.
Learn more about choosing a static code analyzer to enforce MISRA rules.