FreeRTOS / Lab-Project-FreeRTOS-POSIX

This repository contains FreeRTOS+POSIX source code, which could be consumed as a submodule.
MIT License
95 stars 60 forks source link

Depends on configSUPPORT_STATIC_ALLOCATION #27

Open asolochek opened 1 year ago

asolochek commented 1 year ago

FreeRTOS-Plus-POSIX uses the static versions of semaphore/mutex API functions. These functions only are available if configSUPPORT_STATIC_ALLOCATION is 1. At a minimum this should be listed as a dependency, but ideally this library would work with dynamic allocation as well, as there is a bit of overhead required to use static allocation.

If there is a straightforward way of converting this to use the dynamic versions of the API functions, I'd appreciate learning about that.

aggarg commented 1 year ago

At a minimum this should be listed as a dependency, but ideally this library would work with dynamic allocation as well, as there is a bit of overhead required to use static allocation.

Agree that it should be listed as a dependency. What do you mean by overhead of using static allocation?

If there is a straightforward way of converting this to use the dynamic versions of the API functions, I'd appreciate learning about that.

It would require you to change the implementation of semaphore and mutex. What is your motivation to do that?

Also, what is your motivation of using these wrappers and not using FreeRTOS native APIs directly?

asolochek commented 1 year ago

The overhead I'm referring to is needing to implement vApplicationGetIdleTaskMemory() and vApplicationGetTimerTaskMemory().

The reason for using posix is because I inherited the project and some components of it run both on the stm32 we are using as well as in some Mac/pc utilities . I guess the previous author thought it would be easier if the threading were portable.

aggarg commented 1 year ago

You can copy the definitions for these functions from here -