Problems with FreeRTOS and Posix

Hello guys!
I had some problems using pthread_create to create first task of my system.
So I change this to use xTaskCreate.
Someone can help me, why can I not use posix to create the first thread?

Which hardware platform are you using? Where did you get the POSIX wrapper for FreeRTOS? Is it possible to share code?


I’m using STM32F427 and IAR compiler.
We used this page to add FreeRTOS + Posix.

What is the error that you are getting? pthread_create eventually calls xTaskCreate:

Would you please step through the code and see what are the differences in the parameters passed to xtaskCreate?


I am trying to integrate POSIX on FreeRTOS for STM32F4 board. Currently i am facing implicit declaration of static functions like xSemaphoreCreateMutexStatic, xEventGroupCreateStatic, etc. I want to not use static functions but use freertos heap memory. These functions are not present in the source code itself. Please let me know what to do.

I am using posix demo project : FreeRTOS-Plus-POSIX.

These functions come from semphr.h file. Have you tried including this file in your source -

#include "FreeRTOS.h"
#include "semphr.h"

Separately, why do you want to use Plus POSIX and not the FreeRTOS APIs directly?

These warnings are coming from FreeRTOS_POSIX_xxxx.c files which is having semphr.h file in includes. My project uses dynamic allocation, therefore configSUPPORT_STATIC_ALLOCATION = 0 . Because of this the static functions are disabled. But in pthread_create function xSemaphoreCreateMutexStatic and xSemaphoreCreateBinaryStatic functions are used. Currently I have solved the warnings by changing the static functions (removing -static letters) and removing the buffer parameter argumets. Please let me know if my approach is right?

Regarding POSIX, I creating a system where it is RTOS interoperable. Therefore I want to use POSIX APIs in the application code.

Yes, that should work.

Be aware that FreeRTOS-Plus-POSIX is a labs project and it implements only a subset of the POSIX APIs. Do you plan to write one application and use it on 2 different RTOS currently? Or are you trying to ensure that you have an option to replace RTOS in future? The reason I am asking is because using the native APIs is more efficient in terms of memory and run-time. Therefore, if your use case is the latter one, you should evaluate the effort of porting your application to a different RTOS vs the overhead of using POSIX wrapper. In both the use cases, you need to ensure that you do not use any native FreeRTOS API in your application to keep it portable.

I am trying to ensure that I have an option to replace the RTOS in future. I am aware of the fact that there will be overhead due to POSIX, but the project I am working is a research project and need not be efficient on computational level. My plan is to develop some simple application without any FreeRTOS APIs for the prototype.

POSIX seems to be the right choice for your use case then :slight_smile: