Storage variable in the specific location in memory

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

Storage variable in the specific location in memory

2,866件の閲覧回数
admin
Specialist II
Hello,
how I can storage variable in the specific location in memory?
For example I have
int x; //I want have variable x on address 0x200
but how it say to compiler?
I'm using Code warrior 8.0 and DSP56F805
please help.
Regards
MP
ラベル(1)
タグ(1)
0 件の賞賛
返信
4 返答(返信)

1,076件の閲覧回数
Vilbcam
Contributor I
Hello, Im starting at 56F801, coming from 8 bits microcontrollers and I just cant have it right, I want to write in assembler and need to use variables, but I dont know where to ( and how ) define them.
 
How did you do? Did you find out how to define it?
Thanks
0 件の賞賛
返信

1,076件の閲覧回数
mbandini
Contributor I
0 件の賞賛
返信

1,076件の閲覧回数
admin
Specialist II
it doesn't work.
0 件の賞賛
返信

1,076件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee
The @ syntax is supported by the 8/16 bit tools (HC08/HC12).
I never used DSP56F805, so I cannot really say anything useful specific to this compiler, but I would suspect that you can place some variables into a specific section and then place this section in the lcf file.

If you do not really need a variable, just a way to read/write from a certain memory location, you can use a macro instead of a variable with any ANSI-C compiler.
#define MyVar (*(unsigned char*)0x200)
The actual code using it looks just as if a MyVar variable was defined as unsigned char, what's not so good is that there wont be any debug information tough, also the "variable" wont be initialized, of course.

Daniel
0 件の賞賛
返信