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.

ISR not called from C++ code, but works if its C code

Other Parts Discussed in Thread: SYSBIOS

Hello,

I have two sources of interrupts in my C++ code. And I am trying to register them with the SYS BIOS using the API calls as follows:

1. GPIO

EventCombiner_dispatchPlug (89, (EventCombiner_FuncPtr)Class_A::ISR_GPIO, (UArg)0, 1);

2. SRIO

EventCombiner_dispatchPlug (49, (EventCombiner_FuncPtr)Class_B::ISR_SRIO, (UArg)0, 1);

CpIntc_dispatchPlug(49, (CpIntc_FuncPtr)(Class_B::ISR_SRIO), (UArg)hSrioDriver, 1);

All this is C++ code. The interrupt subroutine for GPIO is called successfully on GPIO events.

ISR_SRIO is not invoked for SRIO events.

If I make the ISR_SRIO a pure C function defined in a C file, and wrap the srio ISR setup ( call to EventCombiner_dispatchPlug and CpIntc_dispatchPlug) in a block of extern "C", then the ISR_SRIO is called on SRIO events. So, the other SRIO configuration are proper, and it is a ISR setup issue.

Now, I need to avoid C source files. I tried the making the ISR_SRIO a non-member function, and putting it in an extern C block of a Cpp file. The operations EventCombiner_dispatchPlug and CpIntc_dispatchPlug are also in a extern C block of the Cpp file. In this case. the srio ISR is not called. Name mangling issue should have been handled by doing so, correct?

Other possiblity that I took care of is that the mangled names need to be 32 bytes or less. The name used here are not the original names in my code. But I have made sure the mangled names, as they appear in the map file, are less than 32 bytes.

Any pointers if it can be mangling issue, or something else?

One thing is. GPIO module works alright (did not have to use extern C at all), while SRIO does not if all code is C++. But GPIO setup does not use CpIntc_dispatchPlug modules as GPIO is primary interrupts (for DSP 66xx), while SRIO are secondary interrupts and need to be mapped using CpIntc_dispatchPlug.

I am using SYSBIOS 6.32.5.54, XDC tools 3.22.4.46, and Compiler 7.3.1

Thanks

Thakkar

  • SThakkar said:
    I tried the making the ISR_SRIO a non-member function, and putting it in an extern C block of a Cpp file.

    An ordinary C function is expected here.  It seems like this ought to do it.  Make sure the prototype and the definition of the ISR_SRIO function are all extern "C".

    I doubt that will fix it.  I suspect something else is going on.  I'll move this thread to the BIOS forum.

    Thanks and regards,

    -George

  • Hi Thakkar,

    Can you try using a C wrapper (that calls Class_B's SRIO ISR function) when registering the ISR with CpIntc ?

    Within your cpp file, add a C wrapper:

    Now register the C wrapper instead of Class_B's function:

    I tried creating an example using this for C66x and was able to run it successfully.

    Best,

    Ashish