ESP32 di lingkungan VSCode

Dalam beberapa artikel berikutnya, saya ingin melihat lebih dekat pada pengaturan lingkungan VSCode untuk bekerja dengan kerangka kerja ESP-IDF. Kombinasi perangkat lunak yang tidak begitu populer memiliki kelebihan dan kekurangan, yang, setelah diteliti lebih dekat, kami akan mencoba memperbaikinya, melewati, atau mengubahnya menjadi kelebihan.

Penelitian dilakukan sebagai bagian dari pengembangan kompleks perangkat keras dan lunak pengendali penerbangan pada kuaternion murni, tanpa menggunakan sudut Euler.

Karena pengembangan jarak jauh multipengguna diasumsikan, kami memutuskan untuk terlebih dahulu menentukan pemilihan dan konfigurasi lingkungan pengembangan itu sendiri. Setelah beberapa percobaan dengan Eclipse, Visual Studio dan QT Creator, pilihan jatuh pada VSCode lintas platform dan plugin dari pengembang Espressif IDF untuk bekerja dengan kerangka kerja ESP-IDF.

Sebagai "jantung" dari pengontrol, perhatikanlah mikrokontroler inti ganda ESP32, yang memiliki sejumlah keunggulan yang rencananya akan digunakan dan diungkap dalam proyek, yaitu:

  1. ESP32 bukanlah MCU, tetapi SoC *, yang memiliki:

    1. Wi-Fi: 802.11 b / g / n / e / i (802.11n @ 2,4 GHz hingga 150 Mbit / s)

    2. Bluetooth: v4.2 BR / EDR dan Bluetooth Hemat Energi (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 .

Pada artikel berikutnya, kami akan mengubah lingkungan VSCode dan kerangka itu sendiri - kami akan mempertimbangkan utilitas menuconfig , skrip baru untuk task.jsondan memecahkan masalah dengan penyorotan sintaks IntelliSense yang tidak selalu benar , dan juga mempertimbangkan eksekusi perintah kerangka kerja dari baris perintah.




All Articles