WebUpdate how to create firmware image file?

warwound
Posts: 5
Joined: Fri Aug 23, 2019 9:06 am

WebUpdate how to create firmware image file?

Postby warwound » Wed Oct 02, 2024 11:13 am

I have flashed the WebUpdate example to my WT32-ETH01.
But am confused - how do I create the firmware image file that I will upload?

In Arduino IDE I tried Sketch menu > Export Compiled Binary.
In my sketch folder I see:
/build/esp32.esp32.wt32-eth01/
which contains files:
ConnectBox2.ino.bin
ConnectBox2.ino.bootloader.bin
ConnectBox2.ino.elf
ConnectBox2.ino.map
ConnectBox2.ino.merged.bin
ConnectBox2.ino.partitions.bin

I tried uploading the file ConnectBox2.ino.bin but my wt32 crashed:
abort() was called at PC 0x40081c99 on core 1

Backtrace: 0x40082a15:0x3ffceb10 0x4008e2e5:0x3ffceb30 0x4009362d:0x3ffceb50 0x40081c99:0x3ffcebd0 0x400eb5cb:0x3ffcec20 0x400e2d15:0x3ffcec40 0x400e2b24:0x3ffcec60 0x400e2c9c:0x3ffcec80 0x400d3e45:0x3ffcecb0 0x400e0455:0x3ffcecf0 0x40185512:0x3ffced50 0x400dd5cd:0x3ffced80 0x400de14d:0x3ffcee00 0x400de2f1:0x3ffcee50 0x400d95ad:0x3ffcee70 0x400d9625:0x3ffceea0 0x400d9e2a:0x3ffceec0 0x40090a6e:0x3ffceef0

Decoding stack results
0x40082a15: panic_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/panic.c:466
0x4008e2e5: esp_system_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/port/esp_system_chip.c:84
0x4009362d: abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/newlib/abort.c:38
0x40081c99: esp_flash_erase_region at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/spi_flash/esp_flash_api.c:595
0x400eb5cb: esp_partition_erase_range at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_partition/partition_target.c:134
0x400e2d15: is in EspClass::partitionEraseRange(esp_partition_t const*, unsigned long, unsigned int) (/home/martin/.arduino15/packages/esp32/hardware/esp32/3.0.5/cores/esp32/Esp.cpp:487).
0x400e2b24: UpdateClass::_writeBuffer() at /home/martin/.arduino15/packages/esp32/hardware/esp32/3.0.5/libraries/Update/src/Updater.cpp:390
0x400e2c9c: is in UpdateClass::write(unsigned char*, unsigned int) (/home/martin/.arduino15/packages/esp32/hardware/esp32/3.0.5/libraries/Update/src/Updater.cpp:503).
0x400d3e45: is in std::_Function_handler<void(AsyncWebServerRequest*, const String&, unsigned int, unsigned char*, unsigned int, bool), http_server_init()::<lambda(AsyncWebServerRequest*, String, size_t, uint8_t*, size_t, bool)> >::_M_invoke(const std::_Any_data &, AsyncWebServerRequest *&&, const String &, unsigned int &&, unsigned char *&&, unsigned int &&, bool &&) (/home/martin/Documents/Programming/arduino/sketchbook/imagineear/ConnectBox2/http_server.cpp:94).
0x400e0455: is in AsyncCallbackWebHandler::handleUpload(AsyncWebServerRequest*, String const&, unsigned int, unsigned char*, unsigned int, bool) (/home/martin/.arduino15/packages/esp32/tools/esp-x32/2302/xtensa-esp32-elf/include/c++/12.2.0/bits/std_function.h:587).
0x40185512: is in AsyncWebServerRequest::_handleUploadByte(unsigned char, bool) (/home/martin/Documents/Programming/arduino/sketchbook/libraries/ESP_Async_WebServer/src/WebRequest.cpp:367).
0x400dd5cd: is in AsyncWebServerRequest::_parseMultipartPostByte(unsigned char, bool) (/home/martin/Documents/Programming/arduino/sketchbook/libraries/ESP_Async_WebServer/src/WebRequest.cpp:406).
0x400de14d: is in AsyncWebServerRequest::_onData(void*, unsigned int) (/home/martin/Documents/Programming/arduino/sketchbook/libraries/ESP_Async_WebServer/src/WebRequest.cpp:109).
0x400de2f1: is in std::_Function_handler<void(void*, AsyncClient*, void*, unsigned int), AsyncWebServerRequest::AsyncWebServerRequest(AsyncWebServer*, AsyncClient*)::<lambda(void*, AsyncClient*, void*, size_t)> >::_M_invoke(const std::_Any_data &, void *&&, AsyncClient *&&, void *&&, unsigned int &&) (/home/martin/Documents/Programming/arduino/sketchbook/libraries/ESP_Async_WebServer/src/WebRequest.cpp:43).
0x400d95ad: is in AsyncClient::_recv(tcp_pcb*, pbuf*, signed char) (/home/martin/.arduino15/packages/esp32/tools/esp-x32/2302/xtensa-esp32-elf/include/c++/12.2.0/bits/std_function.h:591).
0x400d9625: is in AsyncClient::_s_recv(void*, tcp_pcb*, pbuf*, signed char) (/home/martin/Documents/Programming/arduino/sketchbook/libraries/AsyncTCP/src/AsyncTCP.cpp:1210).
0x400d9e2a: _async_service_task(void*) at /home/martin/Documents/Programming/arduino/sketchbook/libraries/AsyncTCP/src/AsyncTCP.cpp:162
0x40090a6e: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162
I don't understand any of the decoded exception.

