The NodeMCU is an open-source firmware and development environment based on the Lua script language for the ESP8266 wifi-enabled microcontroller. For easy development there is available the NodeMCU devkit board that map the contacts of the ESP8266 chip to easy to use pins and contains extra hardware, such as a serial port to USB adapter to flash new firmwares, update the scripts or simply communicate with a PC.
Generating a new firmware
The easiest way to generate a new firmware is to use the online service: NodeMCU Build In it, you only need to select the modules you want to be build into the firmware and then download the generated firmware binary file.
Flashing the firmware
Under the directory where the tool you will execute the command:
$ ./esptool.py --port PORT write_flash 0x00000 FIRMWARE.bin
where PORT is the serial port to where the hardware is connected (and you need to have read and write permissions for the user) and FIRMWARE.bin is the binary file of the firmware to flash. An example:
$ ./esptool.py --port /dev/ttyUSB0 write_flash 0x00000 ~/Downloads/nodemcu-master-14-modules-2015-12-23-21-28-43-float.bin
The process might take some minutes and it will show a similar message to this:
Connecting... Erasing flash... Writing at 0x0002cc00... (42 %)
If the process finish successfully this message will appear:
Wrote 431104 bytes at 0x00000000 in 42.0 seconds (82.1 kbit/s)... Leaving...