VSCode troubles with NCS 2.7.0 and hardware model 2 boards

I'm migrating our project with custom boards from NCS 2.6.1 to 2.7.0, and I'm having a number of issues in the vscode extension (v2024.9.87):

  1. The "Create a new board" option is creating hardware model 1 board start files, which is not useful when the toolchain and SDK versions don't support it anymore
  2. Without porting my custom boards to hwm2, they were not available as board targets in the  VSCode build configuration dialog - even though the porting guide claims they are still supported
  3. After porting my boards to hwm2, they were still not available - the porting guide has no mention on how out-of-tree hwm2 boards can be added to the build
    (also, the zephyr python conversion string created invalid Kconfig symbols, as it failed to replace dash characters to underscores)
  4. After cross checking the zephyr and ncs example-application, I have created the zephyr/module.yml file in the project root with the below contents, which made the boards finally buildable - but only on the first try, coming back to it the next day (and after doing some git rebasing of the changes) it doesn't work again
    # zephyr/module.yml:
    build:
      settings:
        board_root: .
    
  5. Even when the build itself succeeded, the build configuration wasn't shown in the extension's Application view

At the same time, I'm successfully building with these boards with CI, so there's something definitely off with what VSCode is doing...

Attaching the generated support information:

{
  "platform": {
    "os": "darwin",
    "osVersion": "Darwin Kernel Version 24.0.0: Tue Sep 24 23:36:26 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T8103",
    "osKernel": "24.0.0",
    "vscode": "1.94.2",
    "electron": "30.5.1",
    "node": "v20.16.0"
  },
  "system": {
    "date": "2024-10-27T21:19:02.734Z",
    "vscodeRoot": "/Applications/Visual Studio Code.app/Contents/Resources/app",
    "nrfConnectForDesktopInstalled": true,
    "vscodeUptime": "00:35:06",
    "osUptime": "347:11:28",
    "cpu": "Apple M1"
  },
  "workspace": {
    "name": "firmware-uhk80",
    "workspaceFile": null,
    "folders": [
      "/Users/person/sw/uhk-kconfig/firmware-uhk80"
    ]
  },
  "sdks": [
    {
      "version": "v2.7.0",
      "path": "/opt/nordic/ncs/v2.7.0"
    },
    {
      "version": "v2.6.1",
      "path": "/opt/nordic/ncs/v2.6.1"
    },
    {
      "version": "v2.6.1",
      "path": "/opt/nordic/ncs/v2.6.0"
    },
    {
      "version": "v3.7.0-rc2",
      "path": "/Users/person/sw/zephyr-examples"
    },
    {
      "version": "v3.5.99",
      "path": "/Users/person/sw/c2usb-zephyr-workspace"
    },
    {
      "version": "?.?.?",
      "path": "/Users/person/sw/uhk-kconfig"
    },
    {
      "version": "?.?.?",
      "path": "/Users/person/sw/uhk-main"
    }
  ],
  "apps": [
    {
      "workspace": "/Users/person/sw/uhk-kconfig/firmware-uhk80",
      "uri": "/Users/person/sw/uhk-kconfig/firmware-uhk80/device",
      "buildConfigurations": []
    }
  ],
  "topdir": "/Users/person/sw/uhk-kconfig",
  "workspaceState": "workspace-ready",
  "toolchains": [
    {
      "version": "2.7.0",
      "path": "/opt/nordic/ncs/toolchains/f8037e9b83"
    },
    {
      "version": "2.6.1",
      "path": "/opt/nordic/ncs/toolchains/580e4ef81c"
    },
    {
      "version": "2.6.0",
      "path": "/opt/nordic/ncs/toolchains/580e4ef81c"
    },
    {
      "version": "0.16.8",
      "path": "/opt/zephyr-sdk-0.16.8"
    }
  ],
  "activeToolchain": {
    "type": "installation",
    "path": "/opt/nordic/ncs/toolchains/f8037e9b83",
    "version": "2.7.0",
    "displayName": "nRF Connect SDK Toolchain v2.7.0"
  },
  "connectedDevices": [],
  "deviceProvider": "nrfutil",
  "tools": {
    "/opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc": "0.16.5-1 (arm64)",
    "/Applications/SEGGER/JLink/JLinkExe": "7.94e (x64,arm64)",
    "/usr/local/bin/nrfjprog": "10.24.0 (x64,arm64)",
    "/Users/person/.nrfutil/bin/nrfutil": "7.7.1 (arm64)",
    "/opt/nordic/ncs/toolchains/f8037e9b83/bin/cmake": "3.21.0 (arm64)",
    "/opt/nordic/ncs/toolchains/f8037e9b83/bin/west": "1.2.0",
    "/opt/nordic/ncs/toolchains/f8037e9b83/bin/python3": "3.9.6 (arm64)",
    "/opt/nordic/ncs/toolchains/f8037e9b83/bin/ninja": "1.10.2 (arm64)",
    "/opt/nordic/ncs/toolchains/f8037e9b83/bin/gperf": "3.1 (arm64)",
    "/opt/nordic/ncs/toolchains/f8037e9b83/bin/dtc": "1.6.1 (arm64)",
    "/opt/nordic/ncs/toolchains/f8037e9b83/bin/gn": "2175 (arm64)",
    "/opt/nordic/ncs/toolchains/f8037e9b83/bin/git": "2.37.3 (arm64)",
    "arm-gdbPath": "/opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gdb",
    "riscv-gdbPath": "/opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk/riscv64-zephyr-elf/bin/riscv64-zephyr-elf-gdb"
  },
  "nrfutil": {
    "nrfutil-device": {
      "version": "2.5.0",
      "binPath": "/Users/person/.vscode/extensions/nordic-semiconductor.nrf-connect-2024.9.87-darwin-arm64/platform/nrfutil/bin/nrfutil-device"
    },
    "nrfutil-toolchain-manager": {
      "version": "0.14.4",
      "binPath": "/Users/person/.vscode/extensions/nordic-semiconductor.nrf-connect-2024.9.87-darwin-arm64/platform/nrfutil/bin/nrfutil-toolchain-manager"
    }
  },
  "environment": {
    "westEnv": {
      "GIT_EXEC_PATH": "/opt/nordic/ncs/toolchains/f8037e9b83/Cellar/git/2.37.3/libexec/git-core",
      "HOME": "/Users/person",
      "PATH": "/opt/nordic/ncs/toolchains/f8037e9b83/bin:/opt/nordic/ncs/toolchains/f8037e9b83/usr/bin:/opt/nordic/ncs/toolchains/f8037e9b83/usr/local/bin:/opt/nordic/ncs/toolchains/f8037e9b83/opt/bin:/opt/nordic/ncs/toolchains/f8037e9b83/opt/nanopb/generator-bin:/opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk/aarch64-zephyr-elf/bin:/opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk/x86_64-zephyr-elf/bin:/opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk/arm-zephyr-eabi/bin:/opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk/riscv64-zephyr-elf/bin:/opt/homebrew/opt/node@20/bin:/Library/Frameworks/Python.framework/Versions/3.12/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/person/.nrfutil/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/opt/homebrew/opt/node@20/bin:/Library/Frameworks/Python.framework/Versions/3.12/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/person/.nrfutil/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin",
      "ZEPHYR_BASE": "/Users/person/sw/uhk-kconfig/zephyr",
      "ZEPHYR_TOOLCHAIN_VARIANT": "zephyr",
      "ZEPHYR_SDK_INSTALL_DIR": "/opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk",
      "USER": "person"
    },
    "inherited": {
      "ELECTRON_RUN_AS_NODE": "1",
      "HOME": "/Users/person",
      "PATH": "/opt/homebrew/opt/node@20/bin:/Library/Frameworks/Python.framework/Versions/3.12/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/person/.nrfutil/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin",
      "USER": "person"
    }
  },
  "terminal": {
    "defaultProfile": null
  },
  "config": {
    "nordic-semiconductor.nrf-connect": {
      "topdir": "${nrf-connect.sdk:2.7.0}",
      "toolchain": {
        "path": "${nrf-connect.toolchain:2.7.0}"
      },
      "ozonePath": "",
      "applications": [
        "${workspaceFolder}/device"
      ],
      "applicationOptions": {},
      "kconfig": {
        "interface": "kconfig"
      },
      "west": {
        "env": {
          "$base": "terminal"
        }
      },
      "boardRoots": [
        "${workspaceFolder}/"
      ],
      "taskBindings": {},
      "buildTerminal": {
        "condensedProgress": true
      },
      "debugging": {
        "flash": true,
        "bindings": {},
        "justMyCode": true
      },
      "activeAppFollowActiveEditor": true,
      "deviceProvider": "nrfutil",
      "flash": {
        "softreset": false,
        "erase": false,
        "recover": false
      },
      "enableTelemetry": false,
      "thirdpartyIntegration": {},
      "toolchainManager": {
        "indexURL": null,
        "installDirectory": null
      },
      "nrfutil": {
        "home": null
      },
      "defaultOpenAction": "ask"
    },
    "nordic-semiconductor.nrf-terminal": {
      "terminalMode": "character"
    }
  },
  "extensions": {
    "internal": {
      "nordic-semiconductor.nrf-connect": {
        "version": "2024.9.87",
        "path": "/Users/person/.vscode/extensions/nordic-semiconductor.nrf-connect-2024.9.87-darwin-arm64",
        "isActive": true
      },
      "nordic-semiconductor.nrf-terminal": {
        "version": "2024.9.14",
        "path": "/Users/person/.vscode/extensions/nordic-semiconductor.nrf-terminal-2024.9.14",
        "isActive": true
      },
      "nordic-semiconductor.nrf-devicetree": {
        "version": "2024.9.26",
        "path": "/Users/person/.vscode/extensions/nordic-semiconductor.nrf-devicetree-2024.9.26",
        "isActive": true
      },
      "nordic-semiconductor.nrf-kconfig": {
        "version": "2024.9.20",
        "path": "/Users/person/.vscode/extensions/nordic-semiconductor.nrf-kconfig-2024.9.20",
        "isActive": true
      }
    },
    "external": {
      "marus25.cortex-debug": null,
      "ms-vscode.cpptools": "1.22.10",
      "ms-vscode.js-debug": "1.94.0",
      "ms-vscode.js-debug-companion": "1.1.3",
      "ms-vscode.vscode-js-profile-table": "1.0.10",
      "GitHub.copilot": "1.242.0",
      "GitHub.copilot-chat": "0.21.2",
      "github.vscode-github-actions": "0.27.0",
      "ms-vscode.cmake-tools": "1.19.52",
      "ms-vscode.cpptools-extension-pack": "1.3.0",
      "ms-vscode.cpptools-themes": "2.0.0",
      "trond-snekvik.gnu-mapfiles": "1.1.0",
      "twxs.cmake": "0.0.17",
      "waderyan.gitblame": "11.1.1",
      "xaver.clang-format": "1.9.0"
    }
  }
}

Parents
  • Hello,

    The support for custom boards in the VS Code extension is lagging behind a bit after the switch to Hardware model v2, introduced in 2.7.0.

    Let me run your questions by our VS Code team, but first, can you please share some build logs and screenshots of the parts that aren't working in your exercise?

    Best regards,

    Edvin

  • I would love to, but VSCode doesn't allow me to select the board in the build configuration. What I could do was to build successfully on 2.6.1, then switch to the 2.7.0 branch, where I can still re-run the same build configuration. I couldn't select any other build configurations, nor could I edit the current one. The build itself passes fine, also the west boards command is listing my out-of-tree boards.

    Existing build configurations invisible after update to 2.7.0:

    This bubble pops up when the build completes:

  • They are still working on the custom board support. I believe the recommended workaround is to create the build configuration using the command line to build the initial build:

    west build -b <board name> -d <build_folder_name> -- -<DCMAKE_COMMANDS>

    And then, at least in my case, the build appears in the build configuration list. Does that work in your case?

    Best regards,

    Edvin

  • No, building from vscode's command line works, but the result is the same as rebuilding all configurations with the nRF Connect extension button, the extension detects them, but doesn't list them, so I cannot switch between my different boards. (see my last posted image)

Reply Children
  • Ok, I see. The reason it worked for me was that I didn't test with a custom board, like you. 

    I talked with some of the developers, and they said that, unfortunately, at this point custom hardware model v2 boards are not supported in the GUI in VS Code. This will be introduced in a later release. So for now, I am afraid that the only option is to build using the command line.

    Best regards,
    Edvin

Related