Importing IAR Projects into Visual Studio with VisualGDB

This tutorial shows how to import IAR projects into Visual Studio using the VisualGDB project importing plugin. We will import a sample project from the STM32 software package and show the necessary manual adjustments. Before you begin, install VisualGDB 5.5 or later.

  1. Start Visual Studio and open the VisualGDB Embedded Project Wizard:01-newprj
  2. On the first page of the wizard select Automatically import a project in a different format -> Import an existing IAR Project, then enter the location of the .ewp file you want to import:If you are planning to convert the IAR-based project to the GCC compiler, select GCC Compiler under the IAR option. If you are planning to keep using the IAR compiler with VisualGDB, select the IAR Compiler instead and make sure you can create and build a basic IAR project as shown here.
  3. On the next page of the wizard, ensure you have selected the compiler (IAR or GCC) that matches your choice on the first page:
  4. VisualGDB should automatically recognize the device type from the project and limit the device list to only include compatible devices:
  5. Select your debug method on the Debug Method page. VisualGDB can automatically detect and configure debug settings for most common debug interfaces, so simply connect it via USB and select it in the “Debug using” field:
  6. Press “Finish” to generate the project. If you are using the IAR compiler, you should be able to build the project now. Note that if the project is using advanced build settings (e.g. specifies individual optimization settings), they may not be imported automatically and you would then need to specify them via the VS Project Properties.
  7. If you are using GCC, the project may not build initially due to missing header directories or preprocessor macros. If this happens, VisualGDB will try to locate the missing headers and automatically add the corresponding directories to the project properties. Click “Add now” to automatically fix the project properties:06-adddir
  8. The project should now build successfully:07-main
  9. Once the build succeeds, you should be able to debug the project. Simply set your breakpoints and press F5 to begin debugging it:
    08-bkpt

The IAR project importing plugin will try to automatically detect IAR-specific paths in the project settings and replace them with the corresponding GCC paths. You can tweak this logic by downloading the IAR importing plugin sources, modifying them and replacing the IARProjectImporter.dll file in the VisualGDB directory with the modified version.