2023-06-26 02:14 AM - edited 2023-06-26 02:15 AM
Hello,
for determining the Stack-Utilization I fill it with 0xDADBEEF. If you have recommendations and other ideas, I’d like to know and looking forward to learn from others, how they approach the issues “Stacksize” and “Stackutilization”.
Code for the Startup-File:
Reset_Handler:
/* BEGIN : Seppels StackInit*/
ldr r0, = _End_Min_Stack_Size
ldr r1, = _estack
ldr r2, =0xDEADBEEF
Fill:
str r2, [R0], #4
cmp r0, r1
bne Fill
/* END : Seppels Stack Init */
Modification of the Linker-Script:
/* Highest address of the user mode stack */
_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
_Min_Heap_Size = 0x2000 ; /* required amount of heap */
_Min_Stack_Size = 0x2000 ; /* required amount of stack */
_End_Min_Stack_Size = _estack - _Min_Stack_Size ; /* Calculate the lower Address for init with the famoes "EB" */
Top of the Stack:
Thanks a lot.
Best Regards, Seppeltronics
Solved! Go to Solution.
2023-06-26 03:45 AM - edited 2023-06-26 03:46 AM
Maybe you should simply have a look at static stack usage analysis tab in the bottom-right pane after compilation?
2023-06-26 03:45 AM - edited 2023-06-26 03:46 AM
Maybe you should simply have a look at static stack usage analysis tab in the bottom-right pane after compilation?
2023-06-26 04:02 AM
Hello,
sure, I did look at the statically calculated Stacksize as well, but I found it useful as well to fill the stack with a pattern. Actually I found code in a forum that did not work, so I took the chance to publish something working.
Best Regards,
Seppel