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.

SIMPLELINK-OPENOCD: CC1350/2650 debugging with openOcd, arm-none-eabi-gdb and VSCode

Part Number: SIMPLELINK-OPENOCD

Hello,

I'm trying to migrate all my projects for the cc1350 and cc2650 (based on Contiki) to Visual Studio Code and I'm facing problems with the debugger.

I would like to do debugging using openocd and arm-none-eabi-gdb. I downloaded openocd released by TI and it seems to work, when I start it from the console I get:

giova@ubuntu-giova:~$ openocd -f board/ti_cc26x0_launchpad.cfg -c init -c "reset init"
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
openocd.org/.../bugs.html
adapter speed: 2500 kHz
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
adapter_nsrst_delay: 100
Info : XDS110: connected
Info : XDS110: firmware version = 2.3.0.14
Info : XDS110: hardware version = 0x002b
Info : XDS110: connected to target via JTAG
Info : XDS110: TCK set to 2500 kHz
Info : clock speed 2500 kHz
Info : JTAG tap: cc26x0.jrc tap/device found: 0x9b99a02f (mfg: 0x017 (Texas Instruments), part: 0xb99a, ver: 0x9)
Info : JTAG tap: cc26x0.dap enabled
Info : cc26x0.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : JTAG tap: cc26x0.jrc tap/device found: 0x9b99a02f (mfg: 0x017 (Texas Instruments), part: 0xb99a, ver: 0x9)
Info : JTAG tap: cc26x0.dap enabled
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x10003982 msp: 0x20001000

however when I launch it from vscode, the debug console prints the same, but after a while it adds:

<-logout
Send Event AD7MessageEvent

I already set up vscode to debug other arm MCU and it worked, therefore the arm-none-eabi-gdb should be fine.

The bad thing is that there is no other error message to report and then it is difficult to find out where the problem is.

Any suggestion?

PS: attached there is my launch.json (extension changed to .txt otherwise the forum reject it) file that launches and configures openocd and gdb.

