This repository has been archived by the owner on Jun 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 224
[ANN] Debug .NETMF native code using VS Code #520
Comments
Nice work, I'll definately try this one. Launch time of the full VS is so ..... |
👍 |
Very nice!!! Do you know how to integrate with compile key(Ctrl+Shift+B)? |
@josesimoes, I'm a bit new to NETMF, and I'm wondering if the following could also be used to manage Netduino board, any idea? |
@josesimoes I was suffered because of debugger disconnection after starting debug mode. I found it was because of power mode which you included in your PR #524. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This is a guide to use VS Code as a debugging environment for NETMF native code.
Not a competition or wanting to pick on @cw2 ;) !
The motivation behind it is that I’ve been using VS Code for native code development for quite some time now, and felt that being able to debug it right there would be a nice improvement and would boost productivity.
Anyways, it’s another option for the community members interested in this side of the development.
Requirements:
Add the following file (launch.json) in the .vscode directory at the root folder of the NETMF repository .
A few explanations on what you need to tweak there.
miDebuggerPath: full path to the gdb executable.
program: full path to the .axf output file that results from a successful NETMF build.
setupCommands (the second ‘text’ entry): the same as the previous one.
debugServerPath: full path to the OpenOCD executable.
debugServerArgs: full path to the scripts directory on the OpenOCD installation AND the appropriate .cfg files for the interface and the board. In this example I’m using the STM32F4DISCOVERY board, so I add there the ‘stlink-v2-1.cfg’ for the interface and ‘stm32f4discovery.cfg’ for the board support configuration.
(note the slash on all the paths there)
And that’s it!
Assuming that you have successfully build a NETMF image, have loaded it on the board and that you’ve open the root folder of the NETMF repository with VS Code, you can navigate to the View – Debug menu. You’ll see there the debug interface and the familiar green play button (or F5, if you prefer). Hit that one and the magic will happen.
You can set breakpoints, add watch variables, navigate up and down the call stack and use the toolbar or the familiar keyboard shortcuts to debug the code.
Final note: to have enough info in the compiled output for a decent debug session make sure you set the appropriate flavour to the build command. As an alternative you can always tweak the Microsoft.Spot.system.gcc.targets file. I’ve changed mine in these two lines:
<CC_CPP_TARGETTYPE_FLAGS Condition="'$(FLAVOR)'=='Release'" >$(CC_CPP_TARGETTYPE_FLAGS) -Os -g3 -ggdb</CC_CPP_TARGETTYPE_FLAGS></code>
<ARCH_TARGETTYPE_FLAGS Condition="'$(FLAVOR)'=='Release'" >-Os -g3 -ggdb</ARCH_TARGETTYPE_FLAGS></code>
The text was updated successfully, but these errors were encountered: