undefined reference to ‘ulRunTimeStatsC…

Hi, i am beginner with FreeRTOS.
I am trying to compile simple multitask program for test RTOSv7.2.0 on STM32F107VC + Eclipse CDT+ Code sourcery+ openOCD6, but compiler tells me some errors: Description Resource Path Location Type
more undefined references to `ulRunTimeStatsClock’ follow tasks.c /pokus107/src line 1615 C/C++ Problem
undefined reference to `ulRunTimeStatsClock’ tasks.c /pokus107/src line 1615 C/C++ Problem
undefined reference to `ulRunTimeStatsClock’ tasks.c /pokus107/src line 1357 C/C++ Problem
undefined reference to `ulRunTimeStatsClock’ tasks.c /pokus107/src line 1102 C/C++ Problem
make: ***  Error 1 C/C++ Problem
undefined reference to `_sbrk’ pokus107 line 0 C/C++ Problem but in FreeRTOSConfig.h
is defined and declared: extern unsigned long ulRunTimeStatsClock;
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() ulRunTimeStatsClock = 0
#define portGET_RUN_TIME_COUNTER_VALUE() ulRunTimeStatsClock and in file tasks.c witch contain this errors  is included FreeRTOS.h . What is wrong? Thanks for reply.

undefined reference to ‘ulRunTimeStatsC…

FreeRTOSConfig.h is telling tasks.c that ulRunTimeStatsClock is defined somewhere else, and the compiler appears to be telling you that it isn’t defined anywhere.  Is it defined anywhere?  I suspect not. A quick way around this would be to start without any run time stats collection.  Do that by setting configGENERATE_RUN_TIME_STATS to 0 in FreeRTOSConfig.h, then remove the definitions of portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() and portGET_RUN_TIME_COUNTER_VALUE(). Regards.

undefined reference to ‘ulRunTimeStatsC…

Thanks, i havent defined tris variable anywhere.
So I was disabled configGENERATE_RUN_TIME_STATS, but i have still few errors: Description Resource Path Location Type
undefined reference to `_sbrk’ pokus107 line 0 C/C++ Problem my main.c is:
#include <stddef.h>
#include "stm32f10x.h"
#include "stm32f10x_rcc.h"
#include "stm32f10x_gpio.h"
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#define LED_PORT GPIOB
#define LED1 GPIO_Pin_13
#define LED2 GPIO_Pin_14
#define LED3 GPIO_Pin_15
void prvTaskA (void* pvParameters)
{
    (void) pvParameters;
    for (;;) {
                GPIO_SetBits(LED_PORT,LED2);
                vTaskDelay(1000);
                //GPIO_ResetBits(LED_PORT,LED2);
                vTaskDelay(1000);
    }
}
void prvTaskB (void* pvParameters)
{
    (void) pvParameters;
    for (;;) {
         GPIO_SetBits(LED_PORT,LED1);
        vTaskDelay(1000);
        //GPIO_ResetBits(LED_PORT,LED1);
        vTaskDelay(1000);
    }
}
void mojDelay()
{long int i;
     i=0;
               while(i < 2300000) //cca 0,5 sekundovy delay
                       {
                           i++;
                       }
}
int main(void)
{
  GPIO_InitTypeDef GPIO_InitStructure;
  SysTick_Config(1000);
  SystemCoreClockUpdate();
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
     GPIO_InitStructure.GPIO_Pin = LED1 | LED2 | LED3;
     GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
     GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
     GPIO_Init(LED_PORT, &GPIO_InitStructure);
        xTaskCreate( prvTaskA, ( signed char * ) "TaskA", configMINIMAL_STACK_SIZE , NULL,1 , NULL );
        xTaskCreate( prvTaskB, ( signed char * ) "TaskB", configMINIMAL_STACK_SIZE , NULL,1 , NULL );
        vTaskStartScheduler();
        //sem by sme dojst nemali
       while(1)
       {
           GPIO_SetBits(LED_PORT,LED1);
           mojDelay();
           GPIO_SetBits(LED_PORT,LED2);
           mojDelay();
           GPIO_SetBits(LED_PORT,LED3);
           mojDelay();
           GPIO_ResetBits(LED_PORT,LED1);
           mojDelay();
           GPIO_ResetBits(LED_PORT,LED2);
           mojDelay();
           GPIO_ResetBits(LED_PORT,LED3);
           mojDelay();
       }
        return 0;
}
void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName )
{
    ( void ) pxTask;
    ( void ) pcTaskName;
    for( ;; );
}
void vApplicationTickHook( void )
{
}
and my config file is:
#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H
#define configUSE_PREEMPTION        1
#define configUSE_IDLE_HOOK         0
#define configUSE_TICK_HOOK         1
#define configCPU_CLOCK_HZ          ( ( unsigned long ) 72000000 )
#define configTICK_RATE_HZ          ( ( portTickType ) 1000 )
#define configMAX_PRIORITIES        ( ( unsigned portBASE_TYPE ) 5 )
#define configMINIMAL_STACK_SIZE    ( ( unsigned short ) 128 )
#define configTOTAL_HEAP_SIZE       ( ( size_t ) ( 30 * 1024 ) )
#define configMAX_TASK_NAME_LEN     ( 16 )
#define configUSE_TRACE_FACILITY    1
#define configUSE_16_BIT_TICKS      0
#define configIDLE_SHOULD_YIELD     1
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES       0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
#define configUSE_MUTEXES               1
#define configUSE_COUNTING_SEMAPHORES   0
#define configUSE_ALTERNATIVE_API       0
#define configCHECK_FOR_STACK_OVERFLOW  2
#define configUSE_RECURSIVE_MUTEXES     1
#define configQUEUE_REGISTRY_SIZE       0
#define configGENERATE_RUN_TIME_STATS   0
#define INCLUDE_vTaskPrioritySet        1
#define INCLUDE_uxTaskPriorityGet       1
#define INCLUDE_vTaskDelete             1
#define INCLUDE_vTaskCleanUpResources   0
#define INCLUDE_vTaskSuspend            1
#define INCLUDE_vTaskDelayUntil         1
#define INCLUDE_vTaskDelay              1
#define configKERNEL_INTERRUPT_PRIORITY         255
#define configMAX_SYSCALL_INTERRUPT_PRIORITY    191 /* equivalent to 0xb0, or priority 11. */
#define configLIBRARY_KERNEL_INTERRUPT_PRIORITY 15
#endif /* FREERTOS_CONFIG_H */
without FreeRTOS includes and tasks is this compiled and functionaly in last endless loop with LED’s  with no errors

