This is the mail archive of the
mailing list for the GCC project.
Re: avr-gcc doesn't know address space wraps?
- From: Georg-Johann Lay <avr at gjlay dot de>
- To: Ralph Doncaster <ralphdoncaster at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Sun, 03 Jan 2016 18:22:20 +0100
- Subject: Re: avr-gcc doesn't know address space wraps?
- Authentication-results: sourceware.org; auth=none
- References: <CAAmKpLHuPwWcMgA_XMAQbaB+jFx6q3cWk7nDJ3OiZXkHPmxcdw at mail dot gmail dot com>
Ralph Doncaster schrieb:
avr-gcc 4.9.2 doesn't seem to know that the address space wraps, so
that an rjmp in the last 2KB of the address space can reach code in
the first 2KB. The following code works fine with a jmp, but if I
change the jmp ResetVector to rjmp, I get:
(.bootloader+0x4): relocation truncated to fit: R_AVR_13_PCREL against
I'm compiling with:
avr-gcc -mmcu=atmega328p -nostartfiles
-Wl,-section-start=.bootloader=0x7E00 picobootSTK500.S -o
I don't quite get what your question has to do with the compiler proper.
As you are programming in assembly, the only thing that avr-gcc does
is calling the assembler and the linker for you.
; this will be address 0x0000 which is the reset vector
; user application will over-write blink code
; dimly lights LED (using internal pullup) with a 1.5 s cycle time
sbi PINB, LEDPIN
ldi ZH, 60
; 11.8M cycles =~ .74s @ 16Mhz
rcall Delay3Cycle ; 256 * 3 cycles
sbiw ZL, 1
; delay 3 cycles * r24 + 4 cycles (ret instruction)
; use -WL,--section-start=.bootloader=0xXf00
in Temp, MCUSR
sbrs Temp, EXTRF
jmp ResetVector ; jump to application code