cancel
Showing results for 
Search instead for 
Did you mean: 

undefined reference to `osDelay'/`osThreadSuspend'/`osSemaphoreAcquire'

Lyap94
Associate III

Hi guys,

I'm stuck in the following issue. In my STM32 project I'm using FreeRTOS which I have enabled using CubeMX. In my project tree I have the following files:

Lyap94_0-1719407881182.png

At the same time I have included the following paths:

Lyap94_1-1719407980680.png

When I check the file with the error and try to find the referenece the header file is found and opened normally. All the .c files are in place as you can see.

 

Do you know what could be the issue?

4 REPLIES 4
Andrew Neil
Evangelist III

"undefined reference" is a linker error.

It means that you have omitted to provide a definition of that function - either as source code, or as a pre-built binary library.

Probably, you have #included a header which just declares that function (ie, just provides a prototype) - hence the compiler is happy - but haven't added the necessary source or pre-built binary library to your project - so the link fails.

 


@Lyap94 wrote:

 All the .c files are in place as you can see.


So which of them contains a definition of osDelay and/or osThreadSuspend and/or osSemaphoreAcquire ?

 

Hi Andrew Neil,

Thanks for the fast reply!

The file cmsis_os2.c includes the definition of all the functions that seem to be undefined. It's in Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2.

 

 


@Lyap94 wrote:

The file cmsis_os2.c includes the definition of all the functions that seem to be undefined. 


You screenshot is a bit low-res to see clearly, but it looks like that file has errors:

AndrewNeil_1-1719409154650.png

So maybe it wasn't (successfully) built ?

Lyap94
Associate III

You are right. There are two files that have errors: 

- cmsis_os2.c --> SemaphoreHandle_t and QueueHandle_t could not be resolved 

- semphr.h --> Where typedef QueueHandle_t SemaphoreHandle_t; is defined

The problem starts there I think because the QueueHandle_t cannot be resolved. It is defined in queue.h which is also included...