mirror of
https://github.com/espressif/esp-idf.git
synced 2026-08-14 12:59:29 +03:00
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:
@@ -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 user‑allocated stack instead of the current task’s stack.
|
||||
|
||||
The usage may look like the code below:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user