Simple question from a newbie: __declspec

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

Simple question from a newbie: __declspec

2,486 Views
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!!!
Labels (1)
0 Kudos
2 Replies

351 Views
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 Kudos

351 Views
hellamasta
Contributor I
Thank you very much CrasyCat!!! I'm going to read the pdf :smileyhappy:
0 Kudos