avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] Migration from AVR GCC to WinAVR or new Linux avr-gcc


From: Theodore A. Roth
Subject: Re: [avr-gcc-list] Migration from AVR GCC to WinAVR or new Linux avr-gcc
Date: Tue, 16 Sep 2003 09:32:24 -0700 (PDT)


On Tue, 16 Sep 2003, Jamie Lawson wrote:

>
> Hi,
>
> I just came across a similar sounding problem. By comparing the listings
> from both compiler versions; I have found, at least in my case, that the
> newer compiler has optimized out some of the assembler routines I use
> for accurate timing (Dallas 1-wire stuff).
>
> For example: I have used several contiguous "rjmp +2" instructions just to
> waste a few uS and they have been "optimized" to rjmp somewhere else.
> I fixed this by using local labels in the assembler routine.

I seem to recall hitting this problem a while back. It has to do with
how gas interprets 'rjmp +2'. Turns out that gas treats the '+2' as an
absolute address which is not quite what you expect.

What you should use instead is 'rjmp .+2' to make it a relative
address. Using local labels is essentially the same thing and probably
more technically correct since you avoid magic numbers thus making
your code more readable.

The changes made to gas which changed the behaviour of 'rjmp +2' where
made just before this patch for gcc:

  http://gcc.gnu.org/ml/gcc-cvs/2002-11/msg00789.html

Ted Roth


reply via email to

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