Forum: Compiler & IDEs GNUARM-Linker ERROR wegen hardware FP


von Steffen H. (mcst)


Angehängte Dateien:

Lesenswert?

Hallo zusammen,

ich hoff auf eure Hilfe, ich versuche das Olimex Bord LPC2378-STK-A mit 
Eclipse und GNUARM zum Laufen zubringen.

Das Standardbeispiel einer blinkenden LED hab ich hinbekommen. Nun 
wollte ich die CAN-Schnittstelle testen aber sobald ich das Programm 
erstellen will, macht mir der Linker Probleme:
1
Building target: CAN_test.elf
2
Invoking: ARM Windows GCC C Linker
3
arm-elf-ld -T"D:\work\workspace\CAN_test\demo2378.cmd" -Map main.map  -o"CAN_test.elf"  ./can.o ./fio.o ./irq.o ./main.o ./startup.o ./target.o   
4
arm-elf-ld: ERROR: ./startup.o uses hardware FP, whereas CAN_test.elf uses software FP
5
arm-elf-ld: Warning: ./startup.o does not support interworking, whereas CAN_test.elf does
6
arm-elf-ld: failed to merge target specific data of file ./startup.o
7
./startup.o: In function `Undef_Addr':
8
(.text+0x24): undefined reference to `UNDEF_Routine'
9
./startup.o: In function `SWI_Addr':
10
(.text+0x28): undefined reference to `SWI_Routine'
11
./startup.o: In function `PAbt_Addr':
12
(.text+0x2c): undefined reference to `UNDEF_Routine'
13
./startup.o: In function `DAbt_Addr':
14
(.text+0x30): undefined reference to `UNDEF_Routine'
15
./startup.o: In function `IRQ_Addr':
16
(.text+0x34): undefined reference to `IRQ_Routine'
17
./startup.o: In function `FIQ_Addr':
18
(.text+0x38): undefined reference to `FIQ_Routine'
19
make: *** [CAN_test.elf] Error 1
So wie ich es verstehe, ist Startup mit hardware FP und der Rest mit 
software FP übersetzt wurden, daher der ERROR.
Hab schon gegoogelt und wie vorgeschlagen versucht die entsprechende 
Bibliothek libgcc.a zu ersetzen und Flags mit anzugeben. Hat aber alles 
nicht geholfen (ggf. Hab ich auch die falsche erwischt)

Ich habe mal das komplette Build-Listing als .txt angehangen. Hab mir 
das jetzt auch noch mal genauer angeschaut, denke der Assembler 
übersetzt die Startup.s und verursacht so denn Fehler aber ehrlich 
gesagt weis nicht mehr weiter und hoffe nun auf euch.

LG Steffen

von Martin T. (mthomas) (Moderator) Benutzerseite


Lesenswert?

1. -msoft-float Option sollte man erstmal weglassen, wenn es eine nicht 
gar zu ungewöhnlich konfigurierte toolchain ist.

2. Assemblieren einer Assembler-Datei ebenfalls über Frontend arm-*-gcc 
durchführen, nicht direkt per Aufruf von arm-*-as. Dabei dann zumindest 
-mcpu-Parameter mitgeben.

3. Linken ebenfalls über arm-*-gcc, den Linker (arm-*-ld) nicht direkt 
aufrufen - das bring nur Frust. Beim Linken auch einfach die CFLAGS 
mitgeben (zumindest aber die -mcpu option). Dann ruft das Frontend(gcc) 
den Linker(ld) intern automatisch mit den richtigen Optionen.

