Setup launch config for JLink remote debug in VS Code

I have a problem to configure JLink remote client in VS Code IDE to remote debug nrf9160 dk. There is no examples of exactly remote config on Segger and VS Code docs, so it's not clear how to setup it.

There is launch.json file in VS Code, that contains configuration like this

but it is not clear how to set server address, port number and pass, may be something else..

USB debug works okay with cortex-debug or nRF Debug backend. Remote debug works okay in Segger Embedded Studio IDE. But how to config remote debug in VS Code it is a question.

Parents
  • Hi Michael,

    The configuration below runs fine for me:

    {
        "name": "(remote cortex-debug) Launch",
        "type": "cortex-debug",
        "request": "launch",
        "executable": "${command:cmake.buildDirectory}/zephyr/zephyr.elf",
        "cwd": "${workspaceFolder}",
        "servertype": "external",
        "interface": "swd",
        "gdbPath": "/usr/bin/gdb-multiarch",
        "gdbTarget": "${env:TARGET_GDB_IP}:2331",
        "armToolchainPath": "/opt/gnuarmemb/bin",
        "rtos": "GDBServer/RTOSPlugin_Zephyr"
    }

    In this example, I am using the environment variable TARGET_GDB_IP to define the IP address of the server. You can of course also set the address directly in the field "gdb_target".

    As you are on Windows, you will also have to adapt (or remove) "gdbPath" and "armToolchainPath" to your setup.

    Best regards

Reply
  • Hi Michael,

    The configuration below runs fine for me:

    {
        "name": "(remote cortex-debug) Launch",
        "type": "cortex-debug",
        "request": "launch",
        "executable": "${command:cmake.buildDirectory}/zephyr/zephyr.elf",
        "cwd": "${workspaceFolder}",
        "servertype": "external",
        "interface": "swd",
        "gdbPath": "/usr/bin/gdb-multiarch",
        "gdbTarget": "${env:TARGET_GDB_IP}:2331",
        "armToolchainPath": "/opt/gnuarmemb/bin",
        "rtos": "GDBServer/RTOSPlugin_Zephyr"
    }

    In this example, I am using the environment variable TARGET_GDB_IP to define the IP address of the server. You can of course also set the address directly in the field "gdb_target".

    As you are on Windows, you will also have to adapt (or remove) "gdbPath" and "armToolchainPath" to your setup.

    Best regards

Children
No Data
Related