This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Interrupt pragma vs keyword



Hi,

I'm writing interrupt service routines on a TMS570 part, and I haven't been able to find much documentation about the differences between the interrupt pragma, e.g.

#pragma INTERRUPT(func, IRQ)

void func() { }

and the interrupt keyword, e.g.

interrupt void func() { }

 

The ARM compiler's user guide doesn't talk about the difference, but the #pragma has the ability to specify which type of interrupt you're handling, which makes a difference if you're handling a data abort vs an IRQ.

Should I be using one vs the other?  Does it change with aborts vs IRQs vs FIQs?

Thanks!

Tom

  • I don't think there is any difference between them.  However, I have asked other experts to comment.

    Thanks and regards,

    -George

  • All,

    I see no experts have commented further. so here is my summary.

    I use both #PRAGMA INTERRUPT and the 'interrupt' keyword (the latter for use in external tool parsing). Investigating the use of #PRAGMA INTERRUPT verses the 'interrupt' keyword I find the following:

    1. You must use #PRAGMA INTERRUPT for the exception vector ISRs type [RESET, UDEF, SWI, PABT and DABT]. If you don't you will get a completely different binary image after build that (for me) doesn't run (I get an immediate undefined instruction abort from reset).
    2. If you use #PRAGMA INTERRUPT then you don't need to use the 'interrupt' keyword.
    3. If you don't use #PRAGMA INTERRUPT but use the 'interrupt' keyword then all interrupts will be treated as IRQ. including [RESET, UDEF, SWI, PABT and DABT]. You have no way of specifying an FIQ and you will get a different binary image than if you had used #PRAGMA INTERRUPT (..., FIQ).
    This is really to be confirmed by TI, but I suggest that you must use #PRAGMA INTERRUPT not only for [RESET, UDEF, SWI, PABT and DAPT] but also IRQ and FIQ. This pragma sets attributes for the ISRs that the 'interrupt' keyword does not, for example stack allocation and the interrupt handling mechanism itself.
    I recommend that you always use #PRAGMA INTERRUPT for every ISR in your application. Use the 'interrupt' keyword in addition if required by external tool analysis (or always as it makes no difference).
    Regards, Tony
  • Tony Morrell said:
    • You must use #PRAGMA INTERRUPT for the exception vector ISRs type [RESET, UDEF, SWI, PABT and DABT]. If you don't you will get a completely different binary image after build that (for me) doesn't run (I get an immediate undefined instruction abort from reset).
    • If you use #PRAGMA INTERRUPT then you don't need to use the 'interrupt' keyword.
    • If you don't use #PRAGMA INTERRUPT but use the 'interrupt' keyword then all interrupts will be treated as IRQ. including [RESET, UDEF, SWI, PABT and DABT]. You have no way of specifying an FIQ and you will get a different binary image than if you had used #PRAGMA INTERRUPT (..., FIQ).

    I confirm that this is all correct.

    Thanks and regards,

    -George

  • I'll try and verify my answer then! Cheers, Tony

  • Hi

    I have tried the interrupt like

    #pragma INTERRUPT(c_int00,RESET)
    void c_int00(void)
    {
        main();
    }

    However, the compiler comes out with this message "#1559 Interrupt handlers must be compiled in ARM mode". I have no idea how to solve it. Do you have any idea please suggest?

    Thanks.

  • Further to my post, i am using UCD31830 chips and CCSV5.5 Thanks

  • Tom Ki said:
    However, the compiler comes out with this message "#1559 Interrupt handlers must be compiled in ARM mode". I have no idea how to solve it.

    Do not build with the compiler option for Thumb mode --thumb_state (or -mt for short).

    Thanks and regards,

    -George

  • Hi George

    It work fine with my win 7 computer but not for my windows 8 computer. Is there still anything missing or the code composer V5.5 doesn't work in win 8?

    Thanks. I look forward to your prompt reply.

    Best Regards

    Tom

  • Windows 8 support starts with CCS version 5.4.  Exactly what is going wrong?  You might need to attach a screen shot.

    Thanks and regards,

    -George