Select runner for Flash Command in nRF Connect

Hi!

In nRF Connect Extension for VSCode, how can I set a (non-default) runner for the Flash Action in the Actions View?

Specifically, I've got my Adafruit Feather nrf52840 connected via USB and SEGGER JLink and would like to use jlink as a flasher. Clicking on "Flash" in the Action View will however hard code "nrfprog" as flasher to the command line (althout I configured the correct flasher via CMakeLists.txt, i.e. "board_set_flasher(jlink)".

  • Hi,

    You could choose desired runner using west in several ways shown in the documentation.
    For example "west flash --runner jlink" would change the runner to jlink.
    Another option would be to override default flash runner at build time using BOARD_FLASH_RUNNER like this 
    "west build [...] -- -DBOARD_FLASH_RUNNER = jlink"

    Best regards,
    Dejan

  • Thanks for your response. I didn't ask about the command line, though, I asked about the nRF Connect VSCode Extension - and more specifically about the Flash Action there in the Actions View. Building from the command line works as expected. I had tested that before.

    Setting BOARD_FLASH_RUNNER = jlink in the nrf Connect Extension's build configuration doesn't help either, by the way.

    If you could point me to some documentation re how to configure the flash action that would be highly appreciated.

  •   
    Hello. I'm trying to make jlink the default runner for flashing. It looks like you have it working.

    I've created a "tasks" key in the Workspace settings, then bound the task to an action. My custom "jlink flash" action appears under Actions but when I click on it, nothing happens.

    Appreciate if you could share your solution? Thanks.

  • Hi zpm1066,

    AFAICS there is no way to make jlink the default runner of the nRF Connect extension, which only seems to co-operate with the Nordic tools ootb. There is however a recommended workaround which is what I'm pointing to in my previous post.

    Before you can link a task you have to create one in the tasks section of your app.workspace file (or alternatively in the tasks.json file - depending on how you set up your workspace):

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    "tasks": {
    "version": "2.0.0",
    "tasks": [
    {
    "label": "JLink Flash",
    "type": "shell",
    "command": "west flash --runner=jlink --dev-id YOUR-DEVICE-ID -d ${workspaceFolder:YOUR-APP-FOLDER}/build",
    "presentation": {
    "clear": true,
    "reveal": "always"
    }
    }
    ]
    },
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    VSCode has some kind of wizard to add tasks if you don't want to add them manually. You may want to test the west command first. And you have to ensure that VSCode sees the west command in its environment.

    if you then follow the documentation linked in my previous post you should end up with something like the following entry in your VSCode workspace settings file:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    "nrf-connect.taskBindings": {
    "flash": [
    {
    "taskName": "JLink Flash",
    "buildConfigs": [
    "${workspaceFolder:YOUR-APP-FOLDER-HERE}/build"
    ]
    }
    ]
    },
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    These two entries combined should link your "Flash" Action to the given west command which is then used in lieu of the native action.

1 2