MultiGeiger icon indicating copy to clipboard operation
MultiGeiger copied to clipboard

how to flash a firmware binary with esptool.py

Open ThomasWaldmann opened this issue 5 years ago • 4 comments

we have no docs about this, right? but we should have some, because normal users do not want to install the full arduino ide and compile from source / upload to the device via ide.

ThomasWaldmann avatar Feb 13 '20 23:02 ThomasWaldmann

First, erase the flash - usually something like:

esptool.py --port /dev/ttyUSB0 --baud 115200 --chip esp32 erase_flash

Then upload the binary (this commandline is intercepted from the arduino IDE shell call):

esptool.py --chip esp33 --port /dev/ttyUSB0 --baud 115200 \
  --before default_reset --after hard_reset \
  write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect \
  0xe000 .arduino15/packages/esp32/hardware/esp32/1.0.4/tools/partitions/boot_app0.bin \
  0x1000 .arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/bin/bootloader_qio_40m.bin \
  0x10000 multigeiger.ino.bin \
  0x8000 multigeiger.ino.partitions.bin

Is that also possible in a simpler way? Also, is that really esp33?

ThomasWaldmann avatar Feb 13 '20 23:02 ThomasWaldmann

Why do we need this? We have OTA !

Sure, it must be --chip esp32. And if you have an already programmed chip (as usual), you MUST NOT erase, you only have to flash the program. Then the line is shorter:

esptool --chip esp32 --port COM4 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x10000 multigeiger.ino.bin

rexfue avatar Feb 14 '20 11:02 rexfue

Well, we developers flash something all the time, but normal users may not have an OTA capable version yet on their device.

Also, guess it somehow needs to be partitioned for OTA once and after that I guess one must use OTA (not sure how one deals with the 2 flashable partitions via esptool).

ThomasWaldmann avatar Feb 14 '20 12:02 ThomasWaldmann

I suggest to also mention this solution on each release page where you can download the precompiled bin file for 0x1000 (maybe provide the other bins there, too) and also point to the esptool and the Flash Download Tool on this page.

M-a-r-i-a-n-n-e avatar Mar 21 '21 20:03 M-a-r-i-a-n-n-e