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.
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.
I have just been looking at the FreeRTOS.org 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 FreeRTOS.org 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.
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.