Common problems with GPDSC files generated by STM32CubeMX

The STM32CubeMX tool can simplify STM32 project creation by generating initialization code specific to your hardware setup. The gpdsc files generated by STM32CubeMX can be conveniently imported into VisualGDB using the “Automatically import a project in a different format” option in the wizard:However, the STM32CubeMX tool sometimes generates broken gpdsc files that require manual adjustment. This page provides an overview of common errors in the gpdsc files and the suggested workarounds.

Corrupt XML Attributes

Sometimes STM32CubeMX would generate incorrectly escaped XML attributes in the gpdsc files. This would trigger the following VisualGDB error:You can resolve this by locating the line shown in the error message and checking for the “&” character, e.g.:

 <file category="sourceC" condition="ARMCC5;(SIiTcompilerIiARMCC&SIiToptionsIiAC5)" name="Device\ARM\ARMCA9\Source\AC5\startup_ARMCA9.c"/>

The “&” character is used in XML files to specify special entities, so the “&SIiToptionsIiAC5” is treated by the XML parser as an invalid entity reference. This can be fixed by replacing “&” with “&amp;”:

<file category="sourceC" condition="ARMCC5;(SIiTcompilerIiARMCC&amp;SIiToptionsIiAC5)" name="Device\ARM\ARMCA9\Source\AC5\startup_ARMCA9.c"/>

Missing Include Directories

Sometimes the generated gpdsc files would be missing some include directories that are required for building the project. You can use VisualGDB’s header discovery to quickly find the missing directories and update the settings.

Other Errors

If the imported project still doesn’t build, it could be caused by conflicts between VisualGDB-supplied libraries or drivers, and the files referenced by the gpdsc file. See our documentation on the STM32 project structure for a detailed overview of the STM32 projects.

If you believe VisualGDB does not correctly import some settings that are present in the gpdsc file, simply contact our support with further details and we should be able to fix it.