EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Microblaze and low level interrupt example

Started by Andreas Wassatsch April 16, 2008
currently i try to write a simple interrupt driven timer example without
using the provided help functions in the xilinx edk.
The goal is to reduce the code size for a minimal system configuration.
The xilinx functions blows up the code, so i try to program the timer
and interrupt controller components by my self.
So these works, i receive the timer interrupt.
My problem is now, that the handler function doesn't return correctly
and the stack grows up.
I use rtib (microblaze) for the return from interrupt.
Any ideas, why these doesn't work correctly ?

Perhaps somebody has a good reference about the low level programming of
the microblaze.
Hi,

You should use rtid for returning from an interrupt on MicroBlaze.
Since you have used your own versions of the handlers, you also handle the 
stack yourself.
MicroBlaze will not pop/push anything to the stack in hardware, everything 
is controlled by instructions.

If the stack growns, I think you are missing a restore of the stack pointer 
somewhere in the code.
Check that your handler restores the stack pointer to it's previous values 
when you do the rtid instruction.

You are mostly likely creating space on the stack in the beginning of your 
handler with something like
addik r1, r1, -12
This creates space in the stack for 3 words, register r1 is normally used as 
stack pointer and stack pointer grows downwards in memory.
You should then have something near the RTID that restores the value of r1 
like
addik r1, r1, 12


G�ran


"Andreas Wassatsch" <andreas.wassatsch@web.de> wrote in message 
news:fu4p3g$5km$1@gwdu112.gwdg.de...
> currently i try to write a simple interrupt driven timer example without > using the provided help functions in the xilinx edk. > The goal is to reduce the code size for a minimal system configuration. > The xilinx functions blows up the code, so i try to program the timer > and interrupt controller components by my self. > So these works, i receive the timer interrupt. > My problem is now, that the handler function doesn't return correctly > and the stack grows up. > I use rtib (microblaze) for the return from interrupt. > Any ideas, why these doesn't work correctly ? > > Perhaps somebody has a good reference about the low level programming of > the microblaze.

The 2024 Embedded Online Conference