EmbDev.net

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


Author: Alex Moe (spideyfly)
Posted on:

Rate this post
0 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.

Source compilations....
.
.
Compiling C: syscalls.c
arm-elf-gcc -c -mthumb -mcpu=arm7tdmi  -I. -gdwarf-2 -DROM_RUN
-DVECTORS_IN_RAM  -Os -Wall -Wcast-align -Wimplicit  -Wpointer-arith -W
switch -Wredundant-decls -Wreturn-type -Wshadow -Wunused
-Wa,-adhlns=syscalls.lst  -I./common -MD -MP -MF .dep/syscalls.o.d
-Wnested-e
xterns  -std=gnu99 syscalls.c -o syscalls.o

Linking: main.elf
arm-elf-gcc -mthumb -mcpu=arm7tdmi  -I. -gdwarf-2 -DROM_RUN
-DVECTORS_IN_RAM  -Os -Wall -Wcast-align -Wimplicit  -Wpointer-arith
-Wswi
tch -Wredundant-decls -Wreturn-type -Wshadow -Wunused
-Wa,-adhlns=main.lst  -I./common -MD -MP -MF .dep/main.elf.d    main.o
basepath.
o foreign.o heap.o info.o iofuncs.o mark.o mutator.o primitive.o
profile.o stable.o external.o hashtable.o hsffi.o integer.o jonkers.o
 make.o module.o pretty.o process.o sanity.o stopcopy.o Array.o
Concurrent.o FFI.o IO.o IORef.o PackedString.o Prelude.o RuntimeAPI.o
WrapPrimitive.o System.o syscalls.o     --output main.elf -nostartfiles
-Wl,-Map=main.map,--cref -lc  -lm -lc -lgcc     -TAT91SAM7S64-
ROM.ld
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

c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/lib/thumb\libc.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\libc.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\libc.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\libc.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\libc.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\libc.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


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

Author: Denis Kuzmenko (term)
Posted on:

Rate this post
0 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

Author: Alex Moe (spideyfly)
Posted on:

Rate this post
0 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

Author: Denis Kuzmenko (term)
Posted on:

Rate this post
0 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

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.