I want to write a multi-threading program for microcontroller with free-rtos. but I don't want to use non-standard free-rtos functions, instead, I want to use the native c++ library to run parallel and async tasks. but I don't know how to write an adapter for connecting c++ system calls for thread creation to free-rtos functions.
mcu: arm cortex m4 stm32f407
c++ version: 17
It seems that FreeRTOS has a POSIX threads adaptor layer. It's a subset, but probably enough to build a thread
, mutex
, and future
from either GNU libstdc++
or clang libc++
against. You will almost certainly need a working std::atomic
implementation.
There's a lot of grot in POSIX threads that resulted from its retro-fit to various UNIX-alike operating systems, and it's highly likely you won't want the bits not supported. For good reason, it's not the default threading API of many RTOSs.