This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

interrupts in C++ / cpp ARM / Realview compiler

Hello,

has anybody expierienced with the Realview Compiler (ARM) and C++ interrupt programming?
How can I call an non static method as a interrupt handler? I use ATMEL AT91SAM7 controllers.
It's not easy if one has just started to learn C++ at all ... (the reviews I found haven't helped me much).

Parents
  • No extra trouble to get C++ to work. It is a quite straight-forward language as long as you don't spend too much time digging yourself down with multiple base classes with or without virtual base classes.

    But operator-overriden C++ can result in a few nice trivial lines of code that actually consuming huge amounts of CPU time because the operator overloading isn't obvious.

    Because of this, great care should be used in interrupt service routines. They are intended to be fast, to let the next interrupt also be serviced quickly.

    The processor interrupt can never enter an object method since the processor only knows how to call a specific address. But an ISR can make use of a global variable to call a non-static method.

    But if you have a single global object that your ISR is calling one method in, then you can think about having a single function and a number of variables directly inside a namespace. It will also encapsulate the symbols and except for no overloading will be quite similar to a singleton object. And that encapsulated function can be specified as an ISR directly, instead of requiring an extra function call.

Reply
  • No extra trouble to get C++ to work. It is a quite straight-forward language as long as you don't spend too much time digging yourself down with multiple base classes with or without virtual base classes.

    But operator-overriden C++ can result in a few nice trivial lines of code that actually consuming huge amounts of CPU time because the operator overloading isn't obvious.

    Because of this, great care should be used in interrupt service routines. They are intended to be fast, to let the next interrupt also be serviced quickly.

    The processor interrupt can never enter an object method since the processor only knows how to call a specific address. But an ISR can make use of a global variable to call a non-static method.

    But if you have a single global object that your ISR is calling one method in, then you can think about having a single function and a number of variables directly inside a namespace. It will also encapsulate the symbols and except for no overloading will be quite similar to a singleton object. And that encapsulated function can be specified as an ISR directly, instead of requiring an extra function call.

Children