Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

toolchain manager sets ZEPHYR_TOOLCHAIN_VARIANT incorrectly

These are the details of my system:

  • Ubuntu 20.04.5 LTS
  • nRF Connect for Desktop v3.12.0
  • Toolchain Manager v1.2.1
  • Visual Studio Code 1.73.1
  • NCS 2.1.2

If I start Visual Studio Code from the Nordic Toolchain Manager, the global environment variable ZEPHYR_TOOLCHAIN_VARIANT is set to the value "zephyr".

This setting causes my project to not compile.

I also tried to set the correct ZEPHYR_TOOLCHAIN_VARIANT in the file ~/.zephyrrc:

export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb

My workaround is not to start Visual Studio Code from the Toolchain Manager.
Instead set all environment settings manually before starting Visual Studio Code:

export ZEPHYR_BASE="/home/ephimee/ncs2/v2.1.2/zephyr"
export BOARD_ROOT=/home/ephimee/git/myproject
export BOARD=nrf52840dk_nrf52840
export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb
code

A few questions:

  1. why does Toolchain Manager set ZEPHYR_TOOLCHAIN_VARIANT to the value "zephyr"?
  2. can you provide a list of all environment settings the Toolchain Manager sets before running Visual Studio Code?
  3. which script is executed by the Toolchain Manager before running Visual Studio Code?
  4. is this a bug?
  • When I build from commandline (outside vscode) I have the same result.

    [00:11:59] west build --build-dir /home/ephimee/vscode/cafsample/build /home/ephimee/vscode/cafsample
    [00:12:03] Failure (code 1).
    IMPORTANT: The data below could contain sensitive or confidential information about your environment.
    If you do not wish this to be seen by others, please make sure to remove it before sharing.
    
    For help and support, visit the Nordic DevZone at https://devzone.nordicsemi.com/.
    
    {
      "platform": {
        "os": "linux",
        "osVersion": "#148-Ubuntu SMP Mon Oct 17 16:02:06 UTC 2022",
        "osKernel": "5.4.0-132-generic",
        "vscode": "1.73.1",
        "electron": "19.0.17",
        "node": "v16.14.2"
      },
      "system": {
        "date": "2022-12-01T23:13:56.667Z",
        "vscodeRoot": "/usr/share/code/resources/app",
        "nrfConnectForDesktopInstalled": "unknown",
        "vscodeUptime": "00:03:44",
        "osUptime": "00:28:33",
        "cpu": {
          "model": "Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz",
          "speed": "2197 MHz",
          "count": 4
        },
        "memory": {
          "total": "15.40 GB",
          "free": "10.22 GB"
        }
      },
      "workspace": {
        "name": "cafsample (Workspace)",
        "workspaceFile": "/home/ephimee/vscode/cafsample/cafsample.code-workspace",
        "folders": [
          "/home/ephimee/vscode/cafsample"
        ]
      },
      "extensions": {
        "internal": {
          "nordic-semiconductor.nrf-connect": {
            "version": "2022.10.30",
            "path": "/home/ephimee/.vscode/extensions/nordic-semiconductor.nrf-connect-2022.10.30-linux-x64",
            "isActive": true
          },
          "nordic-semiconductor.nrf-terminal": {
            "version": "2022.10.7",
            "path": "/home/ephimee/.vscode/extensions/nordic-semiconductor.nrf-terminal-2022.10.7",
            "isActive": true
          },
          "nordic-semiconductor.nrf-devicetree": {
            "version": "2022.9.11",
            "path": "/home/ephimee/.vscode/extensions/nordic-semiconductor.nrf-devicetree-2022.9.11",
            "isActive": true
          },
          "nordic-semiconductor.nrf-kconfig": {
            "version": "2022.10.7",
            "path": "/home/ephimee/.vscode/extensions/nordic-semiconductor.nrf-kconfig-2022.10.7",
            "isActive": true
          }
        },
        "external": {
          "marus25.cortex-debug": "1.6.7",
          "ms-vscode.cpptools": "1.12.4",
          "ms-vscode.js-debug": "1.72.0",
          "ms-vscode.js-debug-companion": "1.0.18",
          "ms-vscode.vscode-js-profile-table": "1.0.3",
          "trond-snekvik.gnu-mapfiles": "1.1.0",
          "twxs.cmake": "0.0.17",
          "utsavm9.c-cpp-flag-debugging": "0.0.1"
        }
      },
      "tools": {
        "/home/ephimee/ncs_v2.0.2/toolchains/v2.0.2/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc": null,
        "/opt/SEGGER/JLink/JLinkExe": "6.88a",
        "/usr/local/bin/nrfjprog": "10.17.2",
        "/home/ephimee/.local/bin/nrfutil": null,
        "/home/ephimee/.local/bin/cmake": "3.24.1",
        "/home/ephimee/.local/bin/west": "0.13.1",
        "/usr/bin/python3": "3.8.10",
        "/usr/bin/ninja": "1.10.0",
        "/usr/bin/gperf": "3.1",
        "/usr/bin/dtc": "1.5.0",
        "gn": "Not found",
        "/usr/bin/git": "2.25.1"
      },
      "sdks": [
        {
          "version": "2.1.2",
          "path": "/home/ephimee/ncs2/v2.1.2"
        },
        {
          "version": "2.0.2",
          "path": "/home/ephimee/ncs2/v2.0.2"
        },
        {
          "version": "Zephyr 2.4.99",
          "path": "/home/ephimee/zephyrproject"
        }
      ],
      "toolchains": [
        {
          "version": "2.1.2",
          "path": "/home/ephimee/ncs2/toolchains/v2.1.2"
        }
      ],
      "connectedDevices": [],
      "deviceProviders": [
        "nrfjprog"
      ],
      "config": {
        "nordic-semiconductor.nrf-connect": {
          "topdir": "${nrf-connect.sdk:2.1.2}",
          "toolchain": {
            "path": "PATH"
          },
          "ozonePath": "",
          "applications": [
            "/home/ephimee/vscode/cafsample"
          ],
          "applicationOptions": {},
          "kconfig": {
            "interface": "kconfig"
          },
          "welcome": {
            "showOnStartup": true
          },
          "west": {
            "env": {
              "$base": "terminal"
            }
          },
          "boardRoots": [],
          "enableTelemetry": true,
          "taskBindings": {},
          "debugging": {
            "backend": "nRF Debug",
            "flash": true
          },
          "activeAppFollowActiveEditor": true
        },
        "nordic-semiconductor.nrf-terminal": {
          "terminalMode": "character"
        },
        "marus25.cortex-debug": {
          "armToolchainPath": "/home/ephimee/zephyr-sdk-0.14.2/arm-zephyr-eabi/bin",
          "armToolchainPrefix": "arm-zephyr-eabi",
          "gdbPath": null,
          "objdumpPath": null,
          "JLinkGDBServerPath": "/opt/SEGGER/JLink/JLinkGDBServerCLExe",
          "openocdPath": null,
          "pyocdPath": null,
          "PEGDBServerPath": null,
          "stutilPath": null,
          "stlinkPath": null,
          "stm32cubeprogrammer": null,
          "enableTelemetry": true,
          "registerUseNaturalFormat": true,
          "variableUseNaturalFormat": true,
          "dbgServerLogfile": null,
          "showRTOS": false,
          "showDevDebugOutput": "none"
        }
      },
      "environment": {
        "westExe": "west",
        "westEnv": {
          "ELECTRON_RUN_AS_NODE": "1",
          "HOME": "/home/ephimee",
          "PATH": "/home/ephimee/ncs_v2.0.2/toolchains/v2.0.2/opt/zephyr-sdk/arm-zephyr-eabi/bin:/tmp/.mount_nrfconFe5NyS:/tmp/.mount_nrfconFe5NyS/usr/sbin:/home/ephimee/.local/bin:/home/ephimee/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
          "ZEPHYR_BASE": "/home/ephimee/ncs2/v2.1.2/zephyr",
          "GNUARMEMB_TOOLCHAIN_PATH": "/home/ephimee/ncs2/toolchains/v2.0.2",
          "ZEPHYR_TOOLCHAIN_VARIANT": "zephyr",
          "ZEPHYR_SDK_INSTALL_DIR": "/home/ephimee/ncs_v2.0.2/toolchains/v2.0.2/opt/zephyr-sdk",
          "USER": "ephimee"
        },
        "inherited": {
          "ELECTRON_RUN_AS_NODE": "1",
          "HOME": "/home/ephimee",
          "PATH": "/tmp/.mount_nrfconFe5NyS:/tmp/.mount_nrfconFe5NyS/usr/sbin:/home/ephimee/.local/bin:/home/ephimee/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
          "GNUARMEMB_TOOLCHAIN_PATH": "/home/ephimee/ncs2/toolchains/v2.0.2",
          "ZEPHYR_SDK_INSTALL_DIR": "/home/ephimee/ncs_v2.0.2/toolchains/v2.0.2/opt/zephyr-sdk",
          "USER": "ephimee"
        },
        "toolchainPath": "PATH"
      },
      "terminal": {
        "shell": null,
        "defaultProfile": null
      }
    }
    
    
    

  • Hi,

    I have not been able to find an issue in your support log or another reason for why this is failing. Can you make sure that you do not have ZEPHYR_TOOLCHAIN_VARIANT set to gnuarmemb in your environment variables, and then uninstall and reinstall the SDK?

    Best regards,

    Marte

  • Not sure if you noticed. In the support log are references to both version v2.0.2 and v2.1.2, could this be the issue?

  • Hi,

    Sorry for the delay, I have been out of office.

    That you have two versions of the nRF Connect SDK should not be an issue, and the Zephyr SDK is the default toolchain in both v2.0.2 and v2.1.2 anyway.

    Have you made sure that ZEPHYR_TOOLCHAIN_VARIANT is not set to gnuarmemb, and have you tried reinstalling the SDK?

    Best regards,

    Marte

Related