nRF Connect for VS Code - Opening project with NCS as a descendant

Hello, I wanted to test the VS Code extension but it failed for the following use case...

In our company, we are building our product-related SDK that uses nRF Connect SDK "as a child". This is how a west workspace looks like:


.
├── application
├── bootloader
├── chester
├── mbedtls
├── modules
├── nrf
├── nrfxlib
├── test
├── tools
└── zephyr

The directory application is the user's private Git project which "includes" our SDK (directory chester in our tree).

This is what we have in application/west.yml:

manifest:
  version: "0.10"
  remotes:
    - name: hardwario-chester
      url-base: [email protected]:chester
  projects:
    - name: sdk.git
      remote: hardwario-chester
      path: chester
      import: true
  self:
    path: application

This is what we have in chester/west.yml:

manifest:
  version: "0.10"
  remotes:
    - name: nrfconnect
      url-base: https://github.com/nrfconnect
  projects:
    - name: sdk-nrf
      remote: nrfconnect
      revision: v1.7.0
      path: nrf
      import: true

Back to the problem: I am unable to open such a structure with the VS Code extension. I am able to open the application folder which includes prj.conf, but the extension asks for this:

The application version is different to the one in nrf/VERSION. Would you like to change manifest and update the west workspace?

I select No as this would break my workspace. Then I want to provide it with the build configuration, but our custom board defined in chester/boards/... is not available in the list.

Thank you. P.

  • Hi, It sounds like a missing feature in the VS Studio to allow custom directories with board files. I have requested the team to give more info on this and a possible workaround, I will comeback to you when the team has time to look into this and give a response. Thank you for your patience.

  • I got a response from the team

    You can try to pick up custom boards by editing the nrf-connect.boardRoots setting which takes an array of strings and in this case should include the full path to the chester directory as we look for boards/arm/*/*_defconfig inside any folder in the boardRoots setting.
    regarding the below prompt
    The application version is different to the one in nrf/VERSION. Would you like to change manifest and update the west workspace?
    The team has to investigate more into as to why this prompt is triggered.
  • Hello Susheel and thanks for following up on my ticket.

    I have updated VS Code JSON preferences like this:

    "nrf-connect.boardRoots": [
        "/Users/Pavel/HARDWARIO/GitLab/chester/skeleton/chester"
    ],

    It would be nice to be able to specify a relative path as we work with multiple projects and all of them have the same structure in the West workspace (preferably, specifying only "chester" would be best, but maybe I could solve it with a VS Code variable like ${workspaceFolder}, though it is not a systematic approach towards the extension ... dunno).
    Then I have added the application again, but got warnings about an unknown board (despite I was able to select and see chester_nrf52840 in the extension. I have updated CMakeLists.txt like this (added BOARD variable):
    cmake_minimum_required(VERSION 3.20.0)
    
    set(BOARD chester_nrf52840)
    
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    
    project(skeleton)
    
    zephyr_include_directories(include)
    
    target_sources(app PRIVATE src/main.c)
    After this, I am able to work with the nRF Connect for VS Code (tested building/flashing/debugging).
    In the future, the automatic approach would be able to parse west.yml and follow the structure as the west does automatically during the build, so no manual alteration to JSON preferences would be needed.
    After applying the above change, the prompt "Would you like to change manifest and update the west workspace?" did not disappear.
    Thank you. P.
  • Thanks hubpav,

    Glad to see that you attempted to make a workaround and this definitely seems a genuine use case. I will pass your suggestions to the team. 

  • Hi Susheel, any update on this feature, please? Thank you. P.

Related