Boards settings and board_build.f_cpu have no affect

Hello,

So firstly I created an esp-idf project selecting the board “esp-wrover-kit”, this is the platformio.ini file:

[env:esp-wrover-kit]
platform = espressif32
board = esp-wrover-kit
framework = espidf

Now from esp-wrover-kit.json board file in the platform-espressif32 repository I can see that it’s defined as 240 MHz, same thing can be found stated in the documentation

The problem is after running pio to build the project, it generates a sdkconfig.esp-wrover-kit file, where the frequency is set as 160MHz on default in this snippet:

# CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set
CONFIG_ESP32_DEFAULT_CPU_FREQ_160=y
# CONFIG_ESP32_DEFAULT_CPU_FREQ_240 is not set
CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=160

So seems like platformio ignored the json configuration for this board. Just to test it further, I added the following line to platformio.ini:

board_build.f_cpu = 240000000L

Cleaned and rebuilt it, but still got the same issue in the sdkconfig.esp-wrover-kit file

From what I could test and understand it seems that platformio ignores these configurations stated in platformio.ini

I also tested another board (esp32dev) by building the espidf-arduino-blink example here

Then followed the exact instructions provided in the README.md file and still got the same issue in the sdkconfig file (sdkconfig.esp32dev)

It’s still set as 160MHz despite the board json config and platformio.ini board_build.f_cpu

PS: The cpu frequency not being the default value is not the only wrong parameter in the sdkconfig file, it also sets the flash size to 2Mb despite being defined as 4Mb in the board json.

CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y

There’s probably other configurations ignored as well. So why is platformio not generating the sdkconfig file correctly? I also uninstalled everything clean and reinstalled platformio just in case, and the problem persisted. Thanks.

I also found this and this post having the same problem, but with no solution

Usually the board_build.f_cpu setting just sets the value of the macro F_CPU. That’s usefull and correct in e.g. the Atmel AVR platform. It seems to go unimplemented in the ESP-IDF build script since the menuconfig is used for that instead. Do not edit the sdkconfig manually, only through the menuconfig menu.

Thank you for replying. I’m already using menuconfig, I just referred to the sdkconfig settings themselves to be more precise.

Anyways, what’s the point of selecting boards in the ESP-IDF environment if the build is unaffected? It seems weird.

I know I could use a custom sdkconfig.defaults file for every project based each board type.

I was just trying to confirm whether there’s a bug in the fact that selecting boards in platformio.ini won’t affect menuconfig for some reason. Will this be fixed eventually?