Must toolchain version match SDK version?

Hi.

For a while I have had some issues with the toolchain when using the nRF connect SDK in visual studio code on windows 10. I believe it was after installing SDK version 2.8.0 that I saw the problems first, although I'm not entirely sure. When I use certain commands I get errors in toolchain versions other than 2.8.0. For instance, if I try to build and flash an application using SDK version 1.9.1 and toolchain 1.9.1 I get the attached output.

First of all, is there a workaround to get this to work? I'm currently flashing manually with nrfjprog from command line.

Secondly, should I be matching toolchain versions and SDK versions in the first place? What is the intended/recommended way to use SDK and toolchain versions? If I try build my application with SDK version 1.9.1 and toolchain version 2.8.0 the application appears to run as expected, even with some improvements: resulting merged.hex file is smaller and more warnings are caught in the build process.

[9/27] Linking CXX executable zephyr\zephyr_pre0.elf
[10/27] Generating dev_handles.c
FAILED: zephyr/dev_handles.c
cmd.exe /C "cd /D C:\...\build_191\zephyr && C:\ncs\v1.9.1\toolchain\opt\bin\python.exe C:/ncs/v1.9.1/zephyr/scripts/gen_handles.py --output-source dev_handles.c --kernel C:/.../build_191/zephyr/zephyr_pre0.elf --zephyr-base C:/ncs/v1.9.1/zephyr --start-symbol __device_start"
Traceback (most recent call last):
  File "C:/ncs/v1.9.1/zephyr/scripts/gen_handles.py", line 37, in <module>
    from elftools.elf.elffile import ELFFile
  File "C:\ncs\toolchains\2d382dcd92\opt\bin\Lib\site-packages\elftools\elf\elffile.py", line 41, in <module>
    from ..dwarf.dwarfinfo import DWARFInfo, DebugSectionDescriptor, DwarfConfig
  File "C:\ncs\toolchains\2d382dcd92\opt\bin\Lib\site-packages\elftools\dwarf\dwarfinfo.py", line 17, in <module>
    from .structs import DWARFStructs
  File "C:\ncs\toolchains\2d382dcd92\opt\bin\Lib\site-packages\elftools\dwarf\structs.py", line 10, in <module>
    from logging.config import valid_ident
  File "<frozen zipimport>", line 259, in load_module
  File "logging\config.py", line 30, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "logging\handlers.py", line 26, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "socket.py", line 49, in <module>
