16-bit stack on HC908 CodeWarrior

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

16-bit stack on HC908 CodeWarrior

ソリューションへジャンプ
2,723件の閲覧回数
antgalimbe
Contributor I
I have tried to move the stack pointer in a Tiny program outside the zero-page memory but I have discovered that the program crash.
I see the disasseble of the C-code and I discovered that the C-compiler of Codewarrior assume the stack in zero-page.
Is possible to tell to the compiler to assume the stack outside the zero-page?
The actual project run on HC908JL8.
ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,033件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee
The memory model only defines the default way how data are allocated.
If you want the stack to be outside the zero page, I would suggest to use the small memory model. With this, normal, non qualified pointers will be 16 bit and they can therefore point to objects on the stack.
Then place your globals explicitely into a section in the zero page
Put a

#pragma DATA_SEG SHORT _DATA_ZEROPAGE

before the declaration and before the definition of them, and terminate the area with a

#pragma DATA_SEG DEFAULT

PS: To switch the memory model, you have to adapt the compiler/assembler memory model option and to pick the right library. Create a project witht the new project wizard to get a sample, if needed.

Daniel

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
1,033件の閲覧回数
CrasyCat
Specialist III

Hello

According to the HC08 compiler manual "In the TINY memory model, all data including stack must fit into the zero page."

This is the definition of the memory model and cannot be changed.

CrasyCat

0 件の賞賛
返信
1,033件の閲覧回数
antgalimbe
Contributor I
Thanks for your answer. My hope was to find an option to allow only the stack outside the zero-page and not all the data.
0 件の賞賛
返信
1,034件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee
The memory model only defines the default way how data are allocated.
If you want the stack to be outside the zero page, I would suggest to use the small memory model. With this, normal, non qualified pointers will be 16 bit and they can therefore point to objects on the stack.
Then place your globals explicitely into a section in the zero page
Put a

#pragma DATA_SEG SHORT _DATA_ZEROPAGE

before the declaration and before the definition of them, and terminate the area with a

#pragma DATA_SEG DEFAULT

PS: To switch the memory model, you have to adapt the compiler/assembler memory model option and to pick the right library. Create a project witht the new project wizard to get a sample, if needed.

Daniel
0 件の賞賛
返信