Hi,
I’m trying to build FreeRTOS with an additional POSIX layer for my ESP32 project. For this I’m using the FreeRTOS-POSIX lab project. However, I have an awful amount of errors when comping because ESP-IDF already has some POSIX support build in. The FreeRTOS_POSIX_portable.h
does try to mitigate this and excludes certain headers from being included but there are a variety of issues that I can’t seem to get around to.
I originally posted this on the FreeRTOS-POSIX lab GitHub page as an issue. But they redirected me to this forum instead.
Below is copied from the original GitHub issue
I’m having some trouble getting this to work with an ESP32 (w/ ESP-IDF 4.1). There seems to be all kinds of missing headers and deprecated function calls. After modifying the source code I got some part to compile, but now I’m stuck on a number of problems, and I’m not sure if I’m doing something wrong.
Like:
- implicit declaration of function
xSemaphoreCreateCountingStatic
- error: ‘errno’ undeclared (could be easily fixed with #include “errno.h”)
-
#include "Atomic.h"
not found -
#include "FreeRTOS.h"
instead of#include "freertos/FreeRTOS.h"
-
taskENTER_CRITICAL();
missingmux
argument. -
int sched_get_priority_max( int policy );
not implemented by ESP-IDF whileshed.h
is disabled inFreeRTOS_POSIX_portable.h
- Pthread types header from FreeRTOS_POSIX is read instead of ESP-IDF while the FreeRTOS-POSIX pthread header is disabled in
FreeRTOS_POSIX_portable.h
causing failed to find declarations. - There are some more, but I can’t remember them right now.
I might have done something horribly wrong and that it is all my fault, but the issues just seem to keep piling up, and I thought you guys might have a better idea what is going on. My CMakeLists.txt
looks like this:
idf_component_register(
SRCS
"FreeRTOS-Plus-POSIX/source/FreeRTOS_POSIX_pthread.c"
"FreeRTOS-Plus-POSIX/source/FreeRTOS_POSIX_semaphore.c"
"FreeRTOS-Plus-POSIX/source/FreeRTOS_POSIX_clock.c"
"FreeRTOS-Plus-POSIX/source/FreeRTOS_POSIX_timer.c"
"FreeRTOS-Plus-POSIX/source/FreeRTOS_POSIX_utils.c"
"FreeRTOS-Plus-POSIX/source/FreeRTOS_POSIX_mqueue.c"
"FreeRTOS-Plus-POSIX/source/FreeRTOS_POSIX_pthread_barrier.c"
"FreeRTOS-Plus-POSIX/source/FreeRTOS_POSIX_sched.c"
"FreeRTOS-Plus-POSIX/source/FreeRTOS_POSIX_unistd.c"
"FreeRTOS-Plus-POSIX/source/FreeRTOS_POSIX_pthread_mutex.c"
"FreeRTOS-Plus-POSIX/source/FreeRTOS_POSIX_pthread_cond.c"
INCLUDE_DIRS
"include/FreeRTOS_POSIX"
PRIV_INCLUDE_DIRS
"FreeRTOS-Plus-POSIX/include"
"FreeRTOS-Plus-POSIX/include/portable"
"FreeRTOS-Plus-POSIX/include/portable/espressif/esp32_devkitc_esp_wrover_kit"
"include"
"include/private"
"/home/noeel/esp/esp-idf-v4.1/components/freertos/include/freertos"
PRIV_REQUIRES pthread newlib
)