Simple question from a newbie: __declspec

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

Simple question from a newbie: __declspec

3,339 次查看
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,204 次查看
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,204 次查看
hellamasta
Contributor I
Thank you very much CrasyCat!!! I'm going to read the pdf :smileyhappy:
0 项奖励
回复