In the next few articles, I would like to take a closer look at setting up the VSCode environment to work with the ESP-IDF framework. A not-so-popular combination of software has both advantages and disadvantages, which, upon closer examination, we will try to fix, bypass, or turn into advantages.
The research is being carried out as part of the development of the hardware and software complex of the flight controller on pure quaternions, without the use of Euler angles.
Since multiuser remote development is assumed, we decided to first work out the selection and configuration of the development environment itself. After a few experiments with Eclipse, Visual Studio and QT Creator, the choice fell on the cross-platform VSCode and a plugin from the developer Espressif IDF for working with the ESP-IDF framework.
As the "heart" of the controller, consider the ESP32 dual-core microcontroller, which has a number of advantages that are planned to be used and revealed in the project, namely:
ESP32 is not an MCU, but a SoC *, which has on board:
Wi-Fi: 802.11 b / g / n / e / i (802.11n @ 2.4 GHz up to 150 Mbit / s)
Bluetooth: v4.2 BR / EDR and Bluetooth Low Energy (BLE)
* . FPV .
2 Cores 240 MHz up to 600 DMIPS
ULP co-processor
ESP32 Tensilica Xtensa 32-bit LX6, , , , . , LX6 GCC 8 toolchain, . ( Madgwick Mahony).
, LX7 , ESP32-S2.
, float toolchain.
ESP-IDF v4.0 Espressif . GitHub. . ESP-IDF, , Arduino-ESP32.
(Win10Pro). , - , . , , , .
Windows. , , Linux . Linux, . Win Linux , , Linux 2-4 .
, :
Git
Python
CMake
VSCode ESP-IDF ( )
ESP-IDF Tools ( Toolchain)
, C:\dev
, VSCode.
C:\dev\esp32
.
, , Toolchain.
Git
Git
Download URL: https://git-scm.com/
Installation path: C:\dev\Git
Python
Python
Download URL: https://www.python.org/downloads/
Installation path: C:\dev\Python39
, C:\Users\UserName\AppData\Roaming\Python\Python39
. Python Toolchain C:\Users\UserName\AppData\Roaming\Python\Python39
( \Scripts
\site-packages
) . ESP-IDF Toolchain esp-idf-tools-setup-2.3.exe . , - .
(Q1) 1: Python ESP-IDF Tools C:\Users\UserName\AppData\Roaming\Python\Python39
(\Scripts
\site-packages
), Python? ?
. (Q1), «Q» – , .
CMake
CMake
Download URL: https://cmake.org/download/
Installation path: C:\dev\CMake
Toolchain ESP-IDF CMake v3.13.4, , , Python. , , 3.13-19 .
(Q2) 2: CMake 3.13-19? Toolchain ESP-IDF CMake?
VSCode
VSCode
Download URL: https://code.visualstudio.com/
Installation path:
VSCode plugins
VSCode :
Espressif IDF (espressif.esp-idf-extension)
C/C++ IntelliSense (ms-vscode.cpptools)
, Espressif IDF.
Default Terminal Shell
, CMD VSCode . , VSCode MS PowerShell, , Espressif IDF powershell. PowerShell, , . ESP-IDF , PowerShell .
Terminal ==> New Terminal Select Default Shell. Command Prompt … cmd.exe
.
ESP-IDF
Show Onboarding on Visual Studio Code start Espressif IDF, VSCode Espressif – ESP-IDF ( ).
ESSPRESSIF
ESP-IDF: Configure ESP-IDF extension (onboarding.start)
Toolchain.
, .
, , : C:\dev\esp32\device01
, VSCode. , , , .
Workspace folder settings C:\dev\esp32\device01
.
START
_ User & Workplace
.
VSCode – , User , Workspace . , User , , , . User – , Workspace – . - , .
, .. .
VSCode JSON, VSCode. , . .
, , – (Workspace), (User).
Select Python version to use
Python. . , Python python.exe . , .
Git, .
Python Configure ESP-IDF
Configure ESP-IDF
ESP-IDF, ( ), , .
Find ESP-IDF in your system . , , .
Arduino, , ESP-IDF - release/v4.0 (release branch) v4.0.2 (release version), .. Arduino-ESP32 v3.3, v4.0 v4.2.
, v3.3 , v.4.2, , , .
ESP-IDF Arduino-ESP32 v.4.0 . v4.0 v3.x https://github.com/espressif/esp-idf/releases/tag/v4.0 , Arduino-ESP32 ESP-IDF. v4.0 , CMake, .
, Arduino IDE Arduino-ESP32 v.3.3 ESP-IDF, VSCode Arduino, . , .
, (release version), (release branch).
, release/v4.0 (release branch), ESP-IDF C:\dev
, \esp-idf
.
Check here to download, GitHub.
:
, Espressif IDF 0.5.1 release/v4.0 (release branch) – v4.0 4.0.2
, . GitHub https://github.com/espressif/vscode-esp-idf-extension/issues/223
v4.0.2 (release version) .
Toolchain.
Go to ESP-IDF Tools setup
ESP-IDF Tools Configuration
Download ESP-IDF Tools
GitHub .
, Toolchain ESP-IDF Tools. C:\dev\.espressif
.
, , Toolchain ESP-IDF v4.0.2 – () ESP-IDF, Arduino-ESP32 v4.0.
Tool: xtensa-esp32-elf Version: esp-2020r3-8.4.0
Tool: esp32ulp-elf Version: 2.28.51.20170517
Tool: cmake Version: 3.13.4
Tool: openocd-esp32 Version: v0.10.0-esp32-20200709
Tool: mconf Version: v4.6.0.0-idf-20190628
Tool: ninja Version: 1.9.0
Tool: idf-exe Version: 1.0.1
Tool: ccache Version: 3.7
Download
:
ERROR: Failed building wheel for psutil
ERROR: Command errored out with exit status 1:
…
VisualStudio is not installed; get it from http://www.visualstudio.com/en-au/news/vs2015-preview-vs
error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
...
WARNING: You are using pip version 20.2.3; however, version 20.2.4 is available.
You should consider upgrading via the 'C:\dev\.espressif\python_env\idf4.0_py3.9_env\Scripts\python.exe -m pip install --upgrade pip' command.
, wheel for psutil MS ++14 Visual Studio! ?!
, https://visualstudio.microsoft.com/downloads/ , VisualStudio.
VSCode Download.
, , ESP-IDF Tools , . , ++14 Visual Studio, ++14, ?
, . , . ESP-IDF Tools ?
(Q3) 3: ++14, Visual Studio, ESP-IDF Tools? Visual Studio, ?
_ PIP
, Visual Studio Download . , pip , .
PIP – , , Python. , pip Python > 3.4.
ESP-IDF Tools , .
CMD C:\dev\.espressif\python_env\idf4.0_py3.9_env\Scripts\python.exe -m pip install --upgrade pip
, python -m pip install --upgrade pip
, pip idf4.0_py3.9_env, pip Python.
_ PIP cache
pip. ESP-IDF Visual Studio C++, ESP-IDF, ESP-IDF Tools , . , pip . C:\Users\UserName\AppData\Local\pip\cache
, , , , . Toolchain.
Toolchain ESP-IDF, pip, C:\Users\UserName\AppData\Local\pip\cache\wheels
, ++14, .
Visual Studio https://visualstudio.microsoft.com/downloads/ , « C++», VSCode …
: Python, Python , ESP-IDF.
, ESP-IDF Tools, Download ESP-IDF Tools Download.
Toolchain Go to next step.
, pip. -?..
, , :
Creating a new Python environment in C:\dev\.espressif\python_env\idf4.0_py3.9_env ...
, Python, pip, Toolchain, , Python. pip – . , .
pip C:\dev\.espressif\python_env\idf4.0_py3.9_env\Scripts\python.exe -m pip install --upgrade pip
Go to next step
Verify ESP-IDF Tools
Toolchain.
, Python39 - idf4.0_py3.9_env, .
, CMake v3.19 ESP-IDF CMake v3.13.4, . CMake , . . . .
Click here to check tools exist
, , , , .
– … are satisfied
.
Go to next step
ESP-IDF Tools have been configured
, .
. , ESP-IDF , C:\dev\esp32\device01
.vscode
settings.json
:
{
"idf.espIdfPathWin": "C:\\dev\\esp-idf",
"idf.toolsPathWin": "C:\\dev\\.espressif",
"idf.customExtraPaths": "C:\\dev\\.espressif\\python_env …",
"idf.customExtraVars": "{\"OPENOCD_SCRIPTS …",
"idf.pythonBinPathWin": "C:\\dev\\.espressif\\python_env …"
}
, ESP-IDF Toolchain .
, .
, C:\dev\esp32\device02
, VSCode ESP-IDF: Add vscode configuration folder, ESP:Avcf. F1 ESP, .
.vscode
4 . settings.json
, ESP-IDF. c_cpp_properties.json
Toolchain.
, ESP:Avcf device01
, settings.json
.
, , , . ESP-IDF idf toolchain , , . ESP:Avcf .
, c_cpp_properties.json, ? , .
, , , Workspace () User (), , Workspace User . , User, Workspace, , ESP:Avcf, settings.json
, .vscode . .
, , GitHub, settings.json
, , Toolchain .
, - Toolchain , , .
idf User , , User settings ESP-IDF.
.
ESP-IDF ESP-IDF: Show ESP-IDF Examples Projects.
get-started\blink
Crate project using example blink. esp32
.
.vscode\settings.json
device01. JSON, .
q main\blink.c
.
, - BLINK_GPIO
portTICK_PERIOD_MS
C/C++ IntelliSense. , VSCode.
ESP-IDF: Build your project.
, build
, . Build Successfully. , .
, ESP-IDF: Build your project . , Terminal => Run Task… => Build – Build project Terminal => Run Build Task…
, Project build complete. To flash, run this command:..
Terminal .vscode\task.json
, F1, ESP-IDF: Build your project.
– Espressif IDF VSCode .
In the next article, we will tweak the VSCode environment and the framework itself - we will consider the menuconfig utility , new scripts for task.json
and solve the problem with not always correct IntelliSense syntax highlighting , and also consider the execution of the framework commands from the command line.