Think & Create

Debug STM32 with VScode

by on Jul.19, 2017, under Uncategorized

This tutorial shows how to debug STM32 with VScode. Tested with $2 STM32F103C8T6 “blue pill” board and $2 ST link V2.

7_debug

 

Follow instructions on https://github.com/rogerclarkmelbourne/Arduino_STM32

And make sure it works in Arduino IDE. Also make sure the folder is called “Arduino_STM32”, not “Arduino_STM32-master”

 

1_installstm32

In Arduino’s board manager, install “Arduino SAM Boards (32-bits ARM Cortex-m3)”, in order to get a compiled version of openOCD

2_installcortexm0

Now openOCD should appear in “Arduino15” folder. The location of that folder is different in Mac, Windows or Linux. In Mac, it is located in ~/Library

 

Open “packages” in “Arduino15”, create a folder called “Arduino_STM32”. Look for openOCD and copy it to “Arduino_STM32” within “packages”.

3_copy_openocd

Download a copy of openOCD for its script files.

4_download_openocd

Copy scripts files into “scripts” folder in “packages”. Follow this structure.

5_copy_script

Install VScode and Arduino extension

6_installextension

Debugging STM32 require some edit in “misc/usbmapping.json”. I did a PR and get merged into master branch. However you may not get it automatically until next release. If not, find your local file and replace it with the newest one on https://github.com/Microsoft/vscode-arduino/blob/master/misc/usbmapping.json

 

Happy debugging!

7_debug


Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Blogroll

A few highly recommended websites...