[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] About context saving in Vectors

From: Lin Nan
Subject: [avr-gcc-list] About context saving in Vectors
Date: Wed, 14 Jan 2009 17:03:01 +0800

Hi all,


I have been focused on a problem for three days.


My program does not work if compiled with –Os in Ubuntu Linux 8.10 (Avr Gcc 4.3.0), but works if compiled with –Os in Windows+WinAVR(20080512).


After quite a long time of digging, I found that a piece of code does not work correctly where there is also a lot of USART1_TX_vect interrupts.


I compared the assembly code generated in two condition (Linux and Windows) and found that the ISR(USART1_TX_vect) function of Linux version save fewer registers than that of Windows Version, and so does ISR(USART1_RX_vect) function.


The ISR(USART1_TX_vect) function in Windows saves all call-used registers (r18-r27, r30-r31) while the Linux one neglects r21. Since there are function calls in the ISR function, I expected that all call-used registers should be saved.


And the function ISR(USART1_RX_vect) in Linux saves even fewer registers.


I think this might be the cause of the strange bug. Does anyone have a comprehensive understanding on it?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]