Merge branch 'contrib/github_pr_17648' into 'master'

docs(shared_stack): Fix incorrect or misleading expressions (GitHub PR)

Closes IDFGH-16521 and IDFGH-16500

See merge request espressif/esp-idf!42340
This commit is contained in:
Konstantin Kondrashov
2025-11-11 12:32:14 +08:00
2 changed files with 13 additions and 13 deletions

View File

@@ -6,14 +6,14 @@ Call Function with External Stack
Overview
--------
A given function can be executed with a user-allocated stack space which is independent of current task stack. This mechanism can be used to save stack space wasted by tasks which call a common function with intensive stack usage such as ``printf``. The given function can be called inside the shared stack space, which is a callback function deferred by calling :cpp:func:`esp_execute_shared_stack_function`, passing that function as a parameter.
A given function can be executed with a user-allocated stack space which is independent of current task's stack. This mechanism helps reduce stack usage for tasks that call common functions with heavy stack demands such as ``printf``. The given function can be executed on the shared stack space by calling :cpp:func:`esp_execute_shared_stack_function` and passing it as a parameter.
.. warning::
:cpp:func:`esp_execute_shared_stack_function` does only minimal preparation of the provided shared stack memory. The function passed to it for execution on the shared stack space or any of that function's callees should not do any of the following:
.. list::
- Use thread-local storage
:esp32p4: - Use the floating-point unit
:esp32p4: - Use the AI co-processor
@@ -27,12 +27,12 @@ Usage
:cpp:func:`esp_execute_shared_stack_function` takes four arguments:
- a mutex object allocated by the caller, which is used to protect if the same function shares its allocated stack
- a pointer to the top of stack used for that function
- a mutex object allocated by the caller, which is used to protect the shared stack space
- a pointer to the stack used for that function
- the size of stack in bytes
- a pointer to the shared stack function
The user-defined function is deferred as a callback and can be called using the user-allocated space without taking space from current task stack.
The user-defined function is executed immediately as a callback, using a userallocated stack instead of the current tasks stack.
The usage may look like the code below: