GCC optimization

Sysprogs forums Forums VisualGDB GCC optimization

Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #13037
    giovanito
    Participant

    Hi All,

    I have developed an embedded program for STM32L151 and I compiled it with GCC release 7.2.0

    I noted that the program if I compiled with optimize flag for size, or with optimize flag for visualgdb debug, the produced code differ for only 2KB (78K in visualGBD and 76K when compiled for size)

    Somebody have encountered the same behavior?

    thanks and regards

    Gio

    #13038
    support
    Keymaster

    Hi,

    Most likely you are not using newlib-nano, so most of your program size comes from the standard library. Please try switching to the nano version.

    Please also check the Embedded Memory Explorer to see where does the size come from. E.g. your program might contain some binary resources or other artifacts that cannot be optimized.

    #13040
    giovanito
    Participant

    Hi,

    we are already using newlib-nano.

    besides no binary resourses is included in our code.

    In visualstudio project properties page, I set ‘Minimize size (-Os) in optimization menu.

    Is the right  setting?

     

     

     

    Attachments:
    You must be logged in to view attached files.
    #13044
    support
    Keymaster

    Hi,

    The setting is correct. Please use the embedded memory explorer to track what contributes to the program size as shown here: https://visualgdb.com/tutorials/arm/dependencies/

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.