You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
async_context_freertos: Add support for configSUPPORT_STATIC_ALLOCATION (#2436)
* async_context_freertos: Add support for configSUPPORT_STATIC_ALLOCATION
The implementation of async_context_freertos currently assumes that
FreeRTOS has been configured with `configSUPPORT_DYNAMIC_ALLOCATION`,
which causes it to allocate semaphores, timers and tasks from the heap.
However, some projects may prefer `configSUPPORT_STATIC_ALLOCATION`,
which requires memory to be allocated ahead of time. This change allows
async_context_freertos to support either static or dynamic allocation.
The way this works is when `configSUPPORT_STATIC_ALLOCATION` is enabled,
`async_context_freertos` struct will reserve extra space for the static
objects (e.g. `StaticSemaphore_t`) and it will prefer to use the static
creation functions (e.g. `xSemaphoreCreateBinaryStatic()`). For the task
creation, the user will be responsible for allocating the stack memory
and setting the task_stack field in `async_context_freertos_config_t`.
For convenience, The `cyw43_arch_init_default_async_context()` function
will reserve `CYW43_TASK_STACK_SIZE` words of stack space in static
memory.
* Assert that task_stack is set
* Add CYW43_NO_DEFAULT_TASK_STACK
In theory you can use your own async context therefore bypassing
cyw43_arch_init_default_async_context, which would leave
cyw43_async_context_freertos_task_stack unused.
Add a #define for this rare situation.
* Update documentaton for async_context_freertos_config.task_stack
---------
Co-authored-by: Peter Harper <[email protected]>
0 commit comments