为什么 esp32 停止处理文件操作?

问题描述

我正在使用 SPIFFS 在 esp32 的本地存储上存储和删除文件。 在删除文件时,我正面临此异常。 作为新手,我很难理解问题出在哪里。 任何人都可以指导我解决这个问题吗?

代码片段

void deleteFile(fs::FS &fs,const char *path)
{

 delay(50);
 if (fs.remove(path))
 {
  Serial.println("file deleted: %s\r\n",path);
 }
 delay(100);

}

例外

    abort() was called at PC 0x40084fe5 on core 1
    Backtrace: 0x4008c46c:0x3ffb13a0 0x4008c69d:0x3ffb13c0 0x40084fe5:0x3ffb13e0 0x400850fb:0x3ffb1400 0x4000bde5:0x3ffb1420 0x40001ef0:0x3ffb1440 0x40114fbf:0x3ffb1460 0x40115061:0x3ffb1490 0x400e05fe:0x3ffb14b0 0x400e0643:0x3ffb14e0 0x40154662:0x3ffb1560 0x400d1680:0x3ffb1580 0x400d6c95:0x3ffb15a0 0x400d612a:0x3ffb15e0 0x400d63f2:0x3ffb16a0 0x400d6684:0x3ffb16d0 0x400d6c59:0x3ffb1710 0x400d612a:0x3ffb1750 0x400d63f2:0x3ffb1810 0x400d6684:0x3ffb1840 0x400d6c59:0x3ffb1880 0x400d612a:0x3ffb18c0 0x400d63f2:0x3ffb1980 0x400d6684:0x3ffb19b0 0x400d6a29:0x3ffb19f0 0x400d6b0e:0x3ffb1a60 0x40153f5e:0x3ffb1aa0 0x4015444a:0x3ffb1ac0 0x400db5b3:0x3ffb1af0 0x400daeb9:0x3ffb1b10 0x4015440d:0x3ffb1b40 0x400db0c2:0x3ffb1b60 0x400db14f:0x3ffb1b90 0x400db35d:0x3ffb1bc0 0x400db3e6:0x3ffb1c00 0x400db0c2:0x3ffb1c20 0x400db14f:0x3ffb1c50 0x400db1b1:0x3ffb1c80 0x400db2fa:0x3ffb1cc0 0x400db3e6:0x3ffb1d00 0x400db0c2:0x3ffb1d⸮

ESP 异常解码器

          Decoding stack results
          0x4008c46c: invoke_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c line 155
          0x4008c69d: abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c line 170
          0x40084fe5: lock_init_generic at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/newlib/locks.c line 81
          0x400850fb: _lock_init_recursive at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/newlib/locks.c line 95
          0x40114fbf: _fopen_r at ../../../.././newlib/libc/stdio/fopen.c line 138
          0x40115061: fopen at ../../../.././newlib/libc/stdio/fopen.c line 181
          0x400e05fe: VFSFileImpl::VFSFileImpl(VFSImpl*,char const*,char const*) at C:\Users\Admin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\FS\src\vfs_api.cpp line 263
          0x400e0643: VFSImpl::remove(char const*) at C:\Users\Admin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\FS\src\vfs_api.cpp line 130
          0x40154662: fs::FS::remove(char const*) at C:\Users\Admin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\FS\src\FS.cpp line 212
          0x400d1680: deleteFile(fs::FS&,char const*) at D:\sketches\MyDevice/MyFirmware.ino line 1643
          0x400d6c95: executeFile(String,String) at D:\sketches\MyDevice/MyFirmware.ino line 1761
          0x400d612a: executePending() at D:\sketches\MyDevice/MyFirmware.ino line 1700
          0x400d63f2: processQueues() at D:\sketches\MyDevice/MyFirmware.ino line 1922
          0x400d6684: allocateQue(int) at D:\sketches\MyDevice/MyFirmware.ino line 726
          0x400d6c59: executeFile(String,String) at D:\sketches\MyDevice/MyFirmware.ino line 1749
          0x400d612a: executePending() at D:\sketches\MyDevice/MyFirmware.ino line 1700
          0x400d63f2: processQueues() at D:\sketches\MyDevice/MyFirmware.ino line 1922
          0x400d6684: allocateQue(int) at D:\sketches\MyDevice/MyFirmware.ino line 726
          0x400d6c59: executeFile(String,String) at D:\sketches\MyDevice/MyFirmware.ino line 1749
          0x400d612a: executePending() at D:\sketches\MyDevice/MyFirmware.ino line 1700
          0x400d63f2: processQueues() at D:\sketches\MyDevice/MyFirmware.ino line 1922
          0x400d6684: allocateQue(int) at D:\sketches\MyDevice/MyFirmware.ino line 726
          0x400d6a29: readTXT(unsigned char,unsigned char*) at D:\sketches\MyDevice/MyFirmware.ino line 370
          0x400d6b0e: webSocketEvent(unsigned char,WStype_t,unsigned char*,unsigned int) at D:\sketches\MyDevice/MyFirmware.ino line 22
          0x40153f5e: std::_Function_handler ::_M_invoke(std::_Any_data const&,unsigned char&&,WStype_t&&,unsigned char*&&,unsigned int&&) at c:\users\Admin\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0\xtensa-esp32-elf\include\c++\5.2.0/functional line 1871
          0x4015444a: WebSocketsServer::runcbEvent(unsigned char,unsigned int) at c:\users\Admin\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0\xtensa-esp32-elf\include\c++\5.2.0/functional line 2271
          0x400db5b3: WebSocketsServer::messageReceived(WSclient_t*,WSopcode_t,unsigned int,bool) at D:\sketches\libraries\WebSockets\src\WebSocketsServer.cpp line 525
          0x400daeb9: WebSockets::handleWebsocketPayloadCb(WSclient_t*,bool,unsigned char*) at D:\sketches\libraries\WebSockets\src\WebSockets.cpp line 483
          0x4015440d: std::_Function_handler    (WebSockets*,std::_Placeholder1>,std::_Placeholder2>,unsigned char*)> >::_M_invoke(std::_Any_data const&,WSclient_t*&&,bool&&) at c:\users\Admin\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0\xtensa-esp32-elf\include\c++\5.2.0/functional line 600
          0x400db0c2: std::function ::operator()(WSclient_t*,bool) const at c:\users\Admin\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0\xtensa-esp32-elf\include\c++\5.2.0/functional line 2271
          0x400db14f: WebSockets::readCb(WSclient_t*,std::function ) at D:\sketches\libraries\WebSockets\src\WebSockets.cpp line 646
          0x400db35d: WebSockets::handleWebsocketCb(WSclient_t*) at D:\sketches\libraries\WebSockets\src\WebSockets.cpp line 451
          0x400db3e6: std::_Function_handler   (WebSockets*,std::_Placeholder2>)> >::_M_invoke(const std::_Any_data &,) at D:\sketches\libraries\WebSockets\src\WebSockets.cpp line 360
          0x400db0c2: std::function ::operator()(WSclient_t*,std::function ) at D:\sketches\libraries\WebSockets\src\WebSockets.cpp line 646
          0x400db1b1: WebSockets::handleWebsocketWaitFor(WSclient_t*,unsigned int) at D:\sketches\libraries\WebSockets\src\WebSockets.cpp line 368
          0x400db2fa: WebSockets::handleWebsocketCb(WSclient_t*) at D:\sketches\libraries\WebSockets\src\WebSockets.cpp line 435
          0x400db3e6: std::_Function_handler   (WebSockets*,bool) const at c:\users\Admin\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0\xtensa-esp32-elf\include\c++\5.2.0/functional line 2271

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)