2024-01-26 07:08 AM
In Keil, if you open a file with the extension .map, you can find information about starting address of stack and so on. See screen.
How can I determine the starting address of the stack in CubeIDE?
2024-01-26 07:41 AM
Hello,
Go to STM32CubeIDE\Debug and open .map file. Try to find the line
_estack = (ORIGIN (RAM) + LENGTH (RAM))
2024-01-26 07:48 AM
Thanks for the answer!
I found the desired line in .map file
_estack = (ORIGIN (RAM) + LENGTH (RAM))
and I don’t understand what to do with it. See screen.
2024-01-26 07:54 AM
2024-01-26 08:04 AM
Thank you, but how to find out the end address of stack from this file?
2024-01-26 08:18 AM
_estack defines the end of the Stack which is the Top of the stack.
So normally the stack starts at: _estack - _Min_Stack_Size
2024-01-26 08:38 AM
It should really use the space allocated by the linker, in this case ST just lets it descend into the end of the heap
See _sbrk implementation in syscalls.c
ST sets in to the end of RAM, and it auto-decrements from there, basically the first 32-bit word gets stored at _estack-4
_bstack = (ORIGIN (RAM) + LENGTH (RAM) - _Min_Stack_Size)
_estack = (ORIGIN (RAM) + LENGTH (RAM))
In the Keil builds the initial stack is set to __initial_sp, and descends too Stack_Mem