I'm porting an older project to SDK_2.2, and I'm getting:
undefined reference to __STACK_TOP
In the original project -- which compiles correctly -- I see references to __STACK_TOP but as far as I can tell, there's no definition for it. This leads me to think it's a special symbol, perhaps defined by the linker?
What's the right remedy to make __STACK_TOP known to my project? Or has the mechanism changed in SDK 2.x?
Solved! Go to Solution.
Okay - figured it out: __STACK_TOP defined in the .ld file.
In the old project, the .ld file defines both __StackTop and __STACK_TOP:
.stack :
{
. = ALIGN(8);
__StackLimit = .;
. += STACK_SIZE;
__StackTop = .;
__STACK_TOP = .;
PROVIDE(__stack = __StackTop);
} > m_data
The newer project only defines __StackTop:
/* Initializes stack on the end of block */
__StackTop = ORIGIN(m_data) + LENGTH(m_data);
__StackLimit = __StackTop - STACK_SIZE;
PROVIDE(__stack = __StackTop);
I could alias __StackTop to __STACK_TOP as in the old project, or change references in my code to _StackTop. The latter appears to be stylistically more correct. And it now compiles without error.
Okay - figured it out: __STACK_TOP defined in the .ld file.
In the old project, the .ld file defines both __StackTop and __STACK_TOP:
.stack :
{
. = ALIGN(8);
__StackLimit = .;
. += STACK_SIZE;
__StackTop = .;
__STACK_TOP = .;
PROVIDE(__stack = __StackTop);
} > m_data
The newer project only defines __StackTop:
/* Initializes stack on the end of block */
__StackTop = ORIGIN(m_data) + LENGTH(m_data);
__StackLimit = __StackTop - STACK_SIZE;
PROVIDE(__stack = __StackTop);
I could alias __StackTop to __STACK_TOP as in the old project, or change references in my code to _StackTop. The latter appears to be stylistically more correct. And it now compiles without error.
Hello Rotert,
Thanks for your sharing .
BR
Alice