This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SK-AM62B-P1: Setting up OpenOCD gdb port within VS Code

Part Number: SK-AM62B-P1

Hello,

I'm trying to setup OpenOCD for gdb debugging within VS code in my WSL2 environment. I installed the two TI VS code extensions (TI Embedded Debug and TI Embedded Development). Now, when I start a debug session, the script is trying to setup OpenOCD with ports 50000 and up. For some reason, I get a bind error on port 50001 because it is in-use. I ran lsof and netstat and didn't find any process using that port, so not sure who is using it. So, I went into scripts/board/ti_am625evm.cfg and added this line to use port 3333 instead:
gdb_port 3333

Now, OpenOCD starts fine on that port and creates gdb servers on ports 3333-3339 for the different cores. However, when arm-none-eabi-gdb is started, it is still trying to connect to OpenOCD remote target using port 50000 and it fails. How do I tell the startup script to use port 3333 instead of 50000 for both openocd and arm-none-eabi-gdb? I tried adding this line in my launch.json but it didn't like that property:

"miDebuggerServerAddress": "localhost:3333"
 
I'm attaching my launch.json from the project's .vscode directory and the terminal/console logs when  starting openocd and arm-none-eabi-gdb.
 
Thanks.
-Ayman
 
  • Hi Ayman,

    miDebuggerServerAddress is a cppDbg field. It will not be recognised by "cortex-debug".

    Can you try removing it, change servertype to external?

    {
        // Use IntelliSense to learn about possible attributes.
        // Hover to view descriptions of existing attributes.
        // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
        "version": "0.2.0",
        "configurations": [
            {
                "cwd": "${workspaceRoot}",
                "executable": "./bazel-bin/cbc9000",
                "name": "Debug with OpenOCD",
                "request": "attach",
                "type": "cortex-debug",
                "servertype": "external",
                "gdbTarget": "localhost:3338", // Set this to the correct core you need.
                "runToEntryPoint": "main",
                "showDevDebugOutput": "raw",
            }
        ]
    }
    

    Run openocd separately before launching the config.

    openocd -f ./interface/xds110.cfg -f ./board/ti_am625evm.cfg

    For more information about using OpenOCD & GDB, refer https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/11_01_05_03/exports/docs/linux/Foundational_Components/U-Boot/Apps-SPL-Debug-OpenOCD.html section 3.1.3.1.1.2.

    Regards,
    Vinu