ESPIDF relative path for sdkconfig for custom board


PlatformIO Version: 6.1.5
Platform/Framework: Espressif IDF SDK

Problem: Custom board with custom json and with a custom sdkconfig file which should be the default file in case the project doesn’t specify one.

Might be important: The custom board is part of a larger library for said board. The library is linked with the application through lib_deps (in PlatformIO.ini)

I have a custom ESP32 Board and a custom board json-file. In that file I have specified the default sdkconfig to be used under build.esp-idf.sdkconfig_path.

I would like to specify this path using env-variables or some other relative variable in order to avoid having problems building on different machines (i.e. larger team and across multiple OS:es).

As far as I understand this path will not expand environment variables (tried to look in the espressif script but I am unsure) - thus it must be an absolute path.

I’ve tried to modify the path through a pre-build script (for the library) but that doesn’t work as expected.
Like (this is not the exact line):
env.GetBoardConfig().update("build.esp-idf.sdkconfig_path", <newPathToMySDKConf>)

Dumping/Printing the variable before/after shows the correct value. I think however that I can’t (from a Library) modify this value for an application using the library. PIO Core however dumps the correct value (in verbose mode) but the generated command path for shows just the filename.

For Zephyr this works like a charm (the library has a couple of custom Zephyr boards) with config files having various defaults for HW which are merged at build time with the application config (for SW features).

Best of worlds I would like to find a way to make espidf builds behave similar (merge) as Zephyr.


In at line 82 one could add


Which would give the desired effect of enabling relative paths.
Like (board.json):

 "esp-idf": {
      "sdkconfig_path" : "$MYLIB_DIR/PlatformIO/boards/sdkconfig.esp32board.conf"