The installation procedure has changed with SDK 1.5 - I've spent a few hours before I got it right, so maybe this post will help you save time.
Here you will find all the required information, but depending on your chip manufacturer, you will need different combinations of some options, and this is exactly the part when it's getting tricky.
Since things are changing rapidly, I will point out exact versions in this tutorial so that it's clear what was working with what at the time of this writing.
Installing esptool
Download esptool v1.1 https://github.com/themadinventor/esptool/releases/tag/v1.1 and unzip it.
This will give you the possibility to execute esptool.py from the command line - we will use it below.
This will give you the possibility to execute esptool.py from the command line - we will use it below.
Determining the version of your ESP8266 chip
As usual, there are different versions, and probably you will have to modify flashing commands if you have a different one.sudo python esptool.py -p /dev/tty.wchusbserial1410 flash_id esptool.py v1.2-dev Connecting... Manufacturer: e0 Device: 4016
Well, it's obviously ESP-12E with 4MB flash:
How do you tell? I've no idea - just Google "Manufacturer: e0 Device: 4016" and check what people think.
Building custom firmware
Now we have to obtain firmware containing the Lua interpreter for our chip - it's everything you will need to upload Lua scripts over serial.
Basically, you will need two binary files:
There are two options to get those files:
Basically, you will need two binary files:
- custom firmware - something like: nodemcu-dev-7-modules-2016-08-10-10-43-59-integer.bin
- initial-data-block (esp_init_data_default.bin)
There are two options to get those files:
- you can download it from my github repo - this will give you SDK 1.5.4.1
- you can also use cloud service to build latest release. The link to latest initial-data-block can be found here - just search for esp_init_data_default.bin
Erase flash
Put your chip into flash mode as described here. If you have a development board, it should have two buttons: flash and reset. In such case, press flash, and without releasing it, press reset, after that, release flash.
Now you must determine and change the com port in all commands in this tutorial. In my case, it's /dev/tty.wchusbserial1410
Let's finally erase flash!
Now disconnect ESP from usb port, so that it can fully reset - pressing reset button does not have the same effect!
sudo python esptool.py -p /dev/tty.wchusbserial1410 erase_flash esptool.py v1.1 Connecting... Erasing flash (this may take a while)...
Now disconnect ESP from usb port, so that it can fully reset - pressing reset button does not have the same effect!
Flashing new firmware
Put your chip again into flash mode.
I am assuming that you have in your current directory two binary files: one with firmware (nodemcu-dev-7-modules-2016-08-10-10-43-59-integer.bin) and a second with init-stuff (esp_init_data_default.bin).
I am assuming that you have in your current directory two binary files: one with firmware (nodemcu-dev-7-modules-2016-08-10-10-43-59-integer.bin) and a second with init-stuff (esp_init_data_default.bin).
sudo python esptool.py -p /dev/tty.wchusbserial1410 write_flash -fm dio -fs 32m 0x000000 nodemcu-dev-7-modules-2016-08-10-10-43-59-integer.bin 0x3fc000 esp_init_data_default.bin
esptool.py v1.1 Connecting... Running Cesanta flasher stub... Flash params set to 0x0240 Writing 385024 @ 0x0... 385024 (100 %) Wrote 385024 bytes at 0x0 in 33.4 seconds (92.2 kbit/s)... Writing 4096 @ 0x3fc000... 4096 (100 %) Wrote 4096 bytes at 0x3fc000 in 0.4 seconds (80.0 kbit/s)... Leaving...