Cov txheej txheem:

Teeb FreeRTOS Los Ntawm Khaub Ncaws ntawm STM32F407 Cov Khoom Siv Tshawb Pom: 14 Kauj Ruam
Teeb FreeRTOS Los Ntawm Khaub Ncaws ntawm STM32F407 Cov Khoom Siv Tshawb Pom: 14 Kauj Ruam

Video: Teeb FreeRTOS Los Ntawm Khaub Ncaws ntawm STM32F407 Cov Khoom Siv Tshawb Pom: 14 Kauj Ruam

Video: Teeb FreeRTOS Los Ntawm Khaub Ncaws ntawm STM32F407 Cov Khoom Siv Tshawb Pom: 14 Kauj Ruam
Video: 03 Curso de Programación Microcontroladores ARM Cortex M7 | STemWIN PARTE 1 2024, Hlis ntuj nqeg
Anonim
Teeb tsa FreeRTOS Los Ntawm Kos rau ntawm STM32F407 Cov Khoom Siv Tshawb Pom
Teeb tsa FreeRTOS Los Ntawm Kos rau ntawm STM32F407 Cov Khoom Siv Tshawb Pom

Xaiv FreeRTOS raws li Lub Sijhawm Ua Haujlwm tiag tiag rau koj txoj haujlwm kos yog qhov kev xaiv zoo. FreeRTOS yog pub dawb tiag tiag thiab muab ntau yam yooj yim thiab siv tau zoo RTOS nta. Tab sis teeb tsa freeRTOS los ntawm kos tej zaum yuav nyuaj lossis kuv tuaj yeem hais me ntsis tsis meej pem vim nws xav tau qee qhov kev hloov pauv xws li ntxiv Microcontroller cov ntaub ntawv tshwj xeeb, teeb tsa header file paths, thiab lwm yam. Hauv Cov Lus Qhia no, Kuv yuav qhia koj yuav teeb tsa FreeRTOS li cas koj STM32F407 Cov khoom siv tshawb pom kom ntxaws siv Kiel uVision IDE.

Khoom siv

  • Koj tuaj yeem nrhiav paub ntau ntxiv txog FreeRTOS hauv freertos.org
  • FreeRTOS download phau ntawv qhia RTOS Source Code Download Cov Lus Qhia
  • Ua kom tiav cov ntsiab lus ntawm STM32F407 Discovery Kit Pib nrog STM32F407 Discovery KIt
  • Github Repository FreeRTOS ntawm STM32F407 Discovery Kit

Kauj Ruam 1: Qhib Keil UVision IDE

Qhib Keil UVision IDE
Qhib Keil UVision IDE

Qhib Keil uVision IDE. Nyem rau ntawm qhov project xaiv New uVision Project… Tom qab ntawv xaiv koj cov npe ua haujlwm thiab muab koj lub npe nyiam dua.

Kauj ruam 2: Xaiv Tus Ntaus

Xaiv Cov Ntaus
Xaiv Cov Ntaus

Thaum koj tau muab lub npe rau txoj haujlwm, hauv cov kauj ruam tom ntej koj yuav tsum tau ntxiv cov cuab yeej. Ntawm no peb tab tom ntxiv STM32F407VG Micronconroller los ntawm STMicroelectronics. Xaiv STM32F407VG, tom qab ntawv nyem OK.

Kauj Ruam 3: Tswj Sijhawm Ib puag ncig

Tswj Khiav Sijhawm Ib puag ncig
Tswj Khiav Sijhawm Ib puag ncig

Cov kauj ruam tom ntej yog xaiv lub tsev qiv ntawv/tus neeg tsav tsheb tiv thaiv hauv Kev Tswj Lub Sijhawm Ib puag ncig Tab. Ntawm no xaiv txhua ntu raws li qhia hauv daim duab saum toj no. Thaum koj txheeb xyuas txhua qhov chaw tsim nyog Nyem Resolve ces Nyem OK.

Kauj Ruam 4: Luam FreeRTOS rau hauv Koj Daim Ntawv Teev Npe

Luam FreeRTOS rau hauv koj li Project Folder
Luam FreeRTOS rau hauv koj li Project Folder

Tam sim no koj yuav tsum theej tag nrho FreeRTOS nplaub tshev rau hauv koj cov ntawv tais ceev tseg.

