This tutorial shows how to create a simple ‘Blinking LED’ project for the STM32100B-EVAL board using Visual Studio.
Before we begin, ensure that VisualGDB 4.0 or later is installed.
- Start Visual Studio. Go to File->New->Project.
- Select VisualGDB -> Embedded Project Wizard.
Specify project directory and enter project name.
- Select “Embedded binary”. If you want VisualGDB to generate a .bin file additionally to an .elf file, ensure that the corresponding checkbox is checked.
- On the next page select the arm-eabi toolchain. If it is not installed, VisualGDB will install it automatically.
- In order to automatically install support files for STM32 microcontrollers press the “download support for more devices” button. Click “find support packages” to see the list of available device packages. Select “STM32 MCUs” from the list and press “Install selected packages”:
- VisualGDB will show the list of supported devices. Select your device from the list:
- VisualGDB will generate the default ‘Blinking LED’ sample project. You can select the port number and the blinking delay on the next page:
- On the last wizard page you can select a debug method. If you are using Segger J-Link, VisualGDB will configure all command lines automatically. If you are using OpenOCD, refer to its documentation for the command line corresponding to your JTAG debugger, select “Custom GDB stub” and provide the OpenOCD command line.
In this tutorial we will use Segger J-Link. Click on “Install support for additional debug methods”.
- Select “Segger J-Link” from the list and press OK.
- If you have not installed the Segger software package yet, follow the link in VisualGDB wizard to install it. Once installed, specify its location in the “Segger J-Link directory” field:
- Press Finish to complete the wizard. VisualGDB will generate a Visual Studio project for your STM32 device. Press Ctrl-Shift-B to build it:
- To start debugging it simply power on your board and connect the JTAG debugger to it. Ensure that Windows recognizes the device and loads the appropriate drivers. Set a breakpoint inside the loop and press F5 to start debugging. You can debug your firmware just like an ordinary Windows program:
- Press F10 to step over the line that turns on the LED. You will see the LED turning on:
- You can customize various project settings by right-clicking on the project node in Solution Explorer and selecting “VisualGDB Project Properties”. E.g. you can specify additional include directories on the “Makefile settings” page. VisualGDB will automatically update your makefile and synchronize IntelliSense settings: