Sudden Build Errors in Visual Studio Code

Hello,

Up until today I had been developing fine with visual studio code, installed via Toolchain Manager. Then, I clicked "Pristine Build" for the first time in a few days. All of a sudden the build failed and now nothing requiring MCUboot will build properly. 

The error I'm seeing is this, when the build gets to the stage of building McuBoot:

/opt/nordic/ncs/v1.8.0/zephyr/scripts/kconfig/kconfig.py: /opt/nordic/ncs/v1.8.0/bootloader/mcuboot/boot/zephyr/Kconfig:11: '/modules/mcuboot/boot/zephyr/Kconfig' not found (in 'source "$(ZEPHYR_NRF_MODULE_DIR)/modules/mcuboot/boot/zephyr/Kconfig"'). Check that environment variables are set correctly (e.g. $srctree, which is set to '/opt/nordic/ncs/v1.8.0/zephyr'). Also note that unset environment variables expand to the empty string.

 

I've tried: 

Uninstalling and re-installing nRF Connect SDK v1.8.0 from the Toolchain manager

Uninstalling and reinstalling Visual Studio code, and then all of its required plugins via Toolchain Manager.

Building a default project that utilizes Mcuboot, that build also fails in the same way that mine does.

An additional thing of note is that when I click "Open VS Code" from within toolchain manager, it will never actually open VS Code. If code isn't installed or is missing plugins, then it will suggest I install them, but then it will just sit on the "Checking iv VS Code and dependencies are installed" screen indefinitely, never doing anything after that.

I am on an M1 Mac, and I am using all Intel versions of software, as suggested. 

Again, everything was working fine yesterday. I have no idea what could have caused this. I hope you guys will have some ideas!

Thanks

