硬汉嵌入式论坛

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

[μCOS-III] uCOS-III的全局变量关键信息,方便RTOS Trace功能检索

[复制链接]

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
107028
QQ
发表于 2022-8-27 11:07:47 | 显示全部楼层 |阅读模式

最近在开发TOOL的RTOS Trace功能,锁定下这些关键全局变量。

[C] 纯文本查看 复制代码
/*
************************************************************************************************************************
************************************************************************************************************************
*                                           G L O B A L   V A R I A B L E S
************************************************************************************************************************
************************************************************************************************************************
*/
                                                                        /* APPLICATION HOOKS ------------------------ */
#if (OS_CFG_APP_HOOKS_EN > 0u)
#if (OS_CFG_TASK_STK_REDZONE_EN > 0u)
OS_EXT           OS_APP_HOOK_TCB            OS_AppRedzoneHitHookPtr;
#endif
OS_EXT           OS_APP_HOOK_TCB            OS_AppTaskCreateHookPtr;
OS_EXT           OS_APP_HOOK_TCB            OS_AppTaskDelHookPtr;
OS_EXT           OS_APP_HOOK_TCB            OS_AppTaskReturnHookPtr;

OS_EXT           OS_APP_HOOK_VOID           OS_AppIdleTaskHookPtr;
OS_EXT           OS_APP_HOOK_VOID           OS_AppStatTaskHookPtr;
OS_EXT           OS_APP_HOOK_VOID           OS_AppTaskSwHookPtr;
OS_EXT           OS_APP_HOOK_VOID           OS_AppTimeTickHookPtr;
#endif

                                                                        /* IDLE TASK -------------------------------- */
#if (OS_CFG_DBG_EN > 0u)
OS_EXT            OS_IDLE_CTR               OSIdleTaskCtr;
#endif
#if (OS_CFG_TASK_IDLE_EN > 0u)
OS_EXT            OS_TCB                    OSIdleTaskTCB;
#endif

                                                                        /* MISCELLANEOUS ---------------------------- */
OS_EXT            OS_NESTING_CTR            OSIntNestingCtr;            /* Interrupt nesting level                    */
#ifdef CPU_CFG_INT_DIS_MEAS_EN
#if (OS_CFG_TS_EN > 0u)
OS_EXT            CPU_TS                    OSIntDisTimeMax;            /* Overall interrupt disable time             */
#endif
#endif

OS_EXT            OS_STATE                  OSRunning;                  /* Flag indicating the kernel is running      */
OS_EXT            OS_STATE                  OSInitialized;              /* Flag indicating the kernel is initialized  */

#if (OS_CFG_STAT_TASK_STK_CHK_EN > 0u) && (OS_CFG_ISR_STK_SIZE > 0u)
OS_EXT            CPU_INT32U                OSISRStkFree;               /* Number of free ISR stack entries           */
OS_EXT            CPU_INT32U                OSISRStkUsed;               /* Number of used ISR stack entries           */
#endif

                                                                        /* FLAGS ------------------------------------ */
#if (OS_CFG_FLAG_EN > 0u)
#if (OS_CFG_DBG_EN  > 0u)
OS_EXT            OS_FLAG_GRP              *OSFlagDbgListPtr;
OS_EXT            OS_OBJ_QTY                OSFlagQty;
#endif
#endif

                                                                        /* MEMORY MANAGEMENT ------------------------ */
#if (OS_CFG_MEM_EN > 0u)
#if (OS_CFG_DBG_EN > 0u)
OS_EXT            OS_MEM                   *OSMemDbgListPtr;
OS_EXT            OS_OBJ_QTY                OSMemQty;                   /* Number of memory partitions created        */
#endif
#endif

                                                                        /* OS_MSG POOL ------------------------------ */
#if (OS_MSG_EN > 0u)
OS_EXT            OS_MSG_POOL               OSMsgPool;                  /* Pool of OS_MSG                             */
#endif

                                                                        /* MUTEX MANAGEMENT ------------------------- */
#if (OS_CFG_MUTEX_EN > 0u)
#if (OS_CFG_DBG_EN > 0u)
OS_EXT            OS_MUTEX                 *OSMutexDbgListPtr;
OS_EXT            OS_OBJ_QTY                OSMutexQty;                 /* Number of mutexes created                  */
#endif
#endif

                                                                        /* PRIORITIES ------------------------------- */
OS_EXT            OS_PRIO                   OSPrioCur;                  /* Priority of current task                   */
OS_EXT            OS_PRIO                   OSPrioHighRdy;              /* Priority of highest priority task          */
OS_EXT            CPU_DATA                  OSPrioTbl[OS_PRIO_TBL_SIZE];

                                                                        /* QUEUES ----------------------------------- */
#if (OS_CFG_Q_EN > 0u)
#if (OS_CFG_DBG_EN > 0u)
OS_EXT            OS_Q                     *OSQDbgListPtr;
OS_EXT            OS_OBJ_QTY                OSQQty;                     /* Number of message queues created           */
#endif
#endif



                                                                        /* READY LIST ------------------------------- */
OS_EXT            OS_RDY_LIST               OSRdyList[OS_CFG_PRIO_MAX]; /* Table of tasks ready to run                */


#ifdef OS_SAFETY_CRITICAL_IEC61508
OS_EXT            CPU_BOOLEAN               OSSafetyCriticalStartFlag;  /* Flag indicating that all init. done        */
#endif
                                                                        /* SCHEDULER -------------------------------- */
#if (OS_CFG_SCHED_LOCK_TIME_MEAS_EN > 0u)
OS_EXT            CPU_TS_TMR                OSSchedLockTimeBegin;       /* Scheduler lock time measurement            */
OS_EXT            CPU_TS_TMR                OSSchedLockTimeMax;
OS_EXT            CPU_TS_TMR                OSSchedLockTimeMaxCur;
#endif

OS_EXT            OS_NESTING_CTR            OSSchedLockNestingCtr;      /* Lock nesting level                         */
#if (OS_CFG_SCHED_ROUND_ROBIN_EN > 0u)
OS_EXT            OS_TICK                   OSSchedRoundRobinDfltTimeQuanta;
OS_EXT            CPU_BOOLEAN               OSSchedRoundRobinEn;        /* Enable/Disable round-robin scheduling      */
#endif
                                                                        /* SEMAPHORES ------------------------------- */
#if (OS_CFG_SEM_EN > 0u)
#if (OS_CFG_DBG_EN > 0u)
OS_EXT            OS_SEM                   *OSSemDbgListPtr;
OS_EXT            OS_OBJ_QTY                OSSemQty;                   /* Number of semaphores created               */
#endif
#endif

                                                                        /* STATISTICS ------------------------------- */
#if (OS_CFG_STAT_TASK_EN > 0u)
OS_EXT            CPU_BOOLEAN               OSStatResetFlag;            /* Force the reset of the computed statistics */
OS_EXT            OS_CPU_USAGE              OSStatTaskCPUUsage;         /* CPU Usage in %                             */
OS_EXT            OS_CPU_USAGE              OSStatTaskCPUUsageMax;      /* CPU Usage in % (Peak)                      */
OS_EXT            OS_TICK                   OSStatTaskCtr;
OS_EXT            OS_TICK                   OSStatTaskCtrMax;
OS_EXT            OS_TICK                   OSStatTaskCtrRun;
OS_EXT            CPU_BOOLEAN               OSStatTaskRdy;
OS_EXT            OS_TCB                    OSStatTaskTCB;
#if (OS_CFG_TS_EN > 0u)
OS_EXT            CPU_TS                    OSStatTaskTime;
OS_EXT            CPU_TS                    OSStatTaskTimeMax;
#endif
#endif

                                                                        /* TASKS ------------------------------------ */
#if ((OS_CFG_TASK_PROFILE_EN > 0u) || (OS_CFG_DBG_EN > 0u))
OS_EXT            OS_CTX_SW_CTR             OSTaskCtxSwCtr;             /* Number of context switches                 */
#if (OS_CFG_DBG_EN > 0u)
OS_EXT            OS_TCB                   *OSTaskDbgListPtr;
#endif
#endif

OS_EXT            OS_OBJ_QTY                OSTaskQty;                  /* Number of tasks created                    */

