ESP8266 NodeMCU Firmware

From ElectroDragon
Revision as of 13:01, 18 June 2020 by Chao (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Custom firmware

Online custom-build, or Docker Build

  • Could run from
  • Docker build
  • Install docker, git clone or download nodemcu firmware from github to your user directory for example c:\users\electrodragon\
git clone
  • run command to generate bin firmware file, in windows folder c:/user/hechao/nodemcu-firmware/ can not be changed, for example:
docker run --rm -it -v //c/Users/electrodragon/nodemcu-firmware:/opt/nodemcu-firmware marcelstoer/nodemcu-build
  • run either integer or float only INTEGER or FLOAT
docker run -e "INTEGER_ONLY=1" --rm -it -v //c/Users/electrodragon/nodemcu-firmware:/opt/nodemcu-firmware marcelstoer/nodemcu-build
docker run -e "FLOAT_ONLY=1" --rm -it -v //c/Users/hechao/nodemcu-firmware:/opt/nodemcu-firmware marcelstoer/nodemcu-build

Build Details

Enable/disable Modules - user_modules.h

Edit app/include/user_modules.h and comment-out the #define statement for modules you don't need. Example:

// #define LUA_USE_MODULES_U8G

board related configuration - user_config.h

Enable smart config: in file /app/include/user_config.h


version related properties - user_version.h

#define NODE_VERSION    "NodeMCU - custom build by"
#ifndef BUILD_DATE  
#define BUILD_DATE        "2016-09-23"

Flashing details

  • Need to flash nodemcu firmware and your code bin firmware now together into target device
  • calculate your nodemcu firmware size for the code bin firmware address first, for example:
  1. use the nodemcu firmware, size on disk as below:

Nodemcu size on disc.png

  1. so the bits size is: 408KB + 4KB =412 KB, 412 KB*1024 = 421888, change from dec to hex by using "calculator" you get 67000
  2. so for the two firmware, the upload address should be:
0x00000 for nodemcu firmware bin
and 0x67000 for your code firmware bin
  1. Finally use esp download tool, combine bin function to combine the two bin files

Spiffy combine.png

Custom Lua to Bin file by Using SPIFFY

  • The following methods has too many bugs, main file spiffs also obsoleted, better do not use
  • Reference: spiffimg and spiffy use spiffs as core file


  • in spiffy folder, create build and run make, a few files will be generated into build folder
  • create files folder, files to store lua file like init.lua print ("Hello")
  • run spiffy to build the rom, before this, you may need delete file "spiff_rom.bin" first, this is the generated bin file
  • Open file spiff_rom.bin by ultraedit can see the original codes
  • If the file large than 16K should edit main.c to change this:
4*4*1024 = 16K, can change to 8*4*1024 = 32K