ESP32 en entorno VSCode

En los próximos artículos, me gustaría echar un vistazo más de cerca a la configuración del entorno VSCode para que funcione con el marco ESP-IDF. Una combinación de software no tan popular tiene ventajas y desventajas que, tras un examen más detenido, intentaremos corregir, omitir o convertir en ventajas.

La investigación se lleva a cabo como parte del desarrollo del complejo de hardware y software del controlador de vuelo en cuaterniones puros, sin el uso de ángulos de Euler.

Dado que se asume el desarrollo remoto multiusuario, decidimos primero trabajar en la selección y configuración del propio entorno de desarrollo. Después de algunos experimentos con Eclipse, Visual Studio y QT Creator, la elección recayó en VSCode multiplataforma y en el complemento del desarrollador Espressif IDF para trabajar con el marco ESP-IDF.

Como el "corazón" del controlador, considere el microcontrolador ESP32 de doble núcleo, que tiene una serie de ventajas que se planea usar y revelar en el proyecto, a saber:

  1. ESP32 no es un MCU, sino un SoC *, que tiene a bordo:

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

    2. Bluetooth: v4.2 BR / EDR y Bluetooth de baja energía (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 .

En el próximo artículo, modificaremos el entorno VSCode y el marco en sí: consideraremos la utilidad menuconfig , nuevos scripts task.jsony resolveremos el problema con el resaltado de sintaxis de IntelliSense no siempre correcto , y también consideraremos la ejecución de los comandos del marco desde la línea de comandos.




All Articles