From 8af172ec46f369b12d787b466e5104240791c742 Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Wed, 25 May 2022 13:51:17 +0800 Subject: [PATCH] esp_system: FIx TWDT SMP FreeRTOS unicore build error When configNUM_CORES = 1, vTaskCoreAffinityGet() is not defined. This commit fixes the TWDT to omit calls to vTaskCoreAffinityGet() when building for unicore. --- components/esp_system/task_wdt.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/components/esp_system/task_wdt.c b/components/esp_system/task_wdt.c index 36fbeb525b..354fc205fc 100644 --- a/components/esp_system/task_wdt.c +++ b/components/esp_system/task_wdt.c @@ -346,9 +346,14 @@ static void task_wdt_isr(void *arg) if (!entry->has_reset) { if (entry->task_handle) { #if CONFIG_FREERTOS_SMP - UBaseType_t uxCoreAffinity = vTaskCoreAffinityGet(entry->task_handle); - ESP_EARLY_LOGE(TAG, " - %s (0x%x)", pcTaskGetName(entry->task_handle), uxCoreAffinity); -#else +#if configNUM_CORES > 1 + // Log the task's name and its affinity + ESP_EARLY_LOGE(TAG, " - %s (0x%x)", pcTaskGetName(entry->task_handle), vTaskCoreAffinityGet(entry->task_handle)); +#else // configNUM_CORES > 1 + // Log the task's name + ESP_EARLY_LOGE(TAG, " - %s", pcTaskGetName(entry->task_handle)); +#endif // configNUM_CORES > 1 +#else // CONFIG_FREERTOS_SMP BaseType_t task_affinity = xTaskGetAffinity(entry->task_handle); const char *cpu; if (task_affinity == 0) { @@ -359,7 +364,7 @@ static void task_wdt_isr(void *arg) cpu = DRAM_STR("CPU 0/1"); } ESP_EARLY_LOGE(TAG, " - %s (%s)", pcTaskGetName(entry->task_handle), cpu); -#endif +#endif // CONFIG_FREERTOS_SMP } else { ESP_EARLY_LOGE(TAG, " - %s", entry->user_name); }