Parents
  • In an attempt at debugging, I installed the 1.7.1 SDK, that provides me with a ton of "warning: the hex symbol PM_PARTITION_SIZE_MCUBOOT  has a non-hex default FPROTECT_BLOCK_SIZE (undefined)" errors on MCUBoot build. It seems as if something is severely broken in my mcuboot files, but re-installing does nothing...

  • Hi,

    Could you please send us "Generate Support Information"?
    In order to get this report, please open VS Code, press Cmd-Shift-P on a Mac (Ctrl-Shift-P on a Mac) and start typing "Generate Support Information". The report will be opened in the Output pane. Please copy this report and send it back to me.

    In addition, please try building the application with the "west" command line tool and check the status of the west manifest as described in the documentation. Afterwards, please provide information on the results.

    Best regards,
    Dejan

  • Hi Griffin, thanks so much for suggesting a solution to my issue.

    I installed the arm version of VS Code, and you are right that nRF Connect for Desktop was able to launch it with the warning. However, it didn't allow me to build the ble_dfu_peripheral_lbs example.  Same error as before involving not finding file paths including ""$(ZEPHYR_NRF_MODULE_DIR)". A pristine build also could not find build.ninja. 

    I'm wondering if a full reinstall can help. Might give that a try. My backup plan is to drag out an old intel Mac.  

    Thanks again,

    Steve

  • Hi Griffin,

    Could you please open VS Code, press CTRL+SHIFT+P and type nrf-connect.topdir. Could you please share the value of the nrf-connect.topdir setting under workspace tab?

    Best regards,
    Dejan

  • Hi Dejans,

    Since I'm also having the issue, I thought I'd respond to your diagnostic directions. 

    You said: 

    >>> Could you please open VS Code, press CTRL+SHIFT+P and type nrf-connect.topdir.

    I think you meant CMD+SHIFT+P since I'm on a Mac. CTRL+SHIFT+P does nothing.

    In any case, if I CMD+SHIFT+P and try to type nrf-connect.topdir, it says "no matching results".  

    I've generated my support info and included it below. There is a line in it that says 

    "config": {

    "nordic-semiconductor.nrf-connect": {
    "topdir": "${nrf-connect.sdk:1.9.1}",
    "toolchain": {
    "path": "${nrf-connect.toolchain:1.9.1}"
    },

    Thanks for your help,

    Steve

    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": "darwin",
        "osVersion": "Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:27 PDT 2021; root:xnu-7195.141.2~5/RELEASE_ARM64_T8101",
        "osKernel": "20.6.0",
        "vscode": "1.65.0",
        "electron": "13.5.2",
        "node": "v14.16.0"
      },
      "system": {
        "date": "2022-03-09T16:22:23.116Z",
        "vscodeRoot": "/Applications/Visual Studio Code.app/Contents/Resources/app",
        "nrfConnectForDesktopInstalled": true,
        "vscodeUptime": "00:02:19",
        "osUptime": "27:49:02",
        "cpu": {
          "model": "Apple M1",
          "speed": "24 MHz",
          "count": 4
        },
        "memory": {
          "total": "16.00 GB",
          "free": "0.04 GB"
        }
      },
      "workspace": {
        "name": "ble_dfu_peripheral_lbs",
        "workspaceFile": null,
        "folders": [
          "/Users/Steve/Projects/ble_dfu_peripheral_lbs"
        ]
      },
      "extensions": {
        "internal": {
          "nordic-semiconductor.nrf-connect": {
            "version": "2022.1.192",
            "path": "/Users/Steve/.vscode/extensions/nordic-semiconductor.nrf-connect-2022.1.192",
            "isActive": true
          },
          "nordic-semiconductor.nrf-terminal": {
            "version": "2022.1.30",
            "path": "/Users/Steve/.vscode/extensions/nordic-semiconductor.nrf-terminal-2022.1.30",
            "isActive": true
          },
          "nordic-semiconductor.devicetree": null,
          "nordic-semiconductor.kconfig": null
        },
        "external": {
          "marus25.cortex-debug": "1.2.2",
          "ms-vscode.cpptools": "1.8.4",
          "ms-vscode.js-debug": "1.65.0",
          "ms-vscode.js-debug-companion": "1.0.15",
          "ms-vscode.references-view": "0.0.85",
          "ms-vscode.vscode-js-profile-table": "0.0.18",
          "cschlosser.doxdocgen": "1.4.0",
          "jeff-hykin.better-cpp-syntax": "1.15.13",
          "ms-vscode-remote.remote-containers": "0.224.2",
          "ms-vscode-remote.remote-ssh": "0.76.1",
          "ms-vscode-remote.remote-ssh-edit": "0.76.1",
          "ms-vscode-remote.remote-wsl": "0.64.2",
          "ms-vscode.cpptools-extension-pack": "1.1.0",
          "ms-vscode.cpptools-themes": "1.0.0",
          "trond-snekvik.gnu-mapfiles": "1.1.0"
        }
      },
      "tools": {
        "/Applications/SEGGER/JLink/JLinkExe": "7.58b",
        "/usr/local/bin/nrfjprog": "10.15.2",
        "/opt/nordic/ncs/v1.9.1/toolchain/bin/cmake": "3.21.1",
        "/opt/nordic/ncs/v1.9.1/toolchain/bin/west": "0.12.0",
        "/opt/nordic/ncs/v1.9.1/toolchain/bin/python3": "3.9.6",
        "/opt/nordic/ncs/v1.9.1/toolchain/bin/ninja": "1.10.2",
        "/opt/nordic/ncs/v1.9.1/toolchain/bin/gperf": "3.1",
        "/opt/nordic/ncs/v1.9.1/toolchain/bin/dtc": "1.6.1",
        "/opt/nordic/ncs/v1.9.1/toolchain/bin/arm-none-eabi-gcc": "9-2019-q4-major",
        "/opt/nordic/ncs/v1.9.1/toolchain/bin/gn": "1977",
        "/opt/nordic/ncs/v1.9.1/toolchain/bin/git": "2.32.0"
      },
      "connectedDevices": [],
      "config": {
        "nordic-semiconductor.nrf-connect": {
          "topdir": "${nrf-connect.sdk:1.9.1}",
          "toolchain": {
            "path": "${nrf-connect.toolchain:1.9.1}"
          },
          "ozonePath": "",
          "applications": [
            "/Users/Steve/Projects/ble_dfu_peripheral_lbs"
          ],
          "jlink": {
            "rtosPlugin": ""
          },
          "kconfig": {
            "interface": "kconfig"
          },
          "welcome": {
            "showOnStartup": false
          },
          "west": {
            "env": {
              "$base": "terminal"
            }
          },
          "boardRoots": [],
          "enableTelemetry": true
        },
        "nordic-semiconductor.nrf-terminal": {
          "terminalMode": "line"
        },
        "nordic-semiconductor.devicetree": {
          "modules": [
            "${zephyrBase}",
            "${zephyrBase}/../nrf",
            "."
          ],
          "zephyr": "",
          "ctxFile": "",
          "defaultBoard": ""
        },
        "nordic-semiconductor.kconfig": {
          "root": "",
          "env": {},
          "cfiles": true,
          "disable": false,
          "zephyr": {
            "base": ""
          },
          "python": "",
          "liveValue": true
        },
        "marus25.cortex-debug": {
          "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,
          "flattenAnonymous": false,
          "registerUseNaturalFormat": true,
          "variableUseNaturalFormat": true,
          "dbgServerLogfile": null,
          "showDevDebugOutput": "none"
        }
      },
      "environment": {
        "westExe": "/opt/nordic/ncs/v1.9.1/toolchain/bin/west",
        "westEnv": {
          "ELECTRON_RUN_AS_NODE": "1",
          "GIT_EXEC_PATH": "/opt/nordic/ncs/v1.9.1/toolchain/Cellar/git/2.32.0_1/libexec/git-core",
          "HOME": "/Users/Steve",
          "PATH": "/opt/nordic/ncs/v1.9.1/toolchain/bin:$/Applications/Visual Studio Code.app/Contents/Resources/app/bin:/Users/Steve/share/bin:/usr/local/bin:/Users/Steve/.fastlane/bin:/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Developer/usr/bin:/Users/Steve/bin:/bin:/usr/sbin:/sbin:/usr/bin:/usr/X11/bin:/Users/Steve/bin/svn-scripts/:.:/Users/Steve/Library/Android/sdk/platform-tools:/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Versions/A/Support:/Users/Steve/Library/Android/sdk/tools/:/Users/Steve/Library/Android/sdk/build-tools/current",
          "ZEPHYR_BASE": "/opt/nordic/ncs/v1.9.1/zephyr",
          "GNUARMEMB_TOOLCHAIN_PATH": "/opt/nordic/ncs/v1.9.1/toolchain",
          "ZEPHYR_TOOLCHAIN_VARIANT": "gnuarmemb",
          "USER": "Steve"
        },
        "toolchainPath": "/opt/nordic/ncs/v1.9.1/toolchain",
        "toolchainBinPath": "/opt/nordic/ncs/v1.9.1/toolchain/bin",
        "toolchainVersion": "1.9.1"
      },
      "terminal": {
        "shell": null,
        "defaultProfile": null
      }
    }
    
    

  • Hello,

    Much like abvio, replicating your diagnostic actions just results in "No Matching commands". However, if I look at VSCode's settings under the workspace tab I can find what I think your'e looking for:

    Topdir is set to "${nrf-connect.sdk:1.9.0}"

  • Hi,

    The actual command I wanted you to try was CMD+SHIFT+P. It was a mistake on my side.
    Your output Griffin is the one I was expecting to see.

    Best regards,
    Dejan

