1. Preface
because ESP8266/ESP32 This development environment is full of trouble , I have never seen such a difficult and unclear environment .
Simple development can use Arduino IDE , This platform is very good . Development use Arduino Function library , Very efficient .
But I'm still not used to it , For example, in the example binker demo Of LED_BUILTIN, Can't jump to the definition , Don't like . Now let's seriously build a 8266 Environment . In fact, it's quite simple , I just haven't found the right place .
Find official documents from other bloggers : ESP8266_RTOS_SDK Programming Guide , I am a person with obsessive-compulsive disorder in knowledge retrieval , I don't know where to find this link. I feel uncomfortable , Finally, it can be found on the official website esp8266 Links to getting started under categories .

The specific steps to build a development environment are : Tool chain 、 obtain SDK、 To configure ( If you want to use IDE It should be IDE Configuration of ).
The four steps in the development process are :
- Configure the project and write code
- Compile the project and link , To build applications
- Burn to ESP8266
- Debugging and monitoring
2. Build the development environment
2.1 Tool chain access
Windows Integrated tool chain and MSYS2 zip file :
https://dl.espressif.com/dl/esp32_win32_msys2_environment_and_toolchain-20181001.zip
I was going to use git bash Self contained mingw Well , result make Stage reminders should use mingw32 Under the msys. As a result, I managed to use the integration tool provided by the official website .
The subsequent orders are in MINGW32.exe Executed under .
2.2 SDK clone
git clone --recursive https://github.com/espressif/ESP8266_RTOS_SDK.git
We must add recursive Loop download sub module , I didn't add , The result will be in make Download other libraries only when , I can't download it yet .
When I add this parameter , I found that the download was very slow , Hanging up the tools is slow , After waiting for a long time, I finally finished downloading . Another option is to use gitee download SDK( no need recursive Download sub module ), Use a tool to download the submodule , Reference resources : Build with Lexin's domestic image ESP8266_RTOS_SDK development environment
I can't imagine that Lexin values the overseas market , How to make the domestic ecology not so good .
2.3 To configure
notes : Tool chains use environment variables IDF_PATH visit SDK Catalog , stay ~/.bash_profile Add... At the end
export IDF_PATH="G:/IOT/ESP8266/ESP8266_RTOS_SDK"
Use source Order it into effect
source ~/.bash_profile
Download other tools
ESP8266 Compiling and burning are based on Python Realization , Need to install python The library of .
$ python -m pip install -r $IDF_PATH/requirements.txt
Come here , Environment configuration is complete . No no no
ESP8266 Proprietary tool chain settings
The integrated environment is for ESP32 Set up ,ESP8266 You also need to download specific tool chains , This official website document or RTOS There is also a link in the description :
v8.4.0
https://dl.espressif.com/dl/xtensa-lx106-elf-gcc8_4_0-esp-2020r3-win32.zip
If you are still using an older version SDK(< 3.0), Please use the tool chain v4.8.5, as follows :
https://dl.espressif.com/dl/xtensa-lx106-elf-win32-1.22.0-88-gde0bdc1-4.8.5.tar.gz
After downloading the first , decompression . then .bash_profile Add environment variables to :
export PATH="$PATH:/G/IOT/ESP8266/xtensa-lx106-elf/bin"
If it's not configured here ESP8266 Proprietary tool chain ,make A reminder will appear after configuration :
GENCONFIG
make:xtensa-lx106-elf-gcc: Command not found
3. The development process
Project configuration
take sdk Medium examples/git-startd/hello_world Copy out , use mingw32 Execute to this directory , function
make menuconfig
You will see the following interface : Make some configuration ( A serial port , Baud rate, etc )


