Difficulties compiling ESP-IDF

I am running Linux Mint with VScode and PlatformIO; all up to date.

I am using a piece of code that was seemingly written with the ESP-IDF (I can’t tell for sure).
The board is specified as ESP-DEVKIT_v1

Having a vanilla PIO install, which I successfully use to write Arduino projects.
I initially opened a new Arduino project, as I thought the code I had was for Arduino.
I then realised it seems to use the ESP-IDF; I looked up the documentation, and installed the pre-requisites for the ESP-IDF.

Here my screen:

I then changed the platform.ini as per documentation, to:

[env:esp32dev]
platform = espressif32
framework = espidf
board = esp32dev

PIO started installing a bunch of dependencies or files.

I then tried to compile the code and ended up with errors I seemingly can make no sense of it.
Here is the terminal response:

Executing task in folder EGO_Automation: platformio run 

Processing esp32dev (platform: espressif32; framework: espidf; board: esp32dev)
--------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (6.3.1) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, 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)
PACKAGES: 
 - framework-espidf @ 3.50002.230601 (5.0.2) 
 - tool-cmake @ 3.16.4 
 - tool-esptoolpy @ 1.40501.0 (4.5.1) 
 - tool-ninja @ 1.7.1 
 - toolchain-esp32ulp @ 1.23500.220830 (2.35.0) 
 - toolchain-xtensa-esp32 @ 11.2.0+2022r1
