So when developing for the ESP32 with platformIO, one has three framework options (or more?) to work with:
framework = espidf (example)
framework = arduino (Since I’m a new user I can only put two links, example for this can be found at the same place as other two)
framework = espidf, arduino (example)
Can someone give (or point to) an indepth explanation of what the dependencies are in the different cases, which toolchain is used in which case and what the advantages and disadvantages of them are?
for framework = espidf, arduino: Special case of “Arduino as ESP-IDF component” (see here). The base framework here is again ESP-IDF, with Arduino core API implementations added as a component.
The ESP-IDF framework has an API aimed at more technically skilled users (see examples). Arduino is aimed at the beginner level (though you can achieve the same thing in every framework with enough of your own code). Arduino-as-ESP-IDF-component enables common Arduino libraries to run in an ESP-IDF environment by providing the needed Arduino APIs, so you can use the Arduino libs but also still use advanced ESP-IDF functions; compatibility mode, so to say.
But is it using the actually same toolchain files and version in all cases? I have xtensa-esp32-elf toolchain in at least four places on my computer currently:
C:\Users\User.espressif\tools\xtensa-esp32-elf\esp32-2019r1-8.2.0\xtensa-esp32-elf
C:\Users\User.espressif\tools\xtensa-esp32-elf\1.22.0-80-g6c4433a5-5.2.0\xtensa-esp32-elf
C:\Users\User.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf
C:\Users\User\AppData\Local\Arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0\xtensa-esp32-elf
I’ve read that readme regarding arduino as an esp-idf component already - but how does that apply for a platformIO project? do I also need to make a components folder in my platformio project and gitclone arduino framework into it? Seems not since it compiles also without having done that…
And is it supposed to compile the arduino framework in the “framework = espidf, arduino” case while using precompiled version in the “framework = arduino” case?
PIO will only ever use its compiler from its downloaded package and ignores everything else. So C:\Users\User\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf-* is used in all PIO compilations for ESP32, regardless of the framework.
Both framework are compiled from source and put into the firmware. (Durung linking of course, the precompiled libraries for each framework are added as always). See the build log.
So in all cases sources are only loaded from within
C:\Users\User.platformio…
And any installation of ESP-IDF (which installs to C:\Users\User.espressif) and Arduino with ESP32 package (which installs to C:\Users\User\AppData\Local\Arduino15\packages\esp32…) is ignored in the compilation process?
But I see that within C:\Users\User.platformio… some components are there once as precompiled lib like for example in
C:\Users\User.platformio\packages\framework-arduinoespressif32\tools\sdk\lib\libwear_levelling.a
and once as sourcecode
C:\Users\Users.platformio\packages\framework-espidf\components\wear_levelling\
whereas some seem to be only available precompiled such as
C:\Users\User.platformio\packages\framework-arduinoespressif32\tools\sdk\lib\libesp32-camera.a
in which of the three cases does it use the precompiled libs and how would I go about if I wanted for example libesp32-camera to be compiled from source as well?