interrupt handling using microblaze with XPS

Hi, I am pretty new to the arena of interrupt handling and would need some help. I am currently using microblaze v4.00a and with Xilinx platform studio 7.1 to develop some UART handling routines. what I am not sure, is

1) whether the important registers (eg, stack pointers and other registers) are saved during an interrupt handling, or do I have to explicitly save them myself.

I dun think this is handled by the microblaze and am wondering if the mb-gcc C compiler would be smart enough to do the same.

kindly advice. thanks! Chris

Reply to
Loading thread data ...

That depends on the machine you are using. Read its documentation. For example, an X86 saves the return address and the program status (flags, interrupt enables, etc.) automatically. Others may differ.

Chuck F (cbfalconer at maineline dot net)
   Available for consulting/temporary embedded and systems.
Reply to

The 68HC11 for example saves all registers on the stack. Others (e.g. NIOS2) save nothing on the stack and just swap a couple registers.

Grant Edwards                   grante             Yow!  My forehead feels
                                  at               like a PACKAGE of moist
 Click to see the full signature
Reply to
Grant Edwards

I have just been looking at the Microblaze demo to see how that configured the interrupts. It seems that the development environment handles all the interrupt prologue and epilogue code for you. From the documentation:

"An interrupt service routine that does not cause a context switch has no special requirements and can be written as a normal function."

and looking through the code the serial port interrupt is just written as: void vSerialISR( void *pvBaseAddress )

The fact that it takes a parameter means it cannot be called directly in response to an interrupt, but indirectly after some processing.

So I would conclude - you have to write your ISR like a standard function without having to worry about the save and restore of any of the registers. Saving of general purpose registers is handled by the tool. Saving of other registers is handled by the hardware itself. Once you have written your ISR you have to somehow tell the tool about it through the GUI. The file xintc_g.c is then automatically generated to contain the interrupt table and references to your ISR functions.

Sorry I cannot remember specifics but I hope this is a pointer.

Regards, Richard.

  • formatting link
  • formatting link
    for Cortex-M3, ARM7, ARM9, HCS12, H8S, MSP430 Microblaze, Coldfire, AVR, x86, 8051, PIC24 & dsPIC
Reply to

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.