cancel
Showing results for 
Search instead for 
Did you mean: 

strange errot (crt0) when buiding a project

arnold
Associate II
Posted on July 23, 2012 at 20:12

could someone tell me how to get ride of this error

c:/yagarto471/bin/../lib/gcc/arm-none-eabi/4.7.1/../../../../arm-none-eabi/bin/ld.exe: cannot find crt0.o: No such file or directory
collect2.exe: error: ld returned 1 exit status

i don't now why it is there, could someone help me. I use yagarto.

make all 
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mlittle-endian -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb-interwork -std=c99 -Os -DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DMANGUSTA_DISCOVERY -DHSE_VALUE=8000000 -I./ -I./ -I../../Utilities/STM32F4-Discovery -I../../Libraries/CMSIS/ST/STM32F4xx/Include/ -I../../Libraries/CMSIS/Include/ -I../../Libraries/STM32F4xx_StdPeriph_Driver/inc/ -I../../Libraries/STM32_USB_Device_Library/Class/hid/inc -I../../Libraries/STM32_USB_Device_Library/Core/inc/ -I../../Libraries/STM32_USB_OTG_Driver/inc/ -I. -Wl,-T,stm32_flash.ld main.c stm32f4xx_it.c ../../Utilities/STM32F4-Discovery/system_stm32f4xx.c ../../Utilities/STM32F4-Discovery/stm32f4_discovery.c ../../Libraries/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_syscfg.c startup_stm32f4xx.s -lm -lc -lnosys -o main.elf
c:/yagarto471/bin/../lib/gcc/arm-none-eabi/4.7.1/../../../../arm-none-eabi/bin/ld.exe: cannot find crt0.o: No such file or directory
collect2.exe: error: ld returned 1 exit status
make: *** [main.elf] Error 1

9 REPLIES 9
Andrew Neil
Evangelist III
Posted on July 23, 2012 at 20:43

''ld.exe: cannot find crt0.o: No such file or directory''

 

ld is the

Linker;

crt0 is the '

C

'

R

un-

T

ime library.

So the Linker is telling you that it can't find the 'C' runtime library.

You need to (re-)configure your project so that the linker

can find the library.

arnold
Associate II
Posted on July 23, 2012 at 20:46

yes, 

i thought that myself, but within the yagarto dir there is no crt0.O file. 

could it some kind of fault in one of the files.
Posted on July 23, 2012 at 20:59

could it some kind of fault in one of the files.

Yes, perhaps something like printf, scanf, memset, memcpy, etc expecting some support code, or an object tagged as requiring crt0.o

Or for that matter the absence of startup_stm32f4xx.s, which replaces the usual crt code.

The other thing I'd do is break down the compilation of code, from the linking step. As it stands you'd need to analyze what intermediate files have been created and why the linker doesn't like them. It could be the content, or the order in which they are furnished to the linker.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
arnold
Associate II
Posted on July 24, 2012 at 10:16

Now i tryed a different makefile, and it looks oke.

Later i g otry if the compiled code run's on the board.

i realy have no clue what is wrong, but when the program is running it's oke for me.
Andrew Neil
Evangelist III
Posted on July 24, 2012 at 23:21

''Now i tryed a different makefile, and it looks oke''

 

It would be a worthwhile exercise, then, to compare the two makefiles and see where they differ...
arnold
Associate II
Posted on July 25, 2012 at 07:27

Yes,

when the oprogram is running then i would try yo find out what was wrong with the first make file.

Nickname15803_O
Associate
Posted on July 30, 2012 at 17:19

Hello,

I experimented the same issue with Yagarto 20120616 and GCC 4.7.1 -> crt0.o is missing in \yagarto\arm-none-eabi\lib\

It's ok then using Yagarto 20111119 and GCC 4.6.2.

You can find it here:

http://sourceforge.net/projects/yagarto/files/YAGARTO for Windows/20111119/

It seems to be YAGARTO install issue..

Cheers

Posted on July 30, 2012 at 18:40

I've been using Yagarto 4.6.2 and 4.7.1 interchangeably for several months, and while the crt0.o library is missing from the latter, the question that has to be asked is why you need it? It only provides start up code, that's being replaced by a custom file tailored to the STM32 architecture and vectors.

You should perhaps look closer at the linker, and whether you need the -nostartfiles option, or need to pay attention to the order of files supplied to the linker.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
jheilig999
Associate II
Posted on September 18, 2012 at 11:49

Hi,

  the -nostartfiles option is not useful for every project. If you  have some static array initialization somewhere in your code the startup code need to call _libc_init_array which has a reference to _init function located in crtXX.o files.  Thus, if crt0.o is missing from your toolchain you cannot link.

As a workaround I put the file crt0.o found in Yagarto 4.6.2 into my project root path. It worked both for Yagarto 4.6.2 and 4.7.1. In the first case the linker finds the crt0.o in the default library path (seen with --verbose option passed to the linker). In the second case, the linker puts in its command line crt0.o without any path (beacause it cannot find it in the lib path) but matches with the file i put in my project root path.

Regards

Giorgio