nRF Connect for VSCode - How to make jlink the default runner for flashing a device

Hello,

I've been trying to bind a custom task to an action so that flashing a device defaults to using "jlink" runner whenever I flash from "Action > Flash" in nRF for VSCode.

I've followed the instructions at  https://nrfconnect.github.io/vscode-nrf-connect/guides/build_bind_tasks.html but without any success. 


Below is the nRF Connect Workspace Tasks file relevant to the action.

I've added a task "jlink flash" and made an entry in "nrf-connect.taskbindings" for it.

I have verified that the script  "${workspaceFolder}/jlink_flash.sh" executes correctly from a macOS Terminal window.

It appears that the taskName "jlink flash" is recognized but the flashing still uses "pyocd"

What am I doing incorrectly? Please review the changes in the Workspace ".  Thank you.

I understand that tasks/actions is a great feature but for ease of use and less confusion, it would be very useful to have an option in the nRF extension settings to select a flash "runner" type (e.g. pyocd, jlink).



Parents
  • Hi Ravi,

    I have asked internally regarding this and will get back to you with a response, soon.

    Best Regards,

    Priyanka

  • Hi Ravi,
    The "tasks" entry should be an array. Also there does not seem to be any proof that his script is actually called or what the content of that script is.


    Instead of calling a custom script in the task, it is simpler to call west flash, like:
    "command": "west", "args": ["flash", "--runner", ...] .


    In order to confirm that the task is called correctly. please share the output of the terminal window that executed the flash task.


    -Priyanka

  • Hi Priyanka,

    With your suggestion above and assistance from  , I'm able to flash a device with jlink as the runner.

    Here's in full the task and binding sections.

    <project>.code-workspace file > "settings:" > ""nrf-connect.taskBindings:",  add


    	"flash": [
    	    { 	"taskName": "jlink flash" ,
    			"buildConfigs":[
    			"${workspaceFolder}/<YOUR-APP-FOLDER>/build"
    			]
    		}
    	]
    



    <project>.code-workspace file, add the following. I'm using NCS 2.3 as "/path/to/zephyr".

        "tasks": {
            "version": "2.0.0",
            "tasks": [
                {
                    "label": "jlink flash",
                    "options":{"env": {"ZEPHYR_BASE": "/opt/nordic/ncs/v2.3.0/zephyr"}},
                    "command": "west flash --runner=jlink --dev-id YOUR_DEVICE_ID -d ${workspaceFolder}/<YOUR-APP-FOLDER>/build",
                    "type": "shell",
                    "args": [],
                    "presentation": {
                        "clear": true,
                        "reveal": "always"
                    },
                    "group": "build"
                }
            ]
        },

    The above task and action works fine. However, as it stands, I would have to create a separate task/bind for each of my projects in the nRF Connect Workspace.

    It would be preferable to have the "Flash" action run the jlink as runner for all the projects in the nRF Connect Workspace and remove the need for  "<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 explicit task/bind actions for all my projects in the workspace. I would think nRF Connect would know the build path of the currently selected project.


    The best option would be an enhancement to  "nRF Connect for VSCode" extension, i.e. select a 
     "runner" of choice in the nRF Connect extension (pyocd, jlink).

    I'm quite surprised that such an option doesn't already exist. I'm sure quite a lot of nRF Connect developers utilize jlink.

    How can I submit an enhancement request for nRF Connect for VSCode? Or is this something that you can raise?

    Please consider the proposed enhancement request. Thank you. Your assistance is much appreciated. 



  • Hi,

    Glad to hear that you got it running. I will forward your concerns and suggestions to the internal team. Slight smile

    Have a nice weekend.

    -Priyanka

  • Hi Priyanka,

    There is a question from my previous message that is still outstanding. 

    How do I modify the above task so that the "Flash" action runs the jlink as the runner for all the projects in the nRF Connect Workspace?

    As it stands, I would need to explicitly specify a <YOUR-APP-FOLDER>"  in the path "${workspaceFolder}/<YOUR-APP-FOLDER>/build" for each project in the nRF Connect Workspace. It’s not a desirable approach.

    Please check if the above ask is possible. If not, an enhancement to  "nRF Connect for VSCode" extension settings to select a  "runner" of choice would be the way to go.

    Thank you.

  • Hi Ravi,

    Thank you for your feedback and suggestion. I have conveyed them internally and will get back to you with a response.

  • Hello Priyanka,

    Did you get a response regarding the following?

    It would be preferable to have the "Flash" action run the jlink as runner for all the projects in the nRF Connect Workspace and remove the need for  "<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?

    Thanks.

Reply
  • Hello Priyanka,

    Did you get a response regarding the following?

    It would be preferable to have the "Flash" action run the jlink as runner for all the projects in the nRF Connect Workspace and remove the need for  "<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?

    Thanks.

Children
Related