undefined reference to ‘ulRunTimeStatsC…

Where i can fix the _sbrk error?

undefined reference to ‘ulRunTimeStatsC…

It sounds like your compiler is trying to use newlilb.  You will have to either change to a different library more suited to deeply embedded systems, or provide some of the library functions yourself, or provide a null implementation of _sbrk(). To define your own library functions you can simply include printf-stdarg.c in your project.  You will find lots of copies of printf-stdarg.c in the FreeRTOS/Demo sub-directories. To define your own sbrk() function add something like:
char * sbrk( size_t x )
{
    /* Just to remove compiler warning. */
    ( void ) x;
    return NULL;
}
to main.c.  Just make sure the function never gets called (it shouldn’t, unless you call malloc() in your application code. Which heap implementation are you using?  If you are using heap_3.c (that is, if heap_3.c is being built with your project), switch to heap_1, heap_2 or heap_4.  That will prevent some library functions being pulled in and prevent malloc being called by the kernel. Regards.

undefined reference to ‘ulRunTimeStatsC…

Thanks,
I defined my own _sbrk according to your example, and errors was cleared…. now is compiling without errors:) But no LED in my application is lighting. :/ What can be cause of not running tasks?
Must I enable some interrupts or samwhat other in startup initialization of MCU? I have STM32F107VC and i’ve read  in datasheet that internal oscilator is running on 72Mhz…. are the settings in my main.c and config.h ok? Sorry for my endless questions.

undefined reference to ‘ulRunTimeStatsC…

Oh, sorry, i forgot to tell that i am using heap_4.c

undefined reference to ‘ulRunTimeStatsC…

Chip initialilzation, set up and IO is outside of the scope of topics discussed here. You need to get these things working in a basic blinky application before adding in the RTOS code. If you need help working out how to configure the chip, or create a working project (without FreeRTOS) then I recommend asking questions on the ST forum because that is where the ST experts are. Once you have your basic application working you can add in the FreeRTOS code.

undefined reference to ‘ulRunTimeStatsC…

My LED basic application is working without RTOS… but i am trying implement led lighting of my basic application to RTOS Task…. compilation is without faults, but my basic code as task not working. So I asked , if I have not something wrong set, or if i havent done something basic FreeRTOS settings for basic FreeRTOS Functionality. In debugging i cam see that program is still in endless loop xPortStartScheduler, prvSetupTimerInterrupt();,prvPortStartFirstTask();, but nothing is happend with my LEDs.

undefined reference to ‘ulRunTimeStatsC…

My next guess is that you have not installed the FreeRTOS interrupt handlers.  See http://www.freertos.org/FreeRTOS_Support_Forum_Archive/September_2011/freertos_FreeRTOS_on_Atmel_SAM3U_in_CrossStudio_4694403.html or numerous other posts. It is always recommended to start your application using one of the many pre-configured examples.  That way you start with a project that has the correct files installed, and the correct project configuration. Regards.

undefined reference to ‘ulRunTimeStatsC…

Is possible that is RTOS using SVC Handler from stm32f10_it.c? because from function
static void prvPortStartFirstTask( void )
{
    __asm volatile(
                    " ldr r0, =0xE000ED08   n" /* Use the NVIC offset register to locate the stack. */
                    " ldr r0, [r0]          n"
                    " ldr r0, [r0]          n"
                    " msr msp, r0           n" /* Set the msp back to the start of the stack. */
                    " cpsie i               n" /* Globally enable interrupts. */
                    " svc 0                 n" /* System call to start first task. */
                    " nop                   n"
                );
}
is program jumping always to : void SVC_Handler(void)
{
}
witch is located in stm32f10x_it.c
FreeRTOS have own handlers, or is ok, that is using this?
Configuration file i have from Demo maked for STM32f107_GCC_Rowley simple two tasks was written myself an other files i had left from working configuration with MCU without FreeRTOS.

undefined reference to ‘ulRunTimeStatsC…

This post assumes you have used the #define method to install the exception handlers, as per my previous post. The program is jumping to the default handler.  It must use the FreeRTOS handler, otherwise the application will never even start. The default handler should be defined weak, so the FreeRTOS handler takes its place.  If the default handler is not defined weak, just delete it. Regards.

undefined reference to ‘ulRunTimeStatsC…

Thank you for help,
problem was caused by using incorrect interrupt handlers. After correct redefining vectors and removing stm32f10x_it.c , **it.h is my application running with FreeROTS:)