Sysprogs forums › Forums › VisualGDB › How control stack usage in real time
Tagged: Stack
- This topic has 8 replies, 2 voices, and was last updated 7 years ago by DUrbano.
-
AuthorPosts
-
December 11, 2017 at 16:30 #13238DUrbanoParticipant
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
December 12, 2017 at 03:42 #13240supportKeymasterHi,
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/
December 12, 2017 at 10:11 #13245DUrbanoParticipantOk, 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.December 12, 2017 at 22:00 #13256supportKeymasterHi,
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.
December 13, 2017 at 10:23 #13264DUrbanoParticipantThanks 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.
December 13, 2017 at 17:38 #13269supportKeymasterHi,
STM32 devices should normally include the “Fixed stack/heap” framework. Are you using a custom project or an mbed-based project?
December 14, 2017 at 09:07 #13279DUrbanoParticipantI’m using an mbed-based project.
December 14, 2017 at 22:56 #13293supportKeymasterHi,
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.
December 18, 2017 at 15:28 #13302DUrbanoParticipantOk, thank you so much for your precious support.
Regards
-
AuthorPosts
- You must be logged in to reply to this topic.