Fehler beim Linken mit WINARM

OP Persönliche Seite #1223359
Lesenswert?

Hallo zusammen,

ich bin gerade dabei, einen mp3-Player auf einem SAM7-EX256 von Olimex 
zu basteln. Es treten am Ende beim Linken ein paar Fehler auf (es können 
einige Referenzen nicht aufgelöst werden). Ich finde nicht heraus, woran 
das liegt. Ich habe schon rausgefunden, dass z.B. das Symbol _sbrk_r in 
reent.h definiert wäre, habe diesen Header dann auch zusätzlich 
includiert, das hilft aber auch nicht. Kann das daran liegen, dass man 
eine zusätzliche Bibliothek dranlinken muss? Wie würde man das im 
Makefile einstellen?
Im Moment sind im Makefile garkeine Libs eingestellt, ich habe den 
Eindruck, dass im Linker einige (oder alle?) bereits voreingestellt 
sind. Liege ich da richtig, oder muss ich doch zusätzliche Bibliotheken 
angeben?

1
> "make" all
2
arm-elf-gcc -D__ASSEMBLY__ -DAT91SAM7X256 -g -mcpu=arm7tdmi -c -Os -Wall -I./include  cstartup.S -o cstartup.o
3
arm-elf-gcc -c -g -mcpu=arm7tdmi -Os -Wall -I./include  -I./SD-lib/inc -I./SD-lib/inc/interfaces -I./SD-lib/conf -DAT91SAM7X256 lowlevel.c -o lowlevel.o
4
arm-elf-gcc -c -g -mcpu=arm7tdmi -Os -Wall -I./include  -I./SD-lib/inc -I./SD-lib/inc/interfaces -I./SD-lib/conf -DAT91SAM7X256 lcd.c -o lcd.o
5
arm-elf-gcc -c -g -mcpu=arm7tdmi -Os -Wall -I./include  -I./SD-lib/inc -I./SD-lib/inc/interfaces -I./SD-lib/conf -DAT91SAM7X256 vs1002.c -o vs1002.o
6
arm-elf-gcc -c -g -mcpu=arm7tdmi -Os -Wall -I./include  -I./SD-lib/inc -I./SD-lib/inc/interfaces -I./SD-lib/conf -DAT91SAM7X256 main.c -o main.o
7
arm-elf-gcc -c -g -mcpu=arm7tdmi -Os -Wall -I./include  -I./SD-lib/inc -I./SD-lib/inc/interfaces -I./SD-lib/conf -DAT91SAM7X256 ./SD-lib/src/FS_debug.c -o FS_debug.o
8
arm-elf-gcc -c -g -mcpu=arm7tdmi -Os -Wall -I./include  -I./SD-lib/inc -I./SD-lib/inc/interfaces -I./SD-lib/conf -DAT91SAM7X256 ./SD-lib/src/FS_dir.c -o FS_dir.o
9
arm-elf-gcc -c -g -mcpu=arm7tdmi -Os -Wall -I./include  -I./SD-lib/inc -I./SD-lib/inc/interfaces -I./SD-lib/conf -DAT91SAM7X256 ./SD-lib/src/FS_disc.c -o FS_disc.o
10
arm-elf-gcc -c -g -mcpu=arm7tdmi -Os -Wall -I./include  -I./SD-lib/inc -I./SD-lib/inc/interfaces -I./SD-lib/conf -DAT91SAM7X256 ./SD-lib/src/FS_efs.c -o FS_efs.o
11
arm-elf-gcc -c -g -mcpu=arm7tdmi -Os -Wall -I./include  -I./SD-lib/inc -I./SD-lib/inc/interfaces -I./SD-lib/conf -DAT91SAM7X256 ./SD-lib/src/FS_extract.c -o FS_extract.o
12
arm-elf-gcc -c -g -mcpu=arm7tdmi -Os -Wall -I./include  -I./SD-lib/inc -I./SD-lib/inc/interfaces -I./SD-lib/conf -DAT91SAM7X256 ./SD-lib/src/FS_fat.c -o FS_fat.o
13
arm-elf-gcc -c -g -mcpu=arm7tdmi -Os -Wall -I./include  -I./SD-lib/inc -I./SD-lib/inc/interfaces -I./SD-lib/conf -DAT91SAM7X256 ./SD-lib/src/FS_file.c -o FS_file.o
14
arm-elf-gcc -c -g -mcpu=arm7tdmi -Os -Wall -I./include  -I./SD-lib/inc -I./SD-lib/inc/interfaces -I./SD-lib/conf -DAT91SAM7X256 ./SD-lib/src/FS_fs.c -o FS_fs.o
15
arm-elf-gcc -c -g -mcpu=arm7tdmi -Os -Wall -I./include  -I./SD-lib/inc -I./SD-lib/inc/interfaces -I./SD-lib/conf -DAT91SAM7X256 ./SD-lib/src/FS_ioman.c -o FS_ioman.o
16
arm-elf-gcc -c -g -mcpu=arm7tdmi -Os -Wall -I./include  -I./SD-lib/inc -I./SD-lib/inc/interfaces -I./SD-lib/conf -DAT91SAM7X256 ./SD-lib/src/FS_ls.c -o FS_ls.o
17
arm-elf-gcc -c -g -mcpu=arm7tdmi -Os -Wall -I./include  -I./SD-lib/inc -I./SD-lib/inc/interfaces -I./SD-lib/conf -DAT91SAM7X256 ./SD-lib/src/FS_mkfs.c -o FS_mkfs.o
18
arm-elf-gcc -c -g -mcpu=arm7tdmi -Os -Wall -I./include  -I./SD-lib/inc -I./SD-lib/inc/interfaces -I./SD-lib/conf -DAT91SAM7X256 ./SD-lib/src/FS_partition.c -o FS_partition.o
19
arm-elf-gcc -c -g -mcpu=arm7tdmi -Os -Wall -I./include  -I./SD-lib/inc -I./SD-lib/inc/interfaces -I./SD-lib/conf -DAT91SAM7X256 ./SD-lib/src/FS_plibc.c -o FS_plibc.o
20
arm-elf-gcc -c -g -mcpu=arm7tdmi -Os -Wall -I./include  -I./SD-lib/inc -I./SD-lib/inc/interfaces -I./SD-lib/conf -DAT91SAM7X256 ./SD-lib/src/FS_time.c -o FS_time.o
21
arm-elf-gcc -c -g -mcpu=arm7tdmi -Os -Wall -I./include  -I./SD-lib/inc -I./SD-lib/inc/interfaces -I./SD-lib/conf -DAT91SAM7X256 ./SD-lib/src/FS_ui.c -o FS_ui.o
22
arm-elf-gcc -c -g -mcpu=arm7tdmi -Os -Wall -I./include  -I./SD-lib/inc -I./SD-lib/inc/interfaces -I./SD-lib/conf -DAT91SAM7X256 ./SD-lib/src/interfaces/FS_sd.c -o FS_sd.o
23
arm-elf-gcc -c -g -mcpu=arm7tdmi -Os -Wall -I./include  -I./SD-lib/inc -I./SD-lib/inc/interfaces -I./SD-lib/conf -DAT91SAM7X256 ./SD-lib/src/interfaces/FS_AT91SAM7X256.c -o FS_AT91SAM7X256.o
24
arm-elf-gcc -nostartfiles -Wl,-Map=AT91SAM7X256.map,--cref -lc -lgcc -T elf32-littlearm.lds -Ttext 0x201000 -Tdata 0x200000 -n -o at91sam7x_getting_started_sram.elf cstartup.o lowlevel.o lcd.o vs1002.o main.o FS_debug.o FS_dir.o FS_disc.o FS_efs.o FS_extract.o FS_fat.o FS_file.o FS_fs.o FS_ioman.o FS_ls.o FS_mkfs.o FS_partition.o FS_plibc.o FS_time.o FS_ui.o FS_sd.o FS_AT91SAM7X256.o
25
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-elf/lib\libc.a(freer.o): In function `_malloc_trim_r':
26
mallocr.c:(.text+0x48): undefined reference to `_sbrk_r'
27
mallocr.c:(.text+0x64): undefined reference to `_sbrk_r'
28
mallocr.c:(.text+0x84): undefined reference to `_sbrk_r'
29
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-elf/lib\libc.a(makebuf.o): In function `__smakebuf':
30
makebuf.c:(.text+0x3c): undefined reference to `_fstat_r'
31
makebuf.c:(.text+0x110): undefined reference to `isatty'
32
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-elf/lib\libc.a(mallocr.o): In function `_malloc_r':
33
mallocr.c:(.text+0x424): undefined reference to `_sbrk_r'
34
mallocr.c:(.text+0x4cc): undefined reference to `_sbrk_r'
35
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-elf/lib\libc.a(stdio.o): In function `__sclose':
36
stdio.c:(.text+0xc): undefined reference to `_close_r'
37
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-elf/lib\libc.a(stdio.o): In function `__sseek':
38
stdio.c:(.text+0x30): undefined reference to `_lseek_r'
39
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-elf/lib\libc.a(stdio.o): In function `__swrite':
40
stdio.c:(.text+0x84): undefined reference to `_lseek_r'
41
stdio.c:(.text+0xac): undefined reference to `_write_r'
42
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-elf/lib\libc.a(stdio.o): In function `__sread':
43
stdio.c:(.text+0xd0): undefined reference to `_read_r'
44
collect2: ld returned 1 exit status
45
make: *** [sram] Fehler 1
46

47
> Process Exit Code: 2
48
> Time Taken: 00:24

Hoffentlich kennt sich irgendjemand besser damit aus...

Grüße,

Peter
OP Persönliche Seite #1223386
Lesenswert?

Ich habs gefunden. Die fehlenden Funktionen müssen von Hand eingebaut 
werden, da es sich um eine sogenannte newlib handelt. Das bedeutet, dass 
die Bibliothek noch nicht auf ein bestimmtes Target fixiert ist. Die 
Funktionen, die zur Verfügung gestellt werden müssen, sind weitgehend 
zur Interaktion mit Peripherie, also putc(), getc(), kbhit() usw.

Geholfen hat mir folgender Link:

Beitrag "WinARM "sprintf" Linkerfehler"

Und folgendes Projekt, bei dem ein Beispiel (syscalls.c) beiliegt, das 
die Funktionsweise dieser Sache zeigt:

Davon USB Example 1:
http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/index_at91.html#at91_usb1

Und dessen sourcen:
http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/at91sam7s64_basicusb_20060901_public.zip

Grüße,

Peter

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren