STM32-Nucleo-F411RE tutorial with Visual Studio

This tutorial shows how to create a simple project for the STM32-Nucleo-F411RE board with Visual Studio.

You will need the following hardware and software to follow this tutorial:

We will create a simple ‘blinking LED’ project, build it, step through it in debugger and use the Code Map to visualize the structure of the HAL library.

  1. Start Visual Studio. Select File->New->Project and select the Embedded Project Wizard from the VisualGDB wizards. 01-prj
  2. Proceed with the default “binary” settings on the first page:02-binary
  3. On then next page select the ARM toolchain. If it is not present, VisualGDB will download it automatically:03-toolchain
  4. Select the STM32F411RE device from the device list. If it is not available, click “download support for more devices”:04-411re
  5. On the next page proceed with the default LEDBlink sample and specify the LED port according to the STM32-Nucleo-F411RE schematics:05-sample
  6. On the next page select OpenOCD as the debug method, connect your board, press “detect” and “test selected OpenOCD settings”. If VisualGDB suggests installing the WinUSB driver, proceed with it: 06-drivers
  7. Press Finish to create your project. You can build it by pressing Ctrl-Shift-B:07-build
  8. Set a breakpoint on the HAL_GPIO_WritePin() call and press F5 to begin debugging:08-bkpt
  9. Verify that the green LED on the board is off:09-led_off
  10. Press F10 to step over HAL_GPIO_WritePin() and verify that the LED turns on:10-led_on
  11. You can right-click on a function or variable in the code and select “Show on Code Map” to explore its role in your source code (requires VisualGDB 5.0+):11-codemap
  12. E.g. you can see how HAL_Delay depends on the uwTick variable that is also modified by HAL_IncTick() called by SysTick_Handler():12-halcode