1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

Microblaze and low level interrupt example

Discussion in 'Embedded' started by Andreas Wassatsch, Apr 16, 2008.

  1. 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.
    Andreas Wassatsch, Apr 16, 2008
    1. Advertisements

  2. 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
    addik r1, r1, 12

    Göran Bilski, Apr 16, 2008
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.