Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8374

General • Baremetal interrupt and GCC

$
0
0
I can't seem to tell the GCC compiler when I have interrupt code is it generates the wrong prologue and epilogue
Is there some trick to this version of GCC the pico uses or is it dorked?

Code:

__attribute__((interrupt)) void irqtest( void ){    asm("nop");}
Generates a normal function code below it seems to ignore the attribute
Got to love pop {r7, pc} in interrupt code

Code:

.text.section.text.irqtest,"ax",%progbits.align1.globalirqtest.syntax unified.code16.thumb_func.typeirqtest, %functionirqtest:@ Stack Align: May be called with mis-aligned SP.@ args = 0, pretend = 0, frame = 0@ frame_needed = 1, uses_anonymous_args = 0push{r7, lr}addr7, sp, #0.syntax dividednop@ 0 "" 2.thumb.syntax unifiednopmovsp, r7@ sp neededpop{r7, pc}.sizeirqtest, .-irqtest
At least the naked attribute works as per below but means I have to provide inline prologue and epilogue

Code:

.text.section.text.irqtest,"ax",%progbits.align1.globalirqtest.syntax unified.code16.thumb_func.typeirqtest, %functionirqtest:@ Naked Function: prologue and epilogue provided by programmer.@ args = 0, pretend = 0, frame = 0@ frame_needed = 1, uses_anonymous_args = 0.syntax dividednop@ 0 "" 2.thumb.syntax unifiednop.sizeirqtest, .-irqtest

Statistics: Posted by LdB — Wed Nov 05, 2025 12:10 am



Viewing all articles
Browse latest Browse all 8374

Trending Articles