using the '@' directive , to assign a variable to specific address

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

using the '@' directive , to assign a variable to specific address

Jump to solution
1,600 Views
lel_chen
Contributor I

Hi,

    To assign a variable to a specific addresses, I tried using the '@' directive as given below:

 

int glob @0x0500 = 10;

 

This gives a compiler error which says:

"Expected ; instead of '@' ".

 

I tried with the C99 & GCC extensions enabled in c/C++ Language settings tab. This did not help.

 

Any solutions?

 

Thanks,

Chen

0 Kudos
Reply
1 Solution
881 Views
CarlFST60L
Senior Contributor II

This thread really has nothing to do with MQX :smileywink:

 

Firstly, you should define the varible as global i.e. outside your code body in the following format

 

volatile type name @0xADDRESS;         

 

//Example copied from one of my 8 bit processors I happen to have open

volatile unsigned char __far NV_ICSTRM_FAR @0x0000FFBE;

 

 

You could always check the header files for definitions of the standard ports and copy those :smileywink:

 

Message Edited by CarlFST60L on 2009-08-11 11:21 PM

View solution in original post

0 Kudos
Reply
2 Replies
882 Views
CarlFST60L
Senior Contributor II

This thread really has nothing to do with MQX :smileywink:

 

Firstly, you should define the varible as global i.e. outside your code body in the following format

 

volatile type name @0xADDRESS;         

 

//Example copied from one of my 8 bit processors I happen to have open

volatile unsigned char __far NV_ICSTRM_FAR @0x0000FFBE;

 

 

You could always check the header files for definitions of the standard ports and copy those :smileywink:

 

Message Edited by CarlFST60L on 2009-08-11 11:21 PM
0 Kudos
Reply
881 Views
lel_chen
Contributor I

Thank You,

        I hadnt declared it as a global - that was the mistake.

 

Thanks,

Chen

0 Kudos
Reply