Purpose Of _Min_Stack_Size
Hello,
In a typical example, there is the following linker script:
/* Highest address of the user mode stack */
_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
_Min_Heap_Size = 0x200; /* required amount of heap */
_Min_Stack_Size = 0x400; /* required amount of stack */
:
:
._user_heap_stack :
{
. = ALIGN(8);
PROVIDE ( end = . );
PROVIDE ( _end = . );
. = . + _Min_Heap_Size;
. = . + _Min_Stack_Size;
. = ALIGN(8);
} >RAM
On paper, the intention is the stack has an allocation of _Min_Stack_Size (0x400) bytes. So far so good.
However, the location _Min_Stack_Size seems to have nothing to do with _estack which the is actual address assigned to the MSP by the start-up code.
The map file shows that "stack" is located between 0x20000208 and 0x20000608.
._user_heap_stack
0x0000000020000004 0x604 load address 0x0000000008000c5c
0x0000000020000008 . = ALIGN (0x8)
*fill* 0x0000000020000004 0x4
[!provide] PROVIDE (end = .)
0x0000000020000008 PROVIDE (_end = .)
0x0000000020000208 . = (. + _Min_Heap_Size)
*fill* 0x0000000020000008 0x200
0x0000000020000608 . = (. + _Min_Stack_Size)
*fill* 0x0000000020000208 0x400
0x0000000020000608 . = ALIGN (0x8)
But the MSP is initialised to _estack which, in this case, is 0x2002 0000.
So my question is: If _Min_Stack_Size does not influence or limit the actual stack in practice, what purpose does _Min_Stack_Size serve in this script please?
Thank you.