ImportError: Module use of python312.dll conflicts with this version of Python.
ninja: build stopped: subcommand failed.
FATAL ERROR: re-build

  • Hi Edvin,

    Here you are!

    // IMPORTANT: The following data can contain sensitive or confidential information about your environment.
    // If you do not want others to see this information, make sure to remove it before sharing the data.
    
    // For help and support, visit Nordic Semiconductor's DevZone at https://devzone.nordicsemi.com/.
    
    {
      "platform": {
        "os": "win32",
        "osVersion": "Windows 11 Enterprise",
        "osKernel": "10.0.26100",
        "vscode": "1.100.2",
        "electron": "34.5.1",
        "node": "v20.19.0"
      },
      "system": {
        "date": "2025-05-23T07:59:05.333Z",
        "vscodeRoot": "c:\\Users\\KieranReilly\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app",
        "nrfConnectForDesktopInstalled": true,
        "vscodeUptime": "00:00:07",
        "osUptime": "54:42:55",
        "cpu": "Intel(R) Core(TM) Ultra 5 125H"
      },
      "workspace": {
        "name": "blinky",
        "workspaceFile": null,
        "folders": [
          "c:\\dm\\private\\nRF_SDK_Tests\\blinky"
        ]
      },
      "sdks": [
        {
          "version": "v2.9.0",
          "path": "c:\\ncs\\v2.9.0"
        },
        {
          "version": "v2.6.1",
          "path": "c:\\ncs\\v2.6.1"
        },
        {
          "version": "v2.4.0",
          "path": "c:\\ncs\\v2.4.0"
        },
        {
          "version": "v2.3.0",
          "path": "c:\\ncs\\v2.3.0"
        },
        {
          "version": "v2.0.0",
          "path": "c:\\ncs\\v2.0.0"
        }
      ],
      "activeBuild": "c:\\dm\\private\\nRF_SDK_Tests\\blinky\\build",
      "apps": [
        {
          "workspace": "c:\\dm\\private\\nRF_SDK_Tests\\blinky",
          "uri": "c:\\dm\\private\\nRF_SDK_Tests\\blinky",
          "buildConfigurations": [
            {
              "id": "c:\\dm\\private\\nRF_SDK_Tests\\blinky\\build",
              "name": "build",
              "boardId": "nrf9161dk_nrf9161_ns",
              "type": "Zephyr",
              "isChild": false,
              "isStale": false,
              "taskBindings": {
                "build": [],
                "pristineBuild": [],
                "flash": [],
                "eraseAndFlash": []
              },
              "sdk": "c:\\ncs\\v2.4.0",
              "toolchain": "nRF Connect SDK Toolchain v2.4.0"
            }
          ]
        }
      ],
      "toolchains": [
        {
          "version": "2.9.0",
          "path": "c:\\ncs\\toolchains\\b620d30767"
        },
        {
          "version": "2.6.1",
          "path": "c:\\ncs\\toolchains\\cf2149caf2"
        },
        {
          "version": "2.4.0",
          "path": "c:\\ncs\\toolchains\\31f4403e35"
        },
        {
          "version": "2.3.0",
          "path": "c:\\ncs\\toolchains\\v2.3.0"
        },
        {
          "version": "2.0.0",
          "path": "c:\\ncs\\toolchains\\v2.0.0"
        }
      ],
      "connectedDevices": [
        {
          "serialNumber": "000506003622"
        }
      ],
      "tools": {
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin\\arm-zephyr-eabi-gcc.exe": "0.16.0",
        "C:\\Program Files\\SEGGER\\JLink_V818\\JLink.exe": "8.18",
        "C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\nrfjprog.exe": "10.24.2",
        "C:\\ncs\\nrfutil\\nrfutil.exe": "8.0.0",
        "C:\\ncs\\toolchains\\31f4403e35\\cmake": "3.20.5",
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\Scripts\\west.exe": "1.0.0",
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\python.exe": "3.8.2",
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\ninja.exe": "1.9.0",
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\gperf.exe": "3.1",
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\dtc.exe": "1.4.7",
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\gn.exe": "2105",
        "C:\\ncs\\toolchains\\31f4403e35\\mingw64\\bin\\git.exe": "2.37.3.windows.1",
        "arm-gdbPath": "c:\\ncs\\toolchains\\31f4403e35\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin\\arm-zephyr-eabi-gdb.exe",
        "riscv-gdbPath": "not found"
      },
      "nrfutil": {
        "nrfutil-device": {
          "version": "2.8.8",
          "binPath": "c:\\Users\\KieranReilly\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2025.5.92-win32-x64\\platform\\nrfutil\\bin\\nrfutil-device",
          "jlinkInfo": {
            "name": "JlinkARM",
            "version": "JLink_V8.18",
            "versionFormat": "string"
          }
        },
        "nrfutil-sdk-manager": {
          "version": "1.3.0",
          "binPath": "c:\\Users\\KieranReilly\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2025.5.92-win32-x64\\platform\\nrfutil\\bin\\nrfutil-sdk-manager"
        }
      },
      "environment": {
        "westEnv": {
          "HOME": "C:\\Users\\KieranReilly",
          "HOMEDRIVE": "C:",
          "HOMEPATH": "\\Users\\KieranReilly",
          "PATH": "C:\\ncs\\toolchains\\b620d30767;C:\\ncs\\toolchains\\b620d30767\\mingw64\\bin;C:\\ncs\\toolchains\\b620d30767\\bin;C:\\ncs\\toolchains\\b620d30767\\opt\\bin;C:\\ncs\\toolchains\\b620d30767\\opt\\bin\\Scripts;C:\\ncs\\toolchains\\b620d30767\\opt\\nanopb\\generator-bin;C:\\ncs\\toolchains\\b620d30767\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin;C:\\ncs\\toolchains\\b620d30767\\opt\\zephyr-sdk\\riscv64-zephyr-elf\\bin;c:\\Users\\KieranReilly\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2025.5.92-win32-x64\\platform\\nrfutil\\lib\\nrfutil-sdk-manager;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files\\dotnet\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\PuTTY\\;C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\;C:\\Program Files (x86)\\Microsoft SQL Server\\160\\DTS\\Binn\\;C:\\Program Files\\CMake\\bin;C:\\ncs\\nrfutil;C:\\Users\\KieranReilly\\AppData\\Local\\Programs\\Python\\Python313\\;C:\\Users\\KieranReilly\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\KieranReilly\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\KieranReilly\\.dotnet\\tools;C:\\msys64\\ucrt64\\bin;C:\\Program Files\\Git;",
          "ZEPHYR_BASE": "c:\\ncs\\v2.4.0\\zephyr",
          "ZEPHYR_TOOLCHAIN_VARIANT": "zephyr",
          "ZEPHYR_SDK_INSTALL_DIR": "C:\\ncs\\toolchains\\b620d30767\\opt\\zephyr-sdk",
          "PYTHONPATH": "C:\\ncs\\toolchains\\b620d30767\\opt\\bin;C:\\ncs\\toolchains\\b620d30767\\opt\\bin\\Lib;C:\\ncs\\toolchains\\b620d30767\\opt\\bin\\Lib\\site-packages"
        },
        "inherited": {
          "HOME": "C:\\Users\\KieranReilly",
          "HOMEDRIVE": "C:",
          "HOMEPATH": "\\Users\\KieranReilly",
          "Path": "C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files\\dotnet\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\PuTTY\\;C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\;C:\\Program Files (x86)\\Microsoft SQL Server\\160\\DTS\\Binn\\;C:\\Program Files\\CMake\\bin;C:\\ncs\\nrfutil;C:\\Users\\KieranReilly\\AppData\\Local\\Programs\\Python\\Python313\\;C:\\Users\\KieranReilly\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\KieranReilly\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\KieranReilly\\.dotnet\\tools;C:\\msys64\\ucrt64\\bin;C:\\Program Files\\Git;",
          "PATH": "C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files\\dotnet\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\PuTTY\\;C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\;C:\\Program Files (x86)\\Microsoft SQL Server\\160\\DTS\\Binn\\;C:\\Program Files\\CMake\\bin;C:\\ncs\\nrfutil;C:\\Users\\KieranReilly\\AppData\\Local\\Programs\\Python\\Python313\\;C:\\Users\\KieranReilly\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\KieranReilly\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\KieranReilly\\.dotnet\\tools;C:\\msys64\\ucrt64\\bin;C:\\Program Files\\Git;"
        }
      },
      "terminal": {
        "defaultProfile": null
      },
      "config": {
        "nordic-semiconductor.nrf-connect": {
          "topdir": "",
          "toolchain": {
            "path": ""
          },
          "ozonePath": "",
          "applications": [],
          "applicationOptions": {},
          "kconfig": {
            "interface": "kconfig"
          },
          "west": {
            "env": {
              "$base": "terminal"
            }
          },
          "boardRoots": [],
          "taskBindings": {},
          "buildTerminal": {
            "condensedProgress": true
          },
          "debugging": {
            "flash": true,
            "bindings": {},
            "justMyCode": false
          },
          "activeAppFollowActiveEditor": true,
          "flash": {
            "softreset": false,
            "erase": false,
            "recover": false
          },
          "enableTelemetry": false,
          "thirdpartyIntegration": {},
          "toolchainManager": {
            "indexURL": null,
            "installDirectory": null
          },
          "nrfutil": {
            "home": null
          },
          "defaultOpenAction": "ask",
          "terminalProfile": {
            "shell": null
          }
        },
        "marus25.cortex-debug": {
          "variableUseNaturalFormat": true,
          "liveWatchRefreshRate": "300",
          "armToolchainPath": null,
          "armToolchainPrefix": "arm-none-eabi",
          "gdbPath": null,
          "objdumpPath": null,
          "JLinkGDBServerPath": null,
          "openocdPath": null,
          "pyocdPath": null,
          "PEGDBServerPath": null,
          "stutilPath": null,
          "stlinkPath": null,
          "stm32cubeprogrammer": null,
          "enableTelemetry": true,
          "dbgServerLogfile": null
        }
      },
      "extensions": {
        "internal": {
          "nordic-semiconductor.nrf-connect": {
            "version": "2025.5.92",
            "path": "c:\\Users\\KieranReilly\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2025.5.92-win32-x64",
            "isActive": true
          },
          "nordic-semiconductor.nrf-terminal": null,
          "nordic-semiconductor.nrf-devicetree": null,
          "nordic-semiconductor.nrf-kconfig": {
            "version": "2025.4.26",
            "path": "c:\\Users\\KieranReilly\\.vscode\\extensions\\nordic-semiconductor.nrf-kconfig-2025.4.26",
            "isActive": true
          }
        },
        "external": {
          "marus25.cortex-debug": "1.12.1",
          "ms-vscode.cpptools": "1.25.3",
          "ms-vscode.js-debug": "1.100.1",
          "ms-vscode.js-debug-companion": "1.1.3",
          "ms-vscode.vscode-js-profile-table": "1.0.10",
          "aaron-bond.better-comments": "3.0.2",
          "cl.keil-assistant": "1.7.0",
          "cschlosser.doxdocgen": "1.4.0",
          "dan-c-underwood.arm": "1.7.4",
          "donjayamanne.python-environment-manager": "1.2.7",
          "GitHub.copilot": "1.323.0",
          "GitHub.copilot-chat": "0.27.2",
          "GitHub.remotehub": "0.64.0",
          "mcu-debug.debug-tracker-vscode": "0.0.15",
          "mcu-debug.memory-view": "0.0.25",
          "mcu-debug.peripheral-viewer": "1.4.6",
          "mcu-debug.rtos-views": "0.0.7",
          "mhutchie.git-graph": "1.30.0",
          "ms-python.debugpy": "2025.8.0",
          "ms-python.python": "2025.6.1",
          "ms-python.vscode-pylance": "2025.5.1",
          "ms-vscode.azure-repos": "0.41.2024112101",
          "ms-vscode.cmake-tools": "1.20.53",
          "ms-vscode.cpptools-extension-pack": "1.3.1",
          "ms-vscode.cpptools-themes": "2.0.0",
          "ms-vscode.hexeditor": "1.11.1",
          "ms-vscode.remote-repositories": "0.42.0",
          "tamasfe.even-better-toml": "0.21.2",
          "trond-snekvik.gnu-mapfiles": "1.1.0",
          "twxs.cmake": "0.0.17",
          "ZixuanWang.linkerscript": "1.0.4"
        }
      }
    }
    
    

    Sincerely,

    Kieran

  •   and  

    Kieran and What happens if you try to take the build configuration that you made using the command line, and flash it from VS Code? Same issue? Or does it succeed?

    BR,

    Edvin

  • Hi Edvin, 

    I did attempt this, and it unfortunately fails.

    Kieran

  • Which part? Flashing the build folder generated from the command line in VS Code? Or flashing from the command line?

  • Pressing the flash button from vscode fails on the build configuration, despite working in the command prompt where the ZEPHYR_BASE variable was set in.

Related