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)".

Parents
  • 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):

      "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"
            }
          }
        ]
      },
    

    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:

        "nrf-connect.taskBindings": {
          "flash": [
            {
              "taskName": "JLink Flash",
              "buildConfigs": [
                "${workspaceFolder:YOUR-APP-FOLDER-HERE}/build"
              ]
            }
          ]
        },

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

  • The original links seem to be dead - found the docs here: nrfconnect.github.io/.../build_bind_tasks.html

    These docs are much better than my own explanation.

  •   
    Hello Florian,

    Thank you!. It's much appreciated!

    The two items I was missing were

    1. "options" key to set ZEPHYR_BASE so that VSCode sees the west command in its environment. I was expecting this to be handled automatically as the action is from within VSCode.

    2. Build directory as part of the "command" in "tasks". Also, specify the Segger Edu Mini device-id.

    The action execution is a bit slow but at least it works now.

    What I really would like is to have the "Flash" action run the jlink as runner for all the projects in my workspace, so that I don't have to specify  "<YOUR-APP-FOLDER>"  in the path "${workspaceFolder}/<YOUR-APP-FOLDER>/build".

    Is there a way to use the currently selected build path to avoid specifying "<YOUR-APP-FOLDER>" explicitly? I don't want to have separate flash actions for all my projects in the workspace.

    Of course, a "nRF Connect for VSCode" enhancement to add an option to select a "runner" of choice in the nRF Connect extension would be the easiest and best option. 

    Once again, Thank you for the very quick response.

  • You're welcome. Unfortunately, I don't have an answer to your last question, although I'd be interested myself. That's probably something one of the Nordic engineers present on the network could/should answer.

Reply Children
No Data
Related