nRF52 Project Compilation and Runtime Issue in VS Code

Hi,

I have a project for nRF52 in VS Code. The project was able to compile and everything worked fine. However, after about a month, I reopened the project and now there is a problem with compilation - somewhere around devicetree. It is hard for me to understand what the issue is. I also tried to make some changes, but the project still won't compile. Even when I go back in Git to a branch that definitely used to compile, it won't compile today.

Now, I downloaded the new SDK 2.7.0-rc2 (before I had v2.5.2), restarted the PC, and now I can compile the program. However, it gets stuck right at the start in the function nrfx_clock_anomaly_132 on the line:

// Delay required time. while ((DWT->CYCCNT - cyccnt_inital) < ANOMALY_132_DELAY_CYCLES) {}

I did not change anything in the code, and I know that the hardware board was working correctly before.

I am not sure what to do and where the problem is. It behaves very unstable on my PC; sometimes it won't compile, and other times the code that worked before doesn't work now. Can you please help me?

edit: Now, however, I made a new build configuration and everything is working again - everything is even working perfectly - I really don't understand this.

project is here: https://file.io/EfQTXIODfs0h

Thank you for your help.

  • Hello,

    Can you please send us the generate support information (for the version, you get compilation and runtime issue) from VS Code?

    1. You can navigate view and find command palette in the menu. 

    2. Then you have to wrtie  "nRF Connect: Generate support information" and press enter.

    3. There will be generated information in the output panel view. You can copy the information and send to us.

    Thanks.

    BR

    Kazi

  • Today this problem was showed during compilation
    The Support information: 

    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 devzone.nordicsemi.com/.

    {
    "platform": {
    "os": "win32",
    "osVersion": "Windows 11 Pro",
    "osKernel": "10.0.22631",
    "vscode": "1.90.0",
    "electron": "29.4.0",
    "node": "v20.9.0"
    },
    "system": {
    "date": "2024-06-19T11:02:07.193Z",
    "vscodeRoot": "c:.../\Programs\\Microsoft VS Code\\resources\\app",
    "nrfConnectForDesktopInstalled": true,
    "vscodeUptime": "25:43:22",
    "osUptime": "26:53:39",
    "cpu": "12th Gen Intel(R) Core(TM) i7-1260P"
    },
    "workspace": {
    "name": "ring_tx",
    "workspaceFile": null,
    "folders": [
    "c:....\\ring_tx"
    ]
    },
    "sdks": [
    {
    "version": "v2.7.0-rc2",
    "path": "c:\\ncs\\v2.7.0-rc2"
    },
    {
    "version": "v2.6.1",
    "path": "c:\\ncs\\v2.6.1"
    },
    {
    "version": "v2.5.2",
    "path": "c:\\ncs\\v2.5.2"
    },
    {
    "version": "v2.1.2",
    "path": "c:\\ncs\\v2.1.2"
    }
    ],
    "activeBuild": ".....\\ring_tx\\RING_TX\\build_1",
    "apps": [
    {
    "workspace": ".......ring_tx\\RING_TX",
    "buildConfigurations": [
    {
    "id": "c:\\.......\\RING_TX\\build",
    "name": "build",
    "boardId": "nrf52840dk_nrf52811",
    "type": "Zephyr",
    "isChild": false,
    "isStale": false,
    "taskBindings": {
    "build": [],
    "pristineBuild": [],
    "flash": [],
    "eraseAndFlash": []
    }
    },
    {
    "id": ".......\\RING_TX\\build_1",
    "name": "build_1",
    "boardId": "nrf52840dk_nrf52811",
    "type": "Zephyr",
    "isChild": false,
    "isStale": false,
    "taskBindings": {
    "build": [],
    "pristineBuild": [],
    "flash": [],
    "eraseAndFlash": []
    }
    }
    ]
    }
    ],
    "topdir": "c:\\ncs\\v2.7.0-rc2",
    "workspaceState": "freestanding-ready",
    "toolchains": [
    {
    "version": "2.7.0-rc2",
    "path": "c:\\ncs\\toolchains\\ce3b5ff664"
    },
    {
    "version": "2.6.1",
    "path": "c:\\ncs\\toolchains\\cf2149caf2"
    },
    {
    "version": "2.5.2",
    "path": "c:\\ncs\\toolchains\\c57af46cb7"
    },
    {
    "version": "2.1.2",
    "path": "c:\\ncs\\toolchains\\v2.1.2"
    }
    ],
    "connectedDevices": [
    {
    "serialNumber": "000260102277"
    }
    ],
    "deviceProvider": "nrfutil",
    "tools": {
    "C:\\ncs\\toolchains\\ce3b5ff664\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin\\arm-zephyr-eabi-gcc.exe": "0.16.5-1",
    "C:\\Program Files\\SEGGER\\JLink_V794e\\JLink.exe": "7.94e",
    "C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\nrfjprog.exe": "10.24.0",
    "nrfutil": "Not found",
    "C:\\ncs\\toolchains\\ce3b5ff664\\opt\\bin\\cmake.exe": "3.21.0",
    "C:\\ncs\\toolchains\\ce3b5ff664\\opt\\bin\\Scripts\\west.exe": "1.2.0",
    "C:\\ncs\\toolchains\\ce3b5ff664\\opt\\bin\\python.exe": "3.9.13",
    "C:\\ncs\\toolchains\\ce3b5ff664\\opt\\bin\\ninja.exe": "1.10.2",
    "C:\\ncs\\toolchains\\ce3b5ff664\\opt\\bin\\gperf.exe": "3.1",
    "C:\\ncs\\toolchains\\ce3b5ff664\\opt\\bin\\dtc.exe": "1.4.7",
    "C:\\ncs\\toolchains\\ce3b5ff664\\opt\\bin\\gn.exe": "2172",
    "C:\\ncs\\toolchains\\ce3b5ff664\\mingw64\\bin\\git.exe": "2.37.3.windows.1",
    "gdbPath": "c:\\ncs\\toolchains\\ce3b5ff664\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin\\arm-zephyr-eabi-gdb.exe"
    },
    "nrfutil": {
    "nrfutil-device": {
    "version": "2.0.0",
    "binPath": "c:\\Users\\Uzivatel\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2024.3.25-win32-x64\\platform\\nrfutil\\bin\\nrfutil-device"
    },
    "nrfutil-toolchain-manager": {
    "version": "0.14.1",
    "binPath": "c:\\Users\\Uzivatel\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2024.3.25-win32-x64\\platform\\nrfutil\\bin\\nrfutil-toolchain-manager"
    }
    },
    "environment": {
    "westEnv": {
    "ELECTRON_RUN_AS_NODE": "1",
    "HOME": "C:\\Users\\Uzivatel",
    "HOMEDRIVE": "C:",
    "HOMEPATH": "\\Users\\Uzivatel",
    "PATH": "C:\\ncs\\toolchains\\ce3b5ff664;C:\\ncs\\toolchains\\ce3b5ff664\\mingw64\\bin;C:\\ncs\\toolchains\\ce3b5ff664\\bin;C:\\ncs\\toolchains\\ce3b5ff664\\opt\\bin;C:\\ncs\\toolchains\\ce3b5ff664\\opt\\bin\\Scripts;C:\\ncs\\toolchains\\ce3b5ff664\\opt\\nanopb\\generator-bin;C:\\ncs\\toolchains\\ce3b5ff664\\opt\\zephyr-sdk\\aarch64-zephyr-elf\\bin;C:\\ncs\\toolchains\\ce3b5ff664\\opt\\zephyr-sdk\\x86_64-zephyr-elf\\bin;C:\\ncs\\toolchains\\ce3b5ff664\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin;C:\\ncs\\toolchains\\ce3b5ff664\\opt\\zephyr-sdk\\riscv64-zephyr-elf\\bin;c:\\Users\\Uzivatel\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2024.3.25-win32-x64\\platform\\nrfutil\\lib\\nrfutil-toolchain-manager;C:\\Program Files (x86)\...\\WindowsApps;",
    "ZEPHYR_BASE": "c:\\ncs\\v2.7.0-rc2\\zephyr",
    "ZEPHYR_TOOLCHAIN_VARIANT": "zephyr",
    "ZEPHYR_SDK_INSTALL_DIR": "C:\\ncs\\toolchains\\ce3b5ff664\\opt\\zephyr-sdk",
    "PYTHONPATH": "C:\\ncs\\toolchains\\ce3b5ff664\\opt\\bin;C:\\ncs\\toolchains\\ce3b5ff664\\opt\\bin\\Lib;C:\\ncs\\toolchains\\ce3b5ff664\\opt\\bin\\Lib\\site-packages"
    },
    "inherited": {
    "ELECTRON_RUN_AS_NODE": "1",
    "HOME": "C:\\Users\\Uzivatel",
    "HOMEDRIVE": "C:",
    "HOMEPATH": "\\Users\\Uzivatel",
    "Path": "C:\\Program Files (x86..\...Microsoft VS Code\\bin;......",
    "PATH": "C:\\Program Files 
    },
    "toolchainPath": "c:\\ncs\\toolchains\\ce3b5ff664",
    "toolchainBinPath": "c:\\ncs\\toolchains\\ce3b5ff664\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin",
    "toolchainVersion": "2.7.0-rc2"
    },
    "terminal": {
    "defaultProfile": null
    },
    "config": {
    "nordic-semiconductor.nrf-connect": {
    "topdir": "${nrf-connect.sdk:2.1.0}",
    "toolchain": {
    "path": "${nrf-connect.toolchain:2.1.0}"
    },
    "ozonePath": "",
    "applications": [
    "${workspaceFolder}\\RING_TX"
    ],
    "applicationOptions": {},
    "kconfig": {
    "interface": "kconfig"
    },
    "west": {
    "env": {
    "$base": "terminal"
    }
    },
    "boardRoots": [],
    "taskBindings": {},
    "buildTerminal": {
    "condensedProgress": true
    },
    "debugging": {
    "flash": true,
    "bindings": {
    "${workspaceFolder}/RING_TX/build": "Launch build"
    },
    "justMyCode": true
    },
    "activeAppFollowActiveEditor": true,
    "deviceProvider": "",
    "flash": {
    "softreset": false,
    "erase": false,
    "recover": false
    },
    "enableTelemetry": true,
    "thirdpartyIntegration": {},
    "toolchainManager": {
    "indexURL": null,
    "installDirectory": null
    },
    "nrfutil": {
    "home": null
    },
    "defaultOpenAction": "ask"
    },
    "nordic-semiconductor.nrf-terminal": {
    "terminalMode": "character"
    },
    "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": "2024.3.25",
    "path": "c:\\Users\\Uzivatel\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2024.3.25-win32-x64",
    "isActive": true
    },
    "nordic-semiconductor.nrf-terminal": {
    "version": "2024.3.15",
    "path": "c:\\Users\\Uzivatel\\.vscode\\extensions\\nordic-semiconductor.nrf-terminal-2024.3.15",
    "isActive": true
    },
    "nordic-semiconductor.nrf-devicetree": {
    "version": "2024.3.78",
    "path": "c:\\Users\\Uzivatel\\.vscode\\extensions\\nordic-semiconductor.nrf-devicetree-2024.3.78",
    "isActive": true
    },
    "nordic-semiconductor.nrf-kconfig": {
    "version": "2024.3.21",
    "path": "c:\\Users\\Uzivatel\\.vscode\\extensions\\nordic-semiconductor.nrf-kconfig-2024.3.21",
    "isActive": true
    }
    },
    "external": {
    "marus25.cortex-debug": "1.12.1",
    "ms-vscode.cpptools": "1.20.5",
    "ms-vscode.js-debug": "1.90.0",
    "ms-vscode.js-debug-companion": "1.1.2",
    "ms-vscode.vscode-js-profile-table": "1.0.9",
    "bbenoist.QML": "1.0.0",
    "cschlosser.doxdocgen": "1.4.0",
    "dan-c-underwood.arm": "1.7.4",
    "jeff-hykin.better-cpp-syntax": "1.17.2",
    "matangover.mypy": "0.3.1",
    "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",
    "ms-python.debugpy": "2024.6.0",
    "ms-python.python": "2024.8.1",
    "ms-python.vscode-pylance": "2024.6.1",
    "ms-vscode.cmake-tools": "1.18.42",
    "ms-vscode.cpptools-extension-pack": "1.3.0",
    "ms-vscode.cpptools-themes": "2.0.0",
    "ms-vscode.hexeditor": "1.10.0",
    "shd101wyy.markdown-preview-enhanced": "0.8.13",
    "STMicroelectronics.stm32-vscode-extension": "2.0.1",
    "trond-snekvik.gnu-mapfiles": "1.1.0",
    "twxs.cmake": "0.0.17",
    "ZixuanWang.linkerscript": "1.0.4"
    }
    }
    }

  • Now it seems like the problem was in SDK version. When I set v2.1.2, it can be compiled without errors. Hope the problem is solved: 

  • Hello,

    It seems installing SDKs to downgrade version solved your problem.

    I got some feedback from respective team. 

    The toolchain was not installed by nrfutil toolchain-manager, or not properly. The solution is to remove that toolchain and install it again. It is recommended to use the Manage toolchains menu in VS Code, rather not using the toolchain manager app.

Related