I am a WROVER user and getting exception while accessing a file from a static task. The problem occurs for large stack sizes, when I shrink the stack size it works. I searched for it and I could NOT find any similar post..
Can anybody faced with the same problem and find a solution for it? Or is there anyone have any opinion about this..
Regards
Ozgur
esp_get_idf_version : v3.3-127-g0a0f2Guru Meditation Error: Core 0 panic'ed (Cache disabled but cached memory region accessed)
Core 0 register dump:
PC : 0x40084d6b PS : 0x00060734 A0 : 0x800837f0 A1 : 0x3ffb02b0
A2 : 0x00000000 A3 : 0x00000001 A4 : 0x3ffafef0 A5 : 0x00000000
A6 : 0x00000001 A7 : 0x00000000 A8 : 0x3ffc0990 A9 : 0x00000000
A10 : 0x00000001 A11 : 0x12000248 A12 : 0x3ffbdc08 A13 : 0x00000018
A14 : 0x000000fe A15 : 0x00000000 SAR : 0x00000000 EXCCAUSE: 0x00000007
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000
ELF file SHA256: ad0bd0baad0bd0baad0bd0baad0bd0baad0bd0baad0bd0baad0bd0baad0bd0ba
Backtrace: 0x40084d6b:0x3ffb02b0 0x400837ed:0x3ffb02d0
Rebooting...
ets Jun 8 2016 00:22:57
rst:0x3 (SW_RESET),boot:0x37 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:612
load:0x40078000,len:9044
ho 0 tail 12 room 4
load:0x40080400,len:5196
entry 0x40080648
I (203) psram: This chip is ESP32-D0WD
I (204) spiram: Found 32MBit SPI RAM device
I (204) spiram: SPI RAM mode: flash 80m sram 80m
I (207) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (214) cpu_start: Pro cpu up.
I (218) cpu_start: Application information:
I (223) cpu_start: Project name: ttSmartMultimeter
I (228) cpu_start: App version: 1
I (233) cpu_start: Compile time: Dec 26 2019 10:28:36
I (239) cpu_start: ELF file SHA256: 4f928746ca4f2d0f...
I (245) cpu_start: ESP-IDF: v3.3-127-g0a0f2caa1-dirty
I (251) cpu_start: Starting app cpu, entry point is 0x40081338
I (0) cpu_start: App cpu up.
I (262) heap_init: Initializing. RAM available for dynamic allocation:
I (269) heap_init: At 3FFAE6E0 len 0000F480 (61 KiB): DRAM
I (275) heap_init: At 3FFC2208 len 0001DDF8 (119 KiB): DRAM
I (281) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (287) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (294) heap_init: At 4008D5D4 len 00012A2C (74 KiB): IRAM
I (300) cpu_start: Pro cpu start user code
I (305) spiram: Adding pool of 4096K of external SPI memory to heap allocator
I (103) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (104) spiram: Reserving pool of 64K of internal memory for DMA/internal allocations
I (144) TEST_APP: Starting task1_task - Free Ram :4023504
I (154) TEST_APP: Starting task2_task - Free Ram :4023312
- #include <stdio.h>
- #include <fstream>
- #include <string.h>
- #include <iostream>
- #include "freertos/FreeRTOS.h"
- #include "freertos/task.h"
- #include "esp_log.h"
- #include "esp_spiffs.h"
- #include "nvs_flash.h"
- using namespace std;
- #define TAG "TEST_APP"
- #define TASK1_STACKSIZE 256 * 1024
- StackType_t *task1_stack;
- StaticTask_t task1_tcb;
- #define TASK2_STACKSIZE 128 * 1024
- StackType_t *task2_stack;
- StaticTask_t task2_tcb;
- /****************************** HANDLERS************************************/
- void task1_task(void *ignore) {
- ESP_LOGI(TAG, "Starting task1_task - Free Ram :%d\n", esp_get_free_heap_size());
- while (true) {
- vPortYield();
- vTaskDelay(1000/portTICK_PERIOD_MS);
- }
- vTaskDelete(NULL);
- }
- void task2_task(void *ignore) {
- ESP_LOGI(TAG, "Starting task2_task - Free Ram :%d\n", esp_get_free_heap_size());
- while (true) {
- ofstream inFile ("/tt/testfile.txt", ios::out | ios::trunc);
- if (inFile.is_open())
- {
- inFile.write("Hello World", strlen("Hello World"));
- inFile.close();
- ESP_LOGI(TAG, "file written successfully.");
- }
- else ESP_LOGE(TAG, "file error.");
- vPortYield();
- vTaskDelay(10000/portTICK_PERIOD_MS);
- }
- vTaskDelete(NULL);
- }
- extern "C" void app_main() {
- nvs_flash_init();
- esp_vfs_spiffs_conf_t conf = {
- .base_path = "/tt",
- .partition_label = NULL,
- .max_files = 5,
- .format_if_mount_failed = true
- };
- esp_err_t err = esp_vfs_spiffs_register(&conf);
- if(err){
- ESP_LOGE(TAG, "Mounting SPIFFS failed! Error: %d", err);
- esp_restart();
- }
- task1_stack = (StackType_t *)malloc(TASK1_STACKSIZE);
- task2_stack = (StackType_t *)malloc(TASK2_STACKSIZE);
- xTaskCreateStatic(task1_task, "task1_task", TASK1_STACKSIZE, NULL, (tskIDLE_PRIORITY + 2), task1_stack, &task1_tcb);
- xTaskCreateStatic(task2_task, "task2_task", TASK2_STACKSIZE, NULL, (tskIDLE_PRIORITY + 2), task2_stack, &task2_tcb);
- printf("021-Free Ram Disp %d\n", esp_get_free_heap_size());
- printf("esp_get_idf_version : %s\n", esp_get_idf_version());
- }