Print Memory usage report in function of linker sections

Sysprogs forums Forums VisualGDB Print Memory usage report in function of linker sections

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #22364
    julieninnovel
    Participant

    Hello,

     

    I would like to now if it’s possible to print automaticaly a memory utilization report, but in functions of differents sections and sizes declared in the linker script ?

    Example, I have a firmware application and a bootloader application.

    The linker script have a frst flash section for the bootloader (4K) a second one for the application (60K), and the RAM is also cut into 3 sections :

    • RAM_VTOR (for interrupt relocation)
    • RAM
    • SHARED_RAM (to exchange data from bootloader to application firmware)

    I would like to have a report with all sections memory usages, and not the default one with the full FLASH and RAM size…

     

    Thanks

    #22371
    support
    Keymaster

    Hi,

    Please try opening View->Embedded Memory Explorer and keeping it open in the detailed view. It will automatically update each time you build the project, showing you the detailed per-section and per-symbol statistics (and also other useful information like offline disassembly or stack usage analysis).

    #22378
    julieninnovel
    Participant

    Hello,

     

    Thanks for this, it will help me but not exactly what I would like to have….

    I explain more :

    My flash size is about 128K split into 3 different sections :

    • 4K for a bootloader
    • 62K for firmware application
    • 62K for new firmware downloaded and to be programmed by bootloader

     

    Since the full size of flash is 128K, the memory utilization report, or embedded memory explorer compute the usage with 128K  for size, but not with my active section of 62K.

     

    Is there a way to do this ?

    Thanks

    #22400
    support
    Keymaster

    Hi,

    Do you mean that you would like to see the percentage of each section that is occupied by the actual symbols vs. padding at the end of the section?

    #22436
    julieninnovel
    Participant

    Hi,

     

    It’s exactly what I want.

    #22442
    support
    Keymaster

    Hi,

    Thanks for clarifying it. Unfortunately it would’t work to not count the space between the symbols, as in most of the cases such space is wasted due to alignment constraints, or contains unnamed data from assembly files, and hence should be counted towards the used space.

    Instead, please consider one of the following approaches:

    • Instead of having fixed-size sections extended until the end of the 62K block, have a variable-size section followed by a dummy section marked with the NOLOAD attribute filling the rest of the space. The NOLOAD sections will be automatically excluded from the memory usage statistics.
    • Simply place sections non-sequentially. You can use the “. = <address>” syntax in the linker script to place the next section at a fixed address.
    • Split the FLASH memory in your linker script into 3 separate memories and place the sections accordingly. Again, ensure that the sections are not extended beyond the actual end of the last symbol.
    #22774
    julieninnovel
    Participant

    Hi,

     

    I found a way to do that, simply add to linker command line the option

    -Wl,--print-memory-usage

     

    #22785
    support
    Keymaster

    Hi,

    Thanks for sharing this. We have added an option to the Linker properties under the VS properties for this setting to our development branch. It will be included in the upcoming VisualGDB beta.

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