Re: minimal sample build
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: minimal sample build



On Thursday 17 April 2008 13:09:41 Kishore Jonnalagadda wrote:
> According to the Code Sourcery documentation, i should be able to build a
> minimum program such as:
> /***main.c***/
> #include <stdio.h>
>
> int
> main()
> {
> 	printf("Hello World!\n");
> 	return 0;
> }
> /***main.c***/
>
> with the command 'arm-none-eabi-gcc -o main main.c' i get the following
> error:
>
> /***error***/
> /home/kishore/Drone/Projects/tools/arm-linux.cs2008q1/bin/../lib/gcc/arm-no
>ne-eabi/4.2.3/../../../../arm-none-eabi/bin/ld: warning: cannot find entry
> symbol _start; defaulting to 00008018
> /home/kishore/Drone/Projects/tools/arm-linux.cs2008q1/bin/../lib/gcc/arm-no
>ne-eabi/4.2.3/../../../../arm-none-eabi/lib/libc.a(lib_a-sbrkr.o): In
> function`_sbrk_r':
> sbrkr.c:(.text+0x18): undefined reference to `_sbrk'
> /home/kishore/Drone/Projects/tools/arm-linux.cs2008q1/bin/../lib/gcc/arm-no
>ne-eabi/4.2.3/../../../../arm-none-eabi/lib/libc.a(lib_a-writer.o): In
> function `_write_r':
> writer.c:(.text+0x20): undefined reference to `_write'
> /home/kishore/Drone/Projects/tools/arm-linux.cs2008q1/bin/../lib/gcc/arm-no
>ne-eabi/4.2.3/../../../../arm-none-eabi/lib/libc.a(lib_a-closer.o): In
> function `_close_r':
> closer.c:(.text+0x18): undefined reference to `_close'
> /home/kishore/Drone/Projects/tools/arm-linux.cs2008q1/bin/../lib/gcc/arm-no
>ne-eabi/4.2.3/../../../../arm-none-eabi/lib/libc.a(lib_a-fstatr.o): In
> function `_fstat_r':
> fstatr.c:(.text+0x1c): undefined reference to `_fstat'
> /home/kishore/Drone/Projects/tools/arm-linux.cs2008q1/bin/../lib/gcc/arm-no
>ne-eabi/4.2.3/../../../../arm-none-eabi/lib/libc.a(lib_a-isattyr.o): In
> function `_isatty_r':
> isattyr.c:(.text+0x18): undefined reference to `_isatty'
> /home/kishore/Drone/Projects/tools/arm-linux.cs2008q1/bin/../lib/gcc/arm-no
>ne-eabi/4.2.3/../../../../arm-none-eabi/lib/libc.a(lib_a-lseekr.o): In
> function `_lseek_r':
> lseekr.c:(.text+0x20): undefined reference to `_lseek'
> /home/kishore/Drone/Projects/tools/arm-linux.cs2008q1/bin/../lib/gcc/arm-no
>ne-eabi/4.2.3/../../../../arm-none-eabi/lib/libc.a(lib_a-readr.o): In
> function`_read_r':
> readr.c:(.text+0x20): undefined reference to `_read'
> collect2: ld returned 1 exit status
> make[2]: *** [main] Error 1
>
> /***error***/
>
> Removing the printf statement compiles it but gives the output:
>
> /home/kishore/Drone/Projects/tools/arm-linux.cs2008q1/bin/../lib/gcc/arm-no
>ne-eabi/4.2.3/../../../../arm-none-eabi/bin/ld: warning: cannot find entry
> symbol _start; defaulting to 00008018
>
> This start address is of course not right as the at91sam7s256 (arm7tdmi)
> expects its vector table to be located at address 0x00. Further examining
> the disassembly and the MAP file does not reveal the vector table anywhere.
>
> So am i doing something wrong or is that minimal example incorrect?

My bad! The documentation at 
share/doc/arm-arm-none-eabi/html/getting-started/chap-building.html clearly 
indicates the need for a linker script. Avoiding the linker script is what i 
was intending to achieve. Sorry for the noise.
-- 
Cheers!
Kishore