Reading CMake configuration...
-- Project is not inside a git repository, or git repository has no commits; will not use 'git describe' to determine PROJECT_VER.
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file /home/maxg/Workspaces/PlatformIO/ESP_Projects/EGO_Automation/sdkconfig.esp32dev
-- App "EGO_Automation" version: 1
-- Adding linker script /home/maxg/Workspaces/PlatformIO/ESP_Projects/EGO_Automation/.pio/build/esp32dev/esp-idf/esp_system/ld/memory.ld
-- Adding linker script /home/maxg/.platformio/packages/framework-espidf/components/esp_system/ld/esp32/sections.ld.in
-- Adding linker script /home/maxg/.platformio/packages/framework-espidf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script /home/maxg/.platformio/packages/framework-espidf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script /home/maxg/.platformio/packages/framework-espidf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script /home/maxg/.platformio/packages/framework-espidf/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld
-- Adding linker script /home/maxg/.platformio/packages/framework-espidf/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld
-- Adding linker script /home/maxg/.platformio/packages/framework-espidf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script /home/maxg/.platformio/packages/framework-espidf/components/soc/esp32/ld/esp32.peripherals.ld
-- Components: __pio_env app_trace app_update bootloader bootloader_support bt cmock console cxx driver efuse esp-tls esp_adc esp_app_format esp_common esp_eth esp_event esp_gdbstub esp_hid esp_http_client esp_http_server esp_https_ota esp_https_server esp_hw_support esp_lcd esp_local_ctrl esp_netif esp_partition esp_phy esp_pm esp_psram esp_ringbuf esp_rom esp_system esp_timer esp_wifi espcoredump esptool_py fatfs freertos hal heap http_parser idf_test ieee802154 json log lwip mbedtls mqtt newlib nvs_flash openthread partition_table perfmon protobuf-c protocomm pthread sdmmc soc spi_flash spiffs src tcp_transport ulp unity usb vfs wear_levelling wifi_provisioning wpa_supplicant xtensa
-- Component paths: /home/maxg/.platformio/packages/framework-espidf/components/__pio_env /home/maxg/.platformio/packages/framework-espidf/components/app_trace /home/maxg/.platformio/packages/framework-espidf/components/app_update /home/maxg/.platformio/packages/framework-espidf/components/bootloader /home/maxg/.platformio/packages/framework-espidf/components/bootloader_support /home/maxg/.platformio/packages/framework-espidf/components/bt /home/maxg/.platformio/packages/framework-espidf/components/cmock /home/maxg/.platformio/packages/framework-espidf/components/console /home/maxg/.platformio/packages/framework-espidf/components/cxx /home/maxg/.platformio/packages/framework-espidf/components/driver /home/maxg/.platformio/packages/framework-espidf/components/efuse /home/maxg/.platformio/packages/framework-espidf/components/esp-tls /home/maxg/.platformio/packages/framework-espidf/components/esp_adc /home/maxg/.platformio/packages/framework-espidf/components/esp_app_format /home/maxg/.platformio/packages/framework-espidf/components/esp_common /home/maxg/.platformio/packages/framework-espidf/components/esp_eth /home/maxg/.platformio/packages/framework-espidf/components/esp_event /home/maxg/.platformio/packages/framework-espidf/components/esp_gdbstub /home/maxg/.platformio/packages/framework-espidf/components/esp_hid /home/maxg/.platformio/packages/framework-espidf/components/esp_http_client /home/maxg/.platformio/packages/framework-espidf/components/esp_http_server /home/maxg/.platformio/packages/framework-espidf/components/esp_https_ota /home/maxg/.platformio/packages/framework-espidf/components/esp_https_server /home/maxg/.platformio/packages/framework-espidf/components/esp_hw_support /home/maxg/.platformio/packages/framework-espidf/components/esp_lcd /home/maxg/.platformio/packages/framework-espidf/components/esp_local_ctrl /home/maxg/.platformio/packages/framework-espidf/components/esp_netif /home/maxg/.platformio/packages/framework-espidf/components/esp_partition /home/maxg/.platformio/packages/framework-espidf/components/esp_phy /home/maxg/.platformio/packages/framework-espidf/components/esp_pm /home/maxg/.platformio/packages/framework-espidf/components/esp_psram /home/maxg/.platformio/packages/framework-espidf/components/esp_ringbuf /home/maxg/.platformio/packages/framework-espidf/components/esp_rom /home/maxg/.platformio/packages/framework-espidf/components/esp_system /home/maxg/.platformio/packages/framework-espidf/components/esp_timer /home/maxg/.platformio/packages/framework-espidf/components/esp_wifi /home/maxg/.platformio/packages/framework-espidf/components/espcoredump /home/maxg/.platformio/packages/framework-espidf/components/esptool_py /home/maxg/.platformio/packages/framework-espidf/components/fatfs /home/maxg/.platformio/packages/framework-espidf/components/freertos /home/maxg/.platformio/packages/framework-espidf/components/hal /home/maxg/.platformio/packages/framework-espidf/components/heap /home/maxg/.platformio/packages/framework-espidf/components/http_parser /home/maxg/.platformio/packages/framework-espidf/components/idf_test /home/maxg/.platformio/packages/framework-espidf/components/ieee802154 /home/maxg/.platformio/packages/framework-espidf/components/json /home/maxg/.platformio/packages/framework-espidf/components/log /home/maxg/.platformio/packages/framework-espidf/components/lwip /home/maxg/.platformio/packages/framework-espidf/components/mbedtls /home/maxg/.platformio/packages/framework-espidf/components/mqtt /home/maxg/.platformio/packages/framework-espidf/components/newlib /home/maxg/.platformio/packages/framework-espidf/components/nvs_flash /home/maxg/.platformio/packages/framework-espidf/components/openthread /home/maxg/.platformio/packages/framework-espidf/components/partition_table /home/maxg/.platformio/packages/framework-espidf/components/perfmon /home/maxg/.platformio/packages/framework-espidf/components/protobuf-c /home/maxg/.platformio/packages/framework-espidf/components/protocomm /home/maxg/.platformio/packages/framework-espidf/components/pthread /home/maxg/.platformio/packages/framework-espidf/components/sdmmc /home/maxg/.platformio/packages/framework-espidf/components/soc /home/maxg/.platformio/packages/framework-espidf/components/spi_flash /home/maxg/.platformio/packages/framework-espidf/components/spiffs /home/maxg/Workspaces/PlatformIO/ESP_Projects/EGO_Automation/src /home/maxg/.platformio/packages/framework-espidf/components/tcp_transport /home/maxg/.platformio/packages/framework-espidf/components/ulp /home/maxg/.platformio/packages/framework-espidf/components/unity /home/maxg/.platformio/packages/framework-espidf/components/usb /home/maxg/.platformio/packages/framework-espidf/components/vfs /home/maxg/.platformio/packages/framework-espidf/components/wear_levelling /home/maxg/.platformio/packages/framework-espidf/components/wifi_provisioning /home/maxg/.platformio/packages/framework-espidf/components/wpa_supplicant /home/maxg/.platformio/packages/framework-espidf/components/xtensa
-- Configuring incomplete, errors occurred!

fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
CMake Error at .pio/build/esp32dev/CMakeFiles/git-data/grabRef.cmake:48 (file):
  file failed to open for reading (No such file or directory):

    /home/maxg/Workspaces/PlatformIO/ESP_Projects/EGO_Automation/.pio/build/esp32dev/CMakeFiles/git-data/head-ref
