Simple question from a newbie: __declspec

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

Simple question from a newbie: __declspec

3,238件の閲覧回数
hellamasta
Contributor I
Hi everybody!

I'm a newbie fo embeddede system programming and I'd like to know the meaning of __declspec instruction.

What's the difference with __interrupt__ ?

When I have to use __declspec and when __interrupt__ ?

...and again...how have I touse __declspec ?

Thank you very much for your help!!!
ラベル(1)
タグ(1)
0 件の賞賛
返信
2 返答(返信)

1,103件の閲覧回数
CrasyCat
Specialist III
Hello
 
__declspec is an attribute, that allows you to specify storage class information for objects.
 
Please check ColdFire_Build_Tools_Reference.pdf in your CW for Coldfire V6.3 Help\PDF directory for more info on that attribute.
 
Basically you can use declspec to specify you want to place an object (variable, constant, function) in a specific section. You can also use it to specify a function is an interrupt function.
 
CodeWarrior for Coldfire provides 3 ways of defining an interrupt function:
__declspec(interrupt) void test_int(void)
{
  counter++;
}
or
#pragma interrupt on
void test_int2(void)
{
  counter++;
}
#pragma interrupt off
 
or
__interrupt__ void test_int3(void)
{
  counter++;
}

You can use any of these notation as you prefer.
 
CrasyCat
0 件の賞賛
返信

1,103件の閲覧回数
hellamasta
Contributor I
Thank you very much CrasyCat!!! I'm going to read the pdf :smileyhappy:
0 件の賞賛
返信