Page 1 of 1

Failed to calculate md5sum when flashing a big image

Posted: Thu Oct 06, 2016 2:50 pm
by ruilyn
Hello, I am developing on the ESP32 with ESP-IDF. When I flash a big image which is about 990KB, a fatal error is reported: Failed to calculate md5sum (result was 0x1, 0x0). If I decrease the image size, it will be OK to flash. Can anyone give me some advice to locate the root cause of this issue? Thanks very much.

LOGs
1) flash failed

Code: Select all

rlhao@rlhao-VirtualBox:~/work/iotjs/targets/esp32/app$ sudo python /home/rlhao/work/SDKS/esp32/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 write_flash --flash_mode qio --flash_freq 40m 0x1000 /home/rlhao/work/iotjs/targets/esp32/app/build/bootloader/bootloader.bin 0x10000 /home/rlhao/work/iotjs/targets/esp32/app/build/app-template.bin 0x4000 /home/rlhao/work/iotjs/targets/esp32/app/build/partitions_singleapp.bin
esptool.py v2.0-dev
Connecting...
Uploading stub...
Calling 4009068c
Stub running...
Changing baud rate to 921600
Changed.
Attaching SPI flash...
Configuring flash size...
Erasing flash...
Took 0.02s to erase flash block
Writing at 0x00001000... (100 %) 
Wrote 8192 bytes at 0x00001000 in 0.1 seconds (608.6 kbit/s)...
Hash of data verified.
Erasing flash...
Took 0.01s to erase flash block
Writing at 0x00100000... (100 %)
Wrote 991232 bytes at 0x00010000 in 14.4 seconds (549.6 kbit/s)...

A fatal error occurred: Failed to calculate md5sum (result was 0x1, 0x0)

2) flash successfully

Code: Select all

rlhao@rlhao-VirtualBox:~/work/iotjs/targets/esp32/app$ sudo python /home/rlhao/work/SDKS/esp32/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 write_flash --flash_mode qio --flash_freq 40m 0x1000 /home/rlhao/work/iotjs/targets/esp32/app/build/bootloader/bootloader.bin 0x10000 /home/rlhao/work/iotjs/targets/esp32/app/build/app-template.bin 0x4000 /home/rlhao/work/iotjs/targets/esp32/app/build/partitions_singleapp.bin
esptool.py v2.0-dev
Connecting...
Uploading stub...
Calling 4009068c
Stub running...
Changing baud rate to 921600
Changed.
Attaching SPI flash...
Configuring flash size...
Erasing flash...
Took 0.01s to erase flash block
Writing at 0x00001000... (100 %) check_command 
Wrote 8192 bytes at 0x00001000 in 0.1 seconds (609.6 kbit/s)...
Hash of data verified.
Erasing flash...
Took 0.01s to erase flash block
Writing at 0x000fe000... (100 %)
Wrote 983040 bytes at 0x00010000 in 14.4 seconds (546.2 kbit/s)...
Hash of data verified.
Erasing flash...
Took 0.02s to erase flash block
Writing at 0x00004000... (100 %) check_command 
Wrote 8192 bytes at 0x00004000 in 0.1 seconds (607.4 kbit/s)...
Hash of data verified.

Leaving...

Re: Failed to calculate md5sum when flashing a big image

Posted: Thu Oct 06, 2016 10:01 pm
by ESP_Angus
Hi ruilyn,

esp-idf doesn't currently generate "flash size" parameter for esptool.py and the default is 1MB. The app is flashed at a 64KB offset ( 0x10000), so its overflows the 1MB boundary and fails.

The error you're getting isn't the error I see on the most recent esp-idf, but the flashing fails in the current version as well.

If you append "--flash_size 4MB" after "--flash_mode dio" then flashing should succeed, as long as your device has enough physical flash.

A flash size parameter will be added to menuconfig in esp-idf soon, so this parameter will be automatically added to the esptool.py command line.

Angus

Re: Failed to calculate md5sum when flashing a big image

Posted: Sat Oct 08, 2016 7:18 am
by ruilyn
Hi Angus,

Thank you very much! It does work!