Using FreeRTOS from C++ is possible AFAICT. Embedded C++ looks a bit too
limited (e.g., no casting operators?), but it's definitely a good list
of things to watch out for.
Memory consumption and fragmentation is also my biggest concern, as we
only have 256 KiB available. It seems FreeRTOS doesn't come with
built-in heap allocator, but there are a a number of example
implementations provided. I think we can use statically allocated
task-local memory most of the time.
Some thoughts about memory and message passing: message passing will
require a scheme for transferring buffers between tasks; ideally without
dynamic allocation, blocking, or dead locks. FreeRTOS comes with message
queues, but it doesn't provide good IPC on top of it. Those queues make
full copies of messages, so transferring larger memory blocks will be
slow. And the messages are of fixed size. All messages that can go into
a buffer are required to be as large as the larges message. (The SDK's
FreeRTOS demo has a bug here.)
We want small message to be fast and large messages to be possible.
Usually, you'd do this with page mapping, but that's also not available.
The next best thing is to have a static local buffer for each task that
holds the message data for sending and receiving. Data transfer would be
done with small 'control messages' with an attached data buffer. A set
of helper functions will take care of sharing or transferring the
content of the buffer.
Best regards
Thomas
> <
https://en.wikipedia.org/wiki/Resource_acquisition_is_initialization>
>
>