3 Replies Latest reply on Feb 23, 2020 8:27 PM by JayakrishnaT_76

    code optimization in Ez-USB Suite

    PrRe_3492461

      Hello All,

       

      I'm using Ez-USB suite V1.3.4.

      In the attached Properties window, if I Change

      configuration: Debug[active] to --> profile release / Release and

      optimization level : None(-O0) to--> any other option n drop down.

       

      Will these configurations break anything, Is it recommended to alter these changes ?

      I need to optimize my code, now even if I add a single function with a single switch case and with one/two variables code size is increasing more than 2k which is unexpected. At present my code size is 167k.

       

      So If I alter the above said options will it affect anything?

      How(in what way) and where are these option will be used?

      What are the recommended settings for compiler to optimize the code size?

       

      Thanks and Regards,

      Pranay.

        • 1. Re: code optimization in Ez-USB Suite
          JayakrishnaT_76

          Hello,

           

          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

          How to shrink size of image?

           

          Best Regards,

          Jayakrishna

          1 of 1 people found this helpful
          • 2. Re: code optimization in Ez-USB Suite
            PrRe_3492461

            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 ?

             

            Regards,

            Pranay.

             

             

            • 3. Re: code optimization in Ez-USB Suite
              JayakrishnaT_76

              Hello,

               

              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.

               

              Best Regards,

              Jayakrishna