[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] Puzzling behaviour of rjmp in assembler
From: |
Tom Harris |
Subject: |
RE: [avr-gcc-list] Puzzling behaviour of rjmp in assembler |
Date: |
Tue, 17 Dec 2002 08:36:38 +1100 |
On 6 Dec 2002 at 8:48, Tom Harris wrote:
> Greetings,
>
> Using avr-gcc 20021111, I assembled the following:
>
> .section .text
> .func i2c_delay_T2
> i2c_delay_T2:
> rjmp +2
> rjmp +2
> rjmp +2
> rjmp +2
> ret
> .endfunc
>
> using options `-c -x assembler-with-cpp -mmcu=at90s2313`.
>
> On dumping the output with avr-objdump , the generated code has
> incorrect offsets. `rjmp -2' looks like an infinite loop. This code
> used to work with an old release of avr-gcc, I could find the verion
> if required.
>
> 00000000 <i2c_delay_T2>:
> 0: 00 c0 rjmp .+0 ; 0x2
> 2: ff cf rjmp .-2 ; 0x2
> 4: fe cf rjmp .-4 ; 0x2
> 6: fd cf rjmp .-6 ; 0x2
> 8: 08 95 ret
>
> Is this a bug or what?
>
Unfortunately the old version of avr-gcc that assembled 'rjmp +2' as if it
were 'rjmp .+2' has gone from our server to the great bit bucket in the sky,
so its version is unknown, but I think that it was released in 2001. I can
confirm that it used to behave this way, as I have code in source control
that I had to modify to work with version 20021209. It's probably only of
academic interest now that an old version of avr-gcc was broken.
Thanks for the interest.
TomH <tomh(AT)optiscan(DOT)com>
avr-gcc-list at http://avr1.org