Using ESP-IFD v4.4/v4.3.2 examples with PlatformIO Core, version 5.2.5?

Thanks very much @maxgerhardt .

The platform example espidf-blink builds without problems using ‘pio run’. It comes with sources in src and CONFIG_BLINK_GPIO=2 and thus gives a nice blinking LED after pio run --target upload.

So my first fault was to take examples from an independent git clone. Lesson learned is to take examples for use with PlatformIO always from ${HOME}/.platformio/packages/framework-espidf where version.txt tells 4.3.2. But as I found out it doesn’t change a lot.

So I took restful_server from within that copy of IDF and tried to create platformio.ini with pio project init -b esp32doit-devkit-v1 --ide=vscode -O "framework = espidf". Now it didn’t hang up but terminated with Error: Couldn't find the main target of the project!. Adding @1.11.2 (like in my first post) let pio project init terminate with success. The platformio.ini made by pio project init with the version patch now looks like this:

[env:esp32doit-devkit-v1]
platform = espressif32@1.11.2
board = esp32doit-devkit-v1
framework = espidf

Another lesson learned is, using src_dir = main to tell PlatformIO where the sources are, is a bad idea. That was the cause of the fatal error: esp_vfs_semihost.h: No such file or directory. Without it the example compiles even if the sources are in main.

An attempt to build by pio run now fails with a missing linker script:

Linking .pio/build/esp32doit-devkit-v1/firmware.elf
ld: cannot open linker script file esp32.project.ld: No such file or directory

The only *.ld within the project directory that can be found is .pio/build/esp32doit-devkit-v1/esp32_out.ld.

The last hint seems to be not needed. The example already references the protocol_examples_common from within the CMakeLists.txt in the base of the project by:
set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
Even with a local copy within the project directory as described in ESP32 IDF Protocol Examples not working - #7 by maxgerhardt the linker script still is missing.

p.s.: I had to remove some links because the platform was complaining.