cancel
Showing results for 
Search instead for 
Did you mean: 

Warning about file 91x_vect.s

lhoy
Associate II
Posted on August 22, 2008 at 23:42

Warning about file 91x_vect.s

2 REPLIES 2
lhoy
Associate II
Posted on May 17, 2011 at 11:32

I have been trying to build a STR912 application based on the USB examples from the ST7/9 USB kit ''um0290''. After many hours of chasing flakey behaviour, I noted that the low level interrupt code in the file ''91x_vect.s'' only saved/restored the R0-R3 register data during an IRQ interrupt. It should have been saving R0-R12. A quick check of newer examples showed that later versions of the 91x_vect.s code had been corrected to save/restore R0-R12. The file in question is the one that is included in all the examples in the USB kit. It is time stamped 9/29/2006. The examples had been a bit flakey from the start but the real problems started when I added more interrupt activity and tried to up the optimization level in the compiler. The unexplained program jumps and corrupted memory arrays went away after modifing 91x_vect.s to save/restore the full set of registers. I have only been working with the examples from the USB kit. I do not know if this problem also exists in other older example files.

mark9
Associate II
Posted on May 17, 2011 at 11:32

I will have to concur with this warning. I wish I had found it at the beginning of the day rather waste all day trying to figure out why R12 was getting corrupted. I also noticed that the ST example code is all over the place. The old code saves/restores r0-r12, the newer code saves/restores r0-r3 or r0-r4, depending on which example you look at.

I believe the proper thing to do is (for EWARM 5.11) change 91x_vect.s to use the following where needed.

STMFD sp!,{r0-r3,r12,lr} ;

...

LDMFD sp!,{r0-r3,r12,pc}^;