error: ld returned 1 exit status

shahril22 wrote on Tuesday, May 07, 2013:

WHEN I BUILD THE PROGRAM THAT ERROR OCCUR

GCC HOME: C:\Program Files (x86)\GNU Tools ARM Embedded\4.7 2013q1\bin
compile:
     Skipping C:\CooCox\CoIDE\workspace\lpcdemo1\lpcdemo1\Debug\bin because it already exists.
     Skipping C:\CooCox\CoIDE\workspace\lpcdemo1\lpcdemo1\Debug\obj because it already exists.
        Starting dependency analysis for 13 files.
        Parsing …\…\…\cmsis\core_cm3.c
        Parsing …\…\…\lpc17xx_lib\source\lpc17xx_clkpwr.c
        Parsing …\…\…\lpc17xx_lib\include\lpc17xx_clkpwr.h
        Parsing …\…\…\cmsis_boot\LPC17xx.h
        Parsing …\…\…\lpc17xx_lib\include\lpc_types.h
        Parsing …\…\…\cmsis\core_cm3.h
        Parsing …\…\…\cmsis_boot\system_LPC17xx.h
        Parsing …\…\…\cmsis_boot\system_LPC17xx.c
        Parsing …\…\…\main.c
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\include\FreeRTOS.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\include\task.h
        Parsing …\…\…\lpc17xx_lib\include\lpc17xx_pinsel.h
        Parsing …\…\…\lpc17xx_lib\include\lpc17xx_gpio.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\include\projdefs.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\FreeRTOSConfig.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\include\portable.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\oWatcom\16BitDOS\PC\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\oWatcom\16BitDOS\Flsh186\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\GCC\ATMega323\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\IAR\ATMega323\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\MPLAB\PIC24_dsPIC\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\MPLAB\PIC24_dsPIC\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\MPLAB\PIC18F\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\MPLAB\PIC32MX\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\SDCC\Cygnal\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\GCC\ARM7_LPC2000\portmacro.h
        Parsing …\…\…\…\lpc demo\FreeRTOS\portable\GCC\ARM_CM3\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\GCC\ARM7_LPC23xx\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\IAR\MSP430\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\GCC\MSP430F449\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\Rowley\MSP430F449\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\RVDS\ARM7_LPC21xx\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\GCC\ARM7_AT91SAM7S\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\IAR\AtmelSAM7S64\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\IAR\AtmelSAM9XE\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\IAR\LPC2000\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\IAR\STR71x\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\IAR\STR75x\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\GCC\STR75x\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\IAR\STR91x\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\GCC\H8S2329\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\GCC\ARM7_AT91FR40008\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\RVDS\ARM_CM3\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\GCC\ARM_CM3\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\GCC\ARM_CM3\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\IAR\ARM_CM3\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\IAR\ARM_CM3\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\CodeWarrior\HCS12\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\GCC\MicroBlaze\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\Paradigm\Tern_EE\small\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\GCC\HCS12\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\GCC\MCF5235\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\CodeWarrior\ColdFire_V2\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\GCC\PPC405_Xilinx\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\GCC\PPC440_Xilinx\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\Softune\MB96340\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\BCC\16BitDOS\PC\prtmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\BCC\16BitDOS\Flsh186\prtmacro.h
        Parsing …\…\…\…\lpc demo\FreeRTOS\portable\GCC\ARM_CM3\portmacro.h
        Parsing …\…\…\…\lpc demo\FreeRTOS\portable\GCC\ARM_CM3\portmacro.h
        Parsing …\…\…\…\lpc demo\FreeRTOS\portable\GCC\ARM_CM3\portmacro.h
        Parsing …\…\…\…\lpc demo\FreeRTOS\portable\GCC\ARM_CM3\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\IAR\V850ES\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\IAR\V850ES\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\IAR\V850ES\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\IAR\V850ES\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\IAR\V850ES\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\IAR\78K0R\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\portable\IAR\78K0R\portmacro.h
        Parsing …\…\…\…\lpc demo\FreeRTOS\portable\GCC\ARM_CM3\portmacro.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\include\mpu_wrappers.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\include\list.h
        Parsing …\…\…\lpc17xx_lib\source\lpc17xx_gpio.c
        Parsing …\…\…\lpc17xx_lib\include\lpc17xx_libcfg_default.h
        Parsing …\…\…\…\lpc demo\FreeRTOS\tasks.c
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\include\timers.h
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\include\StackMacros.h
        Parsing …\…\…\cmsis_boot\startup\startup_LPC17xx.c
        Parsing …\…\…\lpc17xx_lib\source\lpc17xx_libcfg_default.c
        Parsing …\…\…\lpc17xx_lib\source\lpc17xx_pinsel.c
        Parsing …\…\…\…\lpc demo\FreeRTOS\list.c
        Parsing …\…\…\…\lpc demo\FreeRTOS\queue.c
        Parsing …\…\…\…\…\…\…\Freertos\FreeRTOSV7.4.1\FreeRTOS\Source\include\croutine.h
        Parsing …\…\…\…\lpc demo\FreeRTOS\portable\GCC\ARM_CM3\port.c
        Parsing …\…\…\…\lpc demo\FreeRTOS\portable\MemMang\heap_2.c
        13 files are up to date.
        0 files to be recompiled from dependency analysis.
        0 total files to be compiled.
        Starting link
        arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -g -nostartfiles -flto -Wl,-Map=lpcdemo1.map -O0 -Wl,-gc-sections -Wl,-entry=main -LC:\CooCox\CoIDE\configuration\ProgramData\lpcdemo1 -Wl,-TC:\CooCox\CoIDE\configuration\ProgramData\lpcdemo1/arm-gcc-link.ld -g -o lpcdemo1.elf …\obj\core_cm3.o …\obj\lpc17xx_clkpwr.o …\obj\system_LPC17xx.o …\obj\main.o …\obj\lpc17xx_gpio.o …\obj\tasks.o …\obj\startup_LPC17xx.o …\obj\lpc17xx_libcfg_default.o …\obj\lpc17xx_pinsel.o …\obj\list.o …\obj\queue.o …\obj\port.o …\obj\heap_2.o
        C:\Users\User\AppData\Local\Temp\ccX3Qe03.ltrans0.ltrans.o: In function `vTaskStartScheduler’:
        C:\CooCox\CoIDE\workspace\lpc demo\FreeRTOS/tasks.c:1087: undefined reference to `vConfigureTimerForRunTimeStats’
        collect2.exe: error: ld returned 1 exit status

ANYONE KNOW HOW TO SOVE THIS PROBLEM?

smith84 wrote on Tuesday, May 07, 2013:

Might I suggest that you read the http://www.freertos.org/FAQ-how-to-use-the-FreeRTOS-support-forum.html before posting a question next time? Honestly it is good that you posted the actual error message you are getting, but you have provided no information about your system or what you have done to try and fix the problem.

The key is in the last three lines of your build output. The message “error: ld returned 1 exit status” indicates that ld (the linker) failed to link.

The next two lines above show why it failed. I will strip away the headers for each line and show the ‘english’ output.
** In function `vTaskStartScheduler’: undefined reference to `vConfigureTimerForRunTimeStats’**

I would suggest that you either need to provide the function vConfigureTimerForRunTimeStats() OR disable the configuration option configGENERATE_RUN_TIME_STATS which would cause it to be enabled. More info here: http://www.freertos.org/rtos-run-time-stats.html (found by Googling vConfigureTimerForRunTimeStats).

Best of luck with your development!