burn
Only the port number and are set flash( It was originally 4M, An error is reported during burning , Set to 2M succeed ) after , Then use the compile and burn commands
make flash
Report errors :
Submodules 'components/json/cJSON'(https://github.com/DaveGamble/cJSON.git) No path 'components/json/cJSON' register
Is cloning to '/g/IOT/ESP8266/ESP8266_RTOS_SDK/components/json/cJSON'...
fatal: unable to access 'https://github.com/DaveGamble/cJSON.git/': OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
fatal: Unable to clone 'https://github.com/DaveGamble/cJSON.git' Path to submodule '/g/IOT/ESP8266/ESP8266_RTOS_SDK/components/json/cJSON'
clone 'components/json/cJSON' Failure . Retry as scheduled
Is cloning to '/g/IOT/ESP8266/ESP8266_RTOS_SDK/components/json/cJSON'...
This is because from github Downloading some modules failed , There are two solutions online . First, manually download and put it into the corresponding directory , The second is to enlarge http.postBuffer Value . I used the first one , Another error is reported during compilation , Then use the second type . I can't find it , Go and find out why it happened , Discover clones SDK I didn't add recursive Parameter cycle download sub module .
After burning successfully .
It can be used make monitor Monitoring serial port :

hello_world, Just print out CPU Check the number , external Flash size 2M.
use make monitor It is normal to look at the data , What you see with other serial port tools is garbled code , It turns out that the default baud rate here is not 115200, yes 74800. Modify baud rate method :

Here, the environment is built . I'll go to the company tomorrow , Arrangement & Record the problem .
Use VSCODE Make a development environment
Terminal and compiler
vscode Right click the workspace → Open at the integration terminal and replace with mingw32. User settings need to be changed , Or the settings of the current workspace ( stay .vscode/settings.json)

"terminal.integrated.shell.windows":"D:\\Software\\esp32_win32_msys2_environment_and_toolchain-20181001\\msys32\\msys2_shell.cmd",
"terminal.integrated.shellArgs.windows": ["-defterm", "-mingw32", "-no-start", "-here"]
make menuconfig Random code :
file \msys32\etc\profile.d\esp32_toolchain.sh New language configuration :(zh_Cn) It's OK
export LANG="en_Us"
Then it can be used smoothly under the terminal make 了 .
Library settings
Now? vscode Look at code below , There is no associated library , So neither the function nor the header file can be skipped

Header files fall into two categories , As shown in the figure , One is system library stdio.h etc. , One is that RTOS Library in .
First, add the configuration file ,

stay incluPath Add these two types of libraries to : My configuration is as follows , The first is RTOS library , The last three are systems gcc Library used ( Two asterisks indicate that the directory is searched recursively )
"includePath": [
"E:/labs/esp8266/ESP8266_RTOS_SDK/components/**",
"E:/labs/esp8266/xtensa-lx106-elf/xtensa-lx106-elf/include/c++/8.4.0/**",
"E:/labs/esp8266/xtensa-lx106-elf/xtensa-lx106-elf/sys-include" ,
"E:/labs/esp8266/xtensa-lx106-elf/xtensa-lx106-elf/include",
"${workspaceFolder}/**"
],
Want to see gcc Included files , Through the command gcc -v -E -x c++ - , because make They found gcc It uses Toolchain path: /E/labs/esp8266/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc, So you should use /E/labs/esp8266/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc -v -E -x c++ - View the import library location , What is needed is the Library Directory shown in the red box below

So you can jump .
summary
The environment has been built for a long time . I have to summarize , Give some guidance to others who are confused .
Software and libraries needed :msys2 Tool chain ( You can also install it yourself , However, it is recommended to use the official )、8266 Unique tool chain 、RTOS The library of ( Cloning is troublesome , In fact, the required components can be downloaded one by one and put into the specified directory ). Configuration is to put 8266 and RTOS The path of the library is configured in the environment variable (.bash_profile). Then burn and run . It doesn't seem like much trouble now , But the process is really painful .
Reference resources
- build ESP8266 development environment (windows)
- Build with Lexin's domestic image ESP8266_RTOS_SDK development environment
- Yibaite E103-W01 ESP8266EX UART Serial port to WiFi modular
- ESP32 Development solve VS Code in make menuconfig The code problem
- 2 Step by step VSCode Configure the project header file path !
- [ solve ]VSCode stay Linux Import below c Language header file warning
ESP8266 More related articles on system environment construction
- spark Cluster building ( Three virtual machines )—— System environment construction (1)
!!! The series uses three virtual machines to build a complete spark colony , The cluster environment is as follows : virtualBox5.2.Ubuntu14.04.securecrt7.3.6_x64 English version ( Connecting virtual machines ) jdk1.7.0. ...
- Mac Arduino ESP8266 ESP32 Build development environment
Catalog 1. install Arduino 2. Set up the development board manager 3. Possible errors 1. install Arduino Arduino download . Official download address :Arduino Official website Arduino The Chinese community : Download address Installation mode : ...
- Centos7 Next GlusterFS Build a distributed file system environment
Centos7 Next GlusterFS Preparation for environment construction glusterfs-3.6.9.tar.gzuserspace-rcu-master.zip Three servers :192.168.133.53.192.16 ...
- Spring Security + OAuth System environment construction ( One )
Recently, I'm doing the reconstruction of permission management system , The system is based on Spring Security + OAuth framework , The overall architecture . Technology is almost the same as previous research. , I made a brief record in this blog during the architecture research “Spring Cloud Under microservice ...
- win10 ubuntu18 Dual system environment
Thank you for your hard work , According to this 3 This article has successfully configured dual systems https://blog.csdn.net/qq_24624539/article/details/81775635 https://blog.csd ...
- C Language quick start 1 :win10 System environment construction
0. Set up the environment :WIN10 64 position 1. download minGW.zip compiler 2. Resolve the above documents , Configure environment variables 3. Configuration becomes post validation : open cmd Command line , Input gcc -v Here's a hint , Description the compiler was successfully installed D:\mm ...
- OAuth2.0 Build a distributed system environment
study hard , Day day up This article has been included in my Github Warehouse DayDayUP:github.com/RobodLee/DayDayUP, welcome Star, For more articles, please go to : Directory navigation Introduce OAuth( Open licensing ) It's one ...
- linux System environment construction
One . install jdk Reference post use yum install JDK(CentOS) 1. see yum What's in the library jdk edition 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 [r ...
- System --- Linux System environment construction
Linux Command Introduction Hard and soft links effect : Establish connection file ,linux The connection file under is similar to windows Next shortcut classification : Soft link : Soft links do not take up disk space , If the source file is deleted, the soft link will fail Hard links : Hard links can only link different files , ...
- Activiti Workflow system environment construction
One . establish Activiti engineering , And import Activiti Package and database driver package Two . Create in code Process engine 1 @Test 2 public void createProcessEngineWithCode( ...
Random recommendation
- TCP Study two : The connection between client and server
Mainly refer to zhangziyang great God's blog :http://www.cnblogs.com/JimmyZhang/category/101698.html TcpClient It's right Socket Encapsulation One TcpClient ...
- TCP/UDP Simple communication framework source code , Support easy management of multiple TCP Server side ( client )、UDP client
Catalog explain TCP/UDP The main structure of communication Manage multiple Socket Solutions for In the frame TCP Use of parts In the frame UDP Use of parts Framework source structure Additional explanation Source code address explain There have been several blogs about TCP/UDP Correspondent ...
- poj[2104]K-th Number
Description You are working for Macrohard company in data structures department. After failing your ...
- Yes VM Mount the newly added disk
After adding disks to the virtual machine configuration , start-up Linux, Use root Sign in . First look at the unpartitioned disks , Use the following command : ## View unused disks fdisk -l disk /dev/sdb There are no partitions behind , Is a newly mounted disk Input ...
- oracle Connection error
The company's database , There will always be some problems . But it's common . therefore , Post it for you to see 1,oracle An error occurred when starting the database :SQL> startup;ORA-01078: failure in pro ...
- Maven for Myeclipse A common mistake of Project configuration is not up-to-date with pom.xml
Use Myeclipse Development Maven Project time , An error prompt is often found : Description Resource Path Location Type Project configuration is ...
- CoreOS, Kubernetes, etcd
CoreOS CoreOS Container Linux is the leading container operating system, designed to be managed and ...
- C# In the use of CRC32 Value to determine whether the file is duplicated
Need to be in NuGet I quote Crc32.NET package Just post the code : using Force.Crc32; using System; using System.Collections.Generic; ...
- build memcached Use :/usr/bin/phpize install memcached Error when expanding
Can't find PHP headers in /usr/include/phpThe php-devel package is required for use of this command ...
- solve find Command error : paths must precede expression( turn )
Original address :https://www.cnblogs.com/peter1994/p/7297656.html In the morning , Want to be on the server /tmp Directory clear some pdf file , About 10000 files , In the execution of an order ...



![[6.4-6.10] wonderful review of Blog](/img/66/0cfc97bf4bc0c2b6e66c0419690ce5.png)





