Skip to content

FreeRTOS

官网

文件中只保留E:\a学习\9.myOC\FreeRTOS\FreeRTOSv202212.01\FreeRTOS\Demo文件夹下面的CORTEX_STM32F103_Keil, 其他的文件暂时用不到

source文件是核心文件

image-20230620001237465

只保留以上的文件, 之后打开项目

image-20230620001249646

image-20230620001510156

之后编译文件, 选择用keil5进行格式转换

*** Using Compiler 'V5.06 update 5 (build 528)', folder: 'D:\kiel5\ARM\ARMCC\Bin'
Build target 'Target 1'
assembling cortexm3_macro_rvds.s...
cortexm3_macro_rvds.s: error: A1023E: File "..\Common\drivers\ST\STM32F10xFWLib\src\cortexm3_macro_rvds.s" could not be opened: No such file or directory
compiling semtest.c...
"no source": Error:  #5: cannot open source input file "..\Common\Minimal\semtest.c": No such file or directory
..\Common\Minimal\semtest.c: 0 warnings, 1 error
compiling death.c...
"no source": Error:  #5: cannot open source input file "..\Common\Minimal\death.c": No such file or directory
..\Common\Minimal\death.c: 0 warnings, 1 error
compiling blocktim.c...
"no source": Error:  #5: cannot open source input file "..\Common\Minimal\blocktim.c": No such file or directory
..\Common\Minimal\blocktim.c: 0 warnings, 1 error
compiling lcd.c...
"no source": Error:  #5: cannot open source input file "..\Common\drivers\ST\STM32F10xFWLib\src\lcd.c": No such file or directory
..\Common\drivers\ST\STM32F10xFWLib\src\lcd.c: 0 warnings, 1 error
compiling comtest.c...
"no source": Error:  #5: cannot open source input file "..\Common\Minimal\comtest.c": No such file or directory
..\Common\Minimal\comtest.c: 0 warnings, 1 error
compiling flash.c...
"no source": Error:  #5: cannot open source input file "..\Common\Minimal\flash.c": No such file or directory
..\Common\Minimal\flash.c: 0 warnings, 1 error
compiling BlockQ.c...
"no source": Error:  #5: cannot open source input file "..\Common\Minimal\BlockQ.c": No such file or directory
..\Common\Minimal\BlockQ.c: 0 warnings, 1 error
compiling integer.c...
"no source": Error:  #5: cannot open source input file "..\Common\Minimal\integer.c": No such file or directory
..\Common\Minimal\integer.c: 0 warnings, 1 error
compiling ParTest.c...
ParTest\ParTest.c(35): error:  #5: cannot open source input file "partest.h": No such file or directory
  #include "partest.h"
ParTest\ParTest.c: 0 warnings, 1 error
compiling serial.c...
serial\serial.c(41): error:  #5: cannot open source input file "serial.h": No such file or directory
  #include "serial.h"
serial\serial.c: 0 warnings, 1 error
compiling PollQ.c...
"no source": Error:  #5: cannot open source input file "..\Common\Minimal\PollQ.c": No such file or directory
..\Common\Minimal\PollQ.c: 0 warnings, 1 error
compiling main.c...
main.c(74): error:  #5: cannot open source input file "BlockQ.h": No such file or directory
  #include "BlockQ.h"
main.c: 0 warnings, 1 error
".\RTOSDemo.axf" - 4 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed:  00:00:04

发现Common目录不能少, 重新添加

原有的文件是在lcd上面打印文字, 但是没有配套的板子

目录分析

  • Demo是一系列的工程文件

下面是各种芯片的项目文件

  • source是核心文件, 事件组, 链表, 队列, stream buff, 任务, 定时器

image-20230621195959158

portable是可移植文件, 顶层目录是各种编译器, keil下面显示看RVDS, RVDS下面是各种架构

编程规范

image-20230621201125341

后面的变量经常作为返回值

这个文件在source/portable/ARM_CM3

  • 变量名:

image-20230621201532751

  • 函数名

返回值类型 + 实现的文件名 + 函数的功能

prv表示私有函数

image-20230621201917146

  • 宏的名字

image-20230621202018243

小写代表的是文件名字

image-20230621202040119