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