Kauj Ruam 5: Ntxiv Cov Ntaub Ntawv FreeRTOS rau Project

Ntxiv FreeRTOS Cov Ntaub Ntawv rau Txoj Haujlwm
Ntxiv FreeRTOS Cov Ntaub Ntawv rau Txoj Haujlwm

Thaum koj tau theej FreeRTOS nplaub tshev hauv koj daim nplaub tshev qhov project, koj yuav tsum ntxiv txhua qhov tsim nyog FreeRTOS cov ntaub ntawv rau koj Txoj Haujlwm.

  1. Hauv Keil, Xaiv Lub Hom Phiaj 1, nyem rau sab xis thiab xaiv Ntxiv pab pawg tshiab. Hloov npe pab pawg no ua FreeRTOS.
  2. Tam sim no Nyem rau ntawm FreeRTOS pab pawg, txoj cai-nyem qhov xaiv Ntxiv Cov Ntaub Ntawv Tseem Ceeb rau Pab Pawg "FreeRTOS …"
  3. Ntxiv tag nrho FreeRTOS cov ntaub ntawv raws li qhia hauv daim duab saum toj no.

Txoj hauv kev kom pom cov ntaub ntawv no hauv FreeRTOS nplaub tshev yog:

  • Cov ntaub ntawv: croutine, event_groups, npe, kab, stream_buffer, ua haujlwm thiab timers. Txoj kev: (…. / FreeRTOSv10.2.1 / FreeRTOS / Source)
  • Cov ntaub ntawv: heap_4 (Muaj 4 lub cim xeeb tswj cov ntaub ntawv ntxiv rau leej twg). Txoj kev: (…. / FreeRTOSv10.2.1 / FreeRTOS / Source / portable / MemMang)
  • Cov ntaub ntawv: port.c (Nov yog MCU cov ntaub ntawv tshwj xeeb). Txoj kev: (… / FreeRTOSv10.2.1 / FreeRTOS / Source / portable / RVDS / ARM_CM4F)

Nco tseg: FreeRTOS version tuaj yeem hloov pauv. Tsuas yog siv qhov tseeb version muaj.

Kauj Ruam 6: Txhim Kho Txoj Kev ntawm FreeRTOS Header Files

Kho txoj hauv kev ntawm FreeRTOS Header Files
Kho txoj hauv kev ntawm FreeRTOS Header Files

Thaum koj tau ntxiv cov ntaub ntawv FreeRTOS, koj yuav tsum qhia rau tus neeg sib tham qhov twg cov ntaub ntawv header nyob qhov twg. Yog li peb yuav tsum teeb tsa qhov kev xaiv ua tus tsim khoom.

Txoj cai Nyem rau ntawm Target1 Kev Xaiv rau Hom Phiaj "Target1.." C/C ++ Xws li txoj hauv kev. Nco ntsoov tias koj suav nrog cov kev no:

  1. Xws li cov nplaub tshev hauv FreeRTOS (… / FreeRTOSv10.2.1 / FreeRTOS / Source / suav nrog)
  2. RVDS directory (… / FreeRTOSv10.2.1 / FreeRTOS / Source / portable / RVDS / ARM_CM4F)

Nco tseg: Yog tias koj muaj cov ntaub ntawv header, xyuas kom tseeb tias koj suav nrog txoj hauv kev ntawm cov ntaub ntawv no raws li tau piav qhia saum toj no.

Kauj Ruam 7: Ntxiv "FreeRTOSConfig.h" Cov Ntaub Ntawv rau Project

Ntxiv
Ntxiv

FreeRTOS muaj ib daim ntawv tseem ceeb lub npe hu ua FreeRTOSConfig.h. Cov ntaub ntawv no muaj cov ntawv thov tshwj xeeb (hauv peb cov ntaub ntawv tshwj xeeb rau Cortex M4F MCU) kev kho kom haum. Txhawm rau kom yooj yim, Kuv tau theej peb MCU qhov tshwj xeeb FreeRTOSConfig.h cov ntaub ntawv hauv RVDS cov npe. Thiab tseem nyob hauv qib 6, peb twb tau ntxiv txoj hauv kev RVDS. Yog tias koj tau ntxiv nws koj tus kheej ces Koj yuav tsum ntxiv cov ntawv no hauv koj qhov haujlwm thiab tseem ua kom ntseeg tau tias koj suav nrog txoj hauv kev ntawm cov ntawv no raws li tau piav qhia hauv qib 6.

