[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] rjmp confusion
From: |
Simon Han |
Subject: |
Re: [avr-gcc-list] rjmp confusion |
Date: |
Wed, 11 Feb 2004 12:24:02 -0800 |
Thank you for all of these quick replies.
This is what makes this list a *great* list. :-)
By the way, when I use "-mshort-calls" in avr-gcc in atmega128, will
avr-gcc warn me if rjmp is not possible? Note that even if image size
is greater than 4K words (8K bytes), it might still be possible to use
rjmp. Will avr-gcc try to rearrange image such that rjmp is possible
even if image size is greater than 4K words.
Thanks,
Simon
On Wednesday, February 11, 2004, at 12:03 PM, Rune Christensen wrote:
Hello
The rjmp use "modulus"/wrapping when calculating the new address in the
microcontroller.
So rjmp +1.0k at 3.5k will end up at (3.5k + 1.0k) mod 4k = 0.5k
Best regards
Rune Christensen
-----Original Message-----
From: address@hidden
[mailto:address@hidden Behalf Of Simon Han
Sent: Wednesday, February 11, 2004 8:20 PM
To: address@hidden
Subject: [avr-gcc-list] rjmp confusion
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?
Thank you for any help,
Simon
_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list