Call Stack (most recent call first):
  /home/maxg/.platformio/packages/framework-espidf/tools/cmake/third_party/GetGitRevisionDescription.cmake:80 (include)
  /home/maxg/.platformio/packages/framework-espidf/tools/cmake/third_party/GetGitRevisionDescription.cmake:90 (get_git_head_revision)
  /home/maxg/.platformio/packages/framework-espidf/tools/cmake/project.cmake:61 (git_describe)
  /home/maxg/.platformio/packages/framework-espidf/tools/cmake/project.cmake:443 (__project_get_revision)
  CMakeLists.txt:3 (project)


fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: not a git repository: /home/maxg/.platformio/packages/framework-espidf/components/openthread/openthread/../../../.git/modules/components/openthread/openthread

=============================================== [FAILED] Took 2.26 seconds ===============================================

 *  The terminal process "platformio 'run'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

It seems to complain about git… and I am lost.

Any hints to make this work would be appreciated.
Happy to supply anything else that might help troubleshooting; thanks.

6.3.1 is quite old, the latest is 6.7.0.

Handling of the Python and ESP-IDF packages might have changed drastically. So I’d recommend just nuking PlatformIO and letting it reinstall all the latest versions.

  1. Close VSCode
  2. rm -rf ~/.platformio
  3. Restart VSCode
  4. Wait for it to reinstall

Given that no custom modifications to packages files were made, this is safe. (Plus you can always revert to older platform versions with e.g. espressif32@6.3.1 if something reall stopped working.)

1 Like

Thank you for your speedy response…
I followed your instructions (was a bit scared at first to delete my .platformio folder :slight_smile: )

I opened VScode, PIO reinstalled itself, I opened the c file, and get this:

[proc] Executing command: /usr/bin/gcc-12 -v
[main] Configuring project: EGO_Automation 
[proc] Executing command: /usr/bin/cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc-12 -S/home/maxg/Workspaces/esp-idf/EGO_Automation -B/home/maxg/Workspaces/esp-idf/EGO_Automation/build -G Ninja
[cmake] CMake Error at CMakeLists.txt:5 (include):
[cmake]   include could not find requested file:
[cmake] 
[cmake]     /tools/cmake/project.cmake
[cmake] 
[cmake] 
[cmake] Not searching for unused variables given on the command line.
[cmake] -- The C compiler identification is GNU 12.3.0
[cmake] -- The CXX compiler identification is GNU 11.4.0
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Check for working C compiler: /usr/bin/gcc-12 - skipped
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: /usr/bin/c++ - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "/home/maxg/Workspaces/esp-idf/EGO_Automation/build/CMakeFiles/CMakeOutput.log".
[proc] The command: /usr/bin/cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc-12 -S/home/maxg/Workspaces/esp-idf/EGO_Automation -B/home/maxg/Workspaces/esp-idf/EGO_Automation/build -G Ninja exited with code: 1
[main] Configuring project: EGO_Automation 
[proc] Executing command: /usr/bin/cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc-12 -S/home/maxg/Workspaces/esp-idf/EGO_Automation -B/home/maxg/Workspaces/esp-idf/EGO_Automation/build -G Ninja
[cmake] CMake Error at CMakeLists.txt:5 (include):
[cmake]   include could not find requested file:
[cmake] 
[cmake]     /tools/cmake/project.cmake
[cmake] 
[cmake] 
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "/home/maxg/Workspaces/esp-idf/EGO_Automation/build/CMakeFiles/CMakeOutput.log".
[proc] The command: /usr/bin/cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc-12 -S/home/maxg/Workspaces/esp-idf/EGO_Automation -B/home/maxg/Workspaces/esp-idf/EGO_Automation/build -G Ninja exited with code: 1

The /home/maxg/Workspaces/esp-idf/EGO_Automation/build/CMakeFiles/CMakeOutput.log shows this

The system is: Linux - 6.5.0-28-generic - x86_64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: /usr/bin/gcc-12 
Build flags: 
Id flags:  

The output was:
0


Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out"

The C compiler identification is GNU, found in "/home/maxg/Workspaces/esp-idf/EGO_Automation/build/CMakeFiles/3.25.1/CompilerIdC/a.out"

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: /usr/bin/c++ 
Build flags: 
Id flags:  

The output was:
0


Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out"

The CXX compiler identification is GNU, found in "/home/maxg/Workspaces/esp-idf/EGO_Automation/build/CMakeFiles/3.25.1/CompilerIdCXX/a.out"

