Storage variable in the specific location in memory

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Storage variable in the specific location in memory

2,837 次查看
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,047 次查看
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,047 次查看
mbandini
Contributor I
0 项奖励
回复

1,047 次查看
admin
Specialist II
it doesn't work.
0 项奖励
回复

1,047 次查看
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 项奖励
回复