Hi Rolf,

Excellent idea. However your version seems incomplete. The attached file tries to work with MSPGCC, Quadravox, IAR 1-3, Rowley, and CCE. I tried it briefly (not thoroughly) with MSPGCC, Quadravox, IAR 3.x, and CCE. It seems to work OK.

I'd like to get this tested and into CVS when it has been reviewed a little. I need to write code that is built with multiple compilers, and the ISR definitions have been annoying me for a while. Your posting prompted me to finally address the issue.

Regards,
Steve

nobo...@web.de wrote:

Hi,

i made macros for compiler-independent ISR declarations to have a C code
which can be compiled with mspgcc, IAR V1 and crossworks:

http://random.linux-site.net/files/unsorted/mspgcc/compiler.h

I think it would be a good idea to add it to mspgcc because it would force TI
to do the C examples compiler independent.
I used the current version with mspgcc and crossworks.

Regards,

Rolf



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users


/* Cross compiler interrupt compatibility definitions */
/* This code currently allows for:
        MSPGCC - the GNU tools for the MSP430
        Quadravox AQ430
        IAR Version 1 (old syntax)
        IAR Versions 2 and 3 (new syntax)
        Rowley Crossworks
        Code Composer Studio

   These macros allow us to define interrupt routines for all
   compilers with a common syntax:
   
    ISR(<interrupt>, <routine name>)
    {
    }
   
   e.g.
   
    ISR(ADC12, adc_service_routine)
    {
        ADC12CTL0 &= ~ENC;
        ADC12CTL0 |= ENC;
    }
*/

#if defined(__GNUC__)  &&  defined(__MSP430__)
    /* This is the MSPGCC compiler */
#define ISR(a,b) interrupt(a ## _VECTOR) b(void)
#elif defined(__AQCOMPILER__)
    /* This is the Quadravox compiler */
#define ISR(a,b) void _INTERRUPT[a ## _VECTOR] b(void)
#elif defined(__IAR_SYSTEMS_ICC__)  &&  (((__TID__ >> 8) & 0x7f) == 43)  &&  (__VER__ < 200)
    /* This is V1.xx of the IAR compiler. */
#define ISR(a,b) interrupt[a ## _VECTOR] void b(void)
#elif defined(__IAR_SYSTEMS_ICC__)  &&  (((__TID__ >> 8) & 0x7f) == 43)  &&  (__VER__ < 400)
    /* This is V2.xx or V3.xx of the IAR compiler. */
#define ISR(a,b) #pragma vector = a ## _VECTOR \
__interrupt void b(void)
#elif defined(__CROSSWORKS_MSP430)
    /* This is the Rowley Crossworks compiler */
#define ISR(a,b) void b __interrupt[a ## _VECTOR](void)
#else
    /* Assume this is the Code Composer Essentials compiler. They don't
       seem to define anything we can check for */
#define ISR(a,b) __interrupt void b(void); \
a ## _ISR(b) \
__interrupt void b(void)
#endif

Reply via email to