File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
components/freertos/esp_additions Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 11/*
2- * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
2+ * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
33 *
44 * SPDX-License-Identifier: Apache-2.0
55 */
100100
101101 configASSERT ( eRunning != eTaskGetState ( xTaskToDelete ) );
102102
103+ /* We can delete the task and free the memory buffers.
104+ * First, we must call `vTaskDelete` so that the port task delete callback is called.
105+ * On targets that have coprocessors, it may be possible that the stack pointer is modified (restored)
106+ * during this phase, hence, it must be done before getting the statuc buffers out of the task. */
107+ vTaskDelete ( xTaskToDelete );
108+
109+ /* Free the memory buffers */
103110 xResult = xTaskGetStaticBuffers ( xTaskToDelete , & puxStackBuffer , & pxTaskBuffer );
104111 configASSERT ( xResult == pdTRUE );
105112 configASSERT ( puxStackBuffer != NULL );
106113 configASSERT ( pxTaskBuffer != NULL );
107114
108- /* We can delete the task and free the memory buffers. */
109- vTaskDelete ( xTaskToDelete );
110-
111- /* Free the memory buffers */
112115 heap_caps_free ( puxStackBuffer );
113116 vPortFree ( pxTaskBuffer );
114117 }
You can’t perform that action at this time.
0 commit comments