Build Firmware

Build ESP32 Firmware

    • Source :

    • STEPS :

      • Linux Build Environment

        • NodeMCU firmware developers commit or contribute to the project on GitHub and might want to build their own full fledged build environment with the complete tool chain.

        • Run the following command for a new checkout from scratch. This will fetch the nodemcu repo, checkout the dev-esp32 branch and finally pull all submodules:

          • git clone --branch dev-esp32 --recurse-submodules https://github.com/nodemcu/nodemcu-firmware.git nodemcu-firmware-esp32-dir-name

        • The make command initiates the build process, which will start with the configuration menu to set the build options.

          • Important

          • GNU make version 4.0 or higher is required for a successful build. Versions 3.8.2 and below will produce an incomplete firmware image.

        • Updating your clone from upstream needs an additional command to update the submodules as well:

          • git pull origin dev-esp32 git submodule init #only if repo was cloned w/o submodules init git submodule update --recursive

        • ** "make" will flash the ESP32 Device after build, So you can confirm the serial port on menuconfig (make menuconfig)

      • Attached MakeBoot.txt Log file for reference

      • Using your favorite editor (Sublime Text 3 with Vim key bindings thankyouverymuch), open ../nodemcu-firmware/app/include/user_modules.h

      • $ make

      • or $ make flash

Where is Firmware after make :

********* Flash after Build on Lnux

esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect

0x1000 nodemcu-firmware-esp32/build/bootloader/bootloader.bin

0x10000 nodemcu-firmware-esp32-2/build/NodeMCU.bin

0x8000 nodemcu-firmware-esp32-2/build/partitions_singleapp.bin

********* Flash by Windows esptools.py

SET /P _inputname= COM CODE :

echo .

esptool.py --port "%_inputname%" write_flash 0x1000 bootloader.bin 0x10000 NodeMCU.bin 0x8000 partitions_singleapp.bin

****************************************************************************************************************************************

Easy steps on Linux:

  • Config Default :

    • Fedora Image on VirtualBox on Windows 10

    • installed git, apt-get and pip ready

  • mkdir LinuxBuild

  • cd linuxBuild

  • $ git clone --branch dev-esp32 --recurse-submodules https://github.com/nodemcu/nodemcu-firmware.git nodemcu-firmware-esp32-dir-name

  • cd nodemcu-firmware-esp32-dir-name

  • make

  • When Go into menuconfig (Menu), Just Select Exit and let it go !

  • ** When some package missing, then install and make again **

    • sudo yum install ncurses-devel ncurses

    • sudo yum install flex

    • sudo yum install bison

    • sudo yum install gperf

    • python -m pip install --user -r nodemcu-firmware-esp32-dir-name/sdk/esp32-esp-idf/requirements.txt

  • 0x1000 nodemcu-firmware-esp32-dir-name/build/bootloader/bootloader.bin

  • 0x10000 nodemcu-firmware-esp32-dir-name/build/NodeMCU.bin

  • 0x8000 nodemcu-firmware-esp32-dir-name/build/partitions_singleapp.bin

  • Flash by esptool.py or Config by "make menuconfig" flash after make

    • Install Python new Version after that "$ pip install esptool"

    • e.g. esptool.py --port "%_inputname%" write_flash 0x1000 %_foldername%\bootloader.bin 0x10000 %_foldername%\NodeMCU.bin 0x8000 %_foldername%\partitions_singleapp.bin

    • e.g. esptool.py

      • --port COM3 write_flash

      • 0x1000 nodemcu-firmware-esp32-dir-name\bootloader\bootloader.bin

      • 0x10000 nodemcu-firmware-esp32-dir-name\NodeMCU.bin

      • 0x8000 nodemcu-firmware-esp32-dir-name\partitions_singleapp.bin

****************************************************************************************************************************************

Updating your clone from upstream needs an additional command to update the submodules as well:

git pull origin dev-esp32 git submodule init #only if repo was cloned w/o submodules init git submodule update --recursive

****************************************************************************************************************************************

Ready before "make"

Package Version

-------------- ----------

asn1crypto 0.24.0

beautifulsoup4 4.6.3

certifi 2018.11.29

cffi 1.11.5

chardet 3.0.4

colorama 0.4.1

cryptography 2.4.2

dnspython 1.16.0

ecdsa 0.13

enum34 1.1.6

esptool 2.5.1

future 0.17.1

futures 3.2.0

idna 2.8

ipaddress 1.0.22

pip 18.1

pyaes 1.6.1

pycparser 2.19

pyserial 3.4

requests 2.21.0

setuptools 40.4.3

six 1.12.0

termcolor 1.1.0

urllib3 1.24.1

$ sudo apt-get install libncurses5-dev

$ sudo apt-get install python-future

$ sudo yum install ncurses-devel ncurses

$ sudo yum install flex

$ sudo yum install bison

$ sudo yum install gperf

$ sudo yum install serial.tools.list_ports

$ sudo pip install pyserial

sudo pip install pyserial --upgrade

sudo pip install esptool

sudo apt-get install python-future

sudo pip install --index-url=https://pypi.python.org/simple/ -r requirements.txt

$ pip install --upgrade --force-reinstall dnspython requests termcolor colorama future beautifulsoup4 futures

OPTIONS : WIndows INstall subSystem on Linux

How to do : https://medium.com/@cilliemalan/getting-started-on-nodemcu-with-your-own-firmware-cb2feffb067f

Instal Windows 10 SubSystem for Linux : https://docs.microsoft.com/zh-hk/windows/wsl/install-win10

******************************************************************************************************************************************************************************