#if (OS_CFG_TASK_REG_TBL_SIZE > 0u)
OS_EXT            OS_REG_ID                 OSTaskRegNextAvailID;       /* Next available Task Register ID            */
#endif

                                                                        /* TICK ------------------------------------- */
#if (OS_CFG_TICK_EN > 0u)
OS_EXT            OS_TICK                   OSTickCtr;                  /* Cnts the #ticks since startup or last set  */
#if (OS_CFG_DYN_TICK_EN > 0u)
OS_EXT            OS_TICK                   OSTickCtrStep;              /* Number of ticks to the next tick task call.*/
#endif
OS_EXT            OS_TICK_LIST              OSTickList;
#if (OS_CFG_TS_EN > 0u)
OS_EXT            CPU_TS                    OSTickTime;
OS_EXT            CPU_TS                    OSTickTimeMax;
#endif
#endif



#if (OS_CFG_TMR_EN > 0u)                                                /* TIMERS ----------------------------------- */
#if (OS_CFG_DBG_EN > 0u)
OS_EXT            OS_TMR                   *OSTmrDbgListPtr;
OS_EXT            OS_OBJ_QTY                OSTmrListEntries;           /* Doubly-linked list of timers               */
#endif
OS_EXT            OS_TMR                   *OSTmrListPtr;
OS_EXT            OS_COND                   OSTmrCond;
OS_EXT            OS_MUTEX                  OSTmrMutex;

#if (OS_CFG_DBG_EN > 0u)
OS_EXT            OS_OBJ_QTY                OSTmrQty;                   /* Number of timers created                   */
#endif
OS_EXT            OS_TCB                    OSTmrTaskTCB;               /* TCB of timer task                          */
#if (OS_CFG_TS_EN > 0u)
OS_EXT            CPU_TS                    OSTmrTaskTime;
OS_EXT            CPU_TS                    OSTmrTaskTimeMax;
#endif
OS_EXT            OS_TICK                   OSTmrTaskTickBase;          /* Tick to which timer delays are relative    */
OS_EXT            OS_TICK                   OSTmrToTicksMult;           /* Converts Timer time to Ticks Multiplier    */
#endif




                                                                        /* TCBs ------------------------------------- */
OS_EXT            OS_TCB                   *OSTCBCurPtr;                /* Pointer to currently running TCB           */
OS_EXT            OS_TCB                   *OSTCBHighRdyPtr;            /* Pointer to highest priority  TCB           */


/*
************************************************************************************************************************
************************************************************************************************************************
*                                                   E X T E R N A L S
************************************************************************************************************************
************************************************************************************************************************
*/

extern  CPU_STK     * const OSCfg_IdleTaskStkBasePtr;
extern  CPU_STK_SIZE  const OSCfg_IdleTaskStkLimit;
extern  CPU_STK_SIZE  const OSCfg_IdleTaskStkSize;
extern  CPU_INT32U    const OSCfg_IdleTaskStkSizeRAM;

extern  CPU_STK     * const OSCfg_ISRStkBasePtr;
extern  CPU_STK_SIZE  const OSCfg_ISRStkSize;
extern  CPU_INT32U    const OSCfg_ISRStkSizeRAM;

extern  OS_MSG_SIZE   const OSCfg_MsgPoolSize;
extern  CPU_INT32U    const OSCfg_MsgPoolSizeRAM;
extern  OS_MSG      * const OSCfg_MsgPoolBasePtr;

extern  OS_PRIO       const OSCfg_StatTaskPrio;
extern  OS_RATE_HZ    const OSCfg_StatTaskRate_Hz;
extern  CPU_STK     * const OSCfg_StatTaskStkBasePtr;
extern  CPU_STK_SIZE  const OSCfg_StatTaskStkLimit;
extern  CPU_STK_SIZE  const OSCfg_StatTaskStkSize;
extern  CPU_INT32U    const OSCfg_StatTaskStkSizeRAM;

extern  CPU_STK_SIZE  const OSCfg_StkSizeMin;

extern  OS_RATE_HZ    const OSCfg_TickRate_Hz;