Detecting C compiler ABI info compiled with the following output:
Change Dir: /home/maxg/Workspaces/esp-idf/EGO_Automation/build/CMakeFiles/CMakeScratch/TryCompile-QLHxQp

Run Build Command(s):/usr/bin/ninja cmTC_2d8f6 && [1/2] Building C object CMakeFiles/cmTC_2d8f6.dir/CMakeCCompilerABI.c.o
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc-12
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 12.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-12 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-12-ALHxjy/gcc-12-12.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-12-ALHxjy/gcc-12-12.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.3.0 (Ubuntu 12.3.0-1ubuntu1~22.04) 
COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_2d8f6.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_2d8f6.dir/'
 /usr/lib/gcc/x86_64-linux-gnu/12/cc1 -quiet -v -imultiarch x86_64-linux-gnu /usr/share/cmake-3.25/Modules/CMakeCCompilerABI.c -quiet -dumpdir CMakeFiles/cmTC_2d8f6.dir/ -dumpbase CMakeCCompilerABI.c.c -dumpbase-ext .c -mtune=generic -march=x86-64 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccv1j1yv.s
GNU C17 (Ubuntu 12.3.0-1ubuntu1~22.04) version 12.3.0 (x86_64-linux-gnu)
	compiled by GNU C version 12.3.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP


... deleted some stuff here, as the post is too big




Parsed CXX implicit include dir info from above output: rv=done
  found start of include info
  found start of implicit include info
    add: [/usr/include/c++/11]
    add: [/usr/include/x86_64-linux-gnu/c++/11]
    add: [/usr/include/c++/11/backward]
    add: [/usr/lib/gcc/x86_64-linux-gnu/11/include]
    add: [/usr/local/include]
    add: [/usr/include/x86_64-linux-gnu]
    add: [/usr/include]
  end of search list found
  collapse include dir [/usr/include/c++/11] ==> [/usr/include/c++/11]
  collapse include dir [/usr/include/x86_64-linux-gnu/c++/11] ==> [/usr/include/x86_64-linux-gnu/c++/11]
  collapse include dir [/usr/include/c++/11/backward] ==> [/usr/include/c++/11/backward]
  collapse include dir [/usr/lib/gcc/x86_64-linux-gnu/11/include] ==> [/usr/lib/gcc/x86_64-linux-gnu/11/include]
  collapse include dir [/usr/local/include] ==> [/usr/local/include]
  collapse include dir [/usr/include/x86_64-linux-gnu] ==> [/usr/include/x86_64-linux-gnu]
  collapse include dir [/usr/include] ==> [/usr/include]
  implicit include dirs: [/usr/include/c++/11;/usr/include/x86_64-linux-gnu/c++/11;/usr/include/c++/11/backward;/usr/lib/gcc/x86_64-linux-gnu/11/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include]


