AUTOSAR, CDT and static analysis

The Eclipse release Helios brought a lot of new features. A lot of attention on the website is put on Xtext or Acceleo. But for the embedded world, a nice new feature has found its way into CDT: The subproject Codan provides a framework for static analysis of the C/C++ code directly in the editor.  Provided are several examples. One is checking for an assignment in a condition:

The great benefit of, again Eclipse / Plugins, is the extension concept. I have just added another check, that does static analysis for AUTOSAR naming conventions while editing. The AUTOSAR RTE (Run time environment) specification defines the structure API of the RTE (which is generated from an AUTOSAR model). The API differs from Software-component to software component. Example calls from the spec could be:

to find all ports of an interface type <i>, where P and R denote Provided or Required.

where <p> is the port name and <o> is the data element to be read.

With a few lines of code, I made Codan (i.e. CDT) learn that any function starting with “Rte_” should conform to the spec, and any other function is ignored by my static analysis. The programmer is immediately notified of incorrect API calls.

A short demo is attached below. There is plenty of ideas that come from this great (not so) little gem.

One thought on “AUTOSAR, CDT and static analysis

  1. not bad. I can imagine generating checks for basic dependency management in an Embedded-MDSD-Projekt where you have platform, components and system parts. Work done in this direction could easily be reused in other embedded projects.

Leave a Reply

Your email address will not be published. Required fields are marked *