Using specific commit of the espidf

Hello,

I have created a new PlattformIO project with the espidf as the framework and successfully compiled this project. Now I want to use the espidf with the tag 3.3.2 with PlattformIO, so I changed my platformio.ini file in the following way:

[env]
platform = espressif32
framework = espidf
monitor_speed = 115200
platform_packages =
  ; Use the tag 3.3.2 of the espidf
  framework-espidf @ https://github.com/espressif/esp-idf.git#9e70825d1e1cbf7988cf36981774300066580ea7

[env:esp32dev]
board = esp32dev

But I get the following error

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (2.1.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
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)
PACKAGES:
 - framework-espidf 1.1.0+sha.9e70825d1
 - tool-cmake 3.16.4
 - tool-esptoolpy 1.30000.201119 (3.0.0)
 - tool-idf 1.0.1
 - tool-mconf 1.4060000.20190628 (406.0.0)
 - tool-ninja 1.9.0
 - toolchain-esp32ulp 1.22851.191205 (2.28.51)
 - toolchain-xtensa32 2.80200.200827 (8.2.0)
Reading CMake configuration...
-- Configuring incomplete, errors occurred!
See also ".../test9/.pio/build/esp32dev/CMakeFiles/CMakeOutput.log".

CMake Error at CMakeLists.txt:2 (include):
  include could not find load file:

    ...\.platformio\packages\framework-espidf/tools/cmake/project.cmake

How can I fix this error?

A painless way to use a “close” version as

[env]
platform = espressif32@1.10.0
framework = espidf
monitor_speed = 115200

[env:esp32dev]
board = esp32dev

since that platform version uses ESP-IDF v3.3 LTS (release notes). 1.9.0 would use ESP-IDF v.3.2.2.

I remember that older ESP-IDF versions (before 4) were integrated in PlatformIO by having a special build script, instead of calling into CMake.

So using the latest platform version which is meant for 4.x and later with older ESP-IDF may cause failures.

Thank you. This sounds like a good solution.

But I have another idea and maybe this will work. Would it be possible to fork the platform version 1.10.0 and replace the ESP-IDF with 3.3.2, upload this to my own Git and download it with PlatformIO?
How do I have to add my Git-Repository to my ini file?

Ah actually I just noticed another thing.

First of all, both methods can be used in conjunction, platform = espressif32@1.10.0 to get the builder code for ESP-IDF v3.x and platform_packages = framework-espidf @ https://github.com/espressif/esp-idf.git#9e70825d1e1cbf7988cf36981774300066580ea7 for the framework package.

However, looking at PlatformIO’s packaged versions at Service End for Bintray, JCenter, GoCenter, and ChartCenter | JFrog, there’s a file called 7548a7d-framework-espidf-3.30302.200710.tar.gz and the 303002 code should indicate ESP-IDF 3.3.2. That should be safer to use if PlatformIO’s package did some additions to the pure ESP-IDF code, like adding some python scripts to it and the package.json, which one would otherwise need to re-add / adapt if using a custom source for framework-espidf.

Example

[env]
platform = espressif32@1.10.0
framework = espidf
monitor_speed = 115200
platform_packages =
   framework-espidf@3.30302.200710

Hello,

that’s a good point. I tried this:

[env]
# Get the builder tools for ESP-IDF v3.x
# This version use the Arduino framework 1.04
platform = espressif32@1.10.0
framework = espidf, arduino
monitor_speed = 115200

platform_packages =
    # Use ESP-IDF 3.3.2
    framework-espidf@3.30202.190627
    framework-arduinoespressif32

[env:esp32dev]
board = esp32dev

And I get this error:

.../.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: cannot open linker script file esp32.project.ld: No such file or directory
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\esp32dev\firmware.elf] Error 1

Do I have to update the tools too?

Edit: I can compile and link the code when I use 1.10.0 only.

[env]
# Get the builder tools for ESP-IDF v3.x
# This version use the Arduino framework 1.04
platform = espressif32@1.10.0
framework = espidf, arduino
monitor_speed = 115200

platform_packages =
    # Use ESP-IDF 3.3.2
    #framework-espidf@3.30202.190627
    framework-arduinoespressif32# @ https://github.com/espressif/arduino-esp32.git#idf-release/v4.0

[env:esp32dev]
board = esp32dev

Hm the last line shouldn’t be needed, can you remove that? You’re not specifying a different version for that package there, so PlatformIO might get confused. It will pull the framework-arduinoespressfi32 version dictated by the platform.

I got some missing includes when I remove the line

platform = espressif32@1.10.0
framework = espidf, arduino
monitor_speed = 115200
platform_packages =
    # Use ESP-IDF 3.3.2
    framework-espidf@3.30202.190627
    #framework-arduinoespressif32
In file included from src\lora_LoRaWiFiTaskHandler.cpp:1:0:
include/lora_LoRaWiFiTaskHandler.h:4:22: fatal error: esp_wifi.h: No such file or directory

******************************************************************
* Looking for esp_wifi.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:esp_wifi.h"
* Web  > https://platformio.org/lib/search?query=header:esp_wifi.h
*
******************************************************************

compilation terminated.
In file included from src\lora_EncryptionHandler.cpp:1:0:
include/lora_EncryptionHandler.h:4:25: fatal error: mbedtls/aes.h: No such file or directory
compilation terminated.
*** [.pio\build\esp32dev\src\lora_LoRaWiFiTaskHandler.cpp.o] Error 1
*** [.pio\build\esp32dev\src\lora_EncryptionHandler.cpp.o] Error 1
In file included from include/UPSError.h:6:0,
                 from src\UPSWiFiConnection.cpp:5:
.../.platformio/packages/framework-arduinoespressif32@2.10003.190916/cores/esp32/Arduino.h:32:31: fatal error: freertos/FreeRTOS.h: No such file or directory
In file included from include/LoRa.h:7:0,
                 from include/lora_LoRaHandler.h:5,
                 from src\lora_LoRaHandler.cpp:1:
.../.platformio/packages/framework-arduinoespressif32@2.10003.190916/cores/esp32/Arduino.h:32:31: fatal error: freertos/FreeRTOS.h: No such file or directory
compilation terminated.
In file included from include/UPSSleep.h:6:0,
                 from src\UPSSleep.cpp:3:
.../.platformio/packages/framework-arduinoespressif32@2.10003.190916/cores/esp32/Arduino.h:32:31: fatal error: freertos/FreeRTOS.h: No such file or directory
compilation terminated.
compilation terminated.
In file included from include/UPSError.h:6:0,
                 from src\UPSError.cpp:3:
.../.platformio/packages/framework-arduinoespressif32@2.10003.190916/cores/esp32/Arduino.h:32:31: fatal error: freertos/FreeRTOS.h: No such file or directory
compilation terminated.
In file included from include/LoRa.h:7:0,
                 from src\LoRa.cpp:4:
.../.platformio/packages/framework-arduinoespressif32@2.10003.190916/cores/esp32/Arduino.h:32:31: fatal error: freertos/FreeRTOS.h: No such file or directory
compilation terminated.
*** [.pio\build\esp32dev\src\lora_LoRaHandler.cpp.o] Error 1
*** [.pio\build\esp32dev\src\UPSError.cpp.o] Error 1
*** [.pio\build\esp32dev\src\UPSWiFiConnection.cpp.o] Error 1
*** [.pio\build\esp32dev\src\LoRa.cpp.o] Error 1
*** [.pio\build\esp32dev\src\UPSSleep.cpp.o] Error 1