From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Klaus Rudolph <lts-rudolph@gmx.de>
Cc: gcc-help <gcc-help@gcc.gnu.org>, avr-gcc-list@nongnu.org
Subject: Re: static class member as interrupt handler works, but not if class is templated
Date: Sat, 10 Apr 2021 16:26:44 +0100 [thread overview]
Message-ID: <CAH6eHdTbVcgqMmJG=bW-pSf5ctHeuYp6HZrA=LxzH5obgLGawQ@mail.gmail.com> (raw)
In-Reply-To: <5f39cb4e-a445-bf19-ae90-b76c934aa930@gmx.de>
On Sat, 10 Apr 2021, 15:07 Klaus Rudolph via Gcc-help, <gcc-help@gcc.gnu.org>
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__, __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;
>
This doesn't cause the instantiation of the member function.
Have you tried an explicit instantiation?
template class Dummy<1>;
next prev parent reply other threads:[~2021-04-10 15:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-10 13:33 Klaus Rudolph
2021-04-10 15:26 ` Jonathan Wakely [this message]
2021-04-10 19:36 ` Trampas Stern
2021-04-10 20:11 ` Klaus
2021-04-11 12:21 ` David Brown
2021-04-11 23:33 ` Trampas Stern
2021-04-12 9:20 ` Peter Sommerlad (C++)
2021-04-12 11:16 ` Klaus Rudolph
2021-04-12 11:53 ` Matthijs Kooijman
2021-04-12 12:12 ` Klaus Rudolph
2021-04-12 13:46 ` David Brown
2021-04-12 14:56 ` Klaus Rudolph
2021-04-12 14:25 ` Anton Staaf
2021-04-12 15:06 ` Klaus Rudolph
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAH6eHdTbVcgqMmJG=bW-pSf5ctHeuYp6HZrA=LxzH5obgLGawQ@mail.gmail.com' \
--to=jwakely.gcc@gmail.com \
--cc=avr-gcc-list@nongnu.org \
--cc=gcc-help@gcc.gnu.org \
--cc=lts-rudolph@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).