硬汉嵌入式论坛

 找回密码
 立即注册
查看: 1623|回复: 4
收起左侧

[FreeRTOS] STM32CubeMX配置FreeRTOS任务优先级问题

[复制链接]

26

主题

41

回帖

119

积分

初级会员

积分
119
发表于 2024-7-2 10:24:30 | 显示全部楼层 |阅读模式



用STM32CubeMX 配置CMSIS-RTOS V1版本的FreeRTOS,发现任务优先级设置里面,只有7个优先级,即使在“Config parameters”里把MAX_PRIORITIES设置为大于7, 在创建任务时也只有7个选项。
这7个选项分别是:
osPriorityIdle,osPriorityLow,osPriorityBelowNormal,osPriorityNormal,osPriorityAboveNormal,osPriorityHigh,osPriorityRealtime

这种描述让人看着非常懵,为什么不用FreeRTOS原生的数字表示不同优先级呢,而且这几个优先级和FreeRTOS怎么对应起来的也不清楚,如果我要设置超过7个优先级,又该如何设置?

谁能解释下啊


回复

使用道具 举报

2

主题

10

回帖

16

积分

新手上路

积分
16
发表于 2024-7-2 13:53:48 | 显示全部楼层
代码里面go to definiton 能找到对应优先级的数字

cubemX可以设置优先级最大值 但是这好像设置不了,你看看你的行不行
回复

使用道具 举报

33

主题

188

回帖

287

积分

高级会员

积分
287
发表于 2024-7-2 14:32:10 | 显示全部楼层
用的V2
QQ截图20240702143119.png

回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
115454
QQ
发表于 2024-7-3 10:46:44 | 显示全部楼层
osPriorityIdle,osPriorityLow,osPriorityBelowNormal,osPriorityNormal,osPriorityAboveNormal,osPriorityHigh,osPriorityRealtime的大小就是实际数值大小
回复

使用道具 举报

44

主题

230

回帖

362

积分

高级会员

积分
362
发表于 2024-7-6 19:46:09 | 显示全部楼层
不用管,这都是为了兼容设计,免费的就不要纠结了。倒是V2的好像没有使用专门为arm设计的切换寄存器功能,就是CLZ这个功能。
USE_PORT_OPTIMISED_TASK_SELECTION USE_PORT_OPTIMISED_TASK_SELECTION Parameter Description: Some FreeRTOS ports have two methods of selecting the next task to execute - a generic method, and a method that is specific to that port. The Generic method: - Is used when configUSE_PORT_OPTIMISED_TASK_SELECTION is set to 0, or when a port specific method is not implemented. - Can be used with all FreeRTOS ports. - Is completely written in C, making it less efficient than a port specific method. - Does not impose a limit on the maximum number of available priorities. A port specific method: - Is not available for all ports. - Is used when configUSE_PORT_OPTIMISED_TASK_SELECTION is set to 1. - Relies on one or more architecture specific assembly instructions (typically a Count Leading Zeros [CLZ] of equivalent instruction) so can only be used with the architecture for which it was specifically written. - Is more efficient than the generic method. - Typically imposes a limit of 32 on the maximum number of available priorities. Warning:  Forced to 1 (Enabled) since FreeRTOS v9 support.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2025-4-26 14:04 , Processed in 0.275035 second(s), 28 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表