Problem compiling esp-idf v4.2

Hello, I am having trouble trying to compile project using framework-espidf v4.2 (I have to use this specific version)
I am met with following errors

Generating assembly for certificate bundle...
CMake Error at C:/Users/pavel/.platformio/packages/framework-espidf@3.40200.210118/tools/cmake/scripts/data_file_embed_asm.cmake:26 (file):
  file failed to open for reading (No such file or directory):

    C:\Users\pavel\Repos\esp32\.pio\build\doit\x509_crt_bundle


*** Error 1
Warning! Flash memory size mismatch detected. Expected 4MB, found 2MB!

and

*** [.pio\build\doit\memory.ld] Source `C:\Users\pavel\.platformio\packages\framework-espidf@3.40200.210118\components\esp_system\ld\esp32\memory.ld.in' not found, needed by target `.pio\build\doit\memory.ld'.

here is my platformio.ini

[env]
platform = espressif32
framework = 
	arduino
	espidf
platform_packages = 
	framework-espidf @ ~3.40200
	framework-arduinoespressif32 @ https:\//github.com/summivox/arduino-esp32.git#mod-idf-v4.2

monitor_speed = 115200
monitor_filters = esp32_exception_decoder

lib_deps = 
	blynkkk/Blynk@~1.2.0
	erropix/ESP32 AnalogWrite@^0.2
	adafruit/DHT sensor library@^1.4.3
	adafruit/Adafruit Unified Sensor@^1.1.4
	witnessmenow/UniversalTelegramBot@^1.3.0

I really am lost here, hope somebody can diagnose the issue.
Thank you in advance!

Here is full log if you need it

Processing doit (board: esp32doit-devkit-v1; platform: espressif32; 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.9.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 @ 0.0.0+sha.256d716
 - framework-espidf @ 3.40200.210118 (4.2.0)
 - tool-cmake @ 3.16.4
 - tool-esptoolpy @ 1.40501.0 (4.5.1)
 - tool-idf @ 1.0.1
 - tool-mconf @ 1.4060000.20190628 (406.0.0)
 - tool-ninja @ 1.9.0
 - toolchain-esp32ulp @ 1.23800.240113 (2.38.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! Couldn't find the main linker script in the CMake code model.
Generating assembly for certificate bundle...
CMake Error at C:/Users/pavel/.platformio/packages/framework-espidf@3.40200.210118/tools/cmake/scripts/data_file_embed_asm.cmake:26 (file):
  file failed to open for reading (No such file or directory):

    C:\Users\pavel\Repos\esp32\.pio\build\doit\x509_crt_bundle


*** Error 1
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...
Dependency Graph
|-- Blynk @ 1.2.0
|-- ESP32 AnalogWrite @ 0.2.0
|-- DHT sensor library @ 1.4.6
|-- Adafruit Unified Sensor @ 1.1.14
|-- UniversalTelegramBot @ 1.3.0
|-- WiFi @ 1.0
|-- WiFiClientSecure @ 1.0
Building in release mode
*** [.pio\build\doit\memory.ld] Source `C:\Users\pavel\.platformio\packages\framework-espidf@3.40200.210118\components\esp_system\ld\esp32\memory.ld.in' not found, needed by target `.pio\build\doit\memory.ld'.
================================ [FAILED] Took 27.96 seconds ================================

This was already fixed in later ESP-IDF, but if you need to stay at the buggy version, you need the workaround.

Thanks, I resolved the issue by using older platform version, the latest working version is platform = espressif32 @ ~4.4.0

1 Like