0

I'm trying to build an LED blinker with FreeRTOS, but there are some errors in the project:

undefined symbol vApplicationIdleHook referenced by symbol prvIdleTask (section .text.prvIdleTask in file tasks.o)
undefined symbol vApplicationMallocFailedHook referenced by symbol pvPortMalloc (section .text.pvPortMalloc in file heap_1.o)
undefined symbol vApplicationStackOverflowHook referenced by symbol vTaskSwitchContext (section .text.vTaskSwitchContext in file tasks.o)
undefined symbol vApplicationTickHook referenced by symbol xTaskIncrementTick (section .text.xTaskIncrementTick in file tasks.o)

They all look familiar, as I see they are callback functions in FreeRTOS.

So I don't know how to fix it. I tried to change the configUSE_IDLE_HOOK and configUSE_TICK_HOOK parameters, but it still doesn't work.

I tried to make a project with KEIL and SEGGER Embedded Studio and there is the same problem in both of them.

1 Answer 1

1

You should have (somewhere) a file called FreeRTOSConfig.h that is used to configure FreeRTOS. It has a bunch of things you can turn on and off.

If you enable the "hook" functions, then you need to implement a function for the hook that does what you need.

Look for lines like:

#define configUSE_TICK_HOOK            1
#define configCHECK_FOR_STACK_OVERFLOW 2
#define configUSE_MALLOC_FAILED_HOOK   1

You should either set those to zero (to disable the functionality), or implement the missing functions yourself. e.g.

void vApplicationStackOverflowHook( TaskHandle_t xTask, signed char * pcTaskName )
{
    log_error ( "STACK OVERFLOW DETECTED: ", pcTaskName );
}

If you implement the functions, do so in one of your own source code files; don't edit the FreeRTOS sources.

Note that if you change the #defines in FreeRTOSConfig.h you may need to recompile your project (i.e. clean the project, the equivalent of make clean) for the changes to be picked up, if your dependencies are not correctly set up.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for answer! configUSE_IDLE_HOOK, configUSE_TICK_HOOK and configUSE_MALLOC_FAILED_HOOK are set as zero. Where i should implement the missing functions? I mean is this important to define it in FreeRTOSConfig or another file?
@RUMBUFDSI You should add the functions in your own source file. Don't edit the FreeRTOS code. I've updated the answer as such. It seems that the FreeRTOSConfig.h you've found isn't the one being used by the code, otherwise you wouldn't have these undefined symbols.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.