[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
static class member as interrupt handler works, but not if class is temp
From: |
Klaus Rudolph |
Subject: |
static class member as interrupt handler works, but not if class is templated |
Date: |
Sat, 10 Apr 2021 15:33:30 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 |
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 in the handler table:
1c: 0c 94 34 00 jmp 0x68 ; 0x68 <__bad_interrupt>
20: 0c 94 34 00 jmp 0x68 ; 0x68 <__bad_interrupt>
24: 0c 94 34 00 jmp 0x68 ; 0x68 <__bad_interrupt>
28: 0c 94 36 00 jmp 0x6c ; 0x6c <__vector_10>
2c: 0c 94 34 00 jmp 0x68 ; 0x68 <__bad_interrupt>
30: 0c 94 34 00 jmp 0x68 ; 0x68 <__bad_interrupt>
###################
But if the class becomes a template, the function is not longer entered
in the handler. How can I fix it?
template < int i >
class Dummy
{
static void Handler() __asm__("__vector_10")
__attribute__((__signal__, __used__, __externally_visible__));
};
template < int i>
void Dummy<i>::Handler()
{
}
Dummy<1> d1;
20: 0c 94 3c 00 jmp 0x78 ; 0x78 <__bad_interrupt>
24: 0c 94 3c 00 jmp 0x78 ; 0x78 <__bad_interrupt>
28: 0c 94 3c 00 jmp 0x78 ; 0x78 <__bad_interrupt>
2c: 0c 94 3c 00 jmp 0x78 ; 0x78 <__bad_interrupt>
30: 0c 94 3c 00 jmp 0x78 ; 0x78 <__bad_interrupt>
I tried it with avr-g++ (Fedora 10.2.0-1.fc33) 10.2.0
Thanks!
- static class member as interrupt handler works, but not if class is templated,
Klaus Rudolph <=
- Re: static class member as interrupt handler works, but not if class is templated, Jonathan Wakely, 2021/04/10
- Re: static class member as interrupt handler works, but not if class is templated, Trampas Stern, 2021/04/10
- Re: static class member as interrupt handler works, but not if class is templated, David Kelly, 2021/04/10
- Re: static class member as interrupt handler works, but not if class is templated, Trampas Stern, 2021/04/10
- Re: static class member as interrupt handler works, but not if class is templated, Bruce D. Lightner, 2021/04/10
- Re: static class member as interrupt handler works, but not if class is templated, David Brown, 2021/04/11
- Re: static class member as interrupt handler works, but not if class is templated, Trampas Stern, 2021/04/11
- Re: static class member as interrupt handler works, but not if class is templated, Anton Staaf, 2021/04/11
- Re: static class member as interrupt handler works, but not if class is templated, David Brown, 2021/04/12
- Re: static class member as interrupt handler works, but not if class is templated, Klaus Rudolph, 2021/04/12