Installing ESP-IDF 4.0 in platformio

Hey guys, I’m porting over a project which was built on ESPIDF v4.0, as we know setting the platform in pio to espressif32 only uses v3.something - which alas doesn’t work with my project.

I’ve set the platformio.ini file to pull the latest espidf framework from git with the following:

platform_packages =
  framework-espidf @ https://github.com/espressif/esp-idf.git

and it downloads it to the folder .platformio/packages/framework-espidf

However, it doesn’t seem to be linking the framework files correctly - I’m getting a lot of dependency issues (file not found errors) when building, which appear to be files in the framework themselves, not my project files:

compilation terminated.
In file included from lib/esp8266_wrapper/esp8266_wrapper.h:13:0,
                 from src/accelerometer.c:6:
/Users/pinchy/.platformio/packages/framework-espidf/components/freertos/include/freertos/FreeRTOS.h:98:26: fatal error: esp_compiler.h: No such file or directory

Did I miss a step when installing the framework? Is there something I need to do to modify my path? thanks for your help :slight_smile:

(I’m on OSX using VSCode)

Please see forum posts first, especially Support for ESP IDF v4 - #5 by ivankravets

Sorry, that post is how i knew how to add the upstream file in my platformio.ini. But it doesn’t actually solve my problem. (and it’s a month old with no answer to “when”)

From the post you linked:

“You can try ESP-IDF 4.0 with PlatformIO switching to upstream version of dev-platform”

Yep, I did “try” and it didn’t work. Hence my question.

What’s your complete platformio.ini and code?

barebones platformio.ini file:

[env:featheresp32]
board = featheresp32
platform = espressif32
platform_packages =
  framework-espidf @ https://github.com/espressif/esp-idf.git
framework = espidf
lib_ldf_mode = chain+

Not uploading the source code, there’s around a hundred files which successfully compiles using make outside of platformio. As mentioned I’m trying to port over a (working) project to platformio

And if you just try

platform = https://github.com/platformio/platform-espressif32.git

instead?

1 Like

Same problem on a Windows 10, Platformio running inside Atom (all fresh installs). The platformio.ini file reads

[env:upstream_develop]
platform = GitHub - platformio/platform-espressif32: Espressif 32: development platform for PlatformIO
board = fm-devkit
framework = espidf

Strangely enough it finds the includes for “nvs.h”, “nvs_flash.h”, “esp_log.h” and “freertos/FreeRTOS.h” but not any of the Bluetooth includes (e.g. “esp_bt.h”, “esp_gap_ble_api.h” etc.

Susan

Yep, that did it - thank you :slight_smile:

I found my issue: as currently distributed the ‘sdkconfig’ does NOT contain the Bluetooth options.
The work-around for me was to run the ‘idf.py menuconfig’ command in the project folder and select the required Bluetooth configurations.
Getting to the point where I could run that command was a bit of a trick as well - the V3 package contains the necessary ‘install.bat’ and ‘export.bat’ (and their xxx.sh cousins) but the V4 package does not. However running the install/export from V3 sort-of works (it seems to install cmake V3.13 rather than V3.16 that is in V4 - I had to edit the top level CMakeList.txt to alter the minimum version while the menuconfig ran and then set it back again).
After that the compile for my project ran smoothly.
Bottom line: either the V4 distribution needs to include ALL of the tools; (preferably) the V4 distribution needs to allow running ‘idf.py menuconfig’ to allow project-specific options to be set, or some other mechanism needs to be added to allow the same outcome.
Susan

I believe from another thread that the ability to run menuconfig is coming shortly, and sdkconfig will be generated automatically in the project directory. If I see the mention of that again, and remember to do so, I’ll link that here. :wink: