Topic: [SOLVED] Need help reducing compiled size

Hello,

I recently compiled wolfssl (version 3.15.3) and my build size is ~1.5MB. The documentation states it should be 30-100kB, typically 60kB for embedded, so I am wondering if I have done something very wrong.

I am using a microblaze processor, mb-gcc compiler, LWIP, HCC for file system, and FREERTOS.

Currently, I am using the following configs:

#define FREERTOS
#define WOLFSSL_LWIP
#define NO_WOLFSSL_DIR
#define HCC_SAFEFLASH
#define NO_STDIO_FILESYSTEM
#define CUSTOM_RAND_GENERATE     
#define NO_WOLFSSL_SMALL_STACK     
#define WOLFSSL_STATIC_MEMORY     
#define USE_FAST_MATH           
#define TFM_TIMING_RESISTANT       
#define WOLFSSL_STATIC_RSA
#define WC_NO_HARDEN

Share

Re: [SOLVED] Need help reducing compiled size

Hello @I_AM_MAD

Thank you for contacting wolfSSL Support. What are are you minimum requirements, both in terms of functionality and ROM/RAM size?

We have a comprehensive guide to optimizing the wolfSSL library:
https://www.wolfssl.com/docs/tuning-guide/

If you still have questions please feel free to ask here or at support@wolfssl.com

Kind regards,

Eric Blankenhorn
wolfSSL Support

Re: [SOLVED] Need help reducing compiled size

Hi @I_AM_MAD,

I can confirm that I have built for many embedded systems and can nearly always achieve builds in the 80 - 120K range with the same basic setup:

RSA enabled, ECC enabled, AES or 3DES, SHA256 and maybe SHA512/384 + TLS functionality. This setup will typically give me a few PFS cipher suite options. If I need additional features the library can grow a few K here or there. What I often find very interesting is the compiler differences. For example one project I was working on I had the exact same settings and source files and I built with two different compilers. The first, an ARM THUMB compiler, output a binary test application that was 80k. With the second toolchain/compiler (granted, main.c was a bit different due to different devices being targeted), I saw a 240K binary executable output. This wasn't because of anything with the library, rather it was that we just didn't have the compiler tuned right to optimize. Without changing anything in the wolfSSL library or wolfSSL settings I was able to tune the compiler rules a bit and quickly get the 240K build down to 160K. Obviously this was still double the size of what the other compiler was capable of but goes to show just how much the toolchain itself can effect the resulting binary output size.

Can you tell us what compiler you are working with and if it is setup for optimization? Can you tell us also if you are just looking at the library itself or are you looking at the executable binary size? (Executable binary is much different than a library object as the library object does not get optimized until it is linked into an executable binary).

Like Eric mentioned if you would like to discuss in more detail feel free to reach out to support@wolfssl.com.

Warm Regards,

K

Re: [SOLVED] Need help reducing compiled size

Thanks for the replies guys, just wanted to update you guys to let you know that I was mistaken with the size. I had to move some things in my main app's make file, this resulted in some core libraries that are built being stuck into the file that wolfssl was being built in. So the extra bloat was not wolfssl's fault, rather it was just dependencies being moved into the same library that wolfssl was being built into!

kind regards

Share

Re: [SOLVED] Need help reducing compiled size

@I_AM_MAD,

Thanks so much for the update. Let us know if you ever have any other questions, we are always happy to help in any way we can.

Regards,

KH

Re: [SOLVED] Need help reducing compiled size

Good to hear that you were able to resolve the issue.

Thanks again for contacting wolfSSL and best of luck with your project!