However I am having issues writing and closing a settings.ini file on the /spiflash 'storage' partition. It mounts OK (using the SPI flash wear levelling API) and I can open and read the settings.ini file OK. But I'm getting errors either writing (fprintf) or closing (fclose) the file. Sometimes the app just restarts with no useful debug and other times it reports the following.
I've compiled and built the simple wear_levelling example from the ESP-IDF and run it on our target hardware and that works OK. If I use the code from the app_main() in the wear_levelling example to read and write the hello.txt file in our app it also fails. Mounting is done at app start up which succeeds.Saving "language": 0
Saving "isDialLeft": true
Saving "isTemperatureCelsius": false
Saving "isNightMode": true
Saving "NightModeBrightness": 75
Saving "DayModeBrightness": 19
Guru Meditation Error: Core 1 panic'ed (Cache disabled but cached memory region accessed).
Core 1 register dump:
PC : 0x401dcd04 PS : 0x00060034 A0 : 0x80083bd5 A1 : 0x3ffb1150
A2 : 0x00000000 A3 : 0x00000000 A4 : 0x3ffb1680 A5 : 0x3ffc9310
A6 : 0x00000026 A7 : 0x3ffb5928 A8 : 0x80083b08 A9 : 0x00000000
A10 : 0x3ffb1680 A11 : 0x00000000 A12 : 0x00000000 A13 : 0x00000800
A14 : 0x00000000 A15 : 0x1300004c SAR : 0x00000018 EXCCAUSE: 0x00000007
EXCVADDR: 0x00000000 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0x00000000
Backtrace:0x401dcd01:0x3ffb11500x40083bd2:0x3ffb1180 0x40083069:0x3ffb11b0 0x4008c7e8:0x3ffc92e0 0x4008c586:0x3ffc9300 0x40092a99:0x3ffc9330 0x40085a87:0x3ffc93b0 0x401831fd:0x3ffc93f0 0x4016fa92:0x3ffc9420 0x40171267:0x3ffc9440 0x4016fbab:0x3ffc9480 0x40171503:0x3ffc94d0 0x4016f90f:0x3ffc9510 0x4016c157:0x3ffc9530 0x4016c035:0x3ffc9550 0x4016c49e:0x3ffc9570 0x4016c4e4:0x3ffc9590 0x4016ca29:0x3ffc95b0 0x4016cc28:0x3ffc95d0 0x4016d659:0x3ffc95f0 0x4016f3bf:0x3ffc9630 0x400d4581:0x3ffc9660 0x4000bd83:0x3ffc9680 0x4000117d:0x3ffc96a0 0x400592fe:0x3ffc96c0 0x4005937a:0x3ffc96e0 0x40058ad3:0x3ffc9700 0x401d4b8f:0x3ffc9730 0x401cc006:0x3ffc9750 0x401c0d19:0x3ffc9a60 0x4010dccd:0x3ffc9ab0 0x4010df65:0x3ffc9ce0 0x400f9cf9:0x3ffc9d10 0x401da955:0x3ffc9d40 0x401b59d9:0x3ffc9d60 0x400d27c4:0x3ffc9d80 0x4008b7f9:0x3ffc9da0
ELF file SHA256: 92dd71dce0d5f2e2
Rebooting...
So it feels like I have some kind of configuration issue in our project with regard to the SPI Flash FAT API, given the simple wear_levelling example works on the same hardware.
I've tried using the same partitions_example.csv in my project (I did have to increase the factory partition because the app was too big) but that fails too.
Any suggestions would be much appreciated.