硬汉嵌入式论坛

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

[CMSIS-RTOS] 求教osThreadDef()函数中,osPriorityNormal 和stack size值得确定?

[复制链接]

14

主题

28

回帖

70

积分

初级会员

积分
70
QQ
发表于 2017-7-19 15:40:35 | 显示全部楼层 |阅读模式
osThreadDef(thread1, osPriorityNormal, 1, 0); //thread definition structure


The thread structure requires us to define the name of the thread function, its
thread priority, the number of instances of the thread that will be created, and its
stack size. We will look at these parameters in more detail later. Once the thread
structure has been defined the thread can be created using the osThreadCreate()
API call. Then the thread is created from within the application code, this is often
the within the main thread but can be at any point in the code.


请问,这个the number of instances of the thread是指什么?stack size ?
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106997
QQ
发表于 2017-7-19 16:05:11 | 显示全部楼层
还没有顾上研究MDK5中的CMSIS-RTOS RTX,说下我的理解吧,基于RTX的。


the number of instances of the thread   这个应该是任务的例化,即多个任务都是运行的同一个任务函数,RTX有这个功能,具体你这个实际测试下。

stack size是任务栈大小。
回复

使用道具 举报

14

主题

28

回帖

70

积分

初级会员

积分
70
QQ
 楼主| 发表于 2017-7-19 16:25:17 | 显示全部楼层
the number of instances of the thread,是指多个线程都调用的函数数量吗?
stack size 大小怎么确定呢?
学习的时候,给main函数栈溢出,最后给设置更大值
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106997
QQ
发表于 2017-7-19 16:29:09 | 显示全部楼层

回 xhuaihe 的帖子

xhuaihe:the number of instances of the thread,是指多个线程都调用的函数数量吗?
stack size 大小怎么确定呢?
学习的时候,给main函数栈溢出,最后给设置更大值 (2017-07-19 16:25) 
1. 对这个很少用,一般都是创建1个。需要多少个都单独创建。

2. CMSIS-RTOS也有个调试组件的,MDK进入调试状态可以查看,跟早前的RTX使用方法一样,可以查看任务堆栈使用情况。
回复

使用道具 举报

14

主题

28

回帖

70

积分

初级会员

积分
70
QQ
 楼主| 发表于 2017-7-19 16:38:32 | 显示全部楼层
嗯嗯,我也是调试的时候发现栈溢出,然后调大了main函数的栈大小。还在学习,大神有没有推荐的书籍呢
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106997
QQ
发表于 2017-7-19 16:51:48 | 显示全部楼层

回 xhuaihe 的帖子

xhuaihe:嗯嗯,我也是调试的时候发现栈溢出,然后调大了main函数的栈大小。还在学习,大神有没有推荐的书籍呢 (2017-07-19 16:38) 
这个没有书籍,得自学,看官方的help文档就够了。
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-13 18:35 , Processed in 0.287966 second(s), 25 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

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