How control stack usage in real time

Sysprogs forums Forums VisualGDB How control stack usage in real time

Tagged: 

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #13238
    DUrbano
    Participant

    Hi to all,

    I have the last version of Visual GDB 5.3R5 on Visual Studio Community 2017; now, I know if it’s possible to check in real time the stack usage with Visual GDB, but I don’t know how. Please, could anyone tell me how do this ? I’m working on a mbed project and, for some problems I’m facing, I’d like to do.

    Regards

    DUrbano

    #13240
    support
    Keymaster

    Hi,

    No problem, we have a detailed tutorial explaining how to use the dynamic analysis to verify the stack size: https://visualgdb.com/tutorials/arm/stack/

    #13245
    DUrbano
    Participant

    Ok, I see the tutorial but I have a problem; as I wrote I have yet a project but I don’t find the “Fixed stack and heap” box in Visual GDB properties as you can see in the attached screenshot. How can I solve this problem ?

     

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

    Hi,

    The “Fixed stack and heap” is only available on BSPs with linker scripts are generated by VisualGDB. If you are using a different BSP, you would need to edit the linker script manually (the exact steps depend on the device type) and also specify the stack bounds on the Dynamic Analysis page so that VisualGDB could verify it.

    #13264
    DUrbano
    Participant

    Thanks for the reply; could you give me any example how to manually modify the linker script ? I’m working on an STM32F411 on NUCLEO board.

    #13269
    support
    Keymaster

    Hi,

    STM32 devices should normally include the “Fixed stack/heap” framework. Are  you using a custom project or an mbed-based project?

    #13279
    DUrbano
    Participant

    I’m using an mbed-based project.

    #13293
    support
    Keymaster

    Hi,

    Thanks for clarifying this. Mbed projects use slightly different ways to specify stack/heap based on the version and the target. Please try locating the linker script for your target (e.g. via VisualGDB Project Properties) and check it for heap-related definitions. It might look similar to this:

        .heap (COPY):
        {
            __end__ = .;
            end = __end__;
            *(.heap*)
            __HeapLimit = .;
        } > SRAM1

    In that case please locate the source file that defines symbols in the .heap or .stack sections (if you are not sure, you can find it out via the .map file) and see what affects the size of those symbols (e.g. preprocessor defines). Settings those preprocessor defines should change the amount of memory reserved for stack/heap.

    If no source files define any symbols inside .stack/.heap, you can add one manually as shown below:

    char __attribute__((section(".stack"))) ReservedForStack[FIXED_STACK_SIZE];
    char __attribute__((section(".heap"))) FixedSizeHeap[FIXED_HEAP_SIZE];

    This will reserve space for both stack and heap according to the sizes you specify.

    #13302
    DUrbano
    Participant

    Ok, thank you so much for your precious support.

    Regards

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