VSCode环境中的ESP32

在接下来的几篇文章中,我将仔细研究如何设置VSCode环境以与ESP-IDF框架一起使用。不太流行的软件组合既有优点也有缺点,在仔细研究后,我们将尝试修复,绕开或转变成优点。

这项研究是在不使用欧拉角的情况下,在纯四元数上飞行控制器的硬件和软件复合体开发的一部分中进行的。

由于假定使用多用户远程开发,因此我们决定首先研究开发环境本身的选择和配置。在使用Eclipse,Visual Studio和QT Creator进行了一些实验之后,选择落在跨平台的VSCode和开发人员Espressif IDF的插件上,以与ESP-IDF框架一起使用。

作为控制器的“心脏”,请考虑ESP32双核微控制器,它具有计划在项目中使用和展示的许多优点,即:

  1. ESP32不是MCU,而是SoC *,具有以下功能:

    1. Wi-Fi:802.11 b / g / n / e / i(802.11n @ 2.4 GHz最高150 Mbit / s)

    2. 蓝牙:v4.2 BR / EDR和蓝牙低功耗(BLE)

      * . FPV .

  2. 2 Cores 240 MHz up to 600 DMIPS

  3. ULP co-processor

ESP32 Tensilica Xtensa 32-bit LX6, , , , . , LX6 GCC 8 toolchain, . ( Madgwick Mahony).

, LX7 , ESP32-S2.

, float toolchain.

Xtensa vs ARM .

ESP-IDF v4.0 Espressif . GitHub. . ESP-IDF, , Arduino-ESP32.

(Win10Pro). , - , . , , , .

Windows. , , Linux . Linux, . Win Linux , , Linux 2-4 .

, :

  1. Git

  2. Python

  3. CMake

  4. VSCode ESP-IDF ( )

  5. 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 .

在下一篇文章中,我们将调整VSCode环境和框架本身-我们将考虑menuconfig实用工具,新脚本task.json并通过不总是正确的IntelliSense语法突出显示解决问题,并考虑从命令行执行框架命令。




All Articles