Problem to setup correct ESP32 development framework using platformio.ini

I’m trying to set a following dev environment:

board = esp32dev
platform = espressif32
platform_packages =
    toolchain-xtensa-esp32@8.4.0+2021r2-patch3
    framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#2.0.3
framework = arduino

The problem is that my environment always picks up the toolchain-xtensa32 @ 2.50200.97 (5.2.0) even if it’s not selected. Please check my build log below:

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (3.5.0+sha.d93c9ef) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 15.96MB 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-arduinoespressif32 @ 2.0.3+sha.142fceb
 - tool-esptoolpy @ 1.30100.210531 (3.1.0)
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
 - toolchain-xtensa32 @ 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 70 compatible libraries
Scanning dependencies...
Dependency Graph

Your installed Espressif32 platform is outdated – use the most recent one by e.g. writing

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

or

platform = espressif32@5.1.0

in the platformio.ini

@maxgerhardt This solved my issue, but now whenever I change something in platformio.ini, Platformio downloads the platform and I need to wait 10 minutes each time. How can I avoid this?

That happens with platform = espressif32@5.1.0?

No, It happens with

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

Does it work with 5.1.0 still? Then you don’t need the .git one.

@maxgerhardt Seems like this test broke my dev environment. Now even the previous successful configuration doesn’t work. I’m getting the same error as before

platform = https://github.com/platformio/platform-espressif32.git
platform_packages =
    framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#2.0.3
    toolchain-xtensa-esp32@8.4.0+2021r2-patch3
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (5.1.0+sha.cdd0867) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 15.96MB 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 @ 2.0.3+sha.142fceb
 - tool-esptoolpy @ 1.30300.0 (3.3.0)
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3                 LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 70 compatible libraries
Scanning dependencies...