Help using particle debugger with photon 2

I just bought a particle debugger and am looking for some directions on how to set it up to work with a photon 2. Can somebody point me in the right direction?

I would also like to be able to use it on a bsom evaluation board.

The instructions are in the Workbench getting started guide.

1 Like

Thank you.

I am stuck at this step. It seems the getting started guide is not updated.

How did you create your Particle project?

If you created it using Particle: Create New Project there should be a .vscode directory, and in that, a launch.json file. That contains the debugger settings and should prevent what you have in your screenshot.

Also, make sure you open the directory containing the project.properties file. Using the debugger in a multi-root workspace is confusing and may behave unexpectedly.

I am still having troubles with this. I am now getting the following error:

Cortex-Debug: VSCode debugger extension version 1.12.1 git(652d042). Usage info: GitHub - Marus/cortex-debug: Visual Studio Code extension for enhancing debug capabilities for Cortex-M Microcontrollers

Reading symbols from /Users/xxx/.particle/toolchains/gcc-arm/10.2.1/bin/arm-none-eabi-objdump --syms -C -h -w /Users/xxx/Documents/xxx/MainCode/target/5.8.0/p2/MainCode.elf

Reading symbols from /Users/xxx/.particle/toolchains/gcc-arm/10.2.1/bin/arm-none-eabi-nm --defined-only -S -l -C -p /Users/xxx/Documents/xxx/MainCode/target/5.8.0/p2/MainCode.elf

Launching GDB: /Users/xxx/.particle/toolchains/gcc-arm/10.2.1/bin/arm-none-eabi-gdb -q --interpreter=mi2

IMPORTANT: Set "showDevDebugOutput": "raw" in "launch.json" to see verbose GDB transactions here. Very helpful to debug issues or report problems

Launching gdb-server: /Users/xxx/.particle/toolchains/openocd/0.11.0-particle.4/bin/openocd -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s /Users/xxx/.particle/toolchains/openocd/0.11.0-particle.4/share/openocd/scripts -f /Users/xxx/.vscode/extensions/marus25.cortex-debug-1.12.1/support/openocd-helpers.tcl -f interface/cmsis-dap.cfg -f target/rtl872x_km4_debug.cfg -c "CDRTOSConfigure FreeRTOS"

Please check TERMINAL tab (gdb-server) for output from /Users/xxx/.particle/toolchains/openocd/0.11.0-particle.4/bin/openocd

Finished reading symbols from objdump: Time: 52 ms

Finished reading symbols from nm: Time: 348 ms

Output radix now set to decimal 10, hex a, octal 12.

Input radix now set to decimal 10, hex a, octal 12.

OpenOCD: GDB Server Quit Unexpectedly. See gdb-server output in TERMINAL tab for more details.

——————————————————————————————————

Terminal Tab:

Waiting for gdb server to start...[2024-06-07T12:31:13.273Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
/Users/xxx/.particle/toolchains/openocd/0.11.0-particle.4/bin/openocd -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s /Users/xxx/.particle/toolchains/openocd/0.11.0-particle.4/share/openocd/scripts -f /Users/xxx/.vscode/extensions/marus25.cortex-debug-1.12.1/support/openocd-helpers.tcl -f interface/cmsis-dap.cfg -f target/rtl872x_km4_debug.cfg -c "CDRTOSConfigure FreeRTOS"
xPack OpenOCD x86_64 Open On-Chip Debugger 0.11.0+dev (2022-03-25-19:34)
Licensed under GNU GPL v2
For bug reports, read
OpenOCD: Bug Reporting
CDLiveWatchSetup
/Users/xxx/.vscode/extensions/marus25.cortex-debug-1.12.1/support/openocd-helpers.tcl: rtl872x.cpu configure -rtos FreeRTOS
Info : Listening on port 50001 for tcl connections
Info : Listening on port 50002 for telnet connections
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: Atomic commands supported
Info : CMSIS-DAP: FW Version = 0254.2
Info : CMSIS-DAP: Serial# = 310436023138dc291239333437353533a5a5a5a597969908
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Error: Error connecting DP: cannot read IDR

[2024-06-07T12:31:15.015Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...

And here is the Json file:

{
    "version": "0.1.0",
    "configurations": [
        {
            "type": "cortex-debug",
            "request": "attach",
            "servertype": "openocd",
            "name": "Particle Debugger",
            "cwd": "${workspaceRoot}",
            "rtos": "FreeRTOS",
            "armToolchainPath": "${command:particle.getDebuggerCompilerDir}",
            "executable": "${command:particle.getDebuggerExecutable}",
            "serverpath": "${command:particle.getDebuggerOpenocdPath}",
            "preLaunchTask": "Particle: Flash application for debug (local)",
            "searchDir": [
                "${command:particle.getDebuggerSearchDir}"
            ],
            "configFiles": [
                "${command:particle.getDebuggerConfigFiles}"
            ],
            "postAttachCommands": [
                "${command:particle.getDebuggerPostAttachCommands}"
            ],
            "particle": {
                "version": "1.0.1",
                "debugger": "particle-debugger"
            }
        },
        {
            "type": "cortex-debug",
            "request": "attach",
            "servertype": "openocd",
            "name": "Particle Programmer Shield",
            "cwd": "${workspaceRoot}",
            "rtos": "FreeRTOS",
            "armToolchainPath": "${command:particle.getDebuggerCompilerDir}",
            "executable": "${command:particle.getDebuggerExecutable}",
            "serverpath": "${command:particle.getDebuggerOpenocdPath}",
            "preLaunchTask": "Particle: Flash application for debug (local)",
            "searchDir": [
                "${command:particle.getDebuggerSearchDir}"
            ],
            "configFiles": [
                "${command:particle.getDebuggerConfigFiles}"
            ],
            "postAttachCommands": [
                "${command:particle.getDebuggerPostAttachCommands}"
            ],
            "particle": {
                "version": "1.0.1",
                "debugger": "particle-programmer-shield"
            }
        },
        {
            "type": "cortex-debug",
            "request": "attach",
            "servertype": "openocd",
            "name": "Generic DAPLink Compatible Debugger",
            "cwd": "${workspaceRoot}",
            "rtos": "FreeRTOS",
            "armToolchainPath": "${command:particle.getDebuggerCompilerDir}",
            "executable": "${command:particle.getDebuggerExecutable}",
            "serverpath": "${command:particle.getDebuggerOpenocdPath}",
            "preLaunchTask": "Particle: Flash application for debug (local)",
            "searchDir": [
                "${command:particle.getDebuggerSearchDir}"
            ],
            "configFiles": [
                "${command:particle.getDebuggerConfigFiles}"
            ],
            "postAttachCommands": [
                "${command:particle.getDebuggerPostAttachCommands}"
            ],
            "particle": {
                "version": "1.0.1",
                "debugger": "generic-cmsis-dap"
            }
        },
        {
            "type": "cortex-debug",
            "request": "attach",
            "name": "[outdated] Particle Debugger (photon, p1, electron)",
            "servertype": "openocd",
            "interface": "swd",
            "device": "STM32F205RG",
            "cwd": "${workspaceRoot}",
            "executable": "${command:particle.getDebuggerExecutable}",
            "preLaunchTask": "Particle: Flash application for debug (local)",
            "armToolchainPath": "${command:particle.getDebuggerCompilerDir}",
            "svdFile": "${command:particle.getDebuggerSVDFile}",
            "searchDir": [
                "${command:particle.getDebuggerSearchDir}"
            ],
            "configFiles": [
                "interface/cmsis-dap.cfg",
                "target/stm32f2x.cfg"
            ],
            "postAttachCommands": [
                "monitor reset halt"
            ],
            "windows": {
                "configFiles": [
                    "interface\\cmsis-dap.cfg",
                    "target\\stm32f2x.cfg"
                ]
            }
        },
        {
            "type": "cortex-debug",
            "request": "attach",
            "name": "[outdated] Particle Debugger (argon, boron / bsom, xenon)",
            "servertype": "openocd",
            "interface": "swd",
            "device": "nRF52840_xxAA",
            "cwd": "${workspaceRoot}",
            "executable": "${command:particle.getDebuggerExecutable}",
            "preLaunchTask": "Particle: Flash application for debug (local)",
            "armToolchainPath": "${command:particle.getDebuggerCompilerDir}",
            "svdFile": "${command:particle.getDebuggerSVDFile}",
            "searchDir": [
                "${command:particle.getDebuggerSearchDir}"
            ],
            "configFiles": [
                "interface/cmsis-dap.cfg",
                "target/nrf52-particle.cfg"
            ],
            "postAttachCommands": [
                "monitor reset halt"
            ],
            "windows": {
                "configFiles": [
                    "interface\\cmsis-dap.cfg",
                    "target\\nrf52-particle.cfg"
                ]
            }
        },
        {
            "type": "cortex-debug",
            "request": "attach",
            "name": "[outdated] Particle Programmer Shield v1.0 (photon, p1, electron)",
            "servertype": "openocd",
            "interface": "swd",
            "device": "STM32F205RG",
            "cwd": "${workspaceRoot}",
            "executable": "${command:particle.getDebuggerExecutable}",
            "preLaunchTask": "Particle: Flash application for debug (local)",
            "armToolchainPath": "${command:particle.getDebuggerCompilerDir}",
            "svdFile": "${command:particle.getDebuggerSVDFile}",
            "searchDir": [
                "${command:particle.getDebuggerSearchDir}"
            ],
            "configFiles": [
                "interface/particle-ftdi.cfg",
                "target/stm32f2x.cfg"
            ],
            "postAttachCommands": [
                "monitor reset halt"
            ],
            "windows": {
                "configFiles": [
                    "interface\\particle-ftdi.cfg",
                    "target\\stm32f2x.cfg"
                ]
            }
        }
    ]
}