PlatformIO Community

VSCode Cannot Create Project for Esp32

Hi all. I am trying to build a new esp32 project on Visual Studio and PlatformIO. However, when I try to create a new project with the settings below (Board NodeMCU32S, Framework: Espressif Iot Develpoment Framework):

PlatformIO Settings

However, I get the following error message saying that the project could not be built, a PIO Core Call Error (bottom of message). I have tried:

  • updating via >piocore update,
  • disabled all other VSCode extensions except Microsoft C/C++ and PlatformIO extensions
  • reinstalled VS Code (same version, 1.63.2)
  • tried finding a .git folder in the message (see below) to delete but was not there
    from the post: Can not initialize Project for Espressif IoT Dev framework - #3 by kherrmann
  • used Espressif v3.3.0 instead of 3.4.0
  • used Arduino Framework instead of Espressif Iot Development Framework
    and none of those solve the problem.

Can anyone give me insight as to why I cannot create a new project for esp32? I have tried all sorts of methods and can’t even create a stinking hello world project. Any insight would be greatly appreciated.

VSCode Version: 1.63.2
Platformio Version: Core 5.1.0, Home 3.3.4
Espressif Platform Version: 3.4.0 (also tried 3.3.0 but with same failure)
OS: Windows 10, Intel i5 processor.

--------------------------------------------------------------------------------------------------------------------------
PIO Core Call Error: 
"The current working directory C:\\Users\\*username*\\OneDrive\\Documents\\PlatformIO\\Projects\\HelloEsp32 will be used for the project.\r\n\r\n
The next files/directories have been created in C:\\Users\\*username*\\OneDrive\\Documents\\PlatformIO\\Projects\\HelloEsp32\r\n
include - Put project header files here\r\nlib - Put here project specific (private) libraries\r\nsrc - Put project source files here\r\n
platformio.ini - Project Configuration File\r


Error: Processing nodemcu-32s (platform: espressif32; board: nodemcu-32s; framework: espidf)\r\n
--------------------------------------------------------------------------------\r\n
Verbose mode can be enabled via `-v, --verbose` option\r\n
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/nodemcu-32s.html\r\n
PLATFORM: Espressif 32 (3.4.0) > NodeMCU-32S\r\nHARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash\r\n
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)\r\nPACKAGES: \r\n - framework-espidf 3.40301.0 (4.3.1) \r\n
 - tool-cmake 3.16.4 \r\n
 - tool-esptoolpy 1.30100.210531 (3.1.0) \r\n
 - tool-idf 1.0.1 \r\n
 - tool-mconf 1.4060000.20190628 (406.0.0) \r\n
 - tool-ninja 1.9.0 \r\n
 - toolchain-esp32ulp 1.22851.191205 (2.28.51) \r\n
 - toolchain-riscv32-esp 8.4.0+2021r1 \r\n
 - toolchain-xtensa-esp32 8.4.0+2021r1 \r\n
 - toolchain-xtensa-esp32s2 8.4.0+2021r1\r\n
 WARNING: You are using pip version 21.0.1; however, version 21.3.1 is available.\r\n
 You should consider upgrading via the 'c:\\users\\*username*\\.platformio\\penv\\scripts\\python.exe -m pip install --upgrade pip' command.\r\n
 Reading CMake configuration...\r\n
 -- Project is not inside a git repository, or git repository has no commits; will not use 'git describe' to determine PROJECT_VER.\r\n
 -- Building ESP-IDF components for target esp32\r\n
 -- Project sdkconfig file C:/Users/*username*/OneDrive/Documents/PlatformIO/Projects/HelloEsp32/sdkconfig.nodemcu-32s\r\n
 -- Configuring incomplete, errors occurred!\r\n
 See also \"C:/Users/*username*/OneDrive/Documents/PlatformIO/Projects/HelloEsp32/.pio/build/nodemcu-32s/CMakeFiles/CMakeOutput.log\".\r\n
 
 
CMake Error at .pio/build/nodemcu-32s/CMakeFiles/git-data/grabRef.cmake:48 (file):\r\n
 file failed to open for reading (No such file or directory):\r\n
 C:/Users/*username*/OneDrive/Documents/PlatformIO/Projects/HelloEsp32/.pio/build/nodemcu-32s/CMakeFiles/git-data/head-ref\r\n
 Call Stack (most recent call first):\r\n
 C:/Users/*username*/.platformio/packages/framework-espidf/tools/cmake/third_party/GetGitRevisionDescription.cmake:80 (include)\r\n
 C:/Users/*username*/.platformio/packages/framework-espidf/tools/cmake/third_party/GetGitRevisionDescription.cmake:90 (get_git_head_revision)\r\n
 C:/Users/*username*/.platformio/packages/framework-espidf/tools/cmake/build.cmake:67 (git_describe)\r\n
 C:/Users/*username*/.platformio/packages/framework-espidf/tools/cmake/build.cmake:165 (__build_get_idf_git_revision)\r\n
 C:/Users/*username*/.platformio/packages/framework-espidf/tools/cmake/idf.cmake:50 (__build_init)\r\n
 C:/Users/*username*/.platformio/packages/framework-espidf/tools/cmake/project.cmake:7 (include)\r\n
 CMakeLists.txt:2 (include)\r\n
 
 
 CMake Error at .pio/build/nodemcu-32s/CMakeFiles/git-data/grabRef.cmake:48 (file):\r\n
 file failed to open for reading (No such file or directory):\r\n\r\n
 C:/Users/*username*/OneDrive/Documents/PlatformIO/Projects/HelloEsp32/.pio/build/nodemcu-32s/CMakeFiles/git-data/head-ref\r\n
 Call Stack (most recent call first):\r\n
 C:/Users/*username*/.platformio/packages/framework-espidf/tools/cmake/third_party/GetGitRevisionDescription.cmake:80 (include)\r\n
 C:/Users/*username*/.platformio/packages/framework-espidf/tools/cmake/third_party/GetGitRevisionDescription.cmake:90 (get_git_head_revision)\r\n
 C:/Users/*username*/.platformio/packages/framework-espidf/tools/cmake/project.cmake:52 (git_describe)\r\n
 C:/Users/*username*/.platformio/packages/framework-espidf/tools/cmake/project.cmake:395 (__project_get_revision)\r\n
 CMakeLists.txt:3 (project)\r\n\r\n\r\n
 
 
 CMake Error at C:/Users/*username*/.platformio/packages/framework-espidf/tools/cmake/crosstool_version_check.cmake:37 (message):\r\n 
 Toolchain:\r\n C:/Users/*username*/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc.exe,\r\n
 crosstool-ng version esp-2020r3 doesn't match supported version esp-2021r1\r\n\r\n
 Please try to run 'idf.py fullclean' to solve it quickly.\r\n\r\n
 Check Getting Started documentation if the error continues.\r\n\r\n
 You can override this error and proceed with build by defining the\r\n
 IDF_MAINTAINER environment variable.\r\n\r\n
 Call Stack (most recent call first):\r\n
 C:/Users/*username*/.platformio/packages/framework-espidf/components/esp32/project_include.cmake:31 (crosstool_version_check)\r\n
 C:/Users/*username*/.platformio/packages/framework-espidf/tools/cmake/build.cmake:315 (include)\r\n
 C:/Users/*username*/.platformio/packages/framework-espidf/tools/cmake/build.cmake:466 (__build_process_project_includes)\r\n
 C:/Users/*username*/.platformio/packages/framework-espidf/tools/cmake/project.cmake:399 (idf_build_process)\r\n
------------------------------------------------------------------------------------------------------------------------

Every single time I’ve seen that error it was because a user had a .git folder somewhere along the path to the project.

Check every folder on the way to C:/Users/*username*/OneDrive/Documents/PlatformIO/Projects/HelloEsp32/, meaning, C:\.git, C:\Users\.git, C:\Users\<username>\.git, et cetera. The .git folder is also a hidden folder, so make sure you activate the display of hiddin folders in the explorer.