Using Arduino Framework Point to Custom sdkconfig.h file

I am trying to figure out how ‘.platformio\packages\framework-arduinoespressif32\tools\sdk\include\config\sdkconfig.h’ is used by PlatformIO when using the Arduino framework. Through experimentation, I have gained a fair amount of understanding. Forum posts and documentation has not been all too helpful. There may be useful documentation out there, I just haven’t found it. And with the build process as slow as it is, it is a very slow learning process by learning through experimentation. I would like to use a custom sdkconfig.h file so that I do not have to alter the one that comes with the PIO installation, which is global to all projects I may ever work on. Is there any way to do this? Currently, I am planning on manually altering a custom sdkconfig.h file per project. Is there a better, recommended, way to alter this file for Arduino builds?

on a lesser note (to me): I have also run down the path of using Arduino framework as a component of ESP-IDF (so, framework = arduino, espidf in the file platform.io), and have had major issues there. For instance, I have the latest developer version of PIO and the command ‘pio run -t menuconfig’ and it just doesn’t work. It also seems like ESP-IDF stand-alone and PIO do not play nice together. I did not look into which specific version of ESP-IDF is required to work with PIO, though it does seem like a specific version of ESP-IDF would be required to go with an approach to sdkconfig.h configuration.

Cheers

Hi @tparsh! Sorry for the late reply.

I am trying to figure out how ‘.platformio\packages\framework-arduinoespressif32\tools\sdk\include\config\sdkconfig.h’ is used by PlatformIO when using the Arduino framework.

Probably the best way is to add your custom sdkconfig.h to the include folder and specify it in build_flags field so the your sdkconfig.h will have higher priority:

build_flags = -Iinclude

For instance, I have the latest developer version of PIO and the command ‘pio run -t menuconfig’ and it just doesn’t work.

Could you please try the latest espressif32 platform v1.12.1? If it also doesn’t work, please provide more details about the errors. Thanks!

Would anyone know if this is still the preferred way of using a custom sdkconfig. Trying this I get errors on the # sign so I changed them to “//” comments. When I build I get a bunch of warning and errors. I would think it would have to be a valid C header to build.

Changing the sdkconfig.h when using regular framework = arduino won’t do anything as the Arduino-ESP32 libraries are precompiled. You need to use platform-espressif32/examples/espidf-arduino-blink at develop · platformio/platform-espressif32 · GitHub and menuconfig as documented.

What I think you are saying is I have to build the project as a “mixed” project and use Arduino as a component. Basically set up as the example you directed me to. So that example is using the idf to get to the menuconfig ?

Yes exactly. The other way is to generate new precompiled libraries using GitHub - espressif/esp32-arduino-lib-builder with your modified sdkconfig.

1 Like