[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Advice on R_AVR_13_PCREL errors linking forTiny85_and
From: |
Bill Roy |
Subject: |
Re: [avr-gcc-list] Advice on R_AVR_13_PCREL errors linking forTiny85_and_ Mega168?! |
Date: |
Fri, 30 Jan 2009 17:37:05 -0700 |
Hi, Eric:
Thanks for your kind followup. Here's the state of play as the sun
sets in Denver.
Still puzzled here. I have a pixie-dust way to make the link work,
but it feels unclean. (I haven't tested the binary yet.)
What doesn't work (yet) is letting the linker figure everything out,
as it ought to... I get some number of PCREL errors based on the order
of modules, all of them about addresses that seem to be in range
according to the map:
firmware bill$ make clean hex
rm -f main.hex main.lst main.obj main.cof main.list main.map
main.eep.hex main.elf *.o usbdrv/*.o main.s usbdrv/oddebug.s usbdrv/
usbdrv.s *.lst
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c usbdrv/usbdrv.c -o usbdrv/usbdrv.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c usbdrv/usbdrvasm.S -o usbdrv/usbdrvasm.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c main.c -o main.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c bitlash.c -o bitlash.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c bitlash-cmdline.c -o bitlash-cmdline.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c bitlash-taskmgr.c -o bitlash-taskmgr.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c bitlash-parser.c -o bitlash-parser.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c bitlash-interpreter.c -o bitlash-interpreter.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c eeprom.c -o eeprom.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c bitlash-arduino.c -o bitlash-arduino.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c bitlash-functions.c -o bitlash-functions.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c bitlash-serial.c -o bitlash-serial.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c bitlash-eeprom.c -o bitlash-eeprom.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c bitlash-error.c -o bitlash-error.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -o main.elf usbdrv/usbdrv.o usbdrv/usbdrvasm.o main.o
bitlash.o bitlash-cmdline.o bitlash-taskmgr.o bitlash-parser.o bitlash-
interpreter.o eeprom.o bitlash-arduino.o bitlash-functions.o bitlash-
serial.o bitlash-eeprom.o bitlash-error.o -Wl,-Map=main.map,--cref -
Wl,--relax -Wl,--gc-sections
/usr/local/AVRMacPack-20081213/lib/gcc/avr/4.3.2/../../../../avr/lib/
avr25/crttn85.o: In function `__vector_default':
(.vectors+0xa): relocation truncated to fit: R_AVR_13_PCREL against
symbol `__vector_5' defined in .text section in bitlash-arduino.o
/usr/local/AVRMacPack-20081213/lib/gcc/avr/4.3.2/../../../../avr/lib/
avr25/crttn85.o:(.init9+0x2): relocation truncated to fit:
R_AVR_13_PCREL against symbol `exit' defined in .fini9 section in /usr/
local/AVRMacPack-20081213/lib/gcc/avr/4.3.2/avr25/libgcc.a(_exit.o)
bitlash.o: In function `doCommand':
bitlash.c:(.text+0x12): relocation truncated to fit: R_AVR_13_PCREL
against symbol `setjmp' defined in .text section in /usr/local/
AVRMacPack-20081213/lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/
libc.a(setjmp.o)
bitlash.o: In function `initBitlash':
bitlash.c:(.text+0x4e): relocation truncated to fit: R_AVR_13_PCREL
against symbol `strncpy_P' defined in .text section in /usr/local/
AVRMacPack-20081213/lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/
libc.a(strncpy_P.o)
bitlash.c:(.text+0x68): relocation truncated to fit: R_AVR_13_PCREL
against symbol `strncpy_P' defined in .text section in /usr/local/
AVRMacPack-20081213/lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/
libc.a(strncpy_P.o)
make: *** [main.elf] Error 1
Take the first complaint above as an example. Here is what the map
says about where the linker put __vector_5:
.text 0x00001692 0x186 bitlash-arduino.o
0x000016b4 digitalRead
0x000016ca digitalWrite
0x00001692 pinMode
0x000016ec __vector_5
0x000017c2 delay
0x000017a6 millis
0x00001816 delayMicroseconds
It looks to me like __vector_5 at 16ec is within 13-bit PC relative
jump range from 0x000a... or am I mistaken?
In fact, since the linker puts _exit at 1b56:
.fini9 0x00001b56 0x0 /usr/local/AVRMacPack-20081213/
lib/gcc/avr/4.3.2/avr25/libgcc.a(_exit.o)
0x00001b56 exit
0x00001b56 _exit
I am puzzled why it could be unhappy about any relative jumps.
Shouldn't they all fit?
Anyway, a tiny application of "-lc -lm pixie dust" placates the
linker, for reasons which I do not understand and therefore make me
suspicious:
firmware bill$ make clean hex
rm -f main.hex main.lst main.obj main.cof main.list main.map
main.eep.hex main.elf *.o usbdrv/*.o main.s usbdrv/oddebug.s usbdrv/
usbdrv.s *.lst
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c usbdrv/usbdrv.c -o usbdrv/usbdrv.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c usbdrv/usbdrvasm.S -o usbdrv/usbdrvasm.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c main.c -o main.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c bitlash.c -o bitlash.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c bitlash-cmdline.c -o bitlash-cmdline.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c bitlash-taskmgr.c -o bitlash-taskmgr.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c bitlash-parser.c -o bitlash-parser.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c bitlash-interpreter.c -o bitlash-interpreter.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c eeprom.c -o eeprom.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c bitlash-arduino.c -o bitlash-arduino.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c bitlash-functions.c -o bitlash-functions.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c bitlash-serial.c -o bitlash-serial.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c bitlash-eeprom.c -o bitlash-eeprom.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -c bitlash-error.c -o bitlash-error.o
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85 -o main.elf usbdrv/usbdrv.o usbdrv/usbdrvasm.o main.o \
bitlash-arduino.o \
bitlash.o -lc -lm \ <--- pixie dust
bitlash-error.o -lc -lm \ <--- pixie dust
bitlash-cmdline.o \
bitlash-taskmgr.o \
bitlash-parser.o \
bitlash-interpreter.o \
eeprom.o \
bitlash-functions.o \
bitlash-serial.o \
bitlash-eeprom.o \
-Wl,-Map=main.map,--cref -Wl,--relax -Wl,--gc-sections
rm -f main.hex main.eep.hex
avr-objcopy -j .text -j .data -O ihex main.elf main.hex
avr-size main.hex
text data bss dec hex filename
0 7026 0 7026 1b72 main.hex
avr-objdump -S main.elf > main.lss
Apparent success. I will briefly enjoy the sensation of victory
before flashing up a copy and releasing the magic smoke.
I don't feel comfortable about this pixie-dust fix and I don't expect
it to be stable. One does not normally expect the linker to need
guidance on module ordering else fail like this.
Thoughts on this fact pattern would be most welcome.
Cheers,
-br
On Jan 29, 2009, at 4:08 PM, Weddington, Eric wrote:
-----Original Message-----
From:
address@hidden
[mailto:address@hidden
org] On Behalf Of Bill Roy
Sent: Sunday, January 25, 2009 2:09 PM
To: address@hidden
Subject: Re: [avr-gcc-list] Advice on R_AVR_13_PCREL errors
linking forTiny85_and_ Mega168?!
I have received advice to make the total code size smaller and keep
trying, which I shall do.
Were you able to make the code smaller?
_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list