|
From: | E. Weddington |
Subject: | Re: [avr-gcc-list] avr-gcc ABI question |
Date: | Wed, 12 Jan 2005 11:09:36 -0700 |
User-agent: | Mozilla Thunderbird 0.7.3 (Windows/20040803) |
Trampas wrote:
First off I am using avr-gcc 3.4.1 I have the following function and was wondering if the return value was correct. That is where I call the function it looks to be reading r24 and r25 as the 16bit return value. UWORD getMilliSeconds() { UWORD temp; TIMSK=TIMSK & ~(1<<OCIE1A); //Turn Timer1 compare 1A interrupt off 174: 89 b7 in r24, 0x39 ; 57 176: 8f 7e andi r24, 0xEF ; 239 178: 89 bf out 0x39, r24 ; 57 temp=MilliSeconds; 17a: 20 91 20 01 lds r18, 0x0120 17e: 30 91 21 01 lds r19, 0x0121 TIMSK=TIMSK | (1<<OCIE1A); //Turn Timer1 compare 1A interrupt on 182: 89 b7 in r24, 0x39 ; 57 184: 80 61 ori r24, 0x10 ; 16 186: 89 bf out 0x39, r24 ; 57 return temp; } 188: c9 01 movw r24, r18 18a: 08 95 ret
I'm not quite sure what you are asking. Yes, the return value is in r25:r24.Yes, the return value was copied to r25:r24 from r19:r18 (by this: movw r24,r18). Yes r18 was loaded with 0x0120 and r19 was loaded with 0x0121, which correspondes to the "temp = MilliSeconds;" statement. It can only be assumed that MilliSeconds has the correct value that you want (since you don't show how MilliSeconds got that value).
Here is the info on what registers are used: <http://www.nongnu.org/avr-libc/user-manual/FAQ.html#faq_reg_usage> Perhaps this will help with what you are looking for? Eric
[Prev in Thread] | Current Thread | [Next in Thread] |