Main Content

Resolve polyspace-autosar Error: Data Type Not Recognized

Issue

When creating a Polyspace® project from an AUTOSAR description, the software parses your AUTOSAR XML specifications and imports the data types that are required by the Software Components in the scope of verification. If your code uses a data type that is not in the Software Component specification, the analysis does not recognize this data type.

You see an error such as:

Identifier "LaneDetectionVar" is undefined
when creating a Polyspace project from AUTOSAR XML and source files. The error suggests that a data type used in your source code is not recognized.

Possible Solutions

You can force import of data types that are not defined for Software Components that you are verifying. Use the option -autosar-datatype. See polyspace-autosar.

You can find the already imported data types using the file autosar_model_key_elements.html in the AUTOSAR subfolder of your project folder. In the DataTypes section of the HTML, the file shows:

  • Automatically imported data types using this format:

    indirectpkg.types.app.Array_2_n320to320
    indirectpkg.types.app.Boolean

    The text indirect in the first column indicates that the data types are automatically imported.

  • Explicitly imported data types using this format:

    nametst003.typ.app.Boolean

    The text name in the first column indicates that the data type tst003.typ.app.Boolean is explicitly imported for the analysis.

In some cases, the analysis proposes a resolution hint using additional data types imported from the ARXML as a possible match for the unrecognized data type. To see the resolution hints, in the file psar_project.xhtml, click the navigation button button on the upper left, then click Behaviors. On the Behaviors tab, below the errors in the code extraction phase, click the link to see a summary of code-extraction diagnostics with possible resolution hints.

Code extraction errors followed by summary link

You can see resolution hints, that is, possible data types to add, that would resolve some of the issues related to unrecognized data types.

Instead of fixing individual code extraction errors using the resolution hints, you can also download a file with all options that implement the hints. On the summary page, click the link Download polyspace-autosar options.

Location of link to download options that implement resolution hints

You can use the downloaded text file with the polyspace-autosar option -options-file to implement the resolution hints in one shot.

See Also

Related Topics