esp_expression_with_stack: fix wrong top of stack calculation plus documentation update
This commit is contained in:
parent
e4fb50e6f3
commit
f0e82311a5
|
@ -6,8 +6,7 @@ StackType_t * esp_switch_stack_setup(StackType_t *stack, size_t stack_size)
|
||||||
{
|
{
|
||||||
int watchpoint_place = (((int)stack + 31) & ~31);
|
int watchpoint_place = (((int)stack + 31) & ~31);
|
||||||
StackType_t *top_of_stack = (StackType_t *)&stack[0] +
|
StackType_t *top_of_stack = (StackType_t *)&stack[0] +
|
||||||
(sizeof(stack_size * sizeof(StackType_t)) /
|
((stack_size * sizeof(StackType_t)) / sizeof(StackType_t));
|
||||||
sizeof(StackType_t));
|
|
||||||
|
|
||||||
//Align stack to a 16byte boundary, as required by CPU specific:
|
//Align stack to a 16byte boundary, as required by CPU specific:
|
||||||
top_of_stack = (StackType_t *)(((UBaseType_t)(top_of_stack - 31) -
|
top_of_stack = (StackType_t *)(((UBaseType_t)(top_of_stack - 31) -
|
||||||
|
|
|
@ -19,7 +19,7 @@ Usage
|
||||||
a mutex object allocated by the caller, which is used to protect if
|
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
|
the same function shares its allocated stack, a pointer to the top
|
||||||
of stack used to that fuction, and the function itself, note the
|
of stack used to that fuction, and the function itself, note the
|
||||||
function is passed extactly in the same way as do when you call
|
function is passed exactly in the same way as do when you call
|
||||||
it on a regular way.
|
it on a regular way.
|
||||||
|
|
||||||
The usage may looks like the code below:
|
The usage may looks like the code below:
|
||||||
|
@ -40,7 +40,8 @@ The usage may looks like the code below:
|
||||||
ESP_EXECUTE_EXPRESSION_WITH_STACK(printf_lock,
|
ESP_EXECUTE_EXPRESSION_WITH_STACK(printf_lock,
|
||||||
shared_stack,
|
shared_stack,
|
||||||
printf("Executing this from external stack! \n"));
|
printf("Executing this from external stack! \n"));
|
||||||
free(shared_stack);
|
vSemaphoreDelete(printf_lock);
|
||||||
|
free(shared_stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
.. _esp-call-with-stack-basic_usage:
|
.. _esp-call-with-stack-basic_usage:
|
||||||
|
|
|
@ -18,7 +18,7 @@ System API
|
||||||
High Resolution Timer <esp_timer>
|
High Resolution Timer <esp_timer>
|
||||||
Himem (large external SPI RAM) API <himem>
|
Himem (large external SPI RAM) API <himem>
|
||||||
Inter-Processor Call <ipc>
|
Inter-Processor Call <ipc>
|
||||||
Call function with external stack<esp_expression_with_stack>
|
Call function with external stack <esp_expression_with_stack>
|
||||||
Interrupt Allocation <intr_alloc>
|
Interrupt Allocation <intr_alloc>
|
||||||
Logging <log>
|
Logging <log>
|
||||||
Miscellaneous System APIs <system>
|
Miscellaneous System APIs <system>
|
||||||
|
|
Loading…
Reference in a new issue