VScode Configuration for nrfconnect SDK

Hi, I'm trying to configure my VScode project for the nrf5340dk using the nrfconnect sdk to be more version control friendly and require less interactions to set it up. I have these things in my .vscode/settings.json:

{
    // use variables to avoid hardcoding user home path
    "nrf-connect.topdir": "${userHome}/ncs/v2.0.0",
    "nrf-connect.applications": ["${workspaceFolder}/app"],
    "C_Cpp.default.configurationProvider": "nrf-connect"
}

While I understand that officially, VSCode doesn't resolve variables for settings files, is it possible to add support for them specifically in the nrfConnect VSCode extension, I believe the Python extension has some support for it? If not, what's the recommended way to configure the project in a way that's version control friendly? Right now users will have to manually select the location of the SDK on first clone and it would be nice if those are configured to avoid having to do the manual work.

An alternative is to install the SDK to a global known location is like /opt/ncs, however, this one is also a bit cumbersome since I don't know of a way to to install the toolchain without launching the entire nrfconnect desktop app as root and the manual install flow doesn't seem to give the same results since it uses the zephyr upstream toolchain instead of the Nordic one.

  • Did you follow the manual install guide, it should provide a similar instance as with the desktop app? You can always just open the folder, there is no need to run the desktop app to launch the projects. 

    You can use the nRF connect for VSCode plugins to configure as well , Configuring the settings - nRF Connect for VS Code 

    Right now users will have to manually select the location of the SDK on first clone and it would be nice if those are configured to avoid having to do the manual work.

    You can select with the VSCode plugin when you make a project what version of the of NCS that you want to work on. Or is this not what you mean?


    Regards,
    Jonathan

  • Thanks for the very quick reply! I went through my steps again for the manual SDK and I must have missed something the first time since my current vscode project compiles with the upstream toolchain now. There are some utilities that are present in the ncs toolchain folder installed with sdk manager but not from the Zephyr upstream so that confused me a bit but I think the vscode extension ends up using the system built-in version for those so it ends up working out.

    As for the VSCode manual configuration issue, I think the vscode variables I was using didn't expand correctly or the path wasn't correct but after imitating a configuration generated from the nrf vscode extension, I got it to work and can check it in to version control without the hardcoded path. I think there is something currently in the work for the nrf vscode extension called the "Workspace Application" that will make this easier in the future.

    Anyway, I think my issues have been resolved, thank you for the excellent support as always!

Related