Arguments for automatic build

meneldor
Posts: 75
Joined: Mon Dec 25, 2017 7:28 am

Arguments for automatic build

Postby meneldor » Tue May 22, 2018 11:52 am

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 12480 times
ota_off.jpeg
ota_off.jpeg (9.78 KiB) Viewed 12480 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!

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Arguments for automatic build

Postby kolban » Tue May 22, 2018 1:29 pm

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.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

meneldor
Posts: 75
Joined: Mon Dec 25, 2017 7:28 am

Re: Arguments for automatic build

Postby meneldor » Tue May 22, 2018 1:39 pm

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

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Arguments for automatic build

Postby kolban » Tue May 22, 2018 11:40 pm

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.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

meneldor
Posts: 75
Joined: Mon Dec 25, 2017 7:28 am

Re: Arguments for automatic build

Postby meneldor » Tue May 29, 2018 7:27 am

Can i tell to make which Kconfig.projbuild to use?

Mr_Red
Posts: 23
Joined: Mon Sep 11, 2017 12:41 pm

Re: Arguments for automatic build

Postby Mr_Red » Tue May 29, 2018 12:09 pm

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".

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Arguments for automatic build

Postby ESP_Angus » Tue May 29, 2018 11:22 pm

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

meneldor
Posts: 75
Joined: Mon Dec 25, 2017 7:28 am

Re: Arguments for automatic build

Postby meneldor » Wed May 30, 2018 7:38 am

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

RichPiano
Posts: 123
Joined: Mon May 18, 2020 2:51 pm

Re: Arguments for automatic build

Postby RichPiano » Tue Jun 06, 2023 5:38 am

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.

Who is online

Users browsing this forum: Mycael_ and 106 guests