espressif / arduino-esp32

Arduino core for the ESP32
GNU Lesser General Public License v2.1
13.55k stars 7.39k forks source link

firmware update with SPIFFS causing abort() #3126

Closed ChristosPalisidis closed 4 years ago

ChristosPalisidis commented 5 years ago

Hello everyone, I follow the example below to update the firmware to my ESP32-WROVER-B: https://techtutorialsx.com/2019/07/21/esp32-arduino-updating-firmware-from-the-spiffs-file-system/

Although, in my case, when the writeStream(file) executes, i get: abort() was called at PC 0x40169b75 on core 1

Decoding the Backtrace i get:

0x40095368: invoke_abort at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/esp32/panic.c line 707 0x40095599: abort at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/esp32/panic.c line 707 0x40169b75: is_safe_write_address at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/spi_flash/flash_ops.c line 118 0x40082fc7: spi_flash_erase_sector at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/spi_flash/flash_ops.c line 196 0x400e7475: EspClass::flashEraseSector(unsigned int) at C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.2\cores\esp32/Esp.cpp line 210 0x400e6fe8: UpdateClass::_writeBuffer() at C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.2\libraries\Update\src/Updater.cpp line 250 0x400e73d4: UpdateClass::writeStream(Stream&) at C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.2\libraries\Update\src/Updater.cpp line 352 (discriminator 3) 0x400d8336: OTA_update(ArduinoJson6114_000001::VariantRef const&) at C:\Users\user\Documents\Arduino\ESP32_BOTH_WEB_AND_THINGS_OTA/ESP32_BOTH_WEB_AND_THINGS_OTA.ino line 2377 0x400d809e: ThingsBoardSized64u, 8u, ThingsBoardDefaultLogger>::process_message(char*, unsigned char*, unsigned int) at C:\Users\user\Documents\Arduino\libraries\ThingsBoard-Arduino-MQTT-SDK-master\src/ThingsBoard.h line 316 0x400d824f: ThingsBoardSized64u, 8u, ThingsBoardDefaultLogger>::on_message(char*, unsigned char*, unsigned int) at C:\Users\user\Documents\Arduino\libraries\ThingsBoard-Arduino-MQTT-SDK-master\src/ThingsBoard.h line 387 0x402036e7: std::_Function_handler ::_M_invoke(std::_Any_data const&, char*&&, unsigned char*&&, unsigned int&&) at c:\users\user\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 0x400db3d1: std::function ::operator()(char*, unsigned char*, unsigned int) const at c:\users\user\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 1974 : (inlined by) PubSubClient::loop() at C:\Users\user\Documents\Arduino\libraries\PubSubClient-2.7.0\src/PubSubClient.cpp line 348 0x400d5af9: ThingsBoardSized64u, 8u, ThingsBoardDefaultLogger>::loop() at C:\Users\user\Documents\Arduino\libraries\ThingsBoard-Arduino-MQTT-SDK-master\src/ThingsBoard.h line 157 : (inlined by) loop() at C:\Users\user\Documents\Arduino\ESP32_BOTH_WEB_AND_THINGS_OTA/ESP32_BOTH_WEB_AND_THINGS_OTA.ino line 2500 0x400e9d91: loopTask(void*) at C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.2\cores\esp32/main.cpp line 19 0x40091289: vPortTaskWrapper at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/freertos/port.c line 355 (discriminator 1) Any ideas?

lbernstone commented 5 years ago

It appears to be calling abort from is_safe_write_address. That makes me think it is not a safe write address :smile:. Make sure your partitioning includes OTA partitions large enough to hold the firmware to be uploaded. While you test, strip out all the extra code you have added and just use the sketch as shown in that tutorial. You often need to shut down additional running services in order to update, as they can hold open files or otherwise impede the system to the extent that Update fails.

stale[bot] commented 5 years ago

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.