EmbDev.net

Forum: ARM programming with GCC/GNU tools Newbie errors while compiling - libc.a returns undefs


von Alex M. (spideyfly)


Rate this post
useful
not useful
Hi all,

I have been trying to port a bytecode interpreter over to the ARM7 for
future use in the Lego NXT. It's also my first time doing work with the
ARM toolchain or other embedded stuff.

I am using the latest Win-ARM (4/2007) which has arm-elf-gcc 4.1.2. The
makefile I am using is based on the example code from
C:\WinARM\examples\at91sam7s64_Hello.

So far I have been able to debug the majority of errors with the
linking, but now I'm getting the following, even after adding a copy of
the syscalls.c from the C:\WinARM\examples\at91sam7s64_cpp example.
1
Source compilations....
2
.
3
.
4
Compiling C: syscalls.c
5
arm-elf-gcc -c -mthumb -mcpu=arm7tdmi  -I. -gdwarf-2 -DROM_RUN
6
-DVECTORS_IN_RAM  -Os -Wall -Wcast-align -Wimplicit  -Wpointer-arith -W
7
switch -Wredundant-decls -Wreturn-type -Wshadow -Wunused
8
-Wa,-adhlns=syscalls.lst  -I./common -MD -MP -MF .dep/syscalls.o.d
9
-Wnested-e
10
xterns  -std=gnu99 syscalls.c -o syscalls.o
11
12
Linking: main.elf
13
arm-elf-gcc -mthumb -mcpu=arm7tdmi  -I. -gdwarf-2 -DROM_RUN
14
-DVECTORS_IN_RAM  -Os -Wall -Wcast-align -Wimplicit  -Wpointer-arith
15
-Wswi
16
tch -Wredundant-decls -Wreturn-type -Wshadow -Wunused
17
-Wa,-adhlns=main.lst  -I./common -MD -MP -MF .dep/main.elf.d    main.o
18
basepath.
19
o foreign.o heap.o info.o iofuncs.o mark.o mutator.o primitive.o
20
profile.o stable.o external.o hashtable.o hsffi.o integer.o jonkers.o
21
 make.o module.o pretty.o process.o sanity.o stopcopy.o Array.o
22
Concurrent.o FFI.o IO.o IORef.o PackedString.o Prelude.o RuntimeAPI.o
23
WrapPrimitive.o System.o syscalls.o     --output main.elf -nostartfiles
24
-Wl,-Map=main.map,--cref -lc  -lm -lc -lgcc     -TAT91SAM7S64-
25
ROM.ld
26
c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/bin/ld.exe:
27
region CODE is full (main.elf section .text)
28
c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/bin/ld.exe:
29
section .text [00100000 -> 0011c8c7] overlaps section .rodata [
30
00100000 -> 001052bb]
31
c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/bin/ld.exe:
32
section .data [001052bc -> 00105e03] overlaps section .text [00
33
100000 -> 0011c8c7]
34
c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/bin/ld.exe:
35
main.elf: section .text lma 0x100000 overlaps previous sections
36
37
c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/lib/thumb\libc.a(lib_a-clock.o):
38
In function `clock':
39
clock.c:(.text+0xa): undefined reference to `_times_r'
40
c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/lib/thumb\libc.a(lib_a-exit.o):
41
In function `exit':
42
exit.c:(.text+0x1a): undefined reference to `_exit'
43
c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/lib/thumb\libc.a(lib_a-fopen.o):
44
In function `_fopen_r':
45
fopen.c:(.text+0x34): undefined reference to `_open_r'
46
c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/lib/thumb\libc.a(lib_a-remove.o):
47
In function `_remove_r':
48
remove.c:(.text+0x2): undefined reference to `_unlink_r'
49
c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/lib/thumb\libc.a(lib_a-rename.o):
50
In function `_rename_r':
51
rename.c:(.text+0x6): undefined reference to `_link_r'
52
rename.c:(.text+0x12): undefined reference to `_unlink_r'
53
c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/lib/thumb\libc.a(lib_a-sysstat.o):
54
In function `stat':
55
sysstat.c:(.text+0xc): undefined reference to `_stat_r'
56
collect2: ld returned 1 exit status
57
make: *** [main.elf] Error 1

Does anyone have any suggestions? Thanks very much in advance.

von Denis K. (term)


Rate this post
useful
not useful
Hi, Alex.

Alex Moe wrote:
> c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/bin/ld.exe:
> region CODE is full (main.elf section .text)
> c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/bin/ld.exe:
> section .text [00100000 -> 0011c8c7] overlaps section .rodata [
> 00100000 -> 001052bb]
> c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/bin/ld.exe:
> section .data [001052bc -> 00105e03] overlaps section .text [00
> 100000 -> 0011c8c7]
> c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/bin/ld.exe:
> main.elf: section .text lma 0x100000 overlaps previous sections

maybe, there is no enough space in flash?
 >c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/lib/thumb\li 
bc.a(lib_a-clock.o):
> In function `clock':
> clock.c:(.text+0xa): undefined reference to `_times_r'
> c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/lib/thumb\lib 
c.a(lib_a-exit.o):
> In function `exit':
> exit.c:(.text+0x1a): undefined reference to `_exit'
> c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/lib/thumb\lib 
c.a(lib_a-fopen.o):
> In function `_fopen_r':
> fopen.c:(.text+0x34): undefined reference to `_open_r'
> c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/lib/thumb\lib 
c.a(lib_a-remove.o):
> In function `_remove_r':
> remove.c:(.text+0x2): undefined reference to `_unlink_r'
> c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/lib/thumb\lib 
c.a(lib_a-rename.o):
> In function `_rename_r':
> rename.c:(.text+0x6): undefined reference to `_link_r'
> rename.c:(.text+0x12): undefined reference to `_unlink_r'
> c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/lib/thumb\lib 
c.a(lib_a-sysstat.o):
> In function `stat':
> sysstat.c:(.text+0xc): undefined reference to `_stat_r'
> collect2: ld returned 1 exit status
> make: *** [main.elf] Error 1

I think, you need to write your own functions that are missed.
_exit is defined in default syscalls.c, but it is defined in #ifdef
section.
All of other functions anren't present in default syscalls.c

Best regards, Den

von Alex M. (spideyfly)


Rate this post
useful
not useful
Denis Kuzmenko wrote:
> Hi, Alex.
>
> Alex Moe wrote:
>> c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/bin/ld.exe:
>> region CODE is full (main.elf section .text)
>> c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/bin/ld.exe:
>> section .text [00100000 -> 0011c8c7] overlaps section .rodata [
>> 00100000 -> 001052bb]
>> c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/bin/ld.exe:
>> section .data [001052bc -> 00105e03] overlaps section .text [00
>> 100000 -> 0011c8c7]
>> c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/bin/ld.exe:
>> main.elf: section .text lma 0x100000 overlaps previous sections
>
> maybe, there is no enough space in flash?
>  >c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/lib/thumb\li 
bc.a(lib_a-clock.o):
>> In function `clock':
>> clock.c:(.text+0xa): undefined reference to `_times_r'
>> c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/lib/thumb\lib 
c.a(lib_a-exit.o):
>> In function `exit':
>> exit.c:(.text+0x1a): undefined reference to `_exit'
>> c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/lib/thumb\lib 
c.a(lib_a-fopen.o):
>> In function `_fopen_r':
>> fopen.c:(.text+0x34): undefined reference to `_open_r'
>> c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/lib/thumb\lib 
c.a(lib_a-remove.o):
>> In function `_remove_r':
>> remove.c:(.text+0x2): undefined reference to `_unlink_r'
>> c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/lib/thumb\lib 
c.a(lib_a-rename.o):
>> In function `_rename_r':
>> rename.c:(.text+0x6): undefined reference to `_link_r'
>> rename.c:(.text+0x12): undefined reference to `_unlink_r'
>> c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/lib/thumb\lib 
c.a(lib_a-sysstat.o):
>> In function `stat':
>> sysstat.c:(.text+0xc): undefined reference to `_stat_r'
>> collect2: ld returned 1 exit status
>> make: *** [main.elf] Error 1
>
> I think, you need to write your own functions that are missed.
> _exit is defined in default syscalls.c, but it is defined in #ifdef
> section.
> All of other functions anren't present in default syscalls.c
>
> Best regards, Den

Thanks Den...I'm thinking that perhaps this time I am using the wrong
header files...does anyone know if syscalls.c has an up to date version
with all the bells and whistles?

I heard also that there is an arm-lib out there somewhere. Any
experiences with it?

Cheers

von Denis K. (term)


Rate this post
useful
not useful
Alex Moe wrote:
> Thanks Den...I'm thinking that perhaps this time I am using the wrong
> header files...does anyone know if syscalls.c has an up to date version
> with all the bells and whistles?
>
> I heard also that there is an arm-lib out there somewhere. Any
> experiences with it?
>
> Cheers

syscalls.c from example has functionality, which is needed for example's
purposes.
If you are trying to use filesystem, you need to write low-level file
system functions yourself

About armlib. If you mean armlib, which I'm thinking about, I also tried
to use it. I've found it by the request "armlib" in Google(it wasn't
hard to find it). But I don't like it. Armlib has a less functionality(I
this means a low size in flash), but it has many platform-dependent
functions for AT91 and LPC processors.

As for me, newlib is better.

Denis

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.