{
  "version": "0.2.0",
  "configurations": [

      {
          "name": "Debug cc2650 Sink",
          "type": "cppdbg",
          "request": "launch",
          "program": "${workspaceRoot}/build/cc26x0-cc13x0/launchpad_vela/cc2650/vela_sink.elf",
          "args": [],
          "stopAtEntry": true,
          "cwd": "${workspaceRoot}",
          "environment": [],
          "externalConsole": false,
          "debugServerArgs":"-f board/ti_cc26x0_launchpad.cfg -c init -c \"reset init\"",
          "serverLaunchTimeout": 20000,
          "filterStderr": false,
          "filterStdout": false,
          "serverStarted": "target halted due to debug-request, current mode: Thread",
          "preLaunchTask": "build_sink_cc2650",
          "setupCommands": [
              { "text": "-target-select remote localhost:3333", "description": "connect to target", "ignoreFailures": false },
              { "text": "-file-exec-and-symbols ${workspaceRoot}/build/cc26x0-cc13x0/launchpad_vela/cc2650/vela_sink.elf", "description": "load file", "ignoreFailures": false},
              { "text": "-interpreter-exec console \"monitor endian little\"", "ignoreFailures": false },
              { "text": "-interpreter-exec console \"monitor reset\"", "ignoreFailures": false },
              { "text": "-interpreter-exec console \"monitor halt\"", "ignoreFailures": false },
              { "text": "-interpreter-exec console \"monitor arm semihosting enable\"", "ignoreFailures": false },
              { "text": "-target-download", "description": "flash target", "ignoreFailures": false }
          ],
          "logging": {
              "moduleLoad": true,
              "trace": true,
              "engineLogging": true,
              "programOutput": true,
              "exceptions": true
          },
          "linux": {
              "MIMode": "gdb",
              "MIDebuggerPath": "/usr/bin/arm-none-eabi-gdb",
              "debugServerPath": "/usr/local/bin/openocd"
          },
          "osx": {
              "MIMode": "gdb",
              "MIDebuggerPath": "/usr/local/bin/arm-none-eabi-gdb",
              "debugServerPath": "/usr/local/Cellar/open-ocd/0.10.0/bin/openocd"
          },
          "windows": {
              "preLaunchTask": "mbed",
              "MIMode": "gdb",
              "MIDebuggerPath": "C:\\Program Files (x86)\\GNU Tools ARM Embedded\\4.9 2015q3\\bin\\arm-none-eabi-gdb.exe",
              "debugServerPath": "openocd.exe",
              "setupCommands": [
                  { "text": "-environment-cd ${workspaceRoot}\\DISCO_F413ZH\\GCC_ARM\\BUILD" }, //what's this?
                  { "text": "-target-select remote localhost:3333", "description": "connect to target", "ignoreFailures": false },
                  { "text": "-file-exec-and-symbols ${workspaceRootFolderName}.elf", "description": "load file", "ignoreFailures": false},
                  { "text": "-interpreter-exec console \"monitor endian little\"", "ignoreFailures": false },
                  { "text": "-interpreter-exec console \"monitor reset\"", "ignoreFailures": false },
                  { "text": "-interpreter-exec console \"monitor halt\"", "ignoreFailures": false },
                  { "text": "-interpreter-exec console \"monitor arm semihosting enable\"", "ignoreFailures": false },
                  { "text": "-target-download", "description": "flash target", "ignoreFailures": false }
              ]
          }
      },
/*
      {
        "name": "Debug cc1350 Sink",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceRoot}/build/cc26x0-cc13x0/launchpad_vela/cc1350/vela_sink.elf",
        "args": [],
        "stopAtEntry": true,
        "cwd": "${workspaceRoot}/",
        "environment": [],
        "externalConsole": false,
        "debugServerArgs":"-f board/ti_cc13x0_launchpad.cfg -c init -c \"reset init\"",
        "serverLaunchTimeout": 20000,
        "filterStderr": true,
        "filterStdout": true,
        "serverStarted": "target halted due to debug-request, current mode: Thread",
        "preLaunchTask": "build_sink_cc1350",
        "setupCommands": [
            { "text": "-target-select remote localhost:3333", "description": "connect to target", "ignoreFailures": false },
            { "text": "-file-exec-and-symbols ${workspaceRoot}/build/cc26x0-cc13x0/launchpad_vela/cc1350/vela_sink.elf", "description": "load file", "ignoreFailures": false},
            { "text": "-interpreter-exec console \"monitor endian little\"", "ignoreFailures": false },
            { "text": "-interpreter-exec console \"monitor reset\"", "ignoreFailures": false },
            { "text": "-interpreter-exec console \"monitor halt\"", "ignoreFailures": false },
            { "text": "-interpreter-exec console \"monitor arm semihosting enable\"", "ignoreFailures": false },
            { "text": "-target-download", "description": "flash target", "ignoreFailures": false }
        ],
        "logging": {
            "moduleLoad": true,
            "trace": true,
            "engineLogging": true,
            "programOutput": true,
            "exceptions": true
        },
        "linux": {
            "MIMode": "gdb",
            "MIDebuggerPath": "/usr/bin/arm-none-eabi-gdb",
            "debugServerPath": "/home/giova/opt/gnu-mcu-eclipse/openocd/0.10.0-12-20190422-2015/bin/openocd"
        },
        "osx": {
            "MIMode": "gdb",
            "MIDebuggerPath": "/usr/local/bin/arm-none-eabi-gdb",
            "debugServerPath": "/usr/local/Cellar/open-ocd/0.10.0/bin/openocd"
        },
        "windows": {
            "preLaunchTask": "mbed",
            "MIMode": "gdb",
            "MIDebuggerPath": "C:\\Program Files (x86)\\GNU Tools ARM Embedded\\4.9 2015q3\\bin\\arm-none-eabi-gdb.exe",
            "debugServerPath": "openocd.exe",
            "setupCommands": [
                { "text": "-environment-cd ${workspaceRoot}\\DISCO_F413ZH\\GCC_ARM\\BUILD" }, //what's this?
                { "text": "-target-select remote localhost:3333", "description": "connect to target", "ignoreFailures": false },
                { "text": "-file-exec-and-symbols ${workspaceRootFolderName}.elf", "description": "load file", "ignoreFailures": false},
                { "text": "-interpreter-exec console \"monitor endian little\"", "ignoreFailures": false },
                { "text": "-interpreter-exec console \"monitor reset\"", "ignoreFailures": false },
                { "text": "-interpreter-exec console \"monitor halt\"", "ignoreFailures": false },
                { "text": "-interpreter-exec console \"monitor arm semihosting enable\"", "ignoreFailures": false },
                { "text": "-target-download", "description": "flash target", "ignoreFailures": false }
            ]
        }
    },
    {
        "name": "Debug cc2650 Node NO OTA",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceRoot}/build/cc26x0-cc13x0/launchpad_vela/cc2650/vela_node.elf",
        "args": [],
        "stopAtEntry": true,
        "cwd": "${workspaceRoot}",
        "environment": [],
        "externalConsole": false,
        "debugServerArgs":"-f board/ti_cc13x0_launchpad.cfg -c init",
        "serverLaunchTimeout": 20000,
        "filterStderr": true,
        "filterStdout": true,
        "serverStarted": "target halted due to debug-request, current mode: Thread",
        "preLaunchTask": "build_node_cc2650_no_ota",
        "setupCommands": [
            { "text": "-target-select remote localhost:3333", "description": "connect to target", "ignoreFailures": false },
            { "text": "-file-exec-and-symbols ${workspaceRoot}/build/cc26x0-cc13x0/launchpad_vela/cc2650/vela_node.elf", "description": "load file", "ignoreFailures": false},
            { "text": "-interpreter-exec console \"monitor endian little\"", "ignoreFailures": false },
            { "text": "-interpreter-exec console \"monitor reset\"", "ignoreFailures": false },
            { "text": "-interpreter-exec console \"monitor halt\"", "ignoreFailures": false },
            { "text": "-interpreter-exec console \"monitor arm semihosting enable\"", "ignoreFailures": false },
            { "text": "-target-download", "description": "flash target", "ignoreFailures": false }
        ],
        "logging": {
            "moduleLoad": true,
            "trace": true,
            "engineLogging": true,
            "programOutput": true,
            "exceptions": true
        },
        "linux": {
            "MIMode": "gdb",
            "MIDebuggerPath": "/usr/bin/arm-none-eabi-gdb",
            "debugServerPath": "/home/giova/opt/gnu-mcu-eclipse/openocd/0.10.0-12-20190422-2015/bin/openocd"
        },
        "osx": {
            "MIMode": "gdb",
            "MIDebuggerPath": "/usr/local/bin/arm-none-eabi-gdb",
            "debugServerPath": "/usr/local/Cellar/open-ocd/0.10.0/bin/openocd"
        },
        "windows": {
            "preLaunchTask": "mbed",
            "MIMode": "gdb",
            "MIDebuggerPath": "C:\\Program Files (x86)\\GNU Tools ARM Embedded\\4.9 2015q3\\bin\\arm-none-eabi-gdb.exe",
            "debugServerPath": "openocd.exe",
            "setupCommands": [
                { "text": "-environment-cd ${workspaceRoot}\\DISCO_F413ZH\\GCC_ARM\\BUILD" }, //what's this?
                { "text": "-target-select remote localhost:3333", "description": "connect to target", "ignoreFailures": false },
                { "text": "-file-exec-and-symbols ${workspaceRootFolderName}.elf", "description": "load file", "ignoreFailures": false},
                { "text": "-interpreter-exec console \"monitor endian little\"", "ignoreFailures": false },
                { "text": "-interpreter-exec console \"monitor reset\"", "ignoreFailures": false },
                { "text": "-interpreter-exec console \"monitor halt\"", "ignoreFailures": false },
                { "text": "-interpreter-exec console \"monitor arm semihosting enable\"", "ignoreFailures": false },
                { "text": "-target-download", "description": "flash target", "ignoreFailures": false }
            ]
        }
    },

    {
        "name": "Build cc2650 Node OTA",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceRoot}/build/cc26x0-cc13x0/launchpad_vela/cc2650/vela_node.elf",
        "args": [],
        "stopAtEntry": true,
        "cwd": "${workspaceRoot}",
        "environment": [],
        "externalConsole": false,
        "debugServerArgs":"-f board/ti_cc13x0_launchpad.cfg -c init",
        "serverLaunchTimeout": 20000,
        "filterStderr": true,
        "filterStdout": true,
        "serverStarted": "target halted due to debug-request, current mode: Thread",
        "preLaunchTask": "build_node_cc2650_ota",
        "setupCommands": [
            { "text": "-target-select remote localhost:3333", "description": "connect to target", "ignoreFailures": false },
            { "text": "-file-exec-and-symbols ${workspaceRoot}/build/cc26x0-cc13x0/launchpad_vela/cc2650/vela_node.elf", "description": "load file", "ignoreFailures": false},
            { "text": "-interpreter-exec console \"monitor endian little\"", "ignoreFailures": false },
            { "text": "-interpreter-exec console \"monitor reset\"", "ignoreFailures": false },
            { "text": "-interpreter-exec console \"monitor halt\"", "ignoreFailures": false },
            { "text": "-interpreter-exec console \"monitor arm semihosting enable\"", "ignoreFailures": false },
            { "text": "-target-download", "description": "flash target", "ignoreFailures": false }
        ],
        "logging": {
            "moduleLoad": true,
            "trace": true,
            "engineLogging": true,
            "programOutput": true,
            "exceptions": true
        },
        "linux": {
            "MIMode": "gdb",
            "MIDebuggerPath": "/usr/bin/arm-none-eabi-gdb",
            "debugServerPath": "/home/giova/opt/gnu-mcu-eclipse/openocd/0.10.0-12-20190422-2015/bin/openocd"
        },
        "osx": {
            "MIMode": "gdb",
            "MIDebuggerPath": "/usr/local/bin/arm-none-eabi-gdb",
            "debugServerPath": "/usr/local/Cellar/open-ocd/0.10.0/bin/openocd"
        },
        "windows": {
            "preLaunchTask": "mbed",
            "MIMode": "gdb",
            "MIDebuggerPath": "C:\\Program Files (x86)\\GNU Tools ARM Embedded\\4.9 2015q3\\bin\\arm-none-eabi-gdb.exe",
            "debugServerPath": "openocd.exe",
            "setupCommands": [
                { "text": "-environment-cd ${workspaceRoot}\\DISCO_F413ZH\\GCC_ARM\\BUILD" }, //what's this?
                { "text": "-target-select remote localhost:3333", "description": "connect to target", "ignoreFailures": false },
                { "text": "-file-exec-and-symbols ${workspaceRootFolderName}.elf", "description": "load file", "ignoreFailures": false},
                { "text": "-interpreter-exec console \"monitor endian little\"", "ignoreFailures": false },
                { "text": "-interpreter-exec console \"monitor reset\"", "ignoreFailures": false },
                { "text": "-interpreter-exec console \"monitor halt\"", "ignoreFailures": false },
                { "text": "-interpreter-exec console \"monitor arm semihosting enable\"", "ignoreFailures": false },
                { "text": "-target-download", "description": "flash target", "ignoreFailures": false }
            ]
        }
    },
    {
        "name": "Build cc1350 Node OTA",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceRoot}/build/cc26x0-cc13x0/launchpad_vela/cc1350/vela_node.elf",
        "args": [],
        "stopAtEntry": true,
        "cwd": "${workspaceRoot}",
        "environment": [],
        "externalConsole": false,
        "debugServerArgs":"-f board/ti_cc13x0_launchpad.cfg -c init",
        "serverLaunchTimeout": 20000,
        "filterStderr": true,
        "filterStdout": true,
        "serverStarted": "target halted due to debug-request, current mode: Thread",
        "preLaunchTask": "build_node_cc1350_ota",
        "setupCommands": [
            { "text": "-target-select remote localhost:3333", "description": "connect to target", "ignoreFailures": false },
            { "text": "-file-exec-and-symbols ${workspaceRoot}/build/cc26x0-cc13x0/launchpad_vela/cc1350/vela_node.elf", "description": "load file", "ignoreFailures": false},
            { "text": "-interpreter-exec console \"monitor endian little\"", "ignoreFailures": false },
            { "text": "-interpreter-exec console \"monitor reset\"", "ignoreFailures": false },
            { "text": "-interpreter-exec console \"monitor halt\"", "ignoreFailures": false },
            { "text": "-interpreter-exec console \"monitor arm semihosting enable\"", "ignoreFailures": false },
            { "text": "-target-download", "description": "flash target", "ignoreFailures": false }
        ],
        "logging": {
            "moduleLoad": true,
            "trace": true,
            "engineLogging": true,
            "programOutput": true,
            "exceptions": true
        },
        "linux": {
            "MIMode": "gdb",
            "MIDebuggerPath": "/usr/bin/arm-none-eabi-gdb",
            "debugServerPath": "/home/giova/opt/gnu-mcu-eclipse/openocd/0.10.0-12-20190422-2015/bin/openocd"
        },
        "osx": {
            "MIMode": "gdb",
            "MIDebuggerPath": "/usr/local/bin/arm-none-eabi-gdb",
            "debugServerPath": "/usr/local/Cellar/open-ocd/0.10.0/bin/openocd"
        },
        "windows": {
            "preLaunchTask": "mbed",
            "MIMode": "gdb",
            "MIDebuggerPath": "C:\\Program Files (x86)\\GNU Tools ARM Embedded\\4.9 2015q3\\bin\\arm-none-eabi-gdb.exe",
            "debugServerPath": "openocd.exe",
            "setupCommands": [
                { "text": "-environment-cd ${workspaceRoot}\\DISCO_F413ZH\\GCC_ARM\\BUILD" }, //what's this?
                { "text": "-target-select remote localhost:3333", "description": "connect to target", "ignoreFailures": false },
                { "text": "-file-exec-and-symbols ${workspaceRootFolderName}.elf", "description": "load file", "ignoreFailures": false},
                { "text": "-interpreter-exec console \"monitor endian little\"", "ignoreFailures": false },
                { "text": "-interpreter-exec console \"monitor reset\"", "ignoreFailures": false },
                { "text": "-interpreter-exec console \"monitor halt\"", "ignoreFailures": false },
                { "text": "-interpreter-exec console \"monitor arm semihosting enable\"", "ignoreFailures": false },
                { "text": "-target-download", "description": "flash target", "ignoreFailures": false }
            ]
        }
    },*/
  ]
}

  • Hi,

    I sent it to a concerned engineer. We will get back to you ASAP. Please bear with us.

    Thanks,

    PM

  • Hi Davide,

    I'm sorry but we don't provide support for OpenOCD integration with VSCode.

    From what I could understand you are not using the Cortex-Debug extension in VSCode. I would suggest to try that out.

  • I've installed Cortex-Debug and I though I was using it. I'll take a look at that extension doc.

  • So thank you, your answer did not resolve the problem but it brought me to the proper resources.

    Basically I'm a beginner of VSCode and I didn't understand that in order to use the Cortex-Debug extension (that was already installed), the configuration type was required to be "type":"cortex-debug".

    Now, with this launch.json it works:

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Debug cc2650 Sink",
                "type": "cortex-debug",
                "request": "launch",
                "servertype": "openocd",
                "executable": "${workspaceRoot}/build/cc26x0-cc13x0/launchpad_vela/cc2650/vela_sink.elf",
                "cwd": "${workspaceRoot}",
                "preLaunchTask": "build_sink_cc2650",
                "runToMain": true,
                "interface": "jtag",
                "debuggerArgs": [
                    "--directory=/home/giova/workspaces/GIT/vela-lab/network_board/contiki-ng",  //adds reference to external sources, not sure it is required
                ],
                "searchDir": ["/usr/local/share/openocd/scripts"],
                //   "device":"nRF52832_xxAA", //required if "servertype":"jlink",
                //   "svdFile": //used for peripheral view
                //   "swoConfig":{ //see marcelball.ca/.../
                //       "enabled": false,
                //       "swoFrequency": 0,
                //       "cpuFrequency": 0,
                //       "ports":{ //to populate see marcelball.ca/.../
                //       }
                //   },
    
                "graphConfig": [],
                "showDevDebugOutput": true,
                "configFiles": [
                    "board/ti_cc26x0_launchpad.cfg"
                ],
                "linux": {},
            }
        ]
    }

**Attention** This is a public forum