How to reduce the size of the generated binary? Is it possible to disable unused components?

gpcosta
Posts: 2
Joined: Tue Mar 31, 2020 6:06 am

How to reduce the size of the generated binary? Is it possible to disable unused components?

Postby gpcosta » Tue Mar 31, 2020 6:42 am

Hello people!

I developed an application based on ESP-IDF v4.0 and I have the following question:

Is it possible to remove support for features like modbus, for example, to decrease the application's binary size?
How to do this?

Thank you in advance!
Atenciosamente / Best Regards,

Gustavo Costa
P&D - Projetista de Sistemas Embarcados
R&D - Embedded Systems Designer

M: +55 51 984 503 841
L: https://www.linkedin.com/in/gpcosta/
E: costaembedded@gmail.com

ESP_igrr
Posts: 2067
Joined: Tue Dec 01, 2015 8:37 am

Re: How to reduce the size of the generated binary? Is it possible to disable unused components?

Postby ESP_igrr » Tue Mar 31, 2020 7:49 am

Hi Gustavo,

First I would suggest to analyze what actually gets included into the application, by running 'idf.py size-components' (or 'make size-components', if you are using GNU Make). This will give you a list of per component sizes. Usually if you aren't explicitly using a component in your app, it will not get included into the final binary. Exception to this rule are some common system level components which are always included.

To reduce the binary size you can try decreasing the log level in menuconfig (to only log errors, for instance) and change compiler optimization level to "Optimize for size".

Who is online

Users browsing this forum: hugerobber and 120 guests