The AUTomotive Open System ARchitecture (AUTOSAR) partnership provides coding guidelines for C++.
Consider this your guide to the AUTOSAR coding guidelines for C++.
Read along or jump to the section that interests you most:
- What Is AUTOSAR?
- Why AUTOSAR Coding Guidelines?
- Who Should Use the AUTOSAR Standard?
- How to Achieve AUTOSAR Compliance
What Is AUTOSAR?
AUTOSAR is a worldwide partnership. Over 180 automotive manufacturers, automotive suppliers, tool vendors, and semiconductor vendors are members. This includes Perforce’s static code analysis team (formerly PRQA).
Since forming in 2003, AUTOSAR has:
- Developed standardized open software architecture for automotive electronic units (ECUs).
- Created the Adaptive Platform for connected and autonomous vehicles.
- Established a coding standard for C++.
Why AUTOSAR Coding Guidelines?
The AUTOSAR standard is called: “Guidelines for the use of the C++14 language in critical and safety-related systems”.
Who Wrote AUTOSAR Coding Guidelines?
This coding standard was created in 2017. Experts from Perforce's static code analysis team (formerly PRQA) were part of the group that developed the AUTOSAR guidelines. In fact, we were the only static language development partner involved. And we contributed our expertise in C++ and best practice software development.
This set of guidelines is aimed at automotive development. But it's applicable to other safety-critical developers who code in C++.
Why Adopt the AUTOSAR Standard?
The MISRA C++ coding standard was published in 2008 — for ++03. Since then, many things have changed.
C++ has evolved. C++ compilers have improved. Testing, verification, and analysis tools have gotten better. ISO 26262 was released. And additional C++ coding standards have become available — HIC++, JSF AV C++, CERT C++, and C++ Core Guidelines.
The AUTOSAR standard addresses these changes. It also incorporates the expert knowledge embedded in these other coding standards.
AUTOSAR shares coding rules with MISRA C++. And many are based on other C++ coding standards. So, AUTOSAR delivers the most comprehensive coverage of the C++ language.
The AUTOSAR standard allows the use of some features that are not permitted by other C++ coding standards, including:
- Dynamic memory
- Virtual functions
[RELATED WHITE PAPER: AUTOSAR BASICS: INTRODUCTION TO AUTOSAR CODING GUIDELINES]
The Future of AUTOSAR Guidelines
AUTOSAR guidelines will be integrated in the next version of MISRA C++. Find out what this means for the future of the guidelines >>
Who Should Use the AUTOSAR Standard?
Development teams coding in C++14 should use the AUTOSAR standard.
This is especially important for teams developing automotive software.
That’s because the industry is moving towards autonomous vehicles. AUTOSAR has responded by creating the Adaptive Platform for connected and autonomous vehicles.
This will be especially true as cars ultimately become self-driving. Using AUTOSAR will go a long way toward ensuring the safety of self-driving vehicles.
This standard was designed to support AUTOSAR’s Adaptive Platform. But it is a smart choice for all embedded developers.
That’s because more development teams are moving from C to C++. Many developers want to use modern C++. And now that the AUTOSAR standard is available, it’s easier to move to modern C++.
[RELATED WHITE PAPER: MOVING TO MODERN C++]
How to Achieve AUTOSAR Compliance
Compliance with a coding standard is important for functional safety. You need it to fulfill the requirements of ISO standards (such ISO 26262).
The best way to achieve compliance is with a static code analyzer.
Using AUTOSAR Development Tools
Helix QAC for C++ is one of the best AUTOSAR development tools. It finds and reports on violations of AUTOSAR rules and directives. (This is done by applying the AUTOSAR compliance module.)
Here's how to apply AUTOSAR guidelines with Helix QAC.
Using Helix QAC gives you:
- Greater accuracy in complying with AUTOSAR guidelines.
- In-depth analysis of your C++ code.
- Comprehensive diagnostics, including examples of compliant and non-compliant code.
- Compliance reports, demonstrating your progress towards compliance.