Am 17.08.24 um 15:43 schrieb Gerald Pfeifer:
All this patch does (modulo reformatting) is put SEI in a <code>
environment.

However, looking at this I've got a question: How about "imposing a
function name" which is listed as a difference of <code>noblock</code>
versus others? This (the specific name) is not actually documented
anywhere? Is that an omission, or am I missing something?

Gerald

Hmmm, as far as I know, there is no documentation.  The GCC docs just
propose to use the ISR resp. ISR_N macro from AVR-LibC, and AVR-LibC
doesn't document the gory details, either:

https://avrdudes.github.io/avr-libc/avr-libc-user-manual-2.2.0/group__avr__interrupts.html#gad28590624d422cdf30d626e0a506255f

Background is this:  The old signal and interrupt attributes allow
to define an ISR as

1) [[signal]] void __vector_1 (void) { ... }

2) [[interrupt]] void __vector_2 (void) { ... }

where the 2nd form adds a SEI before the prologue.  Using AVR-LibC,
the idioms for 1) and 2) are:

3) ISR(1) { ... }

4) ISR(2, ISR_NOBLOCK) { ... }

where 4) basically resolves to [[signal,interrupt]] void __vector_2 ...
This is supported by GCC: With [[interrupt]], the [[signal]] part is
basically ignored.  This won't work with the new signal(n) attribute:

5) ISR_N(1) static void my_isr1 (void) { ... }  // Ok

6) ISR_N(2, ISR_NOBLOCK) static void my_isr2 (void) { ... }  // Won't
work as expected when we expand "ISR_NOBLOCK" as [[interrupt]] because
the latter requires a function name of the __vector_N form like in 2).
Hence a new attribute "noblock" without that requirement.

HTH

Johann

p.s.: ISR_N is added in AVR-LibC v2.3, so you won't find the doc
behind the link above.


---
  htdocs/gcc-15/changes.html | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/htdocs/gcc-15/changes.html b/htdocs/gcc-15/changes.html
index bfd98496..fe7cf3c1 100644
--- a/htdocs/gcc-15/changes.html
+++ b/htdocs/gcc-15/changes.html
@@ -122,11 +122,11 @@ a work-in-progress.</p>
      functions defined in a C++ namespace.</li>
    <li>Support has been added for the <code>noblock</code> function attribute.
      It can be specified together with the <code>signal</code> attribute to
-    indicate that the interrupt service routine should start with a SEI
-    instruction to globally re-enable interrupts.  The difference to the
-    <code>interrupt</code> attribute is that the <code>noblock</code>
-    attribute just acts like a flag and does not impose a specific function
-    name.</li>
+    indicate that the interrupt service routine should start with a
+    <code>SEI</code> instruction to globally re-enable interrupts.
+    The difference to the <code>interrupt</code> attribute is that the
+    <code>noblock</code> attribute just acts like a flag and does not
+    impose a specific function name.</li>
    <li>Support has been added for the <code>__builtin_avr_mask1</code>
      <a 
href="https://gcc.gnu.org/onlinedocs/gcc/AVR-Built-in-Functions.html#index-_005f_005fbuiltin_005favr_005fmask1";
         >built-in function</a>.  It can be used to compute some bit masks when

Reply via email to