Can anyone tell me how to create the required firmware image file?

lbernstone
Posts: 828
Joined: Mon Jul 22, 2019 3:20 pm

Re: WebUpdate how to create firmware image file?

Postby lbernstone » Wed Oct 02, 2024 3:36 pm

It looks to me like it is having trouble erasing the flash to lay down the new firmware. This can be due to a hardware error on the flash, but more likely there is a mismatch between the partitioning originally laid down on the hardware and what you are trying to upload. Make sure you use the exact same board options (especially partition scheme) when you build your new firmware.
I may be a bit biased, but I think the OTAWebUpdater example does a better job, particularly that it checks that the firmware uploaded will fit in the OTA partition size.

warwound
Posts: 5
Joined: Fri Aug 23, 2019 9:06 am

Re: WebUpdate how to create firmware image file?

Postby warwound » Fri Oct 04, 2024 10:24 am

lbernstone wrote:
Wed Oct 02, 2024 3:36 pm
I may be a bit biased, but I think the OTAWebUpdater example does a better job, particularly that it checks that the firmware uploaded will fit in the OTA partition size.
I have now modified the OTAWebUpdater to work in my sketch but it it fails much like the WebUpdate.
I suspect I'm not uploading the correct firmware image - the original topic of this post.
In Arduino IDE I tried Sketch menu > Export Compiled Binary.
In my sketch folder I see 3 binary files:
/build/esp32.esp32.wt32-eth01/
which contains files:
ConnectBox2.ino.bin, 1.1MB
ConnectBox2.ino.bootloader.bin, 24KB
ConnectBox2.ino.partitions.bin, 3KB
My partition scheme is:
Minimal (1.3MB APP / 700KB SPIFFS)

When I compile my sketch the output states:
Sketch uses 1115949 bytes (13%) of program storage space. Maximum is 8388608 bytes.
So I've assumed the 1.1MB file ConnectBox2.ino.bin is the corretc firmware image.

Any ideas?

lbernstone
Posts: 828
Joined: Mon Jul 22, 2019 3:20 pm

Re: WebUpdate how to create firmware image file?

Postby lbernstone » Fri Oct 04, 2024 4:43 pm

Do a simple test. Build the example and upload it. Change some of the text in the html page so you can see the diff. Then compile and see if you are able to upload OTA and see the change take effect.
Assuming that works, then flash your code and see if you can OTA that same bin file that just worked. I haven't tested AsyncWebServer in a while, but I don't see any issues noted on my example

Who is online

Users browsing this forum: No registered users and 107 guests