AnsweredAssumed Answered

Bug report -- Blackfin Help

Question asked by MikeSmithCanada on Nov 23, 2010
Latest reply on Nov 24, 2010 by DavidS

The following code shown in Visual 5.0 DSP help is incorrect if run in release mode

 

You need to make all functions aware that number of interrupts is a volatile

 

 

To define a function as an ISR, the sys/exception.h header file must be included and the  function must be declared and defined using macros defined within this header  file. There is a macro for each of the three kinds of events the compiler  supports:

EX_INTERRUPT_HANDLER

EX_EXCEPTION_HANDLER

EX_NMI_HANDLER

By default, ISRs generated by the compiler are  not re-entrant; they disable the interrupt system on entry, and re-enable it on  exit. You may also define ISRs for interrupts that are re-entrant, and which  re-enable the interrupt system soon after entering the ISR.

A different macro is used to specify a  re-entrant interrupt handler:

EX_REENTRANT_HANDLER

For example, the following code declares and  defines my_isr() as a handler for interrupt-type events (for  example, the routine returns using an RTI  instruction).

#include <sys/exception.h>

static  int number_of_interrupts;

 

EX_INTERRUPT_HANDLER(my_isr)

{

   number_of_interrupts++;

Outcomes