If I compile ------ .arch atmega128 .text .org 0x0 jmp main .org 0x46 .global main .type main, @function main: nop jmp main ------ with avr-as -g -D -o t.elf -mmcu=atmega128 t.S I get ------ avr-objdump -D t.elf t.elf: file format elf32-avr Disassembly of section .text: 00000000 <main-0x46>: 0: 0c 94 00 00 jmp 0 ; 0x0 <main-0x46> ... 00000046 <main>: 46: 00 00 nop 48: 0c 94 00 00 jmp 0 ; 0x0 <main-0x46> ------ which should be a "jmp 0x46". When I use rjmp/rcall it works fine.
Hi Mack, This is not a bug, but a feature. The AVR assembler has chosen to use a reloc with the JMP instruction, so the actual address is not resolved until link time. If you disassemble the object file with -Dr instead of -D you will see: 00000000 <main-0x46>: 0: 0c 94 00 00 jmp 0 ; 0x0 <main-0x46> 0: R_AVR_CALL .text+0x46 etc. The reason for this is that the JMP instruction takes an absolute address as its operand, and this address cannot be known until the linker has assigned a location to the .text section. The RJMP and RCALL instructions on the other hand take PC-relative operands, so their values can be computed by the assembler at assembly time. Hence these two instructions do not generate relocs. Cheers Nick