This page has been updated a long time ago. Information found here could be outdated and may lead to missconfiguration.
Some of the links and references may be broken or lead to non existing pages.
Please use this docs carefully. Most of the information here now is only for reference or example!
How To Compile Nodemcu Firmware¶
In this post I will assist you through some easy steps on how to build NodeMCU firmware on your own. To do this firstly I created a vanilla Debian 8 OpenVZ container.
If you don't want to bother to compile NodeMCU firmware on your own, you have another option: you can make it online. Here is the link.
Every time you install a new package you should start with updating your Linux system.
root@nodemcu:~# uname -a Linux nodemcu 2.6.32-39-pve #1 SMP Fri May 8 11:27:35 CEST 2015 x86_64 GNU/Linux root@nodemcu:~# cat /etc/issue Debian GNU/Linux 8 \n \l
1. Install the necessary packages¶
apt-get install git gcc make libtool-bin gperf bison flex build-essential texinfo automake libtool cvs autoconf libncurses5-dev help2man wget bzip2 python-dev python-serial python3-serial
You may need to install:
2. Clone packages from git¶
- First we have to create a new user, because
esp-open-sdkcan not be compiled with root user.
- Next create a working directory for nodemcu user:
- Give all permission:
- Change to nodemcu user
sudo su - nodemcu
- Clone the neccessary packages form Git.
This package is needed to compile the NodeMCU firmware. Esp-open-sdk contains some tools which may will be useful in the future, for example tools to flash you ESP8266 board.
- Change directory to /opt/nodemcu/esp-open-sdk
- Run make command
If the compilation is successfully finished you should get something like that:
make: Leaving directory '/opt/nodemcu/esp-open-sdk/esp-open-lwip' cp -a esp-open-lwip/include/arch esp-open-lwip/include/lwip esp-open-lwip/include/netif \ esp-open-lwip/include/lwipopts.h \ /opt/nodemcu/esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr/include/ Xtensa toolchain is built, to use it: export PATH=/opt/nodemcu/esp-open-sdk/xtensa-lx106-elf/bin:$PATH Espressif ESP8266 SDK is installed, its libraries and headers are merged with the toolchain
exportline. Each time you want to compile NodeMCU firmware you have to run this export.
4. Configure and Compile NodeMCU firmware¶
Before you run make command there are some configuration to do. Configuration files:
/opt/nodemcu/nodemcu-firmware/app/include/user_config.h /opt/nodemcu/nodemcu-firmware/app/include/user_modules.h /opt/nodemcu/nodemcu-firmware/app/include/user_version.h
In this file you can configure version related properties. Example:
Here you can configure that which modules will be included in the firmware.
- user_config.h In this file there are some board related configuration, for example: memory size.
If you can not connect to your ESP after flashing it try to modify this value in
#define BIT_RATE_DEFAULT BIT_RATE_115200
#define BIT_RATE_DEFAULT BIT_RATE_9600
And re-flash your ESP.
Now everything is ready to build our first NodeMCU firmware:
export PATH=/opt/nodemcu/esp-open-sdk/xtensa-lx106-elf/bin:$PATH cd /opt/nodemcu/nodemcu-firmware make
nodemcu@nodemcu:/opt/nodemcu/nodemcu-firmware/bin$ ls -al total 392 drwxr-xr-x 2 nodemcu nodemcu 4096 Sep 23 14:02 . drwxr-xr-x 15 nodemcu nodemcu 4096 Sep 23 13:58 .. -rw-r--r-- 1 nodemcu nodemcu 79 Sep 23 09:54 .gitignore -rw-r--r-- 1 nodemcu nodemcu 27808 Sep 23 14:02 0x00000.bin -rw-r--r-- 1 nodemcu nodemcu 354899 Sep 23 14:02 0x10000.bin