[STM32] Undefined references to task API functions

Hi everyone, I am trying to get FreeRTOS 10.1.1 compiling without using STM32Cube for an STM32F413 using Atollic TrueSTUDIO, but I have two compilation errors in my main function, given below. We are choosing not to use STM32Cube for our project. The errors are:
  • Undefined reference to ‘xTaskCreate’
  • Undefined reference to ‘vTaskStartScheduler’
Going to the declarations of both functions in task.h shows that both are simply marked as PRIVELEGED FUNCTION. However, both functions are defined properly in tasks.c. This is true both in FreeRTOS 10.1.1 and in the FreeRTOS 9.0.0 that comes in STM32Cube, but for some reason TrueSTUDIO has no trouble compiling a FreeRTOS 9.0.0-based project generated by STM32Cube. How can I get these API calls to work? I.E. how do I make sure that the correct definitions in tasks.c are used instead of the PRIVELEGED FUNCTION declarations in task.h? main.c below: ~~~ :::C

include <stdint.h>

include “stm32f4xx.h”

include “stm32f4xx_hal.h”

include “FreeRTOS.h”

include “task.h”

include “my_tasks.h”

int main(void) { systemClockConfig();
// https://www.freertos.org/RTOS-Cortex-M3-M4.html
HAL_NVIC_SetPriorityGrouping( NVIC_PRIORITYGROUP_4 );

// Make tasks here
xTaskCreate( vMyLEDTask, "LED", configMINIMAL_STACK_SIZE, NULL, 1, NULL );

vTaskStartScheduler();
} ~~~

[STM32] Undefined references to task API functions

These functions are always available provided tasks.c is being built – double check that is the case.

[STM32] Undefined references to task API functions

Thank you for the heads up, after some Googling I was able to solve the issue. The problem is with TrueSTUDIO (which is based on Eclipse), not FreeRTOS. The directory containing tasks.c is included in the compiler settings within TrueSTUDIO. Additionally, the xTaskCreate function definition is inside an #if( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) section, and my FreeRTOSConfig.h file does indeed have this macro set to 1. The problem was that the FreeRTOS folder was excluded from the build because I did not add it as a source folder in Eclipse. Apparently if you add a new regular folder it will automatically be excluded from the build. See the attached screenshot, where “myFolder” was added as a regular folder, not a source folder. You can see there is no “C” in the folder icon, and if you right-click on the folder, go to Resource Configurations->Exclude from Build, it will show that the folder is excluded in all your builds configurations. Uncheck these boxes and you will see the “C” appear in the folder icon, and TrueSTUDIO will now include the files in “myFolder” in the next build. Here is a link to a stack overflow post that helped me with this.