How Do I Disable the ESP-IDF Component That Is Not Used in a Project?
Posted: Thu Jul 04, 2024 2:49 am
by yaochuanfu
hello,I have some problems when I work with esp-idf V5.2.1.
Some functions before the compilation of the project are confirmed to be not turned on in menuconfig, but after the project is compiled, the corresponding .a file is generated in the build/esp-idf folder, and the corresponding functions are indeed turned on in the sdkconfig file, even after optimizing the compilation level and turning off some log output, the files generated by these useless components occupy a lot of flash space, resulting in a slow online upgrade, how can I completely close these unused components?
Is it possible for each component to have a clear option to enable/disable the component completely?
Re: How Do I Disable the ESP-IDF Component That Is Not Used in a Project?
Posted: Thu Jul 04, 2024 8:28 am
by MicroController
yaochuanfu wrote: ↑Thu Jul 04, 2024 2:49 am
the files generated by these useless components occupy a lot of flash space
I suggest to check if this is actually the case by running
idf.py size-components.
Re: How Do I Disable the ESP-IDF Component That Is Not Used in a Project?
Posted: Thu Jul 04, 2024 8:37 am
by a2800276
This can be accomplished via cmake. Have a look at the COMPONENTS bullets here:
https://docs.espressif.com/projects/esp ... -variables
Re: How Do I Disable the ESP-IDF Component That Is Not Used in a Project?
Posted: Thu Jul 04, 2024 8:42 am
by username
resulting in a slow online upgrade
Have you changed you baud rate to flash it faster ?
Re: How Do I Disable the ESP-IDF Component That Is Not Used in a Project?
Posted: Fri Jul 05, 2024 1:25 am
by yaochuanfu
MicroController wrote: ↑Thu Jul 04, 2024 8:28 am
yaochuanfu wrote: ↑Thu Jul 04, 2024 2:49 am
the files generated by these useless components occupy a lot of flash space
I suggest to check if this is actually the case by running
idf.py size-components.
Thanks for your response.
You're right, but there are still a few in the stats, and I'm not sure if the project really needs those components.
Re: How Do I Disable the ESP-IDF Component That Is Not Used in a Project?
Posted: Fri Jul 05, 2024 1:28 am
by yaochuanfu
Thanks,I will try to check it out.
Re: How Do I Disable the ESP-IDF Component That Is Not Used in a Project?
Posted: Fri Jul 05, 2024 9:58 am
by MicroController
yaochuanfu wrote: ↑Fri Jul 05, 2024 1:25 am
there are still a few in the stats, and I'm not sure if the project really needs those components.
I don't know either. Those libbt* entries would be Bluetooth code. If you use Bluetooth, you probably need them.
And I wouldn't worry about any components that occupy only a few (kilo)bytes of flash or so at all.
FWIW, the
linker does a decent job in removing all entities (functions, variables, constants) from the final binary which are not actually used/referenced by the final application, so the presence or size of a library (.a) is not necessarily indicative of the lib's contribution to flash use/binary size.