diff --git a/cpu/esp32/startup.c b/cpu/esp32/startup.c index 5b4afb6f1311..50f21d1eb85f 100644 --- a/cpu/esp32/startup.c +++ b/cpu/esp32/startup.c @@ -147,6 +147,14 @@ static NORETURN void IRAM system_startup_cpu0(void) puf_sram_init((uint8_t *)&_sheap, SEED_RAM_LEN); #endif +#if IS_USED(MODULE_ESP_IDF_HEAP) + /* init heap */ + heap_caps_init(); + if (IS_ACTIVE(ENABLE_DEBUG)) { + ets_printf("Heap free: %u byte\n", get_free_heap_size()); + } +#endif + /* initialize system call tables of ESP32x rom and newlib */ syscalls_init(); @@ -206,14 +214,6 @@ static NORETURN void IRAM system_startup_cpu0(void) LOG_STARTUP("PRO cpu is up (single core mode, only PRO cpu is used)\n"); -#if IS_USED(MODULE_ESP_IDF_HEAP) - /* init heap */ - heap_caps_init(); - if (IS_ACTIVE(ENABLE_DEBUG)) { - ets_printf("Heap free: %u byte\n", get_free_heap_size()); - } -#endif - /* init esp_timer implementation */ esp_timer_early_init(); diff --git a/cpu/esp_common/freertos/task.c b/cpu/esp_common/freertos/task.c index 285bab2298fc..1914504f90f6 100644 --- a/cpu/esp_common/freertos/task.c +++ b/cpu/esp_common/freertos/task.c @@ -116,6 +116,9 @@ void vTaskDelete(TaskHandle_t xTaskToDelete) DEBUG("%s pid=%d task=%p\n", __func__, thread_getpid(), xTaskToDelete); uint32_t pid = (uint32_t)xTaskToDelete; + if (pid == 0) { + pid = thread_getpid(); + } assert(pid_is_valid(pid)); /* remove the task from scheduling */