Page 1 of 1

Disable components from IDF

Posted: Mon May 20, 2024 9:47 am
by eriksl
Is there a way to disable certain components of the IDF?

I understand that unused components are not included in the image (app), but my problem is that every time I need to a compilation (of even one single file), idf is checking ALL components for changes and it really takes a while, it's frustrating. There are quite a few components I will never use, so I'd like to at least disable them.

Re: Disable components from IDF

Posted: Mon May 20, 2024 2:36 pm
by sudeep-mohanty
Hi, In your project level CMakeLists.txt file, you may set COMPONENTS like

Code: Select all

set(COMPONENTS main)
before the call to

Code: Select all

project()
to restrict the number of components that are built.

Re: Disable components from IDF

Posted: Mon May 20, 2024 5:26 pm
by eriksl
Yeah, works, thanks!

A few notes:
- many components remain active nonetheless because other components depend on them (which was to be expected)
- a few components (in my case: bt, esp_psram, wear_levelling) must be included explicitly otherwise the functionality will lack
- most components (all minus above and minus "main") can be left out anyway
- this will mess with your sdkconfig file. Make sure you make a backup first or be prepared to all configuring from scratch
- compare original and adjusted sdkconfig to see what components are missing (their config will be removed), if some are actually required, you can add them manually
- look in esp-idf/components for components' names. Don't be fooled by the output of idf (using __some_name) that's not what this option expects.