Re: static class member as interrupt handler works, but not if class is templated

2021-04-10 Thread Anton Staaf
For those that care, and ignoring the flame war, I believe that your (Klaus) problem likely stems from the following GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70435 Sadly, support for C++ in AVR GCC is not a priority, so I wouldn't expect it to be fixed. I've been able to work around

Re: static class member as interrupt handler works, but not if class is templated

2021-04-10 Thread Russell Shaw
On 11/4/21 8:36 am, Trampas Stern wrote: Actually C++ is not slower or more bloat than C, depending on the features used. For example I do not use RTTI or exceptions, so that makes it about the same as C for size. Yes you have to turn these features off in your compiler (-fno-rtti,

Re: static class member as interrupt handler works, but not if class is templated

2021-04-10 Thread Bruce D. Lightner
Trampas Stern, I'm sorry, but I've got to chime in here grasshopper.  David Kelly put it well: just "don't use C++"! I somehow knew that this would start a flame war. :-) [FLAME ON] We've been there, done that, bought the T-shirt, here in forums like this before, going back many decades! 

Re: static class member as interrupt handler works, but not if class is templated

2021-04-10 Thread Trampas Stern
Actually C++ is not slower or more bloat than C, depending on the features used. For example I do not use RTTI or exceptions, so that makes it about the same as C for size. Yes you have to turn these features off in your compiler (-fno-rtti, -fno-exceptions). Sure you have trampolines or jump

Re: static class member as interrupt handler works, but not if class is templated

2021-04-10 Thread David Kelly
On Apr 10, 2021, at 2:37 PM, Trampas Stern wrote: > If you guys have a better way I would love to know. Don’t use C++? What does object-oriented coding do for embedded projects? It’s akin to using printf(). Slow and lots of bloat. Time once was I put uint32 in a union so as to code ++

Re: static class member as interrupt handler works, but not if class is templated

2021-04-10 Thread Klaus
Hi, Am 10.04.21 um 17:26 schrieb Jonathan Wakely: Dummy<1> d1; This doesn't cause the instantiation of the member function. Have you tried an explicit instantiation? template class Dummy<1>; Did not change anything. If I use my original code, I get the instantiation of the

Re: static class member as interrupt handler works, but not if class is templated

2021-04-10 Thread Trampas Stern
I wish there was a better way to interrupt handlers in classes, for embedded. For example I write a UART class as a driver which I initialize by passing a pointer to hardware address. However because different UARTs use different interrupt vectors I end up having to have the extern C and create

Re: static class member as interrupt handler works, but not if class is templated

2021-04-10 Thread Jonathan Wakely
On Sat, 10 Apr 2021, 15:07 Klaus Rudolph via Gcc-help, wrote: > Hi all, > > if I write a class with static member function I can use it as an > interrupt handler as follows: > > class Dummy > { > static void Handler() __asm__("__vector_10") > __attribute__((__signal__, __used__,

static class member as interrupt handler works, but not if class is templated

2021-04-10 Thread Klaus Rudolph
Hi all, if I write a class with static member function I can use it as an interrupt handler as follows: class Dummy { static void Handler() __asm__("__vector_10") __attribute__((__signal__, __used__, __externally_visible__)); }; void Dummy::Handler() { } I can see the vector is entered