Reduce size of C++ binaries in Stand-alone project

Sysprogs forums Forums VisualGDB Reduce size of C++ binaries in Stand-alone project

This topic contains 11 replies, has 2 voices, and was last updated by  janulo 1 month, 2 weeks ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #11399

    janulo
    Participant

    Hi everyone!

    I’m working on project on STM32 using VisualGDB. Our project was converted to Stand-alone year ago. I would like to reduce size of output binaries using “Reduce size of C++ binaries” feature described here at the end of page :

    The solution in this case would be to replace __cxa_pure_virtual() with something more compact that will for example just trigger a breakpoint. The “Reduce size of C++ binaries” option does exactly that…

    Unfortunately, I didn’t find any option like this in our project settings. Is there any way to do such a size reduction in case of Stand-alone project?

    Our output from Embedded Memory Explorer looks similar to output from tutorial mentioned above.

     

    #11400

    support
    Keymaster

    Hi,

    Yes, please try adding “compactcpp” to the list of library names in VisualGDB Project Properties. This should be equivalent to checking the “reduce size of C++ binaries” checkbox.

    • This reply was modified 2 months, 1 week ago by  support.
    #11489

    janulo
    Participant

    Hi,

     

    thanks for your response. I tried your recommendation, but no change in flash memory used. We are not using any pure virtual methods, but still a lot of classes and std::arrays, it may be related?

    I will try to insert screenshot from memory explorer:

     

    memory explorer

    • This reply was modified 2 months ago by  janulo. Reason: screenshot edit
    #11496

    support
    Keymaster

    Hi,

    If you are using a 3rd-party toolchain, it may be configured slightly differently and the compactcpp library won’t override the necessary symbols. Please try switching to our ARM toolchain.

    #11497

    janulo
    Participant

    Hi,

    If I’m not wrong, we are already using arm toolchain: VisualGDB properties – Makefile settings – Toolchain: ARM in c:\SysGCC\arm-eabi.

    During compilation, I can see in Output window instructions starting with following (so this should not be the case of 3rd-party toolchain):

    #11499

    support
    Keymaster

    Hi,

    That does indeed look like our toolchain. Please try enabling the map file generation via Linker Properties and ensure that the _ZSt9terminatev (std::terminate) function is coming from the libcompactcpp.a:

    #11530

    janulo
    Participant

    Hi,

     

    It looks like this _ZSt9terminatev is comming from libstdc++.a:

    #11532

    support
    Keymaster

    Hi,

    OK, this looks like the libcompactcpp.a is actually not being compiled in. Please check the verbose link log (if you are using MSBuild, simply check the .link.rsp file) for the linker command line and ensure it contains the “-lcompactcpp” argument. If you are not sure, please post the linker command line here and we will help you resolve this.

    #11537

    janulo
    Participant

    Hi, thanks for trying to help me 🙂

    I’m not using MSBuild, but when I check output window, the almost last line is quite long (I skipped the .o file and left only some to make this shorter, my comments are inside { }. Also I put this on multiple lines to make it more readable ):

     

    • This reply was modified 1 month, 3 weeks ago by  janulo.
    • This reply was modified 1 month, 3 weeks ago by  janulo.
    #11540

    janulo
    Participant

    I’m fighting with text editor 🙂 Using <> for my comments was not good idea, so one more try with { }.

     

    #11548

    support
    Keymaster

    Hi,

    Strange, it looks like the libcompactcpp library is specified in the command line, but is not linked.

    In order to troubleshoot this, please try creating a new project from scratch with the following code:

    Then link it with libcompactcpp. If the map file shows that the _ZSt9terminatev function is taken from libcompactcpp.a, please try understanding the differences between your main project and the test project. If not, please try re-downloading our latest toolchain.

    If nothing helps, please add “-Wl,-verbose” to LDFLAGS and post the following:

    • The full Map file
    • The full verbose link log

    This should help understand why libcompactcpp.a is not included.

    #11583

    janulo
    Participant

    Hi,

    I’m sorry for my delayed response.

    I’ve tried this simple project and _ZSt9terminatev function is linked correctly from libcompactcpp.a. Unfortunately, priorities on project have changed and I have to postpone this downsizing task. I’ll compare main project with the test project and I will come with results, or with full Map and verbose log, ASAP. Thanks for understanding.

    Jan

Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.