[En-Nut-Discussion] ICC Interupt handling corrupting registers

Brett Abbott Brett.Abbott at digital-telemetry.com
Fri Jun 25 12:21:42 CEST 2004


Hi

I have spotted a situation with the JTAG which seemed odd and I'd 
appreciate it if anyone knows anything about it.

The ICC compiler allocates registers to cope with parameter passing for 
C functions (as well as managing the underlying code of course).  In the 
case of interupt handlers, it carefully detects and protects registers 
prior to them being used, so as to avoid destroying the data/values in 
the interupted function.

I have been seeing R16/R17 return code corruption during heavy use of 
the uarts.  This is very intermiiteant.  In the case of our uart 
drivers, I am uncertain if ICC has appropriately detected the function 
eventually called, eg. RxComplete.

I think, in some cases, where the application being interupted is 
complex or, when the timing is just wrong, registers may be being corrupted.

Does anyone know if the compiler is protecting the RxComplete functions, 
is it able to detect the fact that the function is called by the 
interupt, even though it is defined via the uart.h structures.

I have a locally defined copy of the RxComplete in my application for 
debugging purposes, is it possible that this is why Im having problems?

The ICC help tells us that if you write your own assembly interupt 
functions, you must protect all registers that you use.  It also states 
that if you have a C code interut handler, and associate an interupt 
pragma with a function, this protection is done automatically for you.

Any help much appreciated.
Brett

-- 
-----------------------------------------------------------------
Brett Abbott, Managing Director, Digital Telemetry Limited
Email: Brett.Abbott at digital-telemetry.com
PO Box 24 036 Manners Street, Wellington, New Zealand
Phone +64 (4) 5666-860  Mobile +64 (21) 656-144
------------------- Commercial in confidence --------------------





More information about the En-Nut-Discussion mailing list