Debugging Using Custom Hardware

You may want to alter the existing Hardware Debugger settings, or try out a completely new setup which isnt pre-configured in Visual Micro.

All steps are below, and this is added into your local project via the "debugger_launch.json" file, so is not lost via updates to Visual Micro / Visual Studio.

 

Further Information on Microsoft MI: https://github.com/Microsoft/vscode-cpptools/blob/master/launch.md#customlaunchsetupcommands

 

VSCode Style Configuration 

Warning 16Warning:
This is the most intricate layer of configuration and will require setting paths to debugging tools.

Warning 16Warning:
This will override the debugger selections until the debugger_launch.json file is removed

 

 

Add debugger_launch.json

Right Click on the Project in Solution Explorer > Add > Custom GDB Debugger (Advanced)

This will create a [variant].[configuration_name][.]debugger_launch.json file which is the launch command passed to the Microsoft MI Debugger which powers the debugging in Visual Studio.

 

NOTE - All parameters are defaulted to the global parameters supplied by vMicro using the merge syntax $(optionName)

 

JSON NOTES -
  • GDB Paths can be obtained from another board, for the appropriate debuggers' location (review Micro Build output when attaching debugger to view final launch JSON)
  • COM Port is the port of the Black Magic Probe, not your Arduino DUE
  • JSON escaping for '\' > '\\' and '"' > '\"' (Visual Studio will perform this for you when pasting)
  • $(progam) and $(buildpath) will be automatically populated by vMicro


JSON Example - Setup Arduino Due on Black Magic with GDB

{
 "serverLaunchTimeout": 5000,
  "filterStdout": false,
  "filterStderr": true,
  "targetArchitecture": "arm",
  "stopAtEntry": false,
  "externalConsole": false,
  "MIMode": "gdb",
  "MIDebuggerServerAddress": "",
  "cwd": "$(buildPath)",
  "MIDebuggerPath": "C:\\Users\\vMicro\\AppData\\Local\\arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1\\bin\\arm-none-eabi-gdb.exe",
  "MIDebuggerArgs": "-nh -b 115200 -ex \"target extended-remote \\\\.\\COM52\" -ex \"monitor swdp_scan\" -ex \"attach 1\"",
  "debugServerPath": "",
  "debugServerArgs": "",
  "program": "$(program)",
  "logging": {
    "moduleLoad": false,
    "trace": false,
    "engineLogging": false,
    "programOutput": false,
    "exceptions": false,
    "traceResponse": false
  }
}

 

JSON Example - Setup Arduino Due on Atmel ICE with OpenOCD + GDB

# MI Debugger Properties
{
  "serverLaunchTimeout": 5000,
  "filterStdout": false,
  "filterStderr": true,
  "targetArchitecture": "arm",
  "stopAtEntry": false,
  "externalConsole": false,
  "MIMode": "gdb",
  "MIDebuggerServerAddress": "localhost:3333",
  "cwd": "$(buildPath)",
  "MIDebuggerPath": "C:\\Users\\Simon\\AppData\\Local\\arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin\\arm-none-eabi-gdb.exe",
  "MIDebuggerArgs": "",
  "debugServerPath": "C:\\ProgramData\\vmicro\\tools\\openocd-0.10.0.1\\bin/openocd.exe",
  "debugServerArgs": "-d2 -s \"C:\\ProgramData\\vmicro\\tools\\openocd-0.10.0.1/share/openocd/scripts/\" -c \"interface cmsis-dap\" -c \"cmsis_dap_vid_pid 0x03eb 0x2141\" -c \"set CHIPNAME at91sam3X8E\" -c \"source [find target/at91sam3ax_8x.cfg]\" -c \"init; reset halt\"",
  "program": "$(program)",
  "logging": {
    "moduleLoad": false,
    "trace": false,
    "engineLogging": false,
    "programOutput": false,
    "exceptions": false,
    "traceResponse": false
  }
}

 

 

Got It Working?

Please Click here to Email us if you have built a working configuration you would like to see in Visual Micro!