How Do I Disable the ESP-IDF Component That Is Not Used in a Project?

yaochuanfu
Posts: 13
Joined: Mon Mar 04, 2024 9:06 am

How Do I Disable the ESP-IDF Component That Is Not Used in a Project?

Postby yaochuanfu » Thu Jul 04, 2024 2:49 am

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?
Attachments
screenshot-20240704-095301.png
screenshot-20240704-095301.png (97.22 KiB) Viewed 1398 times

MicroController
Posts: 1552
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: How Do I Disable the ESP-IDF Component That Is Not Used in a Project?

Postby MicroController » 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.

a2800276
Posts: 78
Joined: Sat Jan 23, 2016 1:59 pm

Re: How Do I Disable the ESP-IDF Component That Is Not Used in a Project?

Postby a2800276 » Thu Jul 04, 2024 8:37 am

This can be accomplished via cmake. Have a look at the COMPONENTS bullets here: https://docs.espressif.com/projects/esp ... -variables

username
Posts: 507
Joined: Thu May 03, 2018 1:18 pm

Re: How Do I Disable the ESP-IDF Component That Is Not Used in a Project?

Postby username » Thu Jul 04, 2024 8:42 am

resulting in a slow online upgrade
Have you changed you baud rate to flash it faster ?

yaochuanfu
Posts: 13
Joined: Mon Mar 04, 2024 9:06 am

Re: How Do I Disable the ESP-IDF Component That Is Not Used in a Project?

Postby yaochuanfu » Fri Jul 05, 2024 1:25 am

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.
Attachments
20240705-092420.jpg
20240705-092420.jpg (376.88 KiB) Viewed 1273 times
Last edited by yaochuanfu on Fri Jul 05, 2024 1:35 am, edited 1 time in total.

yaochuanfu
Posts: 13
Joined: Mon Mar 04, 2024 9:06 am

Re: How Do I Disable the ESP-IDF Component That Is Not Used in a Project?

Postby yaochuanfu » Fri Jul 05, 2024 1:28 am

a2800276 wrote:
Thu Jul 04, 2024 8:37 am
This can be accomplished via cmake. Have a look at the COMPONENTS bullets here: https://docs.espressif.com/projects/esp ... -variables
Thanks,I will try to check it out.

MicroController
Posts: 1552
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: How Do I Disable the ESP-IDF Component That Is Not Used in a Project?

Postby MicroController » Fri Jul 05, 2024 9:58 am

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.

Who is online

Users browsing this forum: Basalt and 325 guests