Cov txheej txheem:

ESP32 Kev Txhim Kho ntawm Windows Subsystem rau Linux: 7 Kauj Ruam
ESP32 Kev Txhim Kho ntawm Windows Subsystem rau Linux: 7 Kauj Ruam

Video: ESP32 Kev Txhim Kho ntawm Windows Subsystem rau Linux: 7 Kauj Ruam

Video: ESP32 Kev Txhim Kho ntawm Windows Subsystem rau Linux: 7 Kauj Ruam
Video: dab neeg 1651 siv yis adventure EP 32 2024, Hlis ntuj nqeg
Anonim
ESP32 Kev Txhim Kho ntawm Windows Subsystem rau Linux
ESP32 Kev Txhim Kho ntawm Windows Subsystem rau Linux

ESP32 yog tus nqi qis, lub zog qis microcontroller board los ntawm Espressif. Nws yog qhov nrov ntawm cov neeg tsim khoom vim nws tus nqi qis thiab nws cov khoom siv txuas ntxiv, uas suav nrog WiFi thiab Bluetooth. Txawm li cas los xij, cov cuab yeej txhim kho rau ESP32 xav tau ib puag ncig zoo li Unix, uas tuaj yeem nyuaj rau teeb tsa thiab tswj hwm ntawm Windows system.

Ua tsaug rau qhov kev sib txuas lus tsis ntev los no, peb tuaj yeem siv Microsoft Windows Subsystem rau Linux los ua haujlwm tag nrho Linux raws li cov cuab yeej siv ib txwm nyob Windows 10, tsis tas yuav xav tau rov sau dua lossis siv lub tshuab virtual lossis ntim khoom.

Windows Subsystem rau Linux (WSL) ua rau haiv neeg ua tiav ntawm Linux (lossis ELF64 kom muab lawv lawv lub npe raug cai) binaries los ua cov chav kawm tshwj xeeb ntawm cov txheej txheem, hu ua txheej txheem pico. Windows cuam tshuam Linux hu xov tooj thiab cia li txhais lawv rau hauv qhov tsim nyog Windows tus thawj tswj hwm hu. Qhov tshwm sim yog tias feem ntau coj tus cwj pwm zoo Linux yuav khiav ntawm Windows.

Kauj ruam 1: Pab kom muaj qhov tshwj xeeb hauv Windows

Pab kom muaj qhov tshwj xeeb hauv Windows
Pab kom muaj qhov tshwj xeeb hauv Windows

Txhawm rau siv WSL, peb yuav tsum xub ua kom muaj qhov tshwj xeeb hauv kev ua haujlwm. Txoj cai-nias lub pob Pib thiab xaiv Khiav. Ntaus OptionalFeatures.exe thiab nias Enter. Xyuas kom lub Windows Subsystem rau Linux raug tshuaj xyuas ces nyem OK. Tej zaum koj yuav tsum tau rov pib dua kom muaj qhov tshwj xeeb rau nruab.

Kauj ruam 2: Nruab Linux Distribution

Nruab Linux Distribution
Nruab Linux Distribution
Nruab Linux Faib
Nruab Linux Faib

Tom ntej qhib Windows Store thiab tshawb rau Ubuntu. Nov yog Linux faib peb yuav tsum tau siv rau peb ib puag ncig kev txhim kho. Thaum koj tau teeb tsa thiab pib Ubuntu app koj yuav raug ceeb toom kom xaiv lub npe siv thiab tus lej nkag. (Qhov no tsis tas yuav zoo ib yam li koj lub Windows username thiab password, tab sis nws yuav tsum yog qee yam uas koj yuav nco tau).

Kauj Ruam 3: Nruab ESP32 Toolchain

Ua ntej peb yuav tsum teeb tsa qhov yuav tsum tau ua ntej rau cov cuab yeej cuab tam. Qhov no tau ua tiav siv Ubuntu tus thawj tswj hwm pob. Tua tawm Ubuntu thiab ntaus cov hauv qab no:

sudo apt-tau hloov tshiab

sudo apt-tau nruab gcc git wget ua libncurses-dev flex bison gperf sej sej sej-serial

Txhawm rau teeb tsa lub cuab yeej peb yuav tsum rub tawm thiab rho tawm nws:

cd ~ ib

wget https://dl.espressif.com/dl/xtensa-esp32-elf-linu… mkdir esp cd esp tar -xzf ~/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0. tar.gz ua

Kauj Ruam 4: Nruab ESP IoT Txoj Haujlwm Kev Txhim Kho

Tsim git clone ntawm Espressif IDF cov chaw cia khoom yog thawj kauj ruam rau txhim kho txoj haujlwm txhim kho:

cd ~/espgit clone-ua tau zoo

ESP-IDF xav tau qee qhov kev hloov pauv ib puag ncig kom ua haujlwm tau zoo. Peb yuav teeb tsa cov no hauv peb kab lus txib lub plhaub profile, yog li lawv muaj nyob txhua lub sijhawm peb pib Bash.

Ntaus nano ~/.profile los pib kho. Ntxiv cov kab hauv qab no mus rau qhov kawg:

