EmbDev.net

Forum: ARM programming with GCC/GNU tools Problem with Building a simple program for ARM


von Vahid A. (Company: ISC) (vahid_6485)


Rate this post
useful
not useful
Dear Friends
I'm beginner in ARM Projects development, and I wanted to start with run 
a simple "Hello world" on my OK6410 Board. My board processor is ARM 
1176jzf-s and have linux os.
I used Eclipse CDT and installed Sourcery_CodeBench_Lite_for_ARM_EABI on 
windows 7 platform and add GNU ARM Eclipse Plug-in.
my program:
#include "stdio.h"

int main(void) {
printf("Hello world !\n");
return 0;
}


When I wants to build my hello world project I get these errors:

cs-make all
'Building target: helloarm.elf'
'Invoking: ARM Sourcery Windows GCC C++ Linker'
arm-none-eabi-g++ -Wl,-Map,helloarm.map -mcpu=arm1176jzf-s -mthumb -g3 
-o "helloarm.elf"  ./src/helloarm.o
c:/program 
files/codesourcery/sourcery_codebench_lite_for_arm_eabi/bin/../lib/gcc/a 
rm-none-eabi/4.6.1/../../../../arm-none-eabi/bin/ld.exe:  warning: 
cannot find entry symbol _start; defaulting to 00008010
c:/program 
files/codesourcery/sourcery_codebench_lite_for_arm_eabi/bin/../lib/gcc/a 
rm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb\libc.a(lib_a-abor 
t.o):  In function `abort':
abort.c:(.text+0xa): undefined reference to `_exit'
c:/program 
files/codesourcery/sourcery_codebench_lite_for_arm_eabi/bin/../lib/gcc/a 
rm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb\libc.a(lib_a-fsta 
tr.o):  In function `_fstat_r':
fstatr.c:(.text+0xe): undefined reference to `_fstat'
c:/program 
files/codesourcery/sourcery_codebench_lite_for_arm_eabi/bin/../lib/gcc/a 
rm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb\libc.a(lib_a-open 
r.o):  In function `_open_r':
openr.c:(.text+0x10): undefined reference to `_open'
c:/program 
files/codesourcery/sourcery_codebench_lite_for_arm_eabi/bin/../lib/gcc/a 
rm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb\libc.a(lib_a-sbrk 
r.o):  In function `_sbrk_r':
sbrkr.c:(.text+0xc): undefined reference to `_sbrk'
c:/program 
files/codesourcery/sourcery_codebench_lite_for_arm_eabi/bin/../lib/gcc/a 
rm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb\libc.a(lib_a-sign 
alr.o):  In function `_kill_r':
signalr.c:(.text+0xe): undefined reference to `_kill'
c:/program 
files/codesourcery/sourcery_codebench_lite_for_arm_eabi/bin/../lib/gcc/a 
rm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb\libc.a(lib_a-sign 
alr.o):  In function `_getpid_r':
signalr.c:(.text+0x2e): undefined reference to `_getpid'
c:/program 
files/codesourcery/sourcery_codebench_lite_for_arm_eabi/bin/../lib/gcc/a 
rm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb\libc.a(lib_a-writ 
er.o):  In function `_write_r':
writer.c:(.text+0x10): undefined reference to `_write'
c:/program 
files/codesourcery/sourcery_codebench_lite_for_arm_eabi/bin/../lib/gcc/a 
rm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb\libc.a(lib_a-clos 
er.o):  In function `_close_r':
closer.c:(.text+0xc): undefined reference to `_close'
c:/program 
files/codesourcery/sourcery_codebench_lite_for_arm_eabi/bin/../lib/gcc/a 
rm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb\libc.a(lib_a-isat 
tyr.o):  In function `_isatty_r':
isattyr.c:(.text+0xc): undefined reference to `_isatty'
c:/program 
files/codesourcery/sourcery_codebench_lite_for_arm_eabi/bin/../lib/gcc/a 
rm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb\libc.a(lib_a-lsee 
kr.o):  In function `_lseek_r':
lseekr.c:(.text+0x10): undefined reference to `_lseek'
c:/program 
files/codesourcery/sourcery_codebench_lite_for_arm_eabi/bin/../lib/gcc/a 
rm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb\libc.a(lib_a-read 
r.o):  In function `_read_r':
readr.c:(.text+0x10): undefined reference to `_read'
collect2: ld returned 1 exit status
cs-make: *** [helloarm.elf] Error 1

**** Build Finished ****


Could you please help me find out the problem.
best regards

von zagge (Guest)


Rate this post
useful
not useful
didi you select C-Library Component ?

von Marius Wensing (Guest)


Rate this post
useful
not useful
All these functions are so called "newlib stubs". In your C library you 
have only the hardware independent part of the C library functions like 
printf etc. So you have to implement these functions for your concrete 
µC.

Also see: http://www.openhardware.net/Embedded_ARM/NewLib_Stubs/

Best regards
Marius

von Vahid A. (Company: ISC) (vahid_6485)


Rate this post
useful
not useful
Thanks for feedback, based on your advices and link, I find out that I 
installed “arm-2011.09-69-arm-none-eabi.exe” and this version is for 
bare-metal devices and I think defining  "newlib stubs" is nessery for 
this kind of devices but my board has linux os then I installed 
“arm-2011.09-70-arm-none-linux-gnueabi.exe “ and the problem solved.

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.