mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 20:20:14 +01:00
esp32: Add support for IDF version v5.2.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
This commit is contained in:
committed by
Damien George
parent
c92683d67c
commit
d6176c1f5e
@@ -41,6 +41,12 @@
|
||||
#define MP_THREAD_DEFAULT_STACK_SIZE (MP_THREAD_MIN_STACK_SIZE + 1024)
|
||||
#define MP_THREAD_PRIORITY (ESP_TASK_PRIO_MIN + 1)
|
||||
|
||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 2, 0) && !CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP
|
||||
#define FREERTOS_TASK_DELETE_HOOK vTaskPreDeletionHook
|
||||
#else
|
||||
#define FREERTOS_TASK_DELETE_HOOK vPortCleanUpTCB
|
||||
#endif
|
||||
|
||||
// this structure forms a linked list, one node per active thread
|
||||
typedef struct _mp_thread_t {
|
||||
TaskHandle_t id; // system id of thread
|
||||
@@ -70,7 +76,7 @@ void mp_thread_init(void *stack, uint32_t stack_len) {
|
||||
// memory barrier to ensure above data is committed
|
||||
__sync_synchronize();
|
||||
|
||||
// vPortCleanUpTCB needs the thread ready after thread_mutex is ready
|
||||
// FREERTOS_TASK_DELETE_HOOK needs the thread ready after thread_mutex is ready
|
||||
thread = &thread_entry0;
|
||||
}
|
||||
|
||||
@@ -179,7 +185,7 @@ void mp_thread_finish(void) {
|
||||
|
||||
// This is called from the FreeRTOS idle task and is not within Python context,
|
||||
// so MP_STATE_THREAD is not valid and it does not have the GIL.
|
||||
void vPortCleanUpTCB(void *tcb) {
|
||||
void FREERTOS_TASK_DELETE_HOOK(void *tcb) {
|
||||
if (thread == NULL) {
|
||||
// threading not yet initialised
|
||||
return;
|
||||
@@ -235,7 +241,7 @@ void mp_thread_deinit(void) {
|
||||
// No tasks left to delete
|
||||
break;
|
||||
} else {
|
||||
// Call FreeRTOS to delete the task (it will call vPortCleanUpTCB)
|
||||
// Call FreeRTOS to delete the task (it will call FREERTOS_TASK_DELETE_HOOK)
|
||||
vTaskDelete(id);
|
||||
}
|
||||
}
|
||||
@@ -243,7 +249,7 @@ void mp_thread_deinit(void) {
|
||||
|
||||
#else
|
||||
|
||||
void vPortCleanUpTCB(void *tcb) {
|
||||
void FREERTOS_TASK_DELETE_HOOK(void *tcb) {
|
||||
}
|
||||
|
||||
#endif // MICROPY_PY_THREAD
|
||||
|
||||
Reference in New Issue
Block a user