Parsed CXX implicit link information from above output:
  link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)]
  ignore line: [Change Dir: /home/maxg/Workspaces/esp-idf/EGO_Automation/build/CMakeFiles/CMakeScratch/TryCompile-Din4cm]
  ignore line: []
  ignore line: [Run Build Command(s):/usr/bin/ninja cmTC_d83c4 && [1/2] Building CXX object CMakeFiles/cmTC_d83c4.dir/CMakeCXXCompilerABI.cpp.o]
  ignore line: [Using built-in specs.]
  ignore line: [COLLECT_GCC=/usr/bin/c++]
  ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa]
  ignore line: [OFFLOAD_TARGET_DEFAULT=1]
  ignore line: [Target: x86_64-linux-gnu]
  ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.4.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2]
  ignore line: [Thread model: posix]
  ignore line: [Supported LTO compression algorithms: zlib zstd]
  ignore line: [gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04) ]
  ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_d83c4.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_d83c4.dir/']
  ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/11/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE /usr/share/cmake-3.25/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpdir CMakeFiles/cmTC_d83c4.dir/ -dumpbase CMakeCXXCompilerABI.cpp.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/cco4g9xl.s]
  ignore line: [GNU C++17 (Ubuntu 11.4.0-1ubuntu1~22.04) version 11.4.0 (x86_64-linux-gnu)]
  ignore line: [	compiled by GNU C version 11.4.0  GMP version 6.2.1  MPFR version 4.1.0  MPC version 1.2.1  isl version isl-0.24-GMP]
  ignore line: []
  ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072]
  ignore line: [ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/11"]
  ignore line: [ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"]
  ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/include-fixed"]
  ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include"]
  ignore line: [#include "..." search starts here:]
  ignore line: [#include <...> search starts here:]
  ignore line: [ /usr/include/c++/11]
  ignore line: [ /usr/include/x86_64-linux-gnu/c++/11]
  ignore line: [ /usr/include/c++/11/backward]
  ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/11/include]
  ignore line: [ /usr/local/include]
  ignore line: [ /usr/include/x86_64-linux-gnu]
  ignore line: [ /usr/include]
  ignore line: [End of search list.]
  ignore line: [GNU C++17 (Ubuntu 11.4.0-1ubuntu1~22.04) version 11.4.0 (x86_64-linux-gnu)]
  ignore line: [	compiled by GNU C version 11.4.0  GMP version 6.2.1  MPFR version 4.1.0  MPC version 1.2.1  isl version isl-0.24-GMP]
  ignore line: []
  ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072]
  ignore line: [Compiler executable checksum: d591828bb4d392ae8b7b160e5bb0b95f]
  ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_d83c4.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_d83c4.dir/']
  ignore line: [ as -v --64 -o CMakeFiles/cmTC_d83c4.dir/CMakeCXXCompilerABI.cpp.o /tmp/cco4g9xl.s]
  ignore line: [GNU assembler version 2.38 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.38]
  ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/]
  ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../:/lib/:/usr/lib/]
  ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_d83c4.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_d83c4.dir/CMakeCXXCompilerABI.cpp.']
  ignore line: [[2/2] Linking CXX executable cmTC_d83c4]
  ignore line: [Using built-in specs.]
  ignore line: [COLLECT_GCC=/usr/bin/c++]
  ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper]
  ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa]
  ignore line: [OFFLOAD_TARGET_DEFAULT=1]
  ignore line: [Target: x86_64-linux-gnu]
  ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.4.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2]
  ignore line: [Thread model: posix]
  ignore line: [Supported LTO compression algorithms: zlib zstd]
  ignore line: [gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04) ]
  ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/]
  ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../:/lib/:/usr/lib/]
  ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_d83c4' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_d83c4.']
  link line: [ /usr/lib/gcc/x86_64-linux-gnu/11/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper -plugin-opt=-fresolution=/tmp/ccT3mIpr.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_d83c4 /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/11 -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/11/../../.. CMakeFiles/cmTC_d83c4.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o]
    arg [/usr/lib/gcc/x86_64-linux-gnu/11/collect2] ==> ignore
    arg [-plugin] ==> ignore
    arg [/usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so] ==> ignore
    arg [-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper] ==> ignore
    arg [-plugin-opt=-fresolution=/tmp/ccT3mIpr.res] ==> ignore
    arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore
    arg [-plugin-opt=-pass-through=-lgcc] ==> ignore
    arg [-plugin-opt=-pass-through=-lc] ==> ignore
    arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore
    arg [-plugin-opt=-pass-through=-lgcc] ==> ignore
    arg [--build-id] ==> ignore
    arg [--eh-frame-hdr] ==> ignore
    arg [-m] ==> ignore
    arg [elf_x86_64] ==> ignore
    arg [--hash-style=gnu] ==> ignore
    arg [--as-needed] ==> ignore
    arg [-dynamic-linker] ==> ignore
    arg [/lib64/ld-linux-x86-64.so.2] ==> ignore
    arg [-pie] ==> ignore
    arg [-znow] ==> ignore
    arg [-zrelro] ==> ignore
    arg [-o] ==> ignore
    arg [cmTC_d83c4] ==> ignore
    arg [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o]
    arg [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o]
    arg [/usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o]
    arg [-L/usr/lib/gcc/x86_64-linux-gnu/11] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/11]
    arg [-L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu]
    arg [-L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib]
    arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu]
    arg [-L/lib/../lib] ==> dir [/lib/../lib]
    arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu]
    arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib]
    arg [-L/usr/lib/gcc/x86_64-linux-gnu/11/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../..]
    arg [CMakeFiles/cmTC_d83c4.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore
    arg [-lstdc++] ==> lib [stdc++]
    arg [-lm] ==> lib [m]
    arg [-lgcc_s] ==> lib [gcc_s]
    arg [-lgcc] ==> lib [gcc]
    arg [-lc] ==> lib [c]
    arg [-lgcc_s] ==> lib [gcc_s]
    arg [-lgcc] ==> lib [gcc]
    arg [/usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o]
    arg [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o]
  collapse obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o] ==> [/usr/lib/x86_64-linux-gnu/Scrt1.o]
  collapse obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o] ==> [/usr/lib/x86_64-linux-gnu/crti.o]
  collapse obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o] ==> [/usr/lib/x86_64-linux-gnu/crtn.o]
  collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/11] ==> [/usr/lib/gcc/x86_64-linux-gnu/11]
  collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu]
  collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib] ==> [/usr/lib]
  collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu]
  collapse library dir [/lib/../lib] ==> [/lib]
  collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu]
  collapse library dir [/usr/lib/../lib] ==> [/usr/lib]
  collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../..] ==> [/usr/lib]
  implicit libs: [stdc++;m;gcc_s;gcc;c;gcc_s;gcc]
  implicit objs: [/usr/lib/x86_64-linux-gnu/Scrt1.o;/usr/lib/x86_64-linux-gnu/crti.o;/usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o;/usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o;/usr/lib/x86_64-linux-gnu/crtn.o]
  implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/11;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib]
  implicit fwks: []

