public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/26664]  New: use of rjmp on devices with more than 2kb flash
@ 2006-03-13 14:04 hochstein at algo dot informatik dot tu-darmstadt dot de
  2006-03-13 14:34 ` [Bug target/26664] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: hochstein at algo dot informatik dot tu-darmstadt dot de @ 2006-03-13 14:04 UTC (permalink / raw)
  To: gcc-bugs

I compile the following program with

avr-gcc -mmcu=atmega8515 -o rjmp-test rjmp-test.c

program:

const char dummy[7000] __attribute__((__progmem__));
int main() {}

-----

Error:
The atmega8515 has 8Kb of flash memory. So gcc should not use
the rjmp/rcall instructions since they can only access 2Kb.
But avr-objdump shows this:

Disassembly of section .text:

00000000 <__vectors>:
       0:       bc cd           rjmp    .-1160          ; 0xfffffb7a
<__eeprom_e
       2:       d5 cd           rjmp    .-1110          ; 0xfffffbae
<__eeprom_e
       4:       d4 cd           rjmp    .-1112          ; 0xfffffbae
<__eeprom_e
       6:       d3 cd           rjmp    .-1114          ; 0xfffffbae
<__eeprom_e
       8:       d2 cd           rjmp    .-1116          ; 0xfffffbae
<__eeprom_e
       a:       d1 cd           rjmp    .-1118          ; 0xfffffbae
<__eeprom_e
       c:       d0 cd           rjmp    .-1120          ; 0xfffffbae
<__eeprom_e
...

Discussion:
All interrupt handlers are situated behind the 7000 byte array. Therefore
the jumps of the interrupt vectors have to span at least 7000 bytes.
That is not possible with the rjmp instruction which can span at most 2Kb.
This results in the strange negative offsets.

Solution:
Jumps which span more than 2Kb have to be encoded using "jmp" not "rjmp".


-- 
           Summary: use of rjmp on devices with more than 2kb flash
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hochstein at algo dot informatik dot tu-darmstadt dot de
 GCC build triplet: i686-pc-linux
  GCC host triplet: avr
GCC target triplet: avr


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26664


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-03-14 10:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-13 14:04 [Bug target/26664] New: use of rjmp on devices with more than 2kb flash hochstein at algo dot informatik dot tu-darmstadt dot de
2006-03-13 14:34 ` [Bug target/26664] " pinskia at gcc dot gnu dot org
2006-03-13 14:37 ` pinskia at gcc dot gnu dot org
2006-03-13 14:54 ` hochstein at algo dot informatik dot tu-darmstadt dot de
2006-03-14  8:27 ` hochstein at algo dot informatik dot tu-darmstadt dot de
2006-03-14 10:51 ` rguenth at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).