How do I build to support multiple variants of an Application?

genedyne
Posts: 18
Joined: Wed Jun 06, 2018 12:47 pm

How do I build to support multiple variants of an Application?

Postby genedyne » Wed Mar 23, 2022 1:48 pm

I have an App that builds (against ESP-IDF) for a board used in one product.
I need to build the same App for the same board to be used in a different product. The second build requires a subset of the code (i.e., some of the files are not included) used in the original product, plus some 'variation' of the original code (i.e., different screens defined, some features not used, etc.).

For any build, the ESP-IDF build definition will be constant (i.e 'sdkconfig' does not change).

It seems like CMake defines the 'variant' system (cmake-variants.yaml) to address this type of issue, but it's not clear to me this is ideal, as changing variants might (?) require rebuilding of ALL components for each variant. Also, I don't see that use of CMake variants is explicitly supported in the ESP-IDF build system.

I might be able to use the ESP-IDF concept of 'Apps' to define the requirements for each build, but this also might (?) require rebuilding of ALL components for each variant.

I'm building on Linux, so I might be able to setup a second folder, soft-linking source files as required, plus using "#ifdef" extensively, but this seems fragile & convoluted.

Ideally, I would like a simple way to build the SDK components once, then rebuild only my App for each 'application variant' as I make changes to App source.

Does the ESP-IDF build system support this? If so, what is the preferred / recommended way to configure it?

burtrum
Posts: 20
Joined: Mon Dec 28, 2015 1:34 pm

Re: How do I build to support multiple variants of an Application?

Postby burtrum » Wed Mar 23, 2022 3:34 pm

Hi
I’ve just started looking at the exact opposite problem: the same app on ESP32 variants. I have ESP32, ESP32C3 and ESP32S2.

I think this is the Espressif example to look it.

https://github.com/espressif/esp-idf/tr ... lti_config

Separate build directories hold specific config files.

Burtrum

genedyne
Posts: 18
Joined: Wed Jun 06, 2018 12:47 pm

Re: How do I build to support multiple variants of an Application?

Postby genedyne » Wed Mar 23, 2022 5:06 pm

Thanks for the pointer @burtrum.
I updated to esp-idf v4.4 (I was on v4.3, which does not provide the example you cite), and checked the multi_config example.
It's not ideal, in that it builds the _entire_ SDK twice (once each for 'build_prod1', and 'build_prod2' folders).

Of course, apart from the unnecessary duplication, once compiled (and assuming no 'sdkconfig' changes occur), future builds will depend only on my source, so I can make this work.

Best Regards.

tommeyers
Posts: 184
Joined: Tue Apr 17, 2018 1:51 pm
Location: Santiago, Dominican Republic

Re: How do I build to support multiple variants of an Application?

Postby tommeyers » Wed Mar 23, 2022 9:37 pm

I have built a configurator in java. It is to build variants of sensors configured from a library of modules. Each module has a companion xml of prompts, rules, resource items used.

I had an information block interface between modules. You picked one OS root / dispatcher and any sensor combination.

Ultimately it put all the code in a single file that was compiled.

It also prepared configuration reports and assured named resources ,(like gpio pins) we're not reserved for multiple uses.

Gui I/f.

Tom
It. Works well.
IT Professional, Maker
Santiago, Dominican Republic

Who is online

Users browsing this forum: Bing [Bot], MicroController and 159 guests