I am not sure what to make of it.

The VScode screen has changed too (after the reinstall); this is what I see:

Must have something to do with this:
image

There is no platformio.ini file anymore.

Also, my c file throws lots of errors, which are usually related to a missing Arduino.h include.

Ah but now that comes from what looks like the ESP-IDF or CMake extension. Those are incompatible with PlatformIO, you don’t want the project to be built with CMake. Disable both those extensions for your workspace and restart VSCode. Delete the build folder needed.

OK, disabled those… still no dice…

There is no ‘compile’ button in the status bar.

BTW: my code file compiles in the Arduino IDE with the DOIT ESP32 DEVKIT V1 board without errors.

The platformio.ini is gone? PlatformIO needs that. Then, the .pio folder should appear too and PlatformIO should work generating that intellisense.

Note: It needs at least one build with PlatformIO to get correct intellisense.

Also since I see errors about “Serial”: This looks very much Arduino-y. If you’re sure this is using ESP-IDF in a way regular Arduino-ESP32 cannot provide, you need framework = espidf, arduino, too, plus a sdkconfig.defaults that enables the Arduino core to be correctly built. See https://github.com/platformio/platform-espressif32/tree/develop/examples/espidf-arduino-blink

If the entire code compiles fine in the Arduino IDE, then for sure, framework = arduino will be able to built it too, without any ESP-IDF compiled from source. Arduino-ESP32 contains a precompiled copy of ESP-IDF, after all.

1 Like

I have silly question: all I want to achieve is working in VScode like I did with the Arduino framework but with the esp-idf. Is this possible at all?

Don’t really want to work this project with the Arduino IDE.

I worked of this document: https://docs.platformio.org/en/latest/frameworks/espidf.html#configuration which sort of implies it works with PlatformIO.

Well, I just started a new project with the esp-idf framework… and it says please wait (downloading stuff) :slight_smile:

While it is doing that…

The file I have includes #include "soc/uart_reg.h", which did not exist when selecting the Arduino framework; hence, my switch to the esp-idf.

Given that I selected the esp32 framework in the Arduino IDE and it worked, maybe I should have selected something other than esp-idf in PIO.

(PIO is still downloading…)

Thank you for hanging in there… much appreciated.

Alright… PIO completed its downloads; followed your link…

My platformio.ini looks like this now:

[env:esp32doit-devkit-v1]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino, espidf
monitor_speed = 115200

VScode/PIO looks normal again:

However, compiling results in:

 *  Executing task in folder EGO_Automation: platformio run 

Processing esp32doit-devkit-v1 (platform: espressif32; board: esp32doit-devkit-v1; framework: arduino, espidf)
-------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32doit-devkit-v1.html
PLATFORM: Espressif 32 (6.7.0) > DOIT ESP32 DEVKIT V1
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, 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)
PACKAGES: 
 - framework-arduinoespressif32 @ 3.20016.0 (2.0.16) 
 - framework-espidf @ 3.40407.240606 (4.4.7) 
 - tool-cmake @ 3.16.4 
 - tool-esptoolpy @ 1.40501.0 (4.5.1) 
 - tool-ninja @ 1.7.1 
 - toolchain-esp32ulp @ 1.23500.220830 (2.35.0) 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Warning! Arduino framework as an ESP-IDF component doesn't handle the `variant` field! The default `esp32` variant will be used.
