ESP32 builds with STM32 libraries from different commit

I have a project that uses two platforms: espressif32 and ststm32.
A commit that previously worked no longer works for ESP32.
Here is my ini file:

default_envs = esp32doit-devkit-v1

platform = espressif32
board = esp32doit-devkit-v1
framework = espidf
monitor_speed = 115200
monitor_flags = --raw
monitor_rts = 1
monitor_dtr = 0
upload_speed = 921600

platform = ststm32
board = nucleo_f446ze
framework = mbed

I get the following error messages:

ValueError: Please set custom_freertos_config_location in your platformio.ini to the location of a FreeRTOSConfig.h header file -- relative to the location of platformio

  File "C:\Users\<user>\.platformio\lib\STM32Cube Middleware-FreeRTOS_ID6696\", line 15:
    raise ValueError("Please set custom_freertos_config_location in your platformio.ini to the location of a FreeRTOSConfig.h header file -- relative to the location of 

I’ve done a platformio clean. I’ve removed the build folders manually. Restarted platformio and my PC and even reinstalled espressif32 platform because I got the following error message suddenly:

  is not able to compile a simple test program.

The weird thing is that neither environment uses STM32Cube Middleware-FreeRTOS in this commit! It is like ghost build artifact somewhere.

I’ve noticed that unlike the Ubuntu version the Windows version of platformio doesn’t create new vscode files after deletion and subsequent saving of the platformio project.

I have platformio version Core 4.3.1 Home 3.1.1. I can’t wait until platformio releases its first stable version, since I’ve been having nothing but problems on both Windows and Ubuntu.

You have installed this library in the global PlatformIO library repository. Per preference, this is searched first, so when the ESP32 code references FreeRTOS.h, PIO will think it’s from there.

You should remove this library (delete the folder or uninstall it via the VSCode GUI) and prefer to declare library dependencies per project (docs) instead of global installation.


The project did not refer to this header file for the ESP32 target. It refered to “freertos/FreeRTOS.h” which is located in the IDF framework.

I’ve managed to get rid of the errors by deleting platformio and reinstalling it. Apparently upgrading python broke my installation and a reinstall of platformio was needed.
I removed paths to older python versions and reinstalled platformio like in this topic:

This fixes the problem, but now I have new problems:

Warning! Starting with ESP-IDF v4.0, new project structure is required:
Error: Couldn't find target config target-__idf_esp_http_client-b11bf138e832222d
92Reading CMake configuration...

Is the firmware written against ESP-IDF v3 or v4?

It is written for both versions.
I’ve found the solution. I had to delete the sdkconfig files that platformio put in the src folder and manually add all the libs in the lib folder as extra libs.