下载RTOS
下载地址:https://sourceforge.net/projects/freertos/files/FreeRTOS/V9.0.0/
版本:V9.0.0

Source文件夹如下图所示:

除了portable文件夹外的文件是FreeRTOS的共用文件。
portable文件夹内容如下所示:

文件夹中包含了诸多编译器,我们选择GCC编译器,在GCC编译器中由包含了诸多处理器架构,我们使用的MCU型号为STM32F767IG6T,内核架构为ARM_CM7,选择这个文件夹。
Readme内容
There are two options for running FreeRTOS on ARM Cortex-M7 microcontrollers.
The best option depends on the revision of the ARM Cortex-M7 core in use. The
revision is specified by an 'r' number, and a 'p' number, so will look something
like 'r0p1'. Check the documentation for the microcontroller in use to find the
revision of the Cortex-M7 core used in that microcontroller. If in doubt, use
the FreeRTOS port provided specifically for r0p1 revisions, as that can be used
with all core revisions.The first option is to use the ARM Cortex-M4F port, and the second option is to
use the Cortex-M7 r0p1 port - the latter containing a minor errata workaround.If the revision of the ARM Cortex-M7 core is not r0p1 then either option can be
used, but it is recommended to use the FreeRTOS ARM Cortex-M4F port located in
the /FreeRTOS/Source/portable/GCC/ARM_CM4F directory.If the revision of the ARM Cortex-M7 core is r0p1 then use the FreeRTOS ARM
Cortex-M7 r0p1 port located in the /FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1
directory.
文件夹 r0p1中有两个文件:
在portable文件夹中,有一个非常重要的MemMang文件夹,该文件夹存放与内存管理相关c文件,内容如下:

每次创建任务、队列、互斥锁、软件定时器、信号量或事件组时,RTOS 内核都需要 RAM , RAM 可以 可以从 RTOS API 对象创建函数内的 RTOS 堆自动动态分配, 或者由应用程序编写者提供。
FreeRTOS 下载包含五个内存分配实现示例, 以下各小节描述了每个实现示例。 这些小节还介绍了 所提供的每个实现方式何时选择可能最合适 。每个提供的实现都包含在单独的源文件中 (分别是 heap_1.c、 heap_2.c、heap_3.c、heap_4.c 和 heap_5.c), 位于主 RTOS 源代码下载内容的** Source/Portable/MemMang **目录下。 可根据需要添加其他实现方式。 每次一个项目中, 只应包含其中一个源文件[这些可移植层函数定义的堆 将由 RTOS 内核使用, 即使使用 RTOS 的应用程序选择使用自己的堆实现]。
以下是:
注意:
一般选用heap_4方式。
该文件夹中有各种Demo文件,内容如下:

ST实例以 CORTEX开头
略
接上节博客:https://blog.guoxiaozhong.cn/archives/1707829263795
重新打开STM32CubeMX工具

勾选FREERTOS

CMSIS_V1和CMSIS_V2版本主要的区别在于,CMSIS_V2兼容支持的硬件更多,内存耗费更多;对于常见的Cortex-M3、M4、M7芯片,选择V1即可。
在使用FreeRTOS时,必须为HAL设置一个非SysTick定时器作为HAL的基础时钟,SysTick将自动作为FreeRTOS的基础时钟。
选择TIM6作为HAL库的基础时钟
如下图所示:

如下图所示,可以配置的数据项有:



如下图:

编译时会出现一个错误,
Error: selected FPU does not support instruction
解决方法:
在cmakelist.txt取消注释以下代码:
add_compile_definitions(ARM_MATH_CM4;ARM_MATH_MATRIX_CHECK;ARM_MATH_ROUNDING)
add_compile_options(-mfloat-abi=hard -mfpu=fpv4-sp-d16)
add_link_options(-mfloat-abi=hard -mfpu=fpv4-sp-d16)