Reading CMake configuration...
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file /home/maxg/Documents/PlatformIO/Projects/EGO_Automation/sdkconfig.esp32doit-devkit-v1
-- App "EGO_Automation" version: f8fbabd
-- Adding linker script /home/maxg/Documents/PlatformIO/Projects/EGO_Automation/.pio/build/esp32doit-devkit-v1/esp-idf/esp_system/ld/memory.ld
-- Adding linker script /home/maxg/.platformio/packages/framework-espidf@3.40407.240606/components/esp_system/ld/esp32/sections.ld.in
-- Adding linker script /home/maxg/.platformio/packages/framework-espidf@3.40407.240606/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script /home/maxg/.platformio/packages/framework-espidf@3.40407.240606/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script /home/maxg/.platformio/packages/framework-espidf@3.40407.240606/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script /home/maxg/.platformio/packages/framework-espidf@3.40407.240606/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld
-- Adding linker script /home/maxg/.platformio/packages/framework-espidf@3.40407.240606/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld
-- Adding linker script /home/maxg/.platformio/packages/framework-espidf@3.40407.240606/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script /home/maxg/.platformio/packages/framework-espidf@3.40407.240606/components/esp_rom/esp32/ld/esp32.rom.newlib-time.ld
-- Adding linker script /home/maxg/.platformio/packages/framework-espidf@3.40407.240606/components/soc/esp32/ld/esp32.peripherals.ld
-- Configuring incomplete, errors occurred!
See also "/home/maxg/Documents/PlatformIO/Projects/EGO_Automation/.pio/build/esp32doit-devkit-v1/CMakeFiles/CMakeOutput.log".

fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: not a git repository: /home/maxg/.platformio/packages/framework-espidf@3.40407.240606/components/openthread/openthread/../../../.git/modules/components/openthread/openthread
CMake Error at /home/maxg/.platformio/packages/framework-arduinoespressif32/CMakeLists.txt:218 (message):
  esp32-arduino requires CONFIG_FREERTOS_HZ=1000 (currently 100)



================================================= [FAILED] Took 2.70 seconds =================================================

 *  The terminal process "platformio 'run'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

Why is it complaining about git?


I did a git init, which did not change a thing.

Also added sdkconfig.defaults, also no change…

Yep. That’s why I talked about with

You need to copy-paste the sdkconfig.defaults into the root of the project (same level as platformio.ini), delete any existing sdkconfig.esp32 file if existing (otherwise it won’t be regenerated) and build again.

Yep, done… all seems to work; thank you for your support; much appreciated!

This is the compile result:

 *  Executing task in folder EGO_Automation: platformio run 

Processing esp32doit-devkit-v1 (platform: espressif32; board: esp32doit-devkit-v1; framework: arduino, espidf)
-------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32doit-devkit-v1.html
PLATFORM: Espressif 32 (6.7.0) > DOIT ESP32 DEVKIT V1
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, 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)
PACKAGES: 
 - framework-arduinoespressif32 @ 3.20016.0 (2.0.16) 
 - framework-espidf @ 3.40407.240606 (4.4.7) 
 - tool-cmake @ 3.16.4 
 - tool-esptoolpy @ 1.40501.0 (4.5.1) 
 - tool-ninja @ 1.7.1 
 - toolchain-esp32ulp @ 1.23500.220830 (2.35.0) 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Warning! Arduino framework as an ESP-IDF component doesn't handle the `variant` field! The default `esp32` variant will be used.
Reading CMake configuration...
Warning! Flash memory size mismatch detected. Expected 4MB, found 2MB!
Please select a proper value in your `sdkconfig.defaults` or via the `menuconfig` target!
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 33 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/esp32doit-devkit-v1/src/main.cpp.o
Compiling .pio/build/esp32doit-devkit-v1/cbor/tinycbor/src/cborpretty.c.o
Compiling .pio/build/esp32doit-devkit-v1/cbor/tinycbor/src/cbortojson.c.o
Compiling .pio/build/esp32doit-devkit-v1/cbor/tinycbor/src/cborvalidation.c.o
Compiling .pio/build/esp32doit-devkit-v1/cbor/tinycbor/src/open_memstream.c.o
Compiling .pio/build/esp32doit-devkit-v1/cmock/CMock/src/cmock.c.o
Compiling .pio/build/esp32doit-devkit-v1/coap/libcoap/src/address.c.o
Archiving .pio/build/esp32doit-devkit-v1/esp-idf/cmock/libcmock.a
Compiling .pio/build/esp32doit-devkit-v1/coap/libcoap/src/async.c.o
Indexing .pio/build/esp32doit-devkit-v1/esp-idf/cmock/libcmock.a
Compiling .pio/build/esp32doit-devkit-v1/coap/libcoap/src/block.c.o
Archiving .pio/build/esp32doit-devkit-v1/esp-idf/cbor/libcbor.a
Compiling .pio/build/esp32doit-devkit-v1/coap/libcoap/src/coap_asn1.c.o
Indexing .pio/build/esp32doit-devkit-v1/esp-idf/cbor/libcbor.a
Compiling .pio/build/esp32doit-devkit-v1/coap/libcoap/src/coap_cache.c.o
Compiling .pio/build/esp32doit-devkit-v1/coap/libcoap/src/coap_debug.c.o
src/main.cpp: In function 'void sendMessage(const uint8_t*)':
src/main.cpp:321:13: error: 'timerAlarm' was not declared in this scope
             timerAlarm(timer, (MSG_INTERVAL_MS-MSG_TRANSMISSION_TIME_US) * 2, true, 0);
             ^~~~~~~~~~
