avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] rjmp across FLASHEND


From: Georg-Johann Lay
Subject: Re: [avr-libc-dev] rjmp across FLASHEND
Date: Fri, 07 Oct 2011 10:15:50 +0200
User-agent: Thunderbird 2.0.0.24 (X11/20100302)

Bernhard Kuemel schrieb:
> Hi!
> 
> My avr-gcc (debian/squeeze, gcc version 4.3.5 (GCC)), as it seems,
> doesn't support rjmp across FLASHEND for ATmega168 (16K Flash):
> 
> #include <avr/io.h>
> 
>         .global main
> main:
> rjmp    tinyloader
> 
> 
>         .org FLASHEND+1-0x3e
> tinyloader:
>         rjmp    tinyloader
> 
> address@hidden:~/src/attiny45/test5$ make
> avr-gcc  -mmcu=atmega168  -c -o btinyloader.o btinyloader.S
> avr-gcc -g -Wall -O0 -mmcu=atmega168 -nostartfiles
> -Wl,-Map,btinyloader.map -o btinyloader.elf btinyloader.o
> btinyloader.o: In function `main':
> (.text+0x0): relocation truncated to fit: R_AVR_13_PCREL against `no symbol'
> make: *** [btinyloader.elf] Error 1
> 
> Can you implement this, please? Is there a workaround to get the correct
> rjmp?

You are writing in assembler and thus it's up to you to use correct commands.
Neither compiler, assembler or linker will fix bad instructions/operands for 
you.

RJMP can address . +/- 4KiB, i.e. it can target all of flash of an ATmega8.
But as you know, ATmega168 has 16KiB of flash and you will have to use JMP to
target locations outside the range of RJMP.  You may also want to use always
JMP and have a look at linker relaxation.

Johann

> Thanks, Bernhard




reply via email to

[Prev in Thread] Current Thread [Next in Thread]