[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] Pre-prologue and post-epilogue asm code insertion?
From: |
Weddington, Eric |
Subject: |
RE: [avr-gcc-list] Pre-prologue and post-epilogue asm code insertion? |
Date: |
Mon, 20 Oct 2008 21:36:40 -0600 |
> -----Original Message-----
> From:
> address@hidden
> [mailto:address@hidden
> org] On Behalf Of Mark Litwack
> Sent: Monday, October 20, 2008 7:55 PM
> To: address@hidden
> Subject: [avr-gcc-list] Pre-prologue and post-epilogue asm
> code insertion?
>
> Hi all,
>
> Is there an easy way to insert a few lines of asm code in an
> ISR before the prologue starts (at the ISR entry) and then
> some additional code after the epilogue (right before the
> RETI)?
>
> There are a couple of reasons why I'm trying to do this:
>
> 1) To insert some pin toggling instructions so I can more
> accurately track time spent in various ISRs (including
> the register save/restores).
>
> 2) To switch to a different stack for some stack-hungry ISRs
> so that I don't have to reserve as much memory in each
> task's stack area when running a preemptive RTOS.
>
> I've been doing it for a few test scenarios by compiling to
> assembler and then manually inserting code in the generated
> asm, but it's pretty cumbersome. And I don't want to
> declare the ISRs as naked since I still want to the compiler
> to automatically generate the register save/restore code.
>
About the only way to do this that I know of, is to declare the ISRs as naked,
but then you have to write the pro/epi-logue yourself. But you already know
this.