Below you’ll detect all necessary information to flash a NodeMCU firmware binary to ESP8266 or ESP8285. Notation that this is a reference documentation and not a tutorial with fancy screen shots. Plow to the corresponding tool documentation for those.

Attention

Proceed in mind that the ESP8266 needs to exist
put into flash style
before you can flash a new firmware!

Important

When switching between NodeMCU versions, come across the notes nearly
Upgrading Firmware.

esptool.py

A Python-based, open source, platform independent, utility to communicate with the ROM bootloader in Espressif ESP8266.

Source:
https://github.com/espressif/esptool

Supported platforms: Bone X, Linux, Windows, anything that runs Python

Running esptool.py

Run the following command to flash an
aggregated
binary as is produced for example by the
cloud build service
or the
Docker image.

esptool.py --port <serial-port-of-ESP8266> write_flash -fm <flash-manner> 0x00000 <nodemcu-firmware>.bin


wink-mode

is
qio
for most ESP8266 ESP-01/07 (512 kByte modules) and
dio
for most ESP32 and ESP8266 ESP-12 (>=4 MByte modules). ESP8285 requires
dout.

Gotchas

  • See
    below
    if you don’t know or are uncertain about the chapters of the flash scrap on your device. It might help to double check as e.thousand. some ESP-01 modules come up with 512kB while others are equipped with 1MB.
  • esptool.py is nether heavy development. It’s brash yous run the latest version (check with
    esptool.py version). Since this documentation may non have been able to keep up refer to the
    esptool flash modes documentation
    for current options and parameters.
  • The firmware epitome file contains default settings
    dio
    for flash way and
    40m
    for flash frequency.
  • In some uncommon cases, the
    SDK init data
    may be invalid and NodeMCU may fail to boot. The easiest solution is to fully erase the chip before flashing:
    esptool.py --port <series-port-of-ESP8266> erase_flash

NodeMCU PyFlasher

Self-contained
NodeMCU
flasher with GUI based on
esptool.py
and
wxPython.

How to Flash Original Firmware on Esp8266 Esp 01

Source:
https://github.com/marcelstoer/nodemcu-pyflasher

Read:  Best Sm-g930p Best Unlock and Root Firmware

Supported platforms: annihilation that runs Python, runnable
.exe
available for Windows and
.dmg
for macOS

Disclaimer: the availability of
NodeMCU PyFlasher was appear on the NodeMCU Facebook page
but information technology is not an official offering of the current NodeMCU firmware squad.

Putting Device Into Flash Fashion

To enable ESP8266 firmware flashing GPIO0 pin must be pulled low before the device is reset. Conversely, for a normal boot, GPIO0 must exist pulled high or floating.

If you lot have a
NodeMCU dev kit
then you don’t demand to do annihilation, as the USB connection tin pull GPIO0 depression by asserting DTR and reset your board by asserting RTS.

If you take an ESP-01 or other device without built-in USB, you lot will need to enable flashing yourself by pulling GPIO0 low or pressing a “flash” switch, while powering up or resetting the module.

Which Files To Wink

If you build your firmware with the
cloud architect or the Docker image, or any other method that produces a
combined binary, then y’all can flash that file directly to address 0x00000.

Otherwise, if you congenital your own firmware from source lawmaking:

  • bin/0x00000.bin
    to 0x00000
  • bin/0x10000.bin
    to 0x10000

Upgrading Firmware

There are three potential issues that arise from upgrading (or downgrading!) firmware from i NodeMCU version to another:

  • Lua scripts written for i NodeMCU version (similar 0.nine.ten) may not work error-gratis on a more recent firmware. For example, Espressif inverse the
    socket:send
    performance to be asynchronous i.e. non-blocking. See
    API documentation
    for details.

  • The NodeMCU flash file system may need to be reformatted, particularly if its address has changed because the new firmware is dissimilar in size from the old firmware. If information technology is not automatically formatted so it should exist valid and have the same contents as earlier the flash operation. You tin still run

    file.format()

    manually to re-format your wink file organisation. You lot will know if you need to exercise this if your flash files exist merely seem empty, or if data cannot be written to new files. However, this should exist an exceptional case. Formatting a file system on a large flash device (e.m. the 16MB parts) tin take some fourth dimension. Then, on the kickoff kick, you shouldn’t get worried if zero appears to happen for a minute. At that place’s a message printed to console to make you aware of this.

  • The Espressif SDK Init Data may alter between each NodeMCU firmware version, and may need to exist erased or reflashed. See
    SDK Init Data
    for details. Fully erasing the module before upgrading firmware volition avoid this effect.

Read:  Mypassport Wireless Does Not Have Enough Space for Firmware

SDK Init Data

NodeMCU versions are compiled against specific versions of the Espressif SDK. The SDK reserves space in flash that is used to shop calibration and other data. Espressif refers to this area as “Organisation Param” and information technology occupies four 4 Kb sectors of flash. A fifth four Kb sector is also reserved for RF calibration. – With SDK version two.10 builds, these 5 sectors are located in the concluding pages at in the Flash memory. – With SDK version 3.ten builds, these 5 sectors are located in the otherwise unused pages at Flash start 0x0B000-0x0FFFF, between the
bin/0x00000.bin
segment at 0x00000 and the
bin/0x10000.bin
to 0x10000.

If this data gets corrupted or you are upgrading major SDK versions, then the firmware may not boot correctly. Symptoms include messages like
rf_cal[0] !=0x05,is 0xFF, or endless reboot loops and/or fast blinking module LEDs. If you are seeing one or several of the to a higher place symptoms, ensure that your fleck is fully erased earlier flashing, for case by using
esptool.py. The SDK version 3.x firmware builds discover if the RF calibration sector has been erased or corrupted, and will automatically initialise it with the correct content earlier restarting the processor. This works for all SDK supported wink sizes.

Determine flash size

The easiest fashion to determine the flash capacity is to load the firmware and and then
impress(node.info'hw'.flash_size)
which reports the wink size in Kb. Alternatively, if you want to determine the capacity of the flash fleck
earlier
a firmware is installed then you can run the following command. This volition return a 2 hex digit
Manufacturer
ID and a 4 digit
Device
ID and the detected flash size.

Read:  How to Update Magellan Maestro 4040 Firmware

esptool.py --port <serial-port> flash_id
The scrap ID can so be looked upwardly in
https://review.coreboot.org/plugins/gitiles/flashrom/+/refs/heads/master/flashchips.h.