Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

arm-elf-gcc _sbrk errors

Status
Not open for further replies.

mdpai

Junior Member level 2
Junior Member level 2
Joined
Jan 7, 2010
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
france
Activity points
1,459
Hi,
I tried to compile an empty main function (just to test the toolchain) but i got these errors.

Code:
fairuz@ubuntu:~/test$ arm-elf-gcc -mcpu=arm7tdmi-s test.c
/opt/gnuarm/lib/gcc/arm-elf/4.4.1/../../../../arm-elf/lib/libc.a(lib_a-exit.o): In function `exit':
/home/fairuz/build-newlib/arm-elf/newlib/libc/stdlib/../../../../../newlib-1.17.0/newlib/libc/stdlib/exit.c:65: undefined reference to `_exit'
/opt/gnuarm/lib/gcc/arm-elf/4.4.1/../../../../arm-elf/lib/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
/home/fairuz/build-newlib/arm-elf/newlib/libc/reent/../../../../../newlib-1.17.0/newlib/libc/reent/sbrkr.c:60: undefined reference to `_sbrk'
collect2: ld returned 1 exit status

This is my main

Code:
void main (void){}

I compile my own toolchain using gcc 4.4.1, binutils 2.19.1, newlib 1.17, GDB 6.8, insight 6.8-1

I've read somewhere that this kind of error is caused by newlib syscall and they suggest to add --disable-newlib-supplied-syscalls option when compiling newlib. I've did this but I still got the same errors.

Anyone have some ideas on this matter?

Thanks for your time,

Kind regards,
Fairuz
 

it seems that you have not linked the required library.

srizbf
6thjuly2010
 

Why do not you test it with some code in the main?
--
Amr
 

I've test it with a sample ARM code that I downloaded and the same error come out.
 

Is this a bare metal toolchain?
--
Amr
 

I think it is.. I build it with the guide from gnuarm
 

If it is, this means it has no os to run on.
Then how do u expect that you will run ur application unless u add some boot code to it or link some runtime initialization?
--
Amr
 

Thanks for the quick reply.

Sorry I'm new to the cross compiling with ARM. I've downloaded a sample ARM project, and I see they have a *.ld and a *.S. Are these you mean by boot code and linker code? Is it compulsory to have these files. Or did some IDE like CodeBlock (that I configured to run with GNUARM) can generate it from their library?

Thanks,

Kind regards,
Fairuz
 

*.ld is a linker script while .s is just an assembly file.
Boot codes may be with the IDE or you write them yourself.
It depends on your case my lady.
--
Amr
 

I will try to find an example project that have all necessary files and compile it to find out what will happen.

Thanks
 

You have to look for an example that came with your board. For sure they have a working example.
--
Amr
 

One small question, if I want to compile for an ARM simulator such as Synopsys Innovator or Skyeye, is it different? Since there are no target boards.
 

No, they should be same.
--
Amr
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top