Bug-Killing Coding Rules for Embedded C in Automobiles

January 08, 2016 // By Michael Barr
A C coding standard can help keep bugs out of embedded software by leveraging common language features and development tools.

In recent years, the software content of automobiles has grown exponentially. Estimates are that a modern luxury car may contain as many as 100 million lines of code. This code runs a host of interacting subsystems from the infotainment systems, window controls, and air conditioning to the most critical engine control and safety systems. While many of these subsystems are developed by the auto manufacturer, a good number of them come from third-party contractors as well as from independent aftermarket suppliers.

Figure 1: The AUTOSAR system links together various software applications running on different electronic control units (ECUs) within the automobile.

A number of standards are emerging in the auto industry such as the well established CAN bus, the AUTomotive Open System Architecture (AUTOSAR), the Media Oriented Systems Transport (MOST), and the ISO 26262 standard. While the first three standards address the external interaction and networking issues within automobiles, ISO 26262 is a set of requirements for safety and reliability. It is important for applications from different suppliers and groups within a manufacturer to conform to these standards, though only ISO 26262 calls for the use of well-defined coding rules to prevent bugs that can lurk within code and cause sometimes life-threatening malfunctions (Figures 1 and 2).

An embedded C coding standard is therefore needed that can be followed and understood by all teams and members of teams developing these interactive, networked systems. This is especially important because different teams and different suppliers will be using different development tools, compilers, and analysis tools. Therefore it is imperative to establish a common ground at the coding level.

Figure 2: C coding is at the heart of ISO 26262 compliance but the standard does not specify coding rules or standards at the C level.

What’s to Gain from a Coding Standard?

The adoption of a coding standard by a team or a company has many benefits. For example, a coding standard increases

Design category: 

Vous êtes certain ?

Si vous désactivez les cookies, vous ne pouvez plus naviguer sur le site.

Vous allez être rediriger vers Google.