src/main.cpp:321:13: note: suggested alternative: 'timerStart'
Compiling .pio/build/esp32doit-devkit-v1/coap/libcoap/src/coap_event.c.o
             timerAlarm(timer, (MSG_INTERVAL_MS-MSG_TRANSMISSION_TIME_US) * 2, true, 0);
             ^~~~~~~~~~
             timerStart
src/main.cpp: In function 'void setup()':
src/main.cpp:371:31: warning: unsigned conversion from 'int' to 'uint8_t' {aka 'unsigned char'} changes value from '1000000' to '64' [-Woverflow]
     timer = timerBegin(1000000);                // timer at 1MHz
                               ^
src/main.cpp:371:31: error: too few arguments to function 'hw_timer_t* timerBegin(uint8_t, uint16_t, bool)'
In file included from /home/maxg/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal.h:92,
                 from /home/maxg/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:36,
                 from src/main.cpp:16:
/home/maxg/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-timer.h:33:14: note: declared here
 hw_timer_t * timerBegin(uint8_t timer, uint16_t divider, bool countUp);
              ^~~~~~~~~~
src/main.cpp:372:43: error: too few arguments to function 'void timerAttachInterrupt(hw_timer_t*, void (*)(), bool)'
     timerAttachInterrupt(timer, &timer_isr);
                                           ^
In file included from /home/maxg/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal.h:92,
                 from /home/maxg/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:36,
                 from src/main.cpp:16:
/home/maxg/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-timer.h:40:6: note: declared here
 void timerAttachInterrupt(hw_timer_t *timer, void (*fn)(void), bool edge);
      ^~~~~~~~~~~~~~~~~~~~
src/main.cpp:373:5: error: 'timerAlarm' was not declared in this scope
     timerAlarm(timer, MSG_INTERVAL_MS, true, 0);
     ^~~~~~~~~~
src/main.cpp:373:5: note: suggested alternative: 'timerStart'
     timerAlarm(timer, MSG_INTERVAL_MS, true, 0);
     ^~~~~~~~~~
     timerStart
src/main.cpp: In function 'void loop()':
src/main.cpp:430:9: error: 'timerAlarm' was not declared in this scope
         timerAlarm(timer, MSG_INTERVAL_MS, true, 0);
         ^~~~~~~~~~
src/main.cpp:430:9: note: suggested alternative: 'timerStart'
         timerAlarm(timer, MSG_INTERVAL_MS, true, 0);
         ^~~~~~~~~~
         timerStart
Compiling .pio/build/esp32doit-devkit-v1/coap/libcoap/src/coap_hashkey.c.o
Compiling .pio/build/esp32doit-devkit-v1/coap/libcoap/src/coap_io.c.o
Compiling .pio/build/esp32doit-devkit-v1/coap/libcoap/src/coap_mbedtls.c.o
*** [.pio/build/esp32doit-devkit-v1/src/main.cpp.o] Error 1
================================================= [FAILED] Took 6.45 seconds =================================================

 *  The terminal process "platformio 'run'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

I shall figure out the compile errors by comparing the libraries between this setup and the Arduino libraries, where my program compiles w/o errors.

Can tell you already: The timerAlarm() code is for Arduino-ESP32 3.x.

PlatformIO is still on the Arduino-ESP32 2.x core. That had a different API. Compare

vs

if you want to build the latest Arduino-ESP32 3.x WITH ESP-IDF as a base build, you’re gonna need Tasmota’s fork for that. (https://github.com/Jason2866/platform-espressif32). The current standard espressif32 platform is not up to date on that yet.

So a change to

platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF5
1 Like

Man, how do you do it?! Awesome!
Another problem I would have never figured out myself.

After updating the udev rules, my code compiled error-free!

Thank you so much.