extern  OS_PRIO       const OSCfg_TmrTaskPrio;
extern  OS_RATE_HZ    const OSCfg_TmrTaskRate_Hz;
extern  CPU_STK     * const OSCfg_TmrTaskStkBasePtr;
extern  CPU_STK_SIZE  const OSCfg_TmrTaskStkLimit;
extern  CPU_STK_SIZE  const OSCfg_TmrTaskStkSize;
extern  CPU_INT32U    const OSCfg_TmrTaskStkSizeRAM;

extern  CPU_INT32U    const OSCfg_DataSizeRAM;

#if (OS_CFG_TASK_IDLE_EN > 0u)
extern  CPU_STK        OSCfg_IdleTaskStk[OS_CFG_IDLE_TASK_STK_SIZE];
#endif

#if (OS_CFG_ISR_STK_SIZE > 0u)
extern  CPU_STK        OSCfg_ISRStk[OS_CFG_ISR_STK_SIZE];
#endif

#if (OS_MSG_EN > 0u)
extern  OS_MSG         OSCfg_MsgPool[OS_CFG_MSG_POOL_SIZE];
#endif

#if (OS_CFG_STAT_TASK_EN > 0u)
extern  CPU_STK        OSCfg_StatTaskStk[OS_CFG_STAT_TASK_STK_SIZE];
#endif

#if (OS_CFG_TMR_EN > 0u)
extern  CPU_STK        OSCfg_TmrTaskStk[OS_CFG_TMR_TASK_STK_SIZE];
#endif

回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
107028
QQ
 楼主| 发表于 2022-8-28 02:17:40 | 显示全部楼层
image.png
回复

使用道具 举报

3

主题

1228

回帖

1237

积分

至尊会员

积分
1237
发表于 2022-8-28 10:28:00 | 显示全部楼层
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
107028
QQ
 楼主| 发表于 2022-8-31 00:32:52 | 显示全部楼层
需要Trace列表关系,源码都忘了,幸亏源码注释还有这个表格,查看太方便了。
[C] 纯文本查看 复制代码
*              CASE 0: Insert in an empty list.
*
*                     OS_PEND_LIST
*                     +---------------+
*                     | TailPtr       |-> 0
*                     +---------------+
*                     | HeadPtr       |-> 0
*                     +---------------+
*                     | NbrEntries=0  |
*                     +---------------+
*
*
*
*              CASE 1: Insert BEFORE or AFTER an OS_TCB
*
*                     OS_PEND_LIST
*                     +--------------+         OS_TCB
*                     | TailPtr      |--+---> +--------------+
*                     +--------------+  |     | PendNextPtr  |->0
*                     | HeadPtr      |--/     +--------------+
*                     +--------------+     0<-| PendPrevPtr  |
*                     | NbrEntries=1 |        +--------------+
*                     +--------------+        |              |
*                                             +--------------+
*                                             |              |
*                                             +--------------+
*
*
*                     OS_PEND_LIST
*                     +--------------+
*                     | TailPtr      |---------------------------------------------------+
*                     +--------------+         OS_TCB                 OS_TCB             |    OS_TCB
*                     | HeadPtr      |------> +--------------+       +--------------+    +-> +--------------+
*                     +--------------+        | PendNextPtr  |<------| PendNextPtr  | ...... | PendNextPtr  |->0
*                     | NbrEntries=N |        +--------------+       +--------------+        +--------------+
*                     +--------------+     0<-| PendPrevPtr  |<------| PendPrevPtr  | ...... | PendPrevPtr  |
*                                             +--------------+       +--------------+        +--------------+
*                                             |              |       |              |        |              |
*                                             +--------------+       +--------------+        +--------------+
*                                             |              |       |              |        |              |
*                                             +--------------+       +--------------+        +--------------+


回复

使用道具 举报

41

主题

215

回帖

338

积分

高级会员

积分
338
发表于 2022-8-31 19:28:09 | 显示全部楼层
我想了好久,还是觉得上ucosIII。
treadX只能在某些mcu上免费。RTX只能在MDK里面看debug信息。freertos没有安全认证。那就只剩下ucos了。
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-14 14:54 , Processed in 0.235578 second(s), 28 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

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