undefined reference to __STACK_TOP

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

undefined reference to __STACK_TOP

ソリューションへジャンプ
3,931件の閲覧回数
robertpoor
Senior Contributor I

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?

タグ(2)
0 件の賞賛
返信
1 解決策
3,340件の閲覧回数
robertpoor
Senior Contributor I

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.

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
3,341件の閲覧回数
robertpoor
Senior Contributor I

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.

0 件の賞賛
返信
3,340件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Rotert,

Thanks for your sharing .

BR

Alice

0 件の賞賛
返信