export PATH = "$ PATH: $ HOME/esp/xtensa-esp32-elf/bin" export IDF_PATH = "$ HOME/esp/esp-idf"

Txuag thiab tawm nrog Ctrl+X.

Kauj ruam 5: Nruab thiab teeb tsa USB Serial Drivers

Nruab thiab teeb tsa USB Serial Drivers
Nruab thiab teeb tsa USB Serial Drivers

Feem ntau ESP32 cov phiaj xwm txhim kho suav nrog USB rau tus lej txuas, yog li koj tuaj yeem tsim kho lawv thiab saib xyuas qhov tso tawm los ntawm koj lub computer. Txawm li cas los xij, lawv tsis siv FTDI nti uas feem ntau Arduino cov laug cam ua. Hloov chaw, feem ntau siv CP210x nti los ntawm Silicon Labs. Koj yuav tsum rub tawm thiab teeb tsa cov tsav tsheb ua ntej ntsaws lub cuab yeej rau hauv.

Thaum koj tau ua tiav qhov ntawd, qhib Tus Thawj Tswj Ntaus Ntawv thiab paub meej tias lub cuab yeej tau lees paub. Koj yuav tsum paub qhov twg COM chaw nres nkoj Windows tau muab rau koj lub cuab yeej. Hauv kuv qhov xwm txheej nws yog COM4, tab sis koj li yuav txawv.

Hauv Ubuntu, peb tsis hais txog lub cuab yeej los ntawm Windows COM chaw nres nkoj, hloov peb siv lub npe /dev /ttyS X - qhov twg X yog Windows COM chaw nres nkoj tus lej. Yog li COM4 yuav yog /dev /ttyS4.

Txhawm rau kom tuaj yeem sau mus rau qhov chaw nres nkoj, peb yuav tsum teeb tsa kev tso cai. Txhawm rau ua qhov no, ntaus:

sudo chmod 0666 /dev /ttyS4

NB Hauv kuv qhov xwm txheej, kuv siv /dev /ttyS4. Koj yuav tsum hloov koj lub npe ntaus ntawv hloov chaw.

Kauj Ruam 6: Tsim thiab nyem qhov program

Tsim thiab nyem qhov program
Tsim thiab nyem qhov program
Tsim thiab nyem qhov program
Tsim thiab nyem qhov program

Cia peb sim peb ESP32 los ntawm kev tsim thiab ua kom pom qhov chaw nyob thoob ntiaj teb Nyob Zoo.

Koj yuav tau pom tias txog tam sim no peb tau ua haujlwm sab hauv Unix-like filesystem nrog cov npe xws li /dev, /bin thiab /tsev. Peb yuav luam cov phiaj xwm cov ntaub ntawv mus rau peb lub C tsav loj kom peb tuaj yeem hloov kho lawv siv ib qho Windows text editor yog xav tau. Tag nrho peb cov tsav muaj nyob hauv WSL dhau los ntawm /mnt phau ntawv teev npe.

mkdir/mnt/c/espcp -r $ IDF_PATH/piv txwv/pib -pib/nyob zoo_world/mnt/c/espcd/mnt/c/esp/hello_worldmake menuconfig

NB Qhov no tsim cov ntawv tais ceev tseg ntawm lub hauv paus ntawm C: tsav hu ua esp. Yog tias koj xav ua haujlwm hauv lwm qhov chaw, hloov pauv yooj yim hauv txoj kev.

Peb yuav tsum tau hloov qhov chaw nres nkoj ua ntej raws li lub cuab yeej peb tau txheeb xyuas ua ntej. Hauv kuv qhov xwm txheej uas txhais tau tias hloov pauv qhov chaw nres nkoj tsis raug rau /dev /ttyS4. Tsis txhob hnov qab txuag thaum koj tawm ntawm menuconfig.

ua -j16 allmake flash

Qhov -j16 kev xaiv tsis tsim nyog tab sis nws pab ua kom nrawm dua hauv cov txheej txheem khoos phis tawj ntau. Raws li kuv muaj 16 xov tshuab, kuv dhau -j16. Yog tias koj muaj plaub lub tshuab ua haujlwm koj yuav tsum siv -j4.

Kuv lub rooj tsavxwm muaj lub laub khawm sau lo lus IOO uas koj yuav tsum nias kom pab tau cov txheej txheem nyem. Tsuas yog xovxwm luv thaum sib txuas …… theem tau txaus.

Kauj Ruam 7: Txuas mus rau ESP32 thiab Saib Cov Khoom Tawm

Txuas mus rau ESP32 thiab Saib Cov Khoom Tawm
Txuas mus rau ESP32 thiab Saib Cov Khoom Tawm

Txhawm rau saib cov zis los ntawm ESP32 hom yooj yim

ua saib

Qhov no yuav tso tawm qhov tshwm sim los ntawm peb daim ntawv thov hello_world. Nrog koj zoo siab, koj tau ua tiav txoj haujlwm koj li ESP32 ntaus ntawv siv Windows Subsystem rau Linux!

Pom zoo: