I have a question about the compilation of Tiva C interrupt handlers.
(1) My understanding is that when an IRQ (e.g. peripheral) interrupt occurs the hardware saves the following registers on the stack from high addresses to low addresses: xPSR, PC, LR, R12, R3, R2, R1, R0. The SP points at R0. Other general purpose registers are not saved on the stack.
(2) An interrupt handler and the subroutines that it calls should not use registers that are not saved. How does one inform the compiler not to use these unsaved registers? One could, of course, explicitly save the other registers, but I've never seen example C-code that does this.
(3) I have used the C construct: #pragma INTERRUPT( foo ) to indicate that subroutine foo is interrupt code. I don't know if this works. However, many examples show the interrupt handler to call other functions in DriverLib or SensorLib. How do these other functions know not to use the unsaved registers?
How does one write safe interrupt handlers, use library subroutines, and insure the unsaved CPU state is not damaged?
GJM