It has been long time since I worked on ESP8266 and that too native SDK from Esperssif. With the rusty know-how and lack on info online, I had a mixed start again. Hope that the experience shared here might be helpful for many users, who wish to do ESP8266 native SDK development on Windows Platform. But are afraid that most of the working tools for ESP8266 are linux friendly.
Not to worry you are in good company.
Most of Windows users like myself first try to see if there are any docker alternatives.
But if you try to build the tool-chain on your own you can land-up deep into troubled waters. Its not impossible but takes lots of bandwidth, space and hair ripping to get a working setup.
The I found an old repository I had worked on long back fixing some issues:
Well its a fork of the original work:
Mr. Mikhail Grigorev has been kind enough to provide us with packaged installer.
Yet, getting re-started was not straight forward.
It took actually effort of 2 days. Getting a basic program running on Wemos D1 Mini. That hosts the ESP-12E Module of ESP8266.
Here is how you can avoid suffering. And have a quick running setup,
Getting All stuff Downloaded & Installed
There are 3 main pieces of software that needs to be installed in your windows machine.
From the website released nearly 2 years ago but still works great if used correctly.
This can be installed without any fear of corruption or damage to your already delicate Windows machine.
Just that this would create
C:\Espressif directory where all would get installed.
We would revisit this directory when we finish the MinGW installation and to upgrade the SDK from Espressif.
#2 MinGW Setup
This is the special sauce needed to do Makefile stuff and provide the tools needed to emulate Linux tools.
For more experienced user WARNING : Please do not add the
c:\MinGW etc. to path.
The toolchain discussed here would intelligently include stuff needed to work with tools inside
In the MinGW setup
Make sure to select the following choices to install:
NOTE : In my case I had already installed the MinGW tools so the
Apply Changesis not highlighted. In a fresh installation this must get enabled
Just press the
Apply Changes begin the installation.
#3 Eclipse IDE
Choose the respective Windows architectures X86 = 32-bit X64 = 64-bit for
Eclipse IDE for C/C++ Developers
- Windows 32-bit : http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/photon/R/eclipse-cpp-photon-R-win32.zip
- Windows 64-bit: http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/photon/R/eclipse-cpp-photon-R-win32-x86_64.zip
Just choose which ever install comes latest do not worry about version of Eclipse CDT or flavor.
Make sure to setup the Workspace directory as described or as you desire while opening the Eclipse IDE for the first time.
#3.5 Missing JRE !!! ERROR
Yep, I too missed this Not to worry …
Accept License Agreement and then click on correct version of Windows architecture.
Make sure this is aligned with your Eclipse architecture that was downloaded earlier.
Working with Code
Now its time to make comfortable with the workspace.
#1 Getting the Example Code
Typically the example code is stored in :
We are interested in keeping the originals pristine.
Hence we would copy this
ESP8266 folder to our work-space.
This is the same workspace as what’s recommended by
NOTE : In my case I have the location at
I know that’s a strange place to keep the files but lets just roll with that.
Finally your setup should look like
c:\<Your Eclipse Wrokspace>\ESP8266
This where all the examples shall be copied.
#2 Importing Projects in Eclipse
NOTE : By default each of the project is configured for default
ESP-01 that’s with a
512KB flash. And the
programming serial port is configured on
That’s the thing I missed to Note while trying out the SDK.
We would configure the stuff properly so that – we don’t land up in non working board + anguish and lot of head-banging.
Don’t worry we would get through this together
First things first
Get the project imported
Note : This is Eclipse IDE
Photon Release (4.8.0)other might not differ significantly but just in case.
Now select the Correct type to import:
Browse... button Select the Blinky2 Project Folder Only.
Select Folder button in the open dialog
There is distinct reason to choose this project since its easier to understand modify.
Finish button to complete the import.
#3 Configuring the Project
Now, we are all set with IDE and the software.
The crucial part of
Makefile modification is needed.
By Default the
Makefile should look like:
# Main settings includes include ../settings.mk # Individual project settings (Optional) #BOOT = new #APP = 1 #SPI_SPEED = 40 #SPI_MODE = QIO #SPI_SIZE_MAP = 2 #ESPPORT = COM2 #ESPBAUD = 256000 # Basic project settings MODULES = driver user LIBS = c gcc hal phy pp net80211 lwip wpa main crypto # Root includes include ../common_nonos.mk
Note the two important pieces:
include ../settings.mk ... include ../common_nonos.mk
The first line actually is used to setup the defaults.
The last line indicates the processing for NON-OS SDK.
We don’t have to mess around with file includes and
correct file list etc. The
all that automatically.
All that we now need is configure the
project settings in this
ESP-01 the additional configuration looks like:
# Switching to DIO mode for Flash as there might be poor PCB routing SPI_MODE = DIO # Change the COM port based on your PC and USB-to-UART adapter ESPPORT = COM10
So the new
Makefile would become:
# Main settings includes include ../settings.mk # Individual project settings (Optional) #BOOT = new #APP = 1 #SPI_SPEED = 40 #SPI_MODE = QIO #SPI_SIZE_MAP = 2 #ESPPORT = COM2 #ESPBAUD = 256000 # Switching to DIO mode for Flash as there might be poor PCB routing SPI_MODE = DIO # Change the COM port based on your PC and USB-to-UART adapter ESPPORT = COM10 # Basic project settings MODULES = driver user LIBS = c gcc hal phy pp net80211 lwip wpa main crypto # Root includes include ../common_nonos.mk
Note : the location of the modified setting is crucial. Else that would not effect the build output.
With this modifications we are ready to test the
blinky2 example with
#4 Build and Load the Code
Build Targets double click
That should initiate the build.
Now set the ESP8266 in Bootloader Mode.
Finally double click on
flash build target.
Everting goes well you would have a blinking LED on the
How to Update to the Latest SDK
NON-OS SDK in Espressif-ESP8266-DevKit-v2.2.1-x86.exe is
But, one might like to have the Latest
v2.2.1 as on August 2018.
First we can download the Latest SDK:
Typically the files would extract into their unique folder.
ESP8266_NONOS_SDK-2.2.1.zip it would be extracted to
It must be such that
ESP8266_NONOS_SDK-2.2.1\Makefile should be the
Note : Make sure that the directory
ESP8266_NONOS_SDK-2.2.1 should have the
Makefile of the SDK else integration would fail. Its common mistake to have a directory such as
Once you have the file correctly extracted.
Copy it to the
We would be considering upgrade for the
NON-OS SDK to
#3 Rename the Original
Now rename the
#4 Update the SDK
Create a Copy the
Rename the copy of the
Such that we have:
That’s It, you have successfully Upgraded your SDK
Now to make your hair stay ;-)
Here is some configuration examples for
Makefile typically useful
For OTA configuration
(512 KB + 512 KB):
# SPI_SIZE_MAP # 0 : 512 KB (256 KB + 256 KB) # 1 : 256 KB # 2 : 1024 KB (512 KB + 512 KB) # 3 : 2048 KB (512 KB + 512 KB) # 4 : 4096 KB (512 KB + 512 KB) # 5 : 2048 KB (1024 KB + 1024 KB) # 6 : 4096 KB (1024 KB + 1024 KB) SPI_SIZE_MAP = 4
Here apart from the
OTA allocation of
512KB for secondary firmware,
512KB for primary firmware.
One can also use the
6 configuration such that
OTA = 1024KB + FW = 1024KB.
For Poor PCB wiring
Typically cheaper modules do not have good signal integrity on the PCB of the module. That can cause problems in normal operation. Or worst get interfered by external noise.
# SPI_SPEED = 40, 26, 20, 80 SPI_SPEED = 40 # SPI_MODE: QIO, QOUT, DIO, DOUT SPI_MODE = DIO
If you have an Official
WROOM Module from Espressif
then you can use:
# SPI_SPEED = 40, 26, 20, 80 SPI_SPEED = 80 # SPI_MODE: QIO, QOUT, DIO, DOUT SPI_MODE = QIO
Note : This is the fastest setting of Flash operation use this with caution. Some times voltage dips can cause Reset issues. In case you have Low power or Battery operated design Do not use this
# BOOT = none # BOOT = old - boot_v1.1 # BOOT = new - boot_v1.2+ BOOT = none
Typically if you are doing simpler development you might not need the secondary bootloader stuff. Its needed if you want to use OTA and WiFi .etc.
However for finished products its best to have an upgrade capability hence on should use:
# BOOT = none # BOOT = old - boot_v1.1 # BOOT = new - boot_v1.2+ BOOT = new
Note : This setting might have issues in
In order to resolve that just copy
That should resolve the build problem.
Completed on: 12th August 2018
- Add New project Creation details
- Add RTOS and C++ Examples