Main Content

Using Polyspace in AUTOSAR Software Development

Whatever your role in the AUTOSAR software development workflow, you can benefit from using a static code analysis tool such as Polyspace®.

Polyspace supports two approaches for verifying AUTOSAR code:

  • Component-based analysis

    In this approach, you provide your AUTOSAR design specifications in ARXML format. The analysis reads these specifications, creates a separate C code module for each software component, and then checks each module for run-time errors and mismatch with design specifications.

    For an overview of this approach, see Benefits of Polyspace for AUTOSAR.

  • Integration analysis

    In this approach, you do not provide the design specifications but simply run Code Prover on a single project with all relevant source code. To make the analysis AUTOSAR-aware, use the value autosar for the analysis option Libraries used (-library).

See also Choose Between Component-Based and Integration Analysis of AUTOSAR Code with Polyspace.

Check if Implementation of Software Components Follow Specifications

This check is supported only in the component-based analysis.

Suppose you are part of an OEM specifying the structure and runtime behavior of the software components in the application layer, including the data types, events and runnables. You want to check if the tier-1 suppliers providing the code implementation of the software components follow your specifications.

Check the code implementation of each software component individually or see an overview of results for all software component implementations. To see an overview:

  1. Run Polyspace on all software components and upload all results to Polyspace Access.

  2. In the results, see if:

    • All runnables are implemented. See if the checker AUTOSAR runnable not implemented shows any result.

    • All runnables implementations conform to data constraints in the specifications. See if the checker Invalid result of AUTOSAR runnable implementation shows any result.

    • Arguments to Rte_ functions follow data constraints in the specifications. See if the checker Invalid use of AUTOSAR runtime environment function shows any result.

    • There are other possibilities of run-time errors.

To begin checking the code implementation of software components against ARXML specifications:

  1. Provide the locations of your ARXML and code folders. Run Polyspace to check the code implementation of all software components against ARXML specifications.

    If you run verification on a remote server, you can specify that all results must be uploaded to Polyspace Access after verification. Otherwise, you can upload them later.

    See Run Polyspace Code Prover on Server and Upload Results to Web Interface.

  2. Upload all results to Polyspace Access. When uploading, make sure you use the same project name and version number for all results.

    See Upload Results to Polyspace Access.

  3. In Polyspace Access, click the project name in the Project Explorer and see a summary of the results.

    See Dashboard in Polyspace Access Web Interface (Polyspace Access).

Alternatively, you can ask for code analysis reports from the suppliers. The reports are produced individually for each software component. To begin, see Generate Reports from Polyspace Results.

Assess Impact of Edits to Specifications

This check is supported only in the component-based analysis.

Suppose you are part of an OEM and want to add to or edit the specifications that you provide to a tier-1 supplier. Before making the edits, you want to test their potential impact on the existing code implementation.

Check the code implementation of software components that are likely to be impacted. Compare Code Prover analysis results that use the modified specifications with results that use the original specifications.

To begin comparing verification results for a software component:

  1. Run Polyspace using the original specifications.

    See Run Polyspace on AUTOSAR Code.

  2. Upload the result for a software component to Polyspace Access.

    See Upload Results to Polyspace Access.

  3. Rerun Polyspace using the updated specifications.

  4. Upload the new result to Polyspace Access.

  5. See if there is an increase in the number of red, gray or orange checks.

    See Compare Results in Polyspace Access Project to Previous Runs and View Trends (Polyspace Access).

Check Code Implementation for Run-time Errors and Mismatch with Specifications

The check for run-time errors is supported both in the component-based analysis and integration analysis. The check for mismatch with design specifications is supported only in the component-based analysis.

Suppose you are part of a tier-1 supplier providing the code implementation of software components based on specifications from an OEM. You want to check for run-time errors such as overflow and division by zero or violations of data constraints in the ARXML specifications.

Check software components that you implemented. Use the advanced option -autosar-behavior to check specific software components.

To begin:

  1. Run Polyspace on the code implementation of your software components.

  2. If you update the implementation of a software component, you can continue to use the same project to reanalyze your code. The later analysis only consider the software components whose implementation changed since the previous analysis.

See Run Polyspace on AUTOSAR Code.

Check Code Implementation Against Specification Updates

This check is supported only in the component-based analysis.

Suppose you are part of a tier-1 supplier implementing specifications from an OEM. You receive some updates to the specifications. If you had been running Polyspace to compare your code against the specifications, you can quickly check if the specification changes introduced any errors.

In this case, you will already have set up your project, possibly with additional options to emulate your compiler. You can reuse these options when creating a new project from the new ARXML specifications.

Related Topics