Main Content

Troubleshoot Polyspace Analysis of AUTOSAR Code

This topic describes a component-based approach to verifying AUTOSAR code with Polyspace. For an integration analysis approach, see Choose Between Component-Based and Integration Analysis of AUTOSAR Code with Polyspace.

To analyze code implementation of AUTOSAR software components, Polyspace® parses the AUTOSAR XML specifications, detects the corresponding code implementation, compiles this code and runs static analysis to detect run-time errors or mismatch between code and specifications. If an error occurs in any of these steps, you do not see analysis results for the software component containing the error. This topic shows how to diagnose and fix these errors.

For sound analysis results, Code Prover requires that your AUTOSAR XML must be well-formed and your code must not have compilation errors. For instance, two elements in your AUTOSAR XML must not have the same Universal Unique Identifier (UUID). You might be using other tools to ensure well-formed ARXML and code without compilation errors. In addition to those tools, you can use the errors during the AUTOSAR XML parsing and code extraction phases of a Code Prover analysis to find issues in your XML and code.

After analysis, open the file psar_project.xhtml in a web browser. The file is located in the project folder. Check the overall project status and drill down to the specific software components that have issues. If you create a project in the Polyspace user interface, the Project Status tab shows this HTML file after project creation.

View Project Completion Status

If the analysis completes successfully, you see a status message like this.

Project Status

Project is marked created on Sat Dec 23 2017 19:37:53 GMT-0500 (Eastern Standard Time) after completing the following sequence of states in 38.25s:

  1. project_created entered as created with no_error in 0.05s.

  2. project_installed entered as created with no_error in 0.08s.

  3. prove_artifacts_created entered as created with no_error in 1.66s.

  4. user_code_extracted entered as created with no_error in 4.29s.

  5. code_verification_configured entered as created with no_error in 0.2s.

  6. code_verification_executed entered as created with no_error in 31.97s.

In current state, 2 AUTOSAR behaviors are processed, 2 with extracted implementation code and 2 with generated code-prover result.

The message shows how many software components were detected in the ARXML specifications, found in the code implementation and analyzed successfully with Code Prover.

If you create a project in the Polyspace user interface, the analysis is performed later. The project status only shows the first four steps.

View Errors in AUTOSAR XML Parsing

If an error occurs in parsing of AUTOSAR XML (and the error stops the complete analysis), the project status can look like this.

Project Status

Project is marked created on Wed Dec 31 1969 19:25:14 GMT-0500 (Eastern Standard Time) after completing the following sequence of states in 0.58s:

  1. project_created entered as created with no_error in 0.02s.

  2. project_installed entered as created with no_error in 0.09s.

  3. prove_artifacts_created entered as created with error_in_autosar_prove_artifacts_creation (2 errors, 0 warnings) in 0.47s.

Execution terminates with error_in_autosar_prove_artifacts_creation (2 errors, 1 warnings) See execution log messages

The above message shows that an error occurred when parsing the AUTOSAR XML.

To diagnose further,click the icon on the upper left. On the left pane, click Behaviors. Typically you see the list of all software components whose internal behavior-s are extracted. For each behavior, you can:

  • See if there were errors during the ARXML parsing and code extraction phase.

  • See further details of errors and warnings.

    Click the link See key autosar definition for this behavior for errors and warnings.

For a tutorial on filtering behaviors with errors only and interpreting the errors and warnings, see Interpret Errors and Warnings in Polyspace Analysis of AUTOSAR Code.

Tip

If you run polyspace-autosar at the command-line, you can run only the AUTOSAR XML parsing phase. Fix all errors in your AUTOSAR XML first before continuing the rest of the analysis.

Use the options -do-not-update-extract-code and -do-not-update-verification.

View Compilation Errors in Code

If a compilation error is found in the source files, the project status can look like this.

Project Status

Project is marked created on Sat Dec 23 2017 19:37:53 GMT-0500 (Eastern Standard Time) after completing the following sequence of states in 38.25s:

  1. project_created entered as created with no_error in 0.05s.

  2. project_installed entered as created with no_error in 0.08s.

  3. prove_artifacts_created entered as created with no_error in 1.66s.

  4. user_code_extracted entered as created with error_in_user_code_extraction (4 errors, 0 warnings) in 4.29s.

Execution terminates with error_in_user_code_extraction (4 errors, 1 warnings) See execution log messages

In current state, 2 AUTOSAR behaviors are processed, 2 with extracted implementation code and 2 with generated code-prover result.

The above message shows that an error occurred when extracting the code.

To diagnose further, click the icon on the upper left. On the left pane, click Behaviors. You can see the list of all software components whose internal behavior-s are extracted.

To navigate to the components that have errors, search for the string error_atLeastOneRunnableInFileThatDoesNotCompile. Alternatively, to see only the software components with compilation errors, click Create/Edit Query in the left pane. Click and deselect the has success filter and then click Search.

A software component with compilation errors looks like this.

ApplicationComponentBehavior - jyb.tst002.swc001.bhv001

...

...

Extract implementation code

Execution reported no error or warning.

Extraction of implementation completes with state error_atLeastOneRunnableInFileThatDoesNotCompile.

Found implementation for 3 of 3 required runnables; extracting 4 files from code-source directory.

Identify which software components have an error. To see the specific error message, click the line that indicates the number of files extracted from code source directory. Click the link Compiler messages to open a .log file containing all the compilation error messages in the files extracted for the runnable.

The two most common code extraction errors are missing include files and unrecognized data types. For these errors, you can use additional tools to fix many of the errors in one shot. See:

Tip

  • If one or more files do not compile, you can still see analysis results for software components where all files passed compilation. In this way, you can analyze certain software components while development is still in progress on the others.

  • If you run polyspace-autosar at the command-line, you can run only the code extraction phase. Fix all errors in your code first before continuing the analysis.

    Use the options -do-not-update-autosar-prove-environment and -do-not-update-verification.

See Also

Related Topics