Storage variable in the specific location in memory

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Storage variable in the specific location in memory

2,861 Views
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
Labels (1)
Tags (1)
0 Kudos
Reply
4 Replies

1,071 Views
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 Kudos
Reply

1,071 Views
mbandini
Contributor I
0 Kudos
Reply

1,071 Views
admin
Specialist II
it doesn't work.
0 Kudos
Reply

1,071 Views
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 Kudos
Reply