The majority of ST boards are now available out of the box for debugging in vMicro.
The MXChip AZ3166 is an STM32F4 Chip with an On-Board STlink v2 Debugger - see the MXCHIP page for specific information
External Debug Interface: SWD
Some ST Boards come with a debugger built into the board, as with the Nucleo and Discovery boards, which removes the need for an external hardware debugger.
Built-In Debugger Connections
If you have a Nucleo / Discovery, or other board with a built in debugger, please ensure the jumpers are set corrrectly to enable it from the user manual.
Once this is complete, no futher connections are required beyond the USB lead
e.g. STM 32 Nucleo Jumpers
External Debugger Connections
If you don't have a debugger built-in then you can use an External Debugger which supports SWD to attach to your board, as seen in the examples below.
NOTE - SWD Interface Connections
On Boards - often just specific pins on your board, or may be presented in a 2x5 interface (its small at [0.05"/1.27mm pitch]), shown in the first image on the "Black Magic Pro" debugger
On Debuggers - may be presented in the small 2x5 interface, or in the JTAG layout.
Bear this in mind when finding a debugger, you may need more leads / breakouts to connect them to your targets.....
Software Setup
Ensure you have Visual Studio and the vMicro Extension Installed
Open your Sketch and select the Debug > Hardware, and the relevant Debugger you have available, whether it's built in or external, and select the relevant optimization (recommend not Default)
You may need to install an additional USB Driver on Interface 0 of your debugger to allow it to function with this software - check in the debugger list here
Remember - If you have installed a new driver, you may have to do it again if you connect the debugger to a different USB port next time.....
Start Debugger
- Ensure you have the Debug Configuration selected from the Configuration Manager Window
- If you know where you want the first breakpoint in your code, add it now
- To start the debugging process, you can either:
- "Debug > Attach to Process" button if your code has already been uploaded to the STM32 board
- "Debug > Start Debugging" if your code has not been uploaded
Black Magic Note - You will need to set the COM port to the BMP port to DEBUG, so can only set Board COM Port, "Build & Upload", swap to BMP COM Port and then "Attach to Process"
Congratulations - you should have the debugger running, and further windows can be opened from the "Debug > Windows" menu once you have started debugging
See our GDB Debugging in Brief guide, or our detailed GDB Debugging Tutorial for Arduino to learn more about using the debugging interface.
Debugging an STM32 Discovery Board
You can even create a debug probe from an ESP8266 to allow you to use GDB over WiFi!