Cov txheej txheem:
- Kauj ruam 1: Rub txhua yam uas koj xav tau
- Kauj ruam 2: Txhim Kho Software
- Kauj Ruam 3: Teeb Ib Qhov Qauv Piv Txwv
- Kauj ruam 4: Tiav lawm
Video: Pib Tsim STM32 ntawm Linux: 4 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
Hauv Cov Lus Qhia no, Kuv yuav qhia koj yooj yim npaum li cas nws yog pib tsim cov haujlwm STM32 ntawm Linux. Kuv pib siv Linux ua kuv lub tshuab tseem ceeb 2 xyoos dhau los thiab tsis tau tso tseg. Txhua yam ua haujlwm nrawm dua thiab zoo dua li qhov rais. Yog lawm tsis yooj yim los ntawm ib lub sijhawm, tab sis nws yuam koj kom kawm paub tob dua yog li koj tuaj yeem siv nws.
Xijpeem, hauv cov lus qhia no, ib feem ntawm koob kuv tau pib ntawm no THIAB hauv youtube yog yuav pib li cas. Thov nco ntsoov saib kuv cov vis dis aus hauv youtube ib yam uas kuv piav qhia txhua yam ua ib ntu thiab koj tuaj yeem ua chaws nyob ib sab kuv.
Hauv kab ntawv no kuv yuav qhia koj li cas koj tuaj yeem txhim kho siv cov ntawv sau zoo li notepad, SublimeText lossis Atom, yog li koj tsis xav tau software tshwj xeeb lossis IDE. Qhov no zoo li pob txha liab qab li nws tau txais thiab nws yog qhov yooj yim xav tsis thoob.
Kauj ruam 1: Rub txhua yam uas koj xav tau
Koj yuav tsum rub peb ntu rau txhua yam kom ua haujlwm:
- GCC compiler rau ARM
- STM32 firmware cov ntaub ntawv
- St-link kev pabcuam
- Qauv Project
Compiler yog qhov tseem ceeb ntawm software uas suav peb C code nrog txhua lwm cov ntaub ntawv hauv tsev qiv ntawv rau hauv tshuab lus uas peb tus tswj hwm stm32 tuaj yeem nkag siab. Rub tawm qhov ua ntej tso ua ke version ntawm tus neeg sau no.
Cov ntawv tais ceev tseg uas muaj STM32 firmware yog ib qho uas tuav txhua qhov pib thiab cov ntaub ntawv tseem ceeb xav tau rau kev ua haujlwm ntawm lub khoos phis tawj tseem ceeb. Peb yuav siv Cov Tsev Kawm Ntawv Sab Nraud Sab Nraud uas tau dhau los ntawm HAL. Kuv nyiam StPeriphLibrary ntau dua li cov tuam txhab uas ua haujlwm ntawm cov txheej txheem no siv lawv vim tias nws muaj zog thiab laus dua thiab txhawb nqa. Nws kuj tseem muaj zog dua. Nws tsis txiav txoj haujlwm uas koj yuav tsum tau ua rau pib ua ntej lossis qhib lub LED tab sis, yog li nws yuam koj kom kawm paub tias cov txheej txheem no ua haujlwm li cas. Nrog qhov ntawd koj muaj kev paub ntau ntxiv txog kev ua haujlwm sab hauv yog li ua rau muaj kev nkag siab zoo ntawm txhua lub luag haujlwm.
Daim kawg ntawm software rub tawm yog st-link utility. Nws tau khaws cia ntawm github thiab siv los hloov pauv cov ntaub ntawv binary mus rau tus txheej txheem siv stlink IC ntawm pawg thawj coj ua haujlwm SWD / JTAG programmer / debugger.
Tsis tas li kuv tau muab cov qauv nplaub tshev uas kuv tham txog tom qab thiab koj tuaj yeem rub nws. Nws yog sab hauv thawj daim VIDEO1 nplaub tshev.
Kauj ruam 2: Txhim Kho Software
Tom qab koj tau rub tawm tag nrho cov ntaub ntawv Kuv hais qhia koj muab lawv tso rau hauv ib qho ntawv tais ceev tseg raws li lawv txhua tus siv ua ke rau tib lub hom phiaj. Kuv muab tag nrho cov ntawv ntim rau hauv daim nplaub tshev hu ua "Embedded" hauv kuv phau ntawv HOME.
Peb yuav pib nrog qhov yooj yim tshaj plaws, STM32 cov tsev qiv ntawv. Lub nplaub tshev uas koj tau rub tawm tuaj yeem tsuas yog nyob ntawd. Tsuas yog nco ntsoov khawb ib ncig kom pom cov ntaub ntawv tsim nyog khaws cia. Yog li koj tuaj yeem hloov pauv thiab kho qhov tseem ceeb MakeFile yog li nws yuav ua haujlwm nrog koj lub platform.
Qhov yooj yim thib ob yog tus sau. Koj kuj tsis tas yuav ua dab tsi rau nws, tab sis peb yuav ua tus muab tso ua ke kom thoob ntiaj teb siv tau yog li koj tuaj yeem hu xov tooj los ntawm txhua lub nplaub tshev tsis hais txoj hauv kev twg. Txhua kauj ruam tuaj yeem ua tiav hauv lub davhlau ya nyob twg lossis hauv gui, tab sis kuv nyiam siv davhlau ya nyob twg zoo li thaum koj tau ntsib nws sai dua thiab yooj yim dua thiab kuv txhawb koj kom siv davhlau ya nyob twg ntau dua, yog tias koj ntshai nws. Nov yog cov kauj ruam:
- Mus rau hauv koj lub tsev ntawv "/home/YOURUSERNAME/" lossis "~/" lossis ntaus cd rau hauv davhlau ya nyob twg
- qhib cov ntaub ntawv ".bashrc" los ntawm kev ntaus ntawv: nano.bashrc
- nqes mus rau qhov kawg ntawm cov ntawv thiab ntxiv kab ntawv no: export PATH = $ PATH: ~/Embedded/gcc-arm-none-eabi-8-2018-q4/bin
- tawm los ntawm kev txuag: CTRL+X, nyem Y, ENTER
- khiav hais kom ua: qhov chaw.bashrc los kho qhov chaw dav dav
- khij yog tias txhua yam ua haujlwm los ntawm kev ntaus ntawv: caj npab-tsis-eabi-gcc-hloov pauv, nws yuav tsum tso saib qhov hloov tshiab kawg ntawm tus sau
Txhawm rau teeb tsa st-txuas, rho tawm cov ntawv khaws cia uas koj tau rub tawm rau hauv cov ntawv tais ceev tseg. Tom qab ntawd ua raws cov theem no:
- Khiav: ua
- Mus rau hauv daim nplaub tshev "tsim/Tso": cd tsim/Tso Tawm
- Ntaus ls thiab koj yuav pom ob txoj haujlwm hu ua "st-flash" thiab "st-util"
- Tsiv ob qho no rau hauv niam txiv phau ntawv teev npe stlink: mv st-flash st-util../../
-
Koj tuaj yeem, yog tias koj xav siv ob txoj haujlwm no thoob ntiaj teb kho ".bashrc" cov ntaub ntawv ntxiv los ntawm kev ntxiv:
export PATH = $ PATH: ~/Embedded/stlink/
Yog tag nrho! Koj muaj txhua yam koj xav tau. Tam sim no mus lob koj tus kheej koj cov ntawv nyeem uas koj nyiam. Siv tsuas yog tus qauv ib txwm, ib qho ntse dua li SublimeText lossis Atom, nws yog qhov kuv siv.
Kauj Ruam 3: Teeb Ib Qhov Qauv Piv Txwv
Tam sim no peb yuav tsim cov qauv piv txwv uas koj tuaj yeem siv los pib txhua qhov haujlwm. Nws zoo li tus qauv nrog txhua qhov kev teeb tsa tseem ceeb tau ua tiav.
Koj tuaj yeem rub nws ntawm kuv MEGA, qhov txuas yog thawj kauj ruam ntawm cov lus qhia no thiab hauv qab txhua qhov youtube video ntawm kuv. Sab hauv yog qhov khoob main.c cov ntaub ntawv nrog rau qee cov ntaub ntawv pib rau cov txheej txheem no thiab Makefile. Makefile yog tus uas qhia C tus neeg sau ntawv qhov twg los nrhiav tus caj npab compiler, yuav sau li cas thiab txhua lub tsev qiv ntawv nyob qhov twg. Txhawm rau kom tau txais cov ntaub ntawv tsim nyog rau koj txoj haujlwm, koj tuaj yeem nkag mus rau hauv STM32 lub tsev qiv ntawv cov ntawv tais ceev tseg thiab tshawb xyuas "nplaub tshev" lossis "piv txwv" cov ntawv tais ceev tseg. Hauv koj yuav pom thiab theej cov ntaub ntawv no: main.c, Makefile thiab XXX_conf.h, system_XXX.c. Also koj yuav xav tau stm32_flash.ld cov ntawv txuas uas tuaj yeem pom hauv daim nplaub tshev:
"/FLASH_Program/TrueSTUDIO/FLASH_Program/" uas yog hauv cov piv txwv piv txwv lossis tsuas yog tshawb rau cov ntawv.
Makefile tuaj yeem pom hauv online lossis theej los ntawm kuv cov ntawv, tab sis koj yuav tsum tau hloov qee yam. Cia peb hais dab neeg saib kuv cov ntaub ntawv thiab koj tuaj yeem hloov dab tsi.
# Txoj hauv kev mus rau stlink nplaub tshev rau kev xa cov cai mus rau lub rooj tsavxwm
STLINK = ~/Embedded/stlink # Muab koj cov ntaub ntawv tso rau ntawm no (*.c) SRCS = main.c system_stm32f4xx.c # Cov tsev qiv ntawv cov ntaub ntawv #SRCS += stm32f4xx_rcc.c #SRCS += stm32f4xx_gpio.c # Binaries yuav tsim nrog lub npe no (.elf,.bin,.hex) PROJ_NAME = xeem # Muab koj lub STM32F4 lub tsev qiv ntawv cov ntawv teev npe ntawm no, hloov koj tus USERNAME rau koj li STM_COMMON =/home/matej/Embedded/STM32F4-Discovery_FW_V1.1.0 # Compiler settings. Tsuas yog hloov kho CFLAGS kom suav nrog lwm cov ntaub ntawv header. CC = arm -none -eabi -gcc OBJCOPY = arm -none -eabi -objcopy # Compiler chij CFLAGS = -g -O2 -Wall -Tstm32_flash.ld CFLAGS += -DUSE_STDPERIPH_DRIVER CFLAGS += -mlittle -endian -mthumb -mcpu = cortex-m4 -mthumb-interwork CFLAGS += -mfloat-abi = nyuaj -mfpu = fpv4-sp-d16 CFLAGS += -I. # Txheeb cov ntaub ntawv los ntawm STM cov tsev qiv ntawv CFLAGS += -I $ (STM_COMMON)/Libraries/CMSIS/suav nrog CFLAGS += -I $ (STM_COMMON)/Libraries/CMSIS/ST/STM32F4xx/suav nrog CFLAGS += -I $ (STM_COMMON)/ Cov tsev qiv ntawv/STM32F4xx_StdPeriph_Driver/inc CFLAGS += -I $ (STM_COMMON)/Utilities/STM32F4 -Discovery # ntxiv cov ntawv pib tsim SRCS += $ (STM_COMMON)/Libraries/CMSIS/ST/STM32F4xx/Source/Templates/TrueSTIO s OBJS = $ (SRCS:.c =.o) vpath %.c $ (STM_COMMON)/Libraries/STM32F4xx_StdPeriph_Driver/src \. PHONY: proj all: proj proj: $ (PROJ_NAME).elf $ (PROJ_NAME).elf: $ (SRCS) $ (CC) $ (CFLAGS) $^ -o $@ $ (OBJCOPY) -O ihex $ (PROJ_NAME).elf $ (PROJ_NAME).hex $ (OBJCOPY) -O binary $ (PROJ_NAME).elf $ (PROJ_NAME).bin huv: rm -f *.o $ (PROJ_NAME).elf $ (PROJ_NAME).hex $ (PROJ_NAME).bin # Nyem STM32F4 hlawv: proj $ (STLINK)/st -flash sau $ (PROJ_NAME).bin 0x80000000
- Koj tuaj yeem hloov kho thawj kab los hloov txoj hauv kev rau koj li stlink cov khoom siv hluav taws xob
-
Koj tuaj yeem hloov kab mus rau qhov chaw nyob ntawm koj lub nplaub tshev nrog cov tsev qiv ntawv thiab YOURUSERNAME
STM_COMMON =/tsev/YOURUSERNAME/Embedded/STM32F4-Discovery_FW_V1.1.0
- Kuj txheeb xyuas ntu uas txhua lub tsev qiv ntawv tau txuas nrog. Qhov no tuaj yeem hloov pauv nyob ntawm lub platform uas koj tab tom siv yog li thov txheeb xyuas qhov kev hloov pauv hauv cov ntawv ntoo. Lwm qhov ntxiv uas suav nrog txhua txoj hauv kev rau qee cov ntaub ntawv, zoo li nrog kab tom ntej nrog cov ntawv pib tuaj yeem hloov pauv.
Tom qab koj tau kho txhua yam no hauv Makefile koj tuaj yeem tshawb xyuas yog tias nws ua haujlwm los ntawm qhib lub davhlau ya nyob twg hauv koj phau ntawv teev npe thiab ntaus ntawv: ua. Yog tias nws suav txhua yam uas tsis muaj teeb meem, ces koj tau teeb tsa. Yog tias tsis yog, saib cov ntaub ntawv yuam kev thiab kho Makefile.
Tsis tas li, thaum kuv siv Atom, kuv muab ob daim ntawm cov cai ib sab. Feem ntau main.c thiab Makefile ntawm sab laug raws li koj tsuas xav tau kho Makefile ib zaug thiab cov tsev qiv ntawv ntawm sab xis. Koj tuaj yeem pom ntawm daim duab uas kuv tau qhib lub nplaub tshev uas muaj cov ntaub ntawv.c thiab.h rau txhua lub tsev qiv ntawv. Koj tuaj yeem pom txhua qhov no hauv cov yeeb yaj kiab.
Kauj ruam 4: Tiav lawm
Tam sim no koj muaj koj Makefile teeb tsa thiab muab tso ua ke, koj tuaj yeem siv daim nplaub tshev no rau txhua qhov haujlwm ua tus qauv, yog li nco ntsoov tias koj khaws daim ntawv theej ntawm daim nplaub tshev no.
Tsis tas li koj tuaj yeem sim st-flash thiab st-info cov haujlwm los ntawm kev ntsaws rau hauv koj lub rooj tsav xwm txhim kho thiab ntaus rau hauv davhlau ya nyob twg:
st-info-sojntsuam
Koj tuaj yeem pom lub platform uas stlink software lees paub thiab IC tsev neeg nrog rau cache thiab lwm yam khoom. Koj tuaj yeem ntaus hauv:
st-cov ntaub ntawv
kom pom txhua qhov muaj.
Tam sim no koj tuaj yeem pib lub cajmeem. Hauv cov lus qhia ntxiv thiab vis dis aus, kuv yuav qhia koj qhov pib ntawm GPIO thiab moos. Ob qho no yog qhov pib rau txhua yam ntxiv raws li yuav luag txhua yam uas pawg thawj coj saib xyuas cuam tshuam nrog dhau GPIO thiab txhua yam ua haujlwm ntawm lub moos thiab koj yuav pom tus qauv rau kev ua haujlwm cov txheej txheem no.
Txog thaum ntawd, ua tsaug rau koj tshawb xyuas kuv cov lus qhia thiab kuv li youtube video, yog tias koj tseem tsis tau ua li ntawd.
Pom zoo:
Yuav Ua Li Cas Nruab Linux (Pib Pib Ntawm No!): 6 Cov Kauj Ruam
Yuav Ua Li Cas Nruab Linux (Pib Pib Ntawm No!): Dab tsi yog Linux tiag? Zoo, tus nyeem ntawv zoo, Linux yog lub qhov rooj mus rau lub ntiaj teb ntawm tag nrho cov peev xwm tshiab. Ploj mus yog hnub OSX coj kev lom zem los ntawm kev muaj lub khoos phis tawj. Ploj mus yog cov lus ceeb toom ntawm kev nyab xeeb txawm hais tias Windows 10. Tam sim no, nws yog koj tig
Pib Pib/ NodeMCU ESP8266 ntawm Arduino IDE: 6 Cov Kauj Ruam
Pib Pib/ NodeMCU ESP8266 ntawm Arduino IDE: Txheej txheem cej luam Hauv qhov kev qhia no, koj yuav kawm paub siv NodeMCU ntawm Arduino IDE.What Koj Yuav Kawm Paub Cov ntaub ntawv dav dav txog NodeMCU Yuav ua li cas rau teeb tsa ESP8266 raws cov laug cam ntawm Arduino IDE Yuav ua li cas rau program NodeMCU ntawm Arduino IDE siv
Unboxing ntawm Jetson Nano & Kev Pib Pib sai rau Ob Lub Zeem Muag Demo: 4 Kauj Ruam
Unboxing ntawm Jetson Nano & Kev Pib Pib sai rau Ob Lub Zeem Muag Demo: Cov ntsiab lus Raws li koj paub, Jetson Nano tam sim no yog cov khoom lag luam hnub qub. Thiab nws tuaj yeem nthuav dav siv cov thev naus laus zis thev naus laus zis mus rau cov kab ke. Nov yog kab lus unboxing ntawm cov ntsiab lus ntawm cov khoom, cov txheej txheem kom pib, thiab ob qhov pom qhov pom tseeb … Cov lus suav: 800
Nab hab sej rau Tsis Yog-Pib Pib Pib: 7 Kauj Ruam
Nab hab sej rau Tsis -Yog li Pib Pib: Nyob zoo, zaum kawg, yog tias koj tau mob siab rau, peb tau kov ntawm qhov pib ntawm nab nab - luam tawm, thaum thiab rau loops, nkag & tso tawm, yog, thiab pib ntawm easygui. kuj yog kev faib dawb pub dawb ntawm easygui thiab pycal-kuv tus kheej module.this nyeem yuav suav nrog: ntau dua
Pib Pib Tsim Lub Chaw Saib Xyuas PM: 3 Kauj Ruam (nrog Duab)
Pib Tsim Lub Tsev Saib Xyuas PM: Kuv tshwj xeeb txaus siab rau huab cua huab cua ntau ntau, vim kuv nyob hauv Suav teb thiab thaum kuv lub nroog, Shenzhen, tej zaum yog ib lub nroog huv tshaj plaws hauv Suav teb, nws tseem muaj nws cov hnub tsis zoo.Yog li, kuv xav tsim kuv tus kheej los piv rau ib nrab ntawm kaum ob cua