Txawm li cas los xij yog tias koj xav ntxiv FreeRTOSConfig.h cov ntaub ntawv los ntawm koj tus kheej hauv koj cov npe nyiam, Kuv tau suav nrog cov ntawv hauv qab no.

Yog xav paub ntxiv Nyem qhov no FreeRTOSConfig.h

Kauj Ruam 8: Ntxiv cov "main.c" Cov Ntaub Ntawv Nrog Cov Qauv Yooj Yim

Ntxiv rau
Ntxiv rau
  • Tam sim no Tsim Tus Neeg Siv Tshiab (Kuv tau hloov nws mus rau "Tus neeg siv daim ntawv thov").
  • Ntxiv C-file tshiab rau Pawg no (Kuv tau ntxiv cov ntawv hu ua main.c).
  • Nov yog cov ntaub ntawv uas muaj lub luag haujlwm tseem ceeb () muaj nyob. Kuv tau suav nrog txhua qhov kev xav tau yam tsawg kawg nkaus thiab lub taub hau rau hauv cov ntaub ntawv no kom qhov phiaj xwm ua tiav ua ke.

Koj tuaj yeem pom cov ntaub ntawv main.c nrog cov qauv yooj yim hauv qab no.

Kauj Ruam 9: Txuas Koj Cov Khoom Siv STM32F407 rau Koj Lub PC/Laptop

Txuas Koj STM32F407 Cov Khoom Siv Tshawb Nrhiav rau Koj Lub PC/Laptop
Txuas Koj STM32F407 Cov Khoom Siv Tshawb Nrhiav rau Koj Lub PC/Laptop

Kauj ruam 10: Xaiv ST-Txuas Debugger hauv Compiler Configuration

Xaiv ST-Txuas Debugger hauv Compiler Configuration
Xaiv ST-Txuas Debugger hauv Compiler Configuration

Txoj nyem rau ntawm Target1, tom qab ntawd nyem rau ntawm Kev Xaiv rau Hom Phiaj "Target1..", tom qab ntawd mus rau Debug Tab thiab Xaiv ST-Txuas-Debugger raws li qhia hauv daim duab saum toj no

Kauj ruam 11: Kho ST-Txuas Debugger

Configure ST-Txuas Debugger
Configure ST-Txuas Debugger

Tom qab xaiv ST-Txuas Debugger hauv qib 10, nyem rau ntawm qhov chaw ces xaiv Lw thiab kos rau txhua qhov chaw raws li qhia hauv daim duab saum toj no.

Kauj Ruam 12: Tsim thiab Tshaj Tawm Txoj Cai

Tsim thiab Upload Txoj Cai
Tsim thiab Upload Txoj Cai

Tom qab ua tiav txhua cov kauj ruam tsim txoj haujlwm thiab xyuas kom tsis muaj qhov yuam kev hauv cov cai. Tom qab ua tiav kev sau ua ke, xa cov cai rau koj li Discovery Kit.

Kauj Ruam 13: Mus rau Debug Window thiab Qhib Serial Monitor

Mus rau Debug Window thiab Qhib Serial Monitor
Mus rau Debug Window thiab Qhib Serial Monitor

Tom qab rub tawm mus rau debug windowviewSerial WindowsDebug (printf) Viewer raws li pom hauv daim duab saum toj no.

Kauj Ruam 14: Khiav Txoj Cai kom pom Ouput ntawm Debug Printf Window

Khiav Txoj Cai kom pom Ouput ntawm Debug Printf Window
Khiav Txoj Cai kom pom Ouput ntawm Debug Printf Window

Kauj ruam Kawg yog khiav cov cai raws li qhia hauv daim duab kom pom cov zis hauv lub qhov rais printf. Ntawm no hauv main.c Kuv tau siv 2 txoj haujlwm yooj yim hu ua task1 thiab task2. Ob txoj haujlwm muaj qhov tseem ceeb ib yam thiab lawv tsuas yog sau lub npe ntawm txoj haujlwm. Vim yog qhov muaj feem thib ib uas koj tuaj yeem pom ob leeg ua haujlwm thiab luam tawm lub npe.

Pom zoo: