1 of 1 people found this helpful
For optimizing the size of image, you can try release build or change the optimization level. Once you use the Release Build, the Optimization level will switch to Optimize Most (-O3). These settings are recommended to optimize the size of image file generated.
Please refer to section 5.2 of GettingStartedWithFX3SDK.pdf that comes along with FX3 SDK to understand the difference between different build modes. This document can be found in the following location.
C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\doc\firmware
Note that this path depends on the installation directory of FX3 SDK.
If you want to reduce the code size further, please go through the suggestions mentioned in this thread
Thanks for the response JayakrishnaT_76,
I've a doubt.
correct me if I'm wrong.
As we know that using a re-sequencing technique called LTO (Link Time Optimization) some optimization algorithms are moved from the compiler to the linker – where they can be applied to the whole code base, not just locally inside each file in isolation. This enables the toolchain to optimize also across files, not just within them.
This should reduce the code size furthe right ?
But here in Ez-USB suite, If I use release build configuration alone without enabling Link time optimization(-flto) .img size is reducing to some extent say 133k. And for further optimization if I enable Link time optimization(-flto) .img size is increasing to 139k.
Is it expected or how it is ?
Your understanding about Link Time Optimization is correct. It should further reduce the size of the .img file generated.
I tested this on the example project USBBulkSrcSink that comes along with FX3 SDK. Upon building this project in Release mode, the size of the .img file generated was 105 KB. But when Link Time Optimization was used along with Release build, the size further got reduced to 104 KB. Please check whether you are seeing the same result with this project. The example project can be found in the following location:
C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\basic_examples\cyfxbulksrcsink
Note: This path depends on the installation directory of FX3 SDK.