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

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

Re: [avr-gcc-list] rjmp confusion


From: Theodore A. Roth
Subject: Re: [avr-gcc-list] rjmp confusion
Date: Wed, 11 Feb 2004 11:56:04 -0800 (PST)


On Wed, 11 Feb 2004, Simon Han wrote:

> Hello,
>       Based on AVR instruction set documentation, rjmp is defined to be
> "relative jump to an address within PC - 2K + 1 and PC + 2K (words)".
> Then it says that "for AVR microcontrollers with Program memory not
> exceeding 4K words this instruction can address the entire memory from
> EVERY address location".  I capitalize the word I am confused about.
> How can a rjmp instruction located at flash memory 3.5K jump back to
> flash memory location at 0.5K?  This will require rjmp (-3K).
>       Does avr-gcc generate code at some middle point (say flash memory
> location at 2K) to solve this problem?

It jumps forward from 3.5K by 1K and wraps around to 0.5K.

Put another way, take the 3.5K address and add the 1K. Then mask the
result with (4K-1) and you will get the 0.5K address.

Ted Roth


reply via email to

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