mglw. hilfreich:
1
-------- begin (mode: ROM_RUN) --------
2
arm-eabi-gcc (devkitARM release 23b) 4.3.0
3
Copyright (C) 2008 Free Software Foundation, Inc.
4
This is free software; see the source for copying conditions.  There is NO
5
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
6
7
8
Assembling (ARM-only): Common/src/Startup.S
9
arm-eabi-gcc -c -mcpu=arm7tdmi-s  -I. -x assembler-with-cpp -DROM_RUN -D__WinARM__ -D__WINARMSUBMDL_LPC2378__ -Wa,-adhlns=Common/src/Startup.lst,-gdwarf-2 Common/src/Startup.S -o Common/src/Startup.o
10
11
Compiling C: main.c
12
arm-eabi-gcc -c  -mcpu=arm7tdmi-s  -I. -gdwarf-2 -DROM_RUN -D__WinARM__ -D__WINARMSUBMDL_LPC2378__  -Os -Wall -Wcast-align -Wimplicit  -Wpointer-arith -Wswitch -ffunction-sections -fdata-sections -Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-adhlns=main.lst  -ICommon/inc -Wcast-qual -MD -MP -MF .dep/main.o.d -Wnested-externs  -std=gnu99 -Wmissing-prototypes  -Wstrict-prototypes -Wmissing-declarations main.c -o main.o 
13
14
Compiling C: fio.c
15
arm-eabi-gcc -c  -mcpu=arm7tdmi-s  -I. -gdwarf-2 -DROM_RUN -D__WinARM__ -D__WINARMSUBMDL_LPC2378__  -Os -Wall -Wcast-align -Wimplicit  -Wpointer-arith -Wswitch -ffunction-sections -fdata-sections -Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-adhlns=fio.lst  -ICommon/inc -Wcast-qual -MD -MP -MF .dep/fio.o.d -Wnested-externs  -std=gnu99 -Wmissing-prototypes  -Wstrict-prototypes -Wmissing-declarations fio.c -o fio.o 
16
17
Compiling C: uart.c
18
arm-eabi-gcc -c  -mcpu=arm7tdmi-s  -I. -gdwarf-2 -DROM_RUN -D__WinARM__ -D__WINARMSUBMDL_LPC2378__  -Os -Wall -Wcast-align -Wimplicit  -Wpointer-arith -Wswitch -ffunction-sections -fdata-sections -Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-adhlns=uart.lst  -ICommon/inc -Wcast-qual -MD -MP -MF .dep/uart.o.d -Wnested-externs  -std=gnu99 -Wmissing-prototypes  -Wstrict-prototypes -Wmissing-declarations uart.c -o uart.o 
19
20
Compiling C: Common/src/timer.c
21
arm-eabi-gcc -c  -mcpu=arm7tdmi-s  -I. -gdwarf-2 -DROM_RUN -D__WinARM__ -D__WINARMSUBMDL_LPC2378__  -Os -Wall -Wcast-align -Wimplicit  -Wpointer-arith -Wswitch -ffunction-sections -fdata-sections -Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-adhlns=Common/src/timer.lst  -ICommon/inc -Wcast-qual -MD -MP -MF .dep/timer.o.d -Wnested-externs  -std=gnu99 -Wmissing-prototypes  -Wstrict-prototypes -Wmissing-declarations Common/src/timer.c -o Common/src/timer.o 
22
23
Compiling C: Common/src/target.c
24
arm-eabi-gcc -c  -mcpu=arm7tdmi-s  -I. -gdwarf-2 -DROM_RUN -D__WinARM__ -D__WINARMSUBMDL_LPC2378__  -Os -Wall -Wcast-align -Wimplicit  -Wpointer-arith -Wswitch -ffunction-sections -fdata-sections -Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-adhlns=Common/src/target.lst  -ICommon/inc -Wcast-qual -MD -MP -MF .dep/target.o.d -Wnested-externs  -std=gnu99 -Wmissing-prototypes  -Wstrict-prototypes -Wmissing-declarations Common/src/target.c -o Common/src/target.o 
25
26
Compiling C: Common/src/irq.c
27
arm-eabi-gcc -c  -mcpu=arm7tdmi-s  -I. -gdwarf-2 -DROM_RUN -D__WinARM__ -D__WINARMSUBMDL_LPC2378__  -Os -Wall -Wcast-align -Wimplicit  -Wpointer-arith -Wswitch -ffunction-sections -fdata-sections -Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-adhlns=Common/src/irq.lst  -ICommon/inc -Wcast-qual -MD -MP -MF .dep/irq.o.d -Wnested-externs  -std=gnu99 -Wmissing-prototypes  -Wstrict-prototypes -Wmissing-declarations Common/src/irq.c -o Common/src/irq.o 
28
29
Linking: main.elf
30
arm-eabi-gcc  -mcpu=arm7tdmi-s  -I. -gdwarf-2 -DROM_RUN -D__WinARM__ -D__WINARMSUBMDL_LPC2378__  -Os -Wall -Wcast-align -Wimplicit  -Wpointer-arith -Wswitch -ffunction-sections -fdata-sections -Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-adhlns=Common/src/Startup.lst  -ICommon/inc -Wcast-qual -MD -MP -MF .dep/main.elf.d Common/src/Startup.o   main.o fio.o uart.o Common/src/timer.o Common/src/target.o Common/src/irq.o     --output main.elf -nostartfiles -Wl,-Map=main.map,--cref,--gc-sections -lc  -lm -lc -lgcc     -TCommon//LPC2378-ROM.ld
31
32
Creating load file for Flash: main.hex
33
arm-eabi-objcopy -O ihex main.elf main.hex
34
35
Creating load file for Flash: main.bin
36
arm-eabi-objcopy -O binary main.elf main.bin
37
38
Creating Extended Listing: main.lss
39
arm-eabi-objdump -h -S -C main.elf > main.lss
40
41
Creating Symbol Table: main.sym
42
arm-eabi-nm -n main.elf > main.sym

