Journal of Computer Applications

• Typical applications • Previous Articles     Next Articles

Method of calculating stack space of μC/OS-II task based on tree structure and its application

Guang-jian ZHANG Zheng LIU   

  • Received:2008-10-27 Revised:1900-01-01 Online:2009-04-01 Published:2009-04-01
  • Contact: Guang-jian ZHANG

基于树结构的μC/OS-II任务栈空间计算方法及应用

张光建 刘政   

  1. 重庆工学院 重庆工学院
  • 通讯作者: 张光建

Abstract: Aiming at the problem that the stack space size of μC/OS-II task is not easily confirmed by existing ways, this paper presented a new way by which the stack space size of μC/OS-II task can be computed based on tree structure. Firstly, the stack space structure of μC/OS-II task was analyzed. Secondly, some tree structures that can show the extreme usage of the stack space were defined. Lastly, the formula that can calculate the stack space which is maximal was presented based on tree structure and the stack space of a real system was calculated by the formula. The stack space size which is calculated by this way can reflect the extreme usage of a stack space factually and can reduce the requirement for RAM.

Key words: tree structure, μC/OS-II, task, stack space, function, interrupt nesting

摘要: 针对用现有方法较难确定μC/OS-II任务栈空间大小的问题,提出了基于树结构计算μC/OS-II任务栈空间的方法。分析了任务栈空间结构,定义了能够表示栈空间最坏使用情况的树结构,提出了用树结构计算最坏情况下栈空间的计算公式,并计算了一个实际系统的栈空间。用该方法确定的任务栈空间能够准确地反映任务栈空间的最坏使用情况,同时还能够节约内存的使用。

关键词: 树结构, μC/OS-II, 任务, 栈空间, 函数, 中断嵌套

CLC Number: