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

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

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

ソリューションへジャンプ
1,601件の閲覧回数
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 件の賞賛
返信
1 解決策
882件の閲覧回数
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 件の賞賛
返信
2 返答(返信)
883件の閲覧回数
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 件の賞賛
返信
882件の閲覧回数
lel_chen
Contributor I

Thank You,

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

 

Thanks,

Chen

0 件の賞賛
返信