von Steffen H. (mcst)


Lesenswert?

Hallo,
ich muss zugeben, ich seh da nicht so richtig durch. Als Toolchain hab 
ich einfach das GNUARM von
http://www.gnuarm.com/
runtergeladen, installiert und Eclipse Plugin eingefügt.
Hab aber grad festgestellt das  ich meine Version nicht mehr auf 
gnuarm.com zu finden ist. Lade jetzt erstmal noch mal eine andere 
Version (binutils-2.16.1, gcc-4.1.0...) runter und teste obs besser 
geht.

Die Gänderungen hab ich gemacht, mun bekomm ich aber den Fehler:
1
make all
2
Building file: ../crt.S
3
Invoking: ARM Windows GCC Assembler
4
arm-elf-gcc-x assembler-with-cpp -v -mapcs -MMD -MP -MF"crt.d" -MT"crt.d" -mcpu=arm7tdmi-s -mthumb -g -ggdb-o"crt.o" "../crt.S"
5
/bin/sh: arm-elf-gcc-x: command not found
6
make: *** [crt.o] Error 127

von Steffen H. (mcst)


Angehängte Dateien:

Lesenswert?

OK mit der neuen Version gibt es andere Fehler, laufen tut aber gar 
nichts mehr:
bei mein Programm zum LEB-blinken bekomme ich den Error:
1
Building target: BLINK.elf
2
Invoking: ARM Windows GCC C Linker
3
arm-elf-ld -T"D:\work\workspace\BLINK\demo2378_blink_flash.cmd" -Wl,-Map,BLINK.map -v -mcpu=arm7tdmi-s -g -ggdb -o"BLINK.elf"  ./crt.o ./fio.o ./irq.o ./main.o ./target.o   
4
arm-elf-ld: unrecognised emulation mode: cpu=arm7tdmi-s
5
Supported emulations: armelf
6
make: *** [BLINK.elf] Error 1

