-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"esp_restart" cause Core 0 panic'ed (Cache disabled but cached memory region accessed) (IDFGH-3086) #5107
Comments
Do not use psram stack for that task. Psram stack can only be used if you do not use any ROM functions in it, either directly or indirectly. esp_restart() calls a rom function. |
@Spritetm |
@Spritetm void IRAM_ATTR esp_restart(void)
{
for (int i = SHUTDOWN_HANDLERS_NO - 1; i >= 0; i--) {
if (shutdown_handlers[i]) {
shutdown_handlers[i]();
}
}
// Disable scheduler on this core.
vTaskSuspendAll();
esp_restart_noos();
} |
If change #include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
void panic_task(void *param)
{
*((int *) 0) = 0;
vTaskDelete(NULL);
}
void app_main(void)
{
vTaskDelay(5000 / portTICK_PERIOD_MS);
StackType_t *task_stack = (StackType_t *) heap_caps_calloc(1, 1024 * 3, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
static StaticTask_t task_buf;
xTaskCreateStaticPinnedToCore(panic_task, "panictask", (1024 * 3),
NULL, 5, task_stack, &task_buf, 1);
} Log:
|
Aaaah, the fact that this happens on the next boot makes this a different story indeed. We'll investigate this. |
@xiruilin I think we have found the reason, will update this thread when the fix is available. |
If esp_restart_noos() is run and the stack address points to external memory (SPIRAM) then Cache_Read_Disable() raises up the error "Cache disabled but cached memory region accessed" to fix this we switch stack to internal RAM before disable cache. Added unit tests. Closes: #5107
If esp_restart_noos() is run and the stack address points to external memory (SPIRAM) then Cache_Read_Disable() raises up the error "Cache disabled but cached memory region accessed" to fix this we switch stack to internal RAM before disable cache. Added unit tests. Closes: #5107
If esp_restart_noos() is run and the stack address points to external memory (SPIRAM) then Cache_Read_Disable() raises up the error "Cache disabled but cached memory region accessed" to fix this we switch stack to internal RAM before disable cache. Added unit tests. Closes: #5107
Environment
Problem Description
When
CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY=y
,call
esp_restart
on core 1, got the issue:Code to reproduce this issue
Debug Logs
The text was updated successfully, but these errors were encountered: