DSPRelated.com
Forums

RE: [infos_TI] Position of __STACK_SIZE symbol

Started by Jean-Michel MERCIER March 15, 2002

> I think that __STACK_SIZE is the size of the stack, not its position in
memory.
> You could think of it as a compile time constant that doesn't exist anyway in
> the memory map. Look for the .stack section to see exactly where in the DSP's
> address space the stack has been located.

Your right
__STACK_SIZE is a pseudo-symbol that doesn't points anywhere.
The linker use it because it is the only means that they have to pass
information from the linker to the code that have already been compiled.

The same mecanism is used with the heap (__SYSMEM_SIZE).

The code can get the value by using somthing linke :

extern int _STACK_SIZE[];
// you must place only 1 underscore
// and use an extern array definition
and to get the size :
int StackSize = (int)(_STACK_SIZE);
// you do cast what the compiler think is an address (the base address of
// the _STACK_SIZE array but which in reality the stack size as imposed by the
linker Jean-Michel MERCIER




At 04:27 PM 03/15/02 +0100, Jean-Michel MERCIER wrote:

> > I think that __STACK_SIZE is the size of the stack, not its position in
> memory.
> > You could think of it as a compile time constant that doesn't exist
> anyway in
> > the memory map. Look for the .stack section to see exactly where in the
> DSP's
> > address space the stack has been located.
>
>Your right
>__STACK_SIZE is a pseudo-symbol that doesn't points anywhere.
By which you mean _STACK_SIZE has a VALUE which is NOT AN ADDRESS, but
which is the SIZE of the allocated stack, right?

So while it appears to the original user that it's value is the same as the
address of their vector section, it's merely a coincidence. If they change
the size of the allocated stack (RTFM), the coincidence will no longer exist.

-W