espressif / esptool

Espressif SoC serial bootloader utility
https://docs.espressif.com/projects/esptool
GNU General Public License v2.0
5.61k stars 1.39k forks source link

Passing command line arguments out of order can lead to spurious/misleading errors (ESPTOOL-127) #146

Open forrestfiller opened 8 years ago

forrestfiller commented 8 years ago

I'm less of an advanced user, apologies if this is too basic of a question:

I've been struggling for the past day with flashing my esp, as I'm unsure what they mean by address? I have used 0x00000 as well as 0x0 before my .bin file. Have a look at the enclosed screenshot. Thanks for your time.

virtualbox_ubuntu16_24_11_2016_10_00_46

projectgus commented 8 years ago

This is a bad error message, so it's absolutely not your fault that it doesn't make sense. The esptool options have to passed in a certain order - a small number apply to "esptool" and some apply to the "write_flash" subcommand.

This is annoying, and I've been trying to think of a good way to fix it but at the moment esptool relies fairly heavily on python's built-in argument parsing support which is what does this.

You should find this argument order works (-b before write_flash, -p goes before write_flash also.)

esptool.py -b 74880 write_flash -fm dio -fs 4m -ff 80m 0x0 nodemcu-dev-13-modules-2016-11-24-01-56-58-integer.bin

(BTW, -fs 4m is only 4 megabits which is half a megabyte. If you have a huzzah you probably want -fs 32m for 32 megabits ie 4 megabytes. Or with esptool v1.2 or newer you can leave it blank and esptool will detect the actual flash size.)

Please let me know if this works for you. In any case, I'd like to keep this issue open as a reminder that the underly argument order problem needs to be taken care of (ideally, you should be able to put -b anywhere you like. Or, at minimum, the error message you should tell you what you did wrong.)

forrestfiller commented 8 years ago

@projectgus Thanks very much, I was able to flash the unit correctly thanks to your thoughtful and helpful reply.

The reason I elect to flash with the minimal -fs 4m in lieu of your above recommendation (-fs 32m) is that I am attempting to follow along with this LoRaWanGateway repository. The author recommends keeping the image as small as possible: "...The LoRaWanGateway needs quite some RAM and processing power, so it it necessary to flash firmware that uses as little resources as possible. "

I wanted to share a little bit more about some of the issues I struggled with during my final attempts to flash the ESP8266:

Thanks so much for all of ongoing your support which was invaluable.

Best regards,

Forrest

tablatronix commented 7 years ago

So annoying, i get bit by this everytime I use it.