bei meinem CAN-Testprogramm siehts so aus:
1
Building target: CAN_test.elf
2
Invoking: ARM Windows GCC C Linker
3
arm-elf-gcc -T"D:\work\workspace\CAN_test\demo2378.cmd" -nodefaultlibs -Wl,-Map,CAN_test.map -v -mcpu -mapcs -mcpu=arm7tdmi-s -g3 -ggdb -o"CAN_test.elf"  ./can.o ./fio.o ./irq.o ./main.o ./startup.o ./target.o   
4
Using built-in specs.
5
Target: arm-elf
6
Configured with: ../gcc-4.1.0/configure --target=arm-elf --prefix=/g/gnuarm-4.1.0 --enable-interwork --enable-multilib --with-float=soft --with-newlib --with-headers=../newlib-1.14.0/newlib/libc/include --enable-languages=c,c++
7
Thread model: single
8
gcc version 4.1.0
9
 /cygdrive/d/work/gnuarm/bin/../libexec/gcc/arm-elf/4.1.0/collect2.exe -X -oCAN_test.elf /cygdrive/d/work/gnuarm/bin/../lib/gcc/arm-elf/4.1.0/crti.o /cygdrive/d/work/gnuarm/bin/../lib/gcc/arm-elf/4.1.0/crtbegin.o /cygdrive/d/work/gnuarm/bin/../lib/gcc/arm-elf/4.1.0/../../../../arm-elf/lib/crt0.o -L/cygdrive/d/work/gnuarm/bin/../lib/gcc/arm-elf/4.1.0 -L/cygdrive/d/work/gnuarm/bin/../lib/gcc -L/cygdrive/d/work/gnuarm/bin/../lib/gcc/arm-elf/4.1.0/../../../../arm-elf/lib -Map CAN_test.map ./can.o ./fio.o ./irq.o ./main.o ./startup.o ./target.o /cygdrive/d/work/gnuarm/bin/../lib/gcc/arm-elf/4.1.0/crtend.o /cygdrive/d/work/gnuarm/bin/../lib/gcc/arm-elf/4.1.0/crtn.o -TD:\work\workspace\CAN_test\demo2378.cmd
10
/cygdrive/d/work/gnuarm/bin/../lib/gcc/arm-elf/4.1.0/crtbegin.o:(.fini+0x0): relocation truncated to fit: R_ARM_PC24 against `.text'
11
/cygdrive/d/work/gnuarm/bin/../lib/gcc/arm-elf/4.1.0/crtbegin.o:(.init+0x0): relocation truncated to fit: R_ARM_PC24 against `.text'
12
/cygdrive/d/work/gnuarm/bin/../lib/gcc/arm-elf/4.1.0/../../../../arm-elf/lib/crt0.o: In function `start':
13
../../../../../../newlib-1.14.0/newlib/libc/sys/arm/crt0.S:89: undefined reference to `memset'
14
../../../../../../newlib-1.14.0/newlib/libc/sys/arm/crt0.S:95: undefined reference to `initialise_monitor_handles'
15
../../../../../../newlib-1.14.0/newlib/libc/sys/arm/crt0.S:216: undefined reference to `atexit'
16
../../../../../../newlib-1.14.0/newlib/libc/sys/arm/crt0.S:217: undefined reference to `__libc_init_array'
17
../../../../../../newlib-1.14.0/newlib/libc/sys/arm/crt0.S:223: undefined reference to `exit'
18
../../../../../../newlib-1.14.0/newlib/libc/sys/arm/crt0.S:223: undefined reference to `__bss_start__'
19
../../../../../../newlib-1.14.0/newlib/libc/sys/arm/crt0.S:223: undefined reference to `__bss_end__'
20
../../../../../../newlib-1.14.0/newlib/libc/sys/arm/crt0.S:223: undefined reference to `__libc_fini_array'
21
./startup.o: In function `Undef_Addr':
22
/cygdrive/d/work/workspace/CAN_test/Debug/../startup.S:51: undefined reference to `UNDEF_Routine'
23
./startup.o: In function `SWI_Addr':
24
/cygdrive/d/work/workspace/CAN_test/Debug/../startup.S:51: undefined reference to `SWI_Routine'
25
./startup.o: In function `PAbt_Addr':
26
/cygdrive/d/work/workspace/CAN_test/Debug/../startup.S:51: undefined reference to `UNDEF_Routine'
27
./startup.o: In function `DAbt_Addr':
28
/cygdrive/d/work/workspace/CAN_test/Debug/../startup.S:51: undefined reference to `UNDEF_Routine'
29
./startup.o: In function `IRQ_Addr':
30
/cygdrive/d/work/workspace/CAN_test/Debug/../startup.S:51: undefined reference to `IRQ_Routine'
31
./startup.o: In function `FIQ_Addr':
32
/cygdrive/d/work/workspace/CAN_test/Debug/../startup.S:51: undefined reference to `FIQ_Routine'
33
/cygdrive/d/work/gnuarm/bin/../lib/gcc/arm-elf/4.1.0/crtend.o:(.init+0x0): relocation truncated to fit: R_ARM_PC24 against `.text'
34
collect2: ld returned 1 exit status
35
make: *** [CAN_test.elf] Error 1

ich hab die komplette Listing's wieder angehangen.

von Martin T. (mthomas) (Moderator) Benutzerseite


Lesenswert?

Steffen H. schrieb:
> OK mit der neuen Version gibt es andere Fehler, laufen tut aber gar
> nichts mehr:
> bei mein Programm zum LEB-blinken bekomme ich den Error:
> [code]Building target: BLINK.elf
> Invoking: ARM Windows GCC C Linker
> arm-elf-ld -T"D:\work\workspace\BLINK\demo2378_blink_flash.cmd"
> [code]

Linker wird immer noch direkt aufgerufen, versteht aber die für das 
Frontende bestimmte Option nicht. Punkt 3 in meinem Getippse 08.12.2009 
17:45 erfolgreich überlesen.

> bei meinem CAN-Testprogramm siehts so aus:
> [code]Building target: CAN_test.elf
> Invoking: ARM Windows GCC C Linker
> arm-elf-gcc -T"D:\work\workspace\CAN_test\demo2378.cmd" -nodefaultlibs
> -Wl,-Map,CAN_test.map -v -mcpu -mapcs -mcpu=arm7tdmi-s -g3 -ggdb
> -o"CAN_test.elf"  ./can.o ./fio.o ./irq.o ./main.o ./startup.o
> ./target.o
> [...]

Siehe Optionen zum Linken in der Beispielausgabe im o.g. Beitrag. 
Zaunpfahl: -nostartfiles

Dokumentation von gcc und binutils/ld lesen ist zwar teilweise etwas 
mühsam aber ganz bestimmt erhellender als ein etwas zielloses Gestocher 
in den Optionen.

Also nochmal mit genannten Modifikationen ausprobieren und mglw. 
verbleibende Fehler zeigen. Viel besser wäre allerdings, ein minimales 
Beispiel mit allen erforderlichen Datein, bei dem man mit einem "make 
all" die Fehler nachvollziehen kann (Makefile sollte also dabei sein, 
sonst kann zumindest ich nicht helfen). Spart dann wahrscheinlich ein 
paar Iterationen in diesem Thread.

Nicht dass man unbedingt mit dem neusten Werkzeug arbeiten muss aber gcc 
4.1.0 ist schon eine Weile auf dem Altenteil. Man google nach Yagarto, 
Codesourcery lite for arm und DevKitARM, dort findet sich Aktuelleres 
fertig compiliert.

von Steffen H. (mcst)


Lesenswert?

HAllo,
danke noch mal, das mit dem Linker habe ich gestern kurz vor 
Arbeitsschluss auch noch gemerkt und nach etwas frimeln funktioniert nun 
der Aufruf über den GCC.

Sollten doch noch Probleme auftreten, werd ich wie du sagst mal das 
BLINK-Projekt anhängen. Ansonsten werd ich auch deinem Vorschlag zu 
aktuelleren Versionen folgen und noch mal nachschau.

Großen Danke für die Hilfe!!!

LG Steffen

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.