Page 1 of 1

Arguments for automatic build

Posted: Tue May 22, 2018 11:52 am
by meneldor
Hello,
I have two builds in my project depending of the following "Build OTA" checkbox:
ota_on.jpeg
ota_on.jpeg (13.83 KiB) Viewed 12482 times
ota_off.jpeg
ota_off.jpeg (9.78 KiB) Viewed 12482 times
Which is configured in Kconfig.projbuild:

Code: Select all

config BUILD_OTA
    bool "Build OTA"
    default n
    help
    	Build OTA partition
    	
config ENABLE_SENSOR_BME280
    bool "enable BME280 sensor"
    default y
    depends on BUILD_OTA 
    help
    	Enable BME280
 ....
where all other components depend on.
If checked - its an OTA build, all checked sensors are included in the source, some source is removed, etc.
If unchecked, its a small build for only factory partition.
I,ve build a dedicated website and tools to manage/upload the built images. My goal is to close the process and build factory/ota image by clicking on a single button. My question is:
How to change CONFIG_BUILD_OTA only during the build (ex: $ make CONFIG_BUILD_OTA=n), also all dependencies have to be processed.

Thansk!

Re: Arguments for automatic build

Posted: Tue May 22, 2018 1:29 pm
by kolban
My understanding is that the "make menuconfig" tool is merely a very nice editor for editing the file called "sdkconfig". If you open that file with an editor you will see it is nothing but name=value pairs. In your build system, you could use a string processing tool like awk or sed to process and change the sdkconfig file and re-write it. This should then be picked up by the ESP-IDF build system and be honored. Realize that a change to sdkconfig usually results in a recompilation of the whole of the ESP-IDF.

Re: Arguments for automatic build

Posted: Tue May 22, 2018 1:39 pm
by meneldor
That was my first idea. However the dependency logic is already implemented in the Kconfig file and i dont wanna repeat it. I need a way to directly execute the tool which processing sdkconfig to build/include/sdkconfig.h

Re: Arguments for automatic build

Posted: Tue May 22, 2018 11:40 pm
by kolban
Try making a change to a value in the sdkconfig file located in your project directory and performing a simple make. In my experience, this causes it to be parsed are rebuild sdkconfig.h.

Re: Arguments for automatic build

Posted: Tue May 29, 2018 7:27 am
by meneldor
Can i tell to make which Kconfig.projbuild to use?

Re: Arguments for automatic build

Posted: Tue May 29, 2018 12:09 pm
by Mr_Red
I haven't tried it myself but I think you can specify the config file by overriding SDKCONFIG from the command line.

Code: Select all

make SDKCONFIG=sdkconfig-ota
where the config file to use is "sdkconfig-ota".

Re: Arguments for automatic build

Posted: Tue May 29, 2018 11:22 pm
by ESP_Angus
MrRed is correct, you should be able to specify a different "sdkconfig" file.

It's also possible to assemble an sdkconfig file from parts. We do this for the ESP-IDF unit tests that we run internally in CI. You can see the various config files here:
https://github.com/espressif/esp-idf/tr ... pp/configs

The CI scripts do the equivalent of:

Code: Select all

cp configs/default sdkconfig  # set any common config items used in all configurations
cat config/psram >> sdkconfig  # append the psram-specific part for the 'psram' specific config
make defconfig   # this step fills in the default values for all the config items not listed in 'default' or 'psram'
make ...             # build the project with this config

Re: Arguments for automatic build

Posted: Wed May 30, 2018 7:38 am
by meneldor
Actually a combination of both posts does the job :)

Code: Select all

$make defconfig SDKCONFIG=${PWD}/sdkconfig-ota
$make -j8 SDKCONFIG=${PWD}/sdkconfig-ota
Thanks guys

Re: Arguments for automatic build

Posted: Tue Jun 06, 2023 5:38 am
by RichPiano
Just an addition. You can do it quite easily now:

Code: Select all

cmake -S . -B build01 -G Ninja -DSDKCONFIG_DEFAULTS=sdkconfig.defaults.v01
cmake --build build01

Code: Select all

cmake -S . -B build02 -G Ninja -DSDKCONFIG_DEFAULTS=sdkconfig.defaults.v02
cmake --build build02
Just make sure to delete sdkconfig file before every generation, as this will override your defaults.