|
楼主 |
发表于 2014-12-19 10:31:51
|
显示全部楼层
这是一个ucos-III的程序,我找到的最后的问题是因为堆栈溢出,堆栈溢出的时候是没事的,后面运行着才有事,我把附件上传上来,你帮忙看下,会的人实在不多,请帮忙下,特别是过程。
Task_Start这个任务堆栈溢出。
溢出语句是图中这个,楼主位说的是开启没有优化的时候测的。
想上传工程可是太大了。我把跑飞的那段代码放上来吧
- OS_MSG_QTY OS_MsgQFreeAll (OS_MSG_Q *p_msg_q)
- {
- OS_MSG *p_msg;
- OS_MSG_QTY qty;
- qty = p_msg_q->NbrEntries; /* Get the number of OS_MSGs being freed */
- if (p_msg_q->NbrEntries > (OS_MSG_QTY)0) {
- p_msg = p_msg_q->InPtr; /* Point to end of message chain */
- p_msg->NextPtr = OSMsgPool.NextPtr;
- OSMsgPool.NextPtr = p_msg_q->OutPtr; /* Point to beginning of message chain */
- OSMsgPool.NbrUsed -= p_msg_q->NbrEntries; /* Update statistics for free list of messages */
- OSMsgPool.NbrFree += p_msg_q->NbrEntries;
- p_msg_q->NbrEntries = (OS_MSG_QTY)0; /* Flush the message queue */
- p_msg_q->NbrEntriesMax = (OS_MSG_QTY)0;
- p_msg_q->InPtr = (OS_MSG *)0;
- p_msg_q->OutPtr = (OS_MSG *)0;
- }
- return (qty);
- }
复制代码 单独放出来就是下面这句
- OSMsgPool.NbrUsed -= p_msg_q->NbrEntries; /* Update statistics for free list of messages */
复制代码 下面是对应的汇编,死在0x0800302C
- 237: qty = p_msg_q->NbrEntries; /* Get the number of OS_MSGs being freed */
- 238: if (p_msg_q->NbrEntries > (OS_MSG_QTY)0) {
- 239: p_msg = p_msg_q->InPtr; /* Point to end of message chain */
- 0x08003018 8941 LDRH r1,[r0,#0x0A]
- 231: {
- 232: OS_MSG *p_msg;
- 233: OS_MSG_QTY qty;
- 234:
- 235:
- 236:
- 237: qty = p_msg_q->NbrEntries; /* Get the number of OS_MSGs being freed */
- 238: if (p_msg_q->NbrEntries > (OS_MSG_QTY)0) {
- 239: p_msg = p_msg_q->InPtr; /* Point to end of message chain */
- 0x0800301A B1B9 CBZ r1,0x0800304C
- 240: p_msg->NextPtr = OSMsgPool.NextPtr;
- 0x0800301C 4B52 LDR r3,[pc,#328] ; @0x08003168
- 0x0800301E 6802 LDR r2,[r0,#0x00]
- 0x08003020 F8D3C000 LDR r12,[r3,#0x00]
复制代码
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|