Source code reusability
Silverio Diquigiovanni
silverio.di at qem.it
Fri Oct 20 12:11:03 UTC 2000
Hi to all,
I'm aware that this isn't a good request to submit to this mail list,
but with faith in your experience in matter of reusable source code I
hope you can help me.
The question:
- I have three compilers which I normally use every day :
Green Hills compiler
GNU gcc compiler
IAR compiler
The source code is largely reusable because I use always ANSI compliant
normative, but today have a problem with interrupt functions.
I must create a mechanism for declarin a function like interrupt
function whitout use a compiler dipendent syntax.
Green Hills uses :
void interrupt my_fun( void ) { }
GNU uses:
#pragma interrupt
void my_fun( void ) { }
IAR uses:
void interrupt[vect_num] my_fun( void ) { }
My initial idea was be usign a macro to implement the different
compiler implementation.
#ifdef __GREEN_HILLS__
#define INTERRUPT_FUN(fun,vec) (.........)
#endif
#ifdef __GNUC__
#define INTERRUPT_FUN(fun,vec) (#pragma interrupt \ void fun(void))
#endif
#ifdef __IAR__
#define INTERRUPT_FUN(fun,vec) (void interrupt[vec] fun(void))
#endif
But #pragma can't be generated by a macro, so the __GNUC__
implementation is impossible....
Have you some suggestion about ?
Thank you in advance,
Best Regards
Silverio Diquigiovanni
More information about the users
mailing list