cancel
Showing results for 
Search instead for 
Did you mean: 

interrupt code

norbertg
Associate II
Posted on December 25, 2008 at 06:31

interrupt code

3 REPLIES 3
norbertg
Associate II
Posted on May 17, 2011 at 09:56

Hello,

I noticed a strange behavior when compiling interrupt code using Keil compiler

I use ST library v2.0

when i write a complex interrupt function it starts to use r12 register

but in file 91x_vect.s

IRQHandler

SUB lr,lr ,#4

SaveContext r0,r3

LDR r0, = VectorAddress

LDR r0, [r0] ; Read the routine address from VIC0 Vector Address register

BLX r0 ; Branch with link to the IRQ handler.

RestoreContext r0,r3

doesn't save on stack r12 ?

is this a bug or I am missing something

Thanks

Norbert

[ This message was edited by: norbertg on 31-10-2008 08:30 ]

mark9
Associate II
Posted on May 17, 2011 at 09:56

''---Removed---''. Some of the demos have broken the register context saving. You should save all registers r0 to r12, especially r12. The old ST library actually worked a little better.

SaveContext r0,r12 ; Save the workspace plus the current

...

RestoreContext r0,r12 ; Restore the context and return

[ This message was edited by: eris on 25-12-2008 10:48 ]

kais
Associate II
Posted on May 17, 2011 at 09:56

Hello,

Sorry for the late reply, I’ve just seen the message.

Inside the IRQ handler we are not using all registers from r0 to r12

So that’s why we are saving the context only of r0-r3.

Moreover the majority of compilers do the saving of context for all general purpose registers prior to executing the ISR.

Taking into account the above statements and to enhance the response time of interrupts we have decided to limit the saving context in IRQ handler to r0-r3.

The current implementation is much appreciated by many STR9 customers.

Kind regards,

Eris.