Passing board frequency to jlink command as argument

Hello, Not sure if this is the place for these questions, but here it is:

I've configured new board, and when I try to debug using the ncsconnect vscode plugin (linux) - Im getting this error `disconnected from gdb-server` and the debugging session quits.

I can debug without a problem using gdb cli.

From investigating `journalctl -f`:

Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (68) LaunchOptions{"type":"nrf-connect","name":"Launch the active build configuration","request":"launch","program":"/home/gbrandwine/dev/augur>
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (98) Starting: "/opt/SEGGER/JLink/JLinkGDBServerCLExe" -if swd -device nrf52 -select usb=821008355 -speed 12000 -port 40927 -singlerun -nogui ->
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->SEGGER J-Link GDB Server V8.24 Command Line Version
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->JLinkARM.dll V8.24 (DLL compiled Mar 26 2025 15:37:28)
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->-----GDB Server start settings-----
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->GDBInit file:                  none
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->GDB Server Listening port:     40927
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->SWO raw output listening port: 2332
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->Terminal I/O port:             2333
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->Accept remote connection:      yes
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->Generate logfile:              off
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->Verify download:               off
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->Init regs on start:            off
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->Silent mode:                   on
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->Single run mode:               on
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->Target connection timeout:     0 ms
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->------J-Link related settings------
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->J-Link Host interface:         USB
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->J-Link script:                 none
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->J-Link settings file:          none
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->------Target related settings------
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->Target device:                 nrf52
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->Target device parameters:      none
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->Target interface:              SWD
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->Target interface speed:        12000kHz
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->Target endian:                 little
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (114) ->
Mar 30 14:58:25 gbrandwine-lx OpenDebugAD7[158910]: MS_MIDebug: 1: (115) Starting: "/home/gbrandwine/ncs/toolchains/b81a7cd864/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gdb" --interpreter=mi -q

You can see that the `speed` argument is 12000khz

When I manually add speed=4000 vecode's launch.json:

{
    // 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": [
        {
            "type": "nrf-connect",
            "request": "launch",
            "name": "Launch build_canary_r4010_lis3_ism_on_spi1",
            "config": "${workspaceFolder}/augury_app/build_canary_r4010_lis3_ism_on_spi1",
            "runToEntryPoint": "main",
            "serverArgs": "-if swd -device nrf52840_xxAA -select usb=${snr} -speed 4000 -logtofile /tmp/nrf52840_log.txt -port ${port} -singlerun -halt -noir -rtos ${rtosPlugin}"
        }
    ]
}

It works.

I don't want to add manually to vscode's launch files.

What can I do so that these arguments will be read from the board directory?

Thanks, gal

Related