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

  • 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

  • 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.

Related