How to use SPIFFS
Posted: Sun Apr 05, 2020 3:14 pm
Hi All.
It is a couple of weeks I'm playing with ESP32 DevKit V1.
Now I'm stduding how to save file on SPIFFS partition.
I can create the partition and save simple file using the example.
Now I want to create an advanced sketch where i have to save several structures on this kind of file.
I know i can use FILE* from stdio librarie, my question is : Can i use fstream library to write and read data?
I have written a class but when i load it on the ESP32 it goes in "Guru meditation"
I know that the class and the code are good because i have tried it on CodeBlocks but it is pure C++ compiler.
My first answer is I can't use fstream library to write and read data.
Could Someone help me understand what is appening?
Thankyou in advance.
It is a couple of weeks I'm playing with ESP32 DevKit V1.
Now I'm stduding how to save file on SPIFFS partition.
I can create the partition and save simple file using the example.
Now I want to create an advanced sketch where i have to save several structures on this kind of file.
I know i can use FILE* from stdio librarie, my question is : Can i use fstream library to write and read data?
I have written a class but when i load it on the ESP32 it goes in "Guru meditation"
Code: Select all
I (0) cpu_start: Starting scheduler on APP CPU.
Guru Meditation Error: Core 0 panic'ed (Unhandled debug exception)
Debug exception reason: BREAK instr
Core 0 register dump:
PC : 0x3ffb81e0 PS : 0x00060220 A0 : 0x0a6d305b A1 : 0x80058bc2
A2 : 0x3ffb5640 A3 : 0x3ffb6778 A4 : 0x3ffae920 A5 : 0x3ffb8228
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x00000000 A9 : 0x800fe3de
A10 : 0x3ffb5660 A11 : 0x3ffb6778 A12 : 0x3f402a04 A13 : 0x0000001a
A14 : 0x00000080 A15 : 0x0000001a SAR : 0x00000001 EXCCAUSE: 0x00000001
EXCVADDR: 0x0a6d303b LBEG : 0x3ffb6778 LEND : 0x3ffae920 LCOUNT : 0xfffffffd
ELF file SHA256: 6151d98a471f83575f4f2f8fdcd38cd7fa9000faa02e486e9ceb0468da88ca51
Backtrace: 0x3ffb81dd:0x80058bc2 |<-CORRUPTED
Rebooting...
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x13 (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:2
load:0x3fff0018,len:4
load:0x3fff001c,len:6864
ho 0 tail 12 room 4
load:0x40078000,len:14076
load:0x40080400,len:4304
entry 0x400806e8
I (75) boot: Chip Revision: 1
I (75) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (41) boot: ESP-IDF v4.0-dirty 2nd stage bootloader
I (41) boot: compile time 16:47:40
I (41) boot: Enabling RNG early entropy source...
I (46) boot: SPI Speed : 40MHz
I (51) boot: SPI Mode : DIO
I (55) boot: SPI Flash Size : 4MB
I (59) boot: Partition Table:
I (62) boot: ## Label Usage Type ST Offset Length
I (70) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (77) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (84) boot: 2 factory factory app 00 00 00010000 00100000
I (92) boot: 3 storage Unknown data 01 82 00110000 000f0000
I (99) boot: End of partition table
I (104) boot_comm: chip revision: 1, min. application chip revision: 0
I (111) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x174e8 ( 95464) map
I (154) esp_image: segment 1: paddr=0x00027510 vaddr=0x3ffb0000 size=0x0218c ( 8588) load
I (158) esp_image: segment 2: paddr=0x000296a4 vaddr=0x40080000 size=0x00400 ( 1024) load
0x40080000: _WindowOverflow4 at C:/Users/Admin/esp-idf/components/freertos/xtensa_vectors.S:1778
I (161) esp_image: segment 3: paddr=0x00029aac vaddr=0x40080400 size=0x06564 ( 25956) load
I (181) esp_image: segment 4: paddr=0x00030018 vaddr=0x400d0018 size=0x423dc (271324) map
0x400d0018: _stext at ??:?
I (278) esp_image: segment 5: paddr=0x000723fc vaddr=0x40086964 size=0x036c8 ( 14024) load
0x40086964: rtc_init at C:/Users/Admin/esp-idf/components/soc/esp32/rtc_init.c:70
I (290) boot: Loaded app from partition at offset 0x10000
I (291) boot: Disabling RNG early entropy source...
I (291) cpu_start: Pro cpu up.
I (295) cpu_start: Application information:
I (299) cpu_start: Project name: template-app
I (305) cpu_start: App version: 1
I (309) cpu_start: Compile time: Apr 5 2020 16:47:28
I (315) cpu_start: ELF file SHA256: 6151d98a471f8357...
I (321) cpu_start: ESP-IDF: v4.0-dirty
I (327) cpu_start: Starting app cpu, entry point is 0x400811c8
0x400811c8: call_start_cpu1 at C:/Users/Admin/esp-idf/components/esp32/cpu_start.c:272
I (313) cpu_start: App cpu up.
I (337) heap_init: Initializing. RAM available for dynamic allocation:
I (344) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (350) heap_init: At 3FFB47E8 len 0002B818 (174 KiB): DRAM
I (356) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (363) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (369) heap_init: At 4008A02C len 00015FD4 (87 KiB): IRAM
I (375) cpu_start: Pro cpu start user code
I (397) spi_flash: detected chip: generic
I (397) spi_flash: flash io: dio
I (397) cpu_start: Starting scheduler on PRO CPU.
My first answer is I can't use fstream library to write and read data.
Could Someone help me understand what is appening?
Thankyou in advance.