In this quick reference I’ll show you how to build the NodeMCU firmware from source and flash it on your ESP8266. In this case I used the ESP8266-01.
You can use these exact same steps to flash any version of ESP8266 but the way you will connect it to your FTDI will differ. A simple Google images search will help you to find the connection schema for your ESP8266 version.
- Clone the NodeMCU project
git clone https://github.com/nodemcu/nodemcu-firmware.git. Or download it manually from GitHub if you’re not a command line lover.
- Open the
- To enable and/or disable modules and settings in the firmware you can open
/app/includes/user_modules.hand comment/uncomment what you need
- Run following Docker command
sudo docker run --rm -ti -v `pwd`:/opt/nodemcu-firmware marcelstoer/nodemcu-build. I need to run this as super user otherwise I get an error about the docker daemon not running.
- Wait for the command to finish and you’ll find your custom build firmware in the
- Install esptool using
pip install esptoolwhich we will use to flash the ESP8266
- Connect your ESP8266 to your FTDI using the diagram above. Do make sure your FTDI is 3.3v. If you use a 5v one you’ll toast your ESP. Trust me I’ve done this before. You can use a 5v FTDI but you’ll have to use a separate 3.3v power supply to power your ESP8266.
- Flash your ESP8266 using following command
esptool.py --port <USB-kport-with-ESP8266> write_flash 0x00000 <NodeMCU-firmware-directory>/bin/nodemcu_[integer|float]_<Git-branch>.bin
- You can use a tool like ESPlorer to see if your flashed ESP8266 is working.