Reply Children
  • Hi Dejans,

    Now that Griffin and I have provided the information you asked for, what can we do to resolve this issue and build our projects? 

    My project has been dead in the water now for two weeks, and getting DFU to compile and work is critical path. 

    Best,

    Steve

  • Hi Steve,

    Toolchain Manager checks if VS Code is installed. M1 would require the Intel version of the VS Code.

    As you have installed all that you need using Toolchain Manager, it means that the environment should be set correctly and this should be enough for nRF Connect SDK and toolchain to be recognized by the VS Code extension.

    Based on the following comment

    GriffinMeyer said:
    I've seen other posts that suggest a full re-install of ALL nordic tools AND (Intel)VSCode will make it so that VS code can properly build projects with MCU Boot, but Connect for desktop is still unable to actually open Intel VSCode on its own.

    I would suggest that you reinstall the Intel version of VS Code  and nRF Command Line Tools, and then open VS Code in a regular way (not through Toolchain Manager). In VS Code nRF Connect extension, you should be able to see nRF Connect SDK and Toolchain.

    Best regards,
    Dejan

  • Hi Dejan,

    Unfortunately, a complete reinstallation of Intel versions of VS Code, nRF Connect, nRF Command Line Tools, and the nRF v1.9.1 SDK still leads to the very same errors that Griffin and I have been describing.

    Here is the repro sequence:

    1. Get an M1 Mac.

    2. Follow these instructions to delete VS Code:
    jimkang.medium.com/complete-uninstall-remove-vscode-mac-5e48bef3bdec

    3. Delete nRF Connect for Desktop.

    4. rm -rf ~/Library/Application\ Support/nrfconnect

    5. Install Intel version of VS Code.

    6. Install nRF Connect for Desktop.

    7. Install Intel version of nRF Command Line Tools.

    8. Install Intel version of Jlink.

    9. Follow these directions to create the ble_dfu_peripheral_lbs sample app.
    devzone.nordicsemi.com/.../ncs-dfu

    10. Get errors listed below.

    It would be very helpful if someone at Nordic attempted to use these steps to verify if there's a bug or not. I can imagine that many developers trying to incorporate MCUBOOT are experiencing the same thing as Griffin and me.

    Best,

    Steve


    /opt/nordic/ncs/v1.9.1/zephyr/scripts/kconfig/kconfig.py: /opt/nordic/ncs/v1.9.1/bootloader/mcuboot/boot/zephyr/Kconfig:11: '/modules/mcuboot/boot/zephyr/Kconfig' not found (in 'source "$(ZEPHYR_NRF_MODULE_DIR)/modules/mcuboot/boot/zephyr/Kconfig"'). Check that environment variables are set correctly (e.g. $srctree, which is set to '/opt/nordic/ncs/v1.9.1/zephyr'). Also note that unset environment variables expand to the empty string.
    CMake Error at /opt/nordic/ncs/v1.9.1/zephyr/cmake/kconfig.cmake:272 (message):
    command failed with return code: 1
    Call Stack (most recent call first):
    /opt/nordic/ncs/v1.9.1/zephyr/cmake/app/boilerplate.cmake:544 (include)
    /opt/nordic/ncs/v1.9.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
    /opt/nordic/ncs/v1.9.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:35 (include_boilerplate)
    /Users/Steve/Projects/ble_dfu_peripheral_lbs/build/CMakeLists.txt:44 (find_package)

    P.S. If I try setting the ZEPHYR_NRF_MODULE_DIR environment variable in my zsh, it gets different errors starting with:

    -- Including generated dts.cmake file: /Users/Steve/Projects/ble_dfu_peripheral_lbs/build/mcuboot/zephyr/dts.cmake

    warning: the hex symbol PM_PARTITION_SIZE_MCUBOOT (defined at /opt/nordic/ncs/v1.9.1/nrf/modules/mcuboot/boot/zephyr/Kconfig:21, /opt/nordic/ncs/v1.9.1/nrf/modules/mcuboot/boot/zephyr/Kconfig:26, /opt/nordic/ncs/v1.9.1/nrf/modules/mcuboot/boot/zephyr/Kconfig:32) has a non-hex default FPROTECT_BLOCK_SIZE (undefined)

  • Hi ,

    I'd like to get clarity on a few things.

    1) Do the errors Steve is getting make sense to anyone on the Nordic team? Are they the result of something specifically not being installed, and/or properly configured?

    2) It seems like re-installing sometimes fixes the problem, but not always. It has not fixed it on one of my machines, and I am only able to build on a brand new M1 MacBook. My guess is that something is not being properly configured during the install process, or something was misconfigured and is sticking around despite an uninstall/reinstall. I'm hoping the Nordic dev team is able to understand exactly what that is given the repeating error messages about environment variables. It would be preferable to get to the actual root source of the problem as re-installing an entire development suite takes time and I worry about having to do that every single update. Not to mention it seems to sometimes NOT fix the problem and I'd hate to be in production and unable to release a new version of firmware.

    3) There is still the core issue of Toolchain Manager refusing to open the Intel version of VSCode. Is this something the Nordic team is able to reproduce? It is happening on both of my M1 machines, for Steve, as well as the user from this post. If nordic devs are not able to reproduce this problem, perhaps there is something that is sticking around on their machines that is causing everything to work properly, even after a reinstall?

    I'm really hoping to get to the root of the problem and fully understand it so that I know how to fix it if it ever happens in the future, and hoping that a full re-install works is not an optimal solution.

  • Hi Griffin,

    I completely understand your eagerness to find the root cause of the problem and I am willing to help.

    Could you please try the following
    Open Toolchain Manager and open command prompt.
    1. Try building application which contains MCUboot, such as asset tracker v2. Does it succeed? Are there any errors?
    2. Try building the same application using VS Code. Does it succeed? Are there any errors?

    Best regards,
    Dejan

Related