Accessing NVS/FAT from task where stack is in external RAM
Posted: Wed Jan 17, 2024 4:08 pm
Hi!
I'm using ESP32-S2 with an external 2MB PSRAM.
In my program I have various tasks, all of which where I allocate the task stack in external RAM (using CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY and xTaskCreateStatic() with EXT_RAM_BSS_ATTR StackType_t _main_event_stack[MAIN_EVENT_TASK_STACK]).
In the main task, I setup NVS as well as mount a FAT file system in flash.
Using ESP-IDF v4.4.4, I can read and write to NVS and the the FAT file system from the various tasks.
But with v.5.1.2, I can only do this from the main thread. If I try to read a file from FAT in a thread with an external allocated task stack, it just reboot. I'm unable to catch any stack trace as the USB/CDC just disconnect. I also tried setting CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT to but to no avail. It also says in the doc that core dumps doesn't work with external ram allocated task stacks.
For me, its a bit unclear from the documentation if reading and writing to flash from a task with external stack is allowed, or it I'm just in luck with v4.4.4.
So my question is, should this be allowed, and if so, what might I be missing with v5.1.2?
Regards,
Johan
I'm using ESP32-S2 with an external 2MB PSRAM.
In my program I have various tasks, all of which where I allocate the task stack in external RAM (using CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY and xTaskCreateStatic() with EXT_RAM_BSS_ATTR StackType_t _main_event_stack[MAIN_EVENT_TASK_STACK]).
In the main task, I setup NVS as well as mount a FAT file system in flash.
Using ESP-IDF v4.4.4, I can read and write to NVS and the the FAT file system from the various tasks.
But with v.5.1.2, I can only do this from the main thread. If I try to read a file from FAT in a thread with an external allocated task stack, it just reboot. I'm unable to catch any stack trace as the USB/CDC just disconnect. I also tried setting CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT to but to no avail. It also says in the doc that core dumps doesn't work with external ram allocated task stacks.
For me, its a bit unclear from the documentation if reading and writing to flash from a task with external stack is allowed, or it I'm just in luck with v4.4.4.
So my question is, should this be allowed, and if so, what might I be missing with v5.1.2?
Regards,
Johan