Skip to content

Commit dff396c

Browse files
committed
audio_sal: Fix bug when task in external stack use esp_restart
1 parent 81abb4b commit dff396c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

components/audio_sal/audio_mem.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,11 @@ bool audio_mem_spiram_is_enabled(void)
144144
}
145145
#endif
146146

147-
#if defined(CONFIG_SPIRAM_BOOT_INIT)
147+
#if defined(CONFIG_SPIRAM_BOOT_INIT) && (CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY)
148148
bool audio_mem_spiram_stack_is_enabled(void)
149149
{
150150
bool ret = true;
151-
#if defined(CONFIG_IDF_TARGET_ESP32) && (CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY)
151+
#if defined(CONFIG_IDF_TARGET_ESP32)
152152
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 4)
153153
uint32_t chip_ver = efuse_hal_chip_revision();
154154
#else
@@ -158,8 +158,6 @@ bool audio_mem_spiram_stack_is_enabled(void)
158158
ESP_LOGW("AUIDO_MEM", "Can't support stack on external memory due to ESP32 chip is %d", chip_ver);
159159
ret = false;
160160
}
161-
#elif defined(CONFIG_IDF_TARGET_ESP32)
162-
ret = false;
163161
#endif
164162
return ret;
165163
}

components/audio_sal/audio_thread.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,14 @@ esp_err_t audio_thread_create(audio_thread_t *p_handle, const char *name, void(*
7373
goto audio_thread_create_error;
7474
}
7575
} else {
76+
if (stack_in_ext) {
77+
ESP_LOGW(TAG, "Make sure selected the `CONFIG_SPIRAM_BOOT_INIT` and `CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY` by `make menuconfig`");
78+
}
7679
if (xTaskCreatePinnedToCore(main_func, name, stack, arg, prio, (xTaskHandle)p_handle, core_id) != pdPASS) {
7780
ESP_LOGE(TAG, "Error creating task %s", name);
7881
goto audio_thread_create_error;
82+
} else {
83+
ESP_LOGI(TAG, "The %s task allocate stack on internal memory", name);
7984
}
8085
}
8186
return ESP_OK;

0 commit comments

Comments
 (0)