docs: update on expression with stack api usage regard the stack setup.
This commit is contained in:
parent
fab50ccf7c
commit
8bfb8e885e
1 changed files with 1 additions and 6 deletions
|
@ -33,17 +33,12 @@ The usage may looks like the code below:
|
||||||
//Allocate a stack buffer, from heap or as a static form:
|
//Allocate a stack buffer, from heap or as a static form:
|
||||||
portSTACK_TYPE *shared_stack = malloc(8192 * sizeof(portSTACK_TYPE));
|
portSTACK_TYPE *shared_stack = malloc(8192 * sizeof(portSTACK_TYPE));
|
||||||
|
|
||||||
//points to the top of stack, that is it the last word of allocated buffer:
|
|
||||||
portSTACK_TYPE *ext_stack_top = (portSTACK_TYPE *)&shared_stack[0] +
|
|
||||||
((sizeof(8192 * sizeof(portSTACK_TYPE))) /
|
|
||||||
sizeof(portSTACK_TYPE));
|
|
||||||
|
|
||||||
//Allocate a mutex to protect its usage:
|
//Allocate a mutex to protect its usage:
|
||||||
SemaphoreHandle_t printf_lock = xSemaphoreCreateMutex();
|
SemaphoreHandle_t printf_lock = xSemaphoreCreateMutex();
|
||||||
|
|
||||||
//Call the desired function using the macro helper:
|
//Call the desired function using the macro helper:
|
||||||
ESP_EXECUTE_EXPRESSION_WITH_STACK(printf_lock,
|
ESP_EXECUTE_EXPRESSION_WITH_STACK(printf_lock,
|
||||||
ext_stack_top,
|
shared_stack,
|
||||||
printf("Executing this from external stack! \n"));
|
printf("Executing this from external stack! \n"));
|
||||||
free